@ncino/web-components 9.0.0-preview.5 → 9.0.0-preview.7

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 (433) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +1 -1
  2. package/dist/_virtual/index.js +1 -1
  3. package/dist/assets/node_modules/.pnpm/ckeditor5@47.3.0/node_modules/ckeditor5/dist/ckeditor5.css +1 -0
  4. package/dist/components/input/gator/input-phone/input-phone.gator.js +1 -1
  5. package/dist/components/input-rich-text/ckeditor-config.js +1 -1
  6. package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
  7. package/dist/components/panel/gator/panel.storybook-test.js +1 -1
  8. package/dist/design-tokens.source.json +1 -0
  9. package/dist/generated/locale-codes.js +1 -0
  10. package/dist/generated/locales/es-419.js +10 -0
  11. package/dist/generated/locales/fr-CA.js +10 -0
  12. package/dist/generated/locales/zh-Hans.js +11 -0
  13. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-alignment@46.1.1 → @ckeditor_ckeditor5-alignment@47.3.0}/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -1
  14. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@46.1.1 → @ckeditor_ckeditor5-autoformat@47.3.0}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
  15. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@46.1.1 → @ckeditor_ckeditor5-autosave@47.3.0}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
  16. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-basic-styles@46.1.1 → @ckeditor_ckeditor5-basic-styles@47.3.0}/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -1
  17. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@46.1.1 → @ckeditor_ckeditor5-block-quote@47.3.0}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -1
  18. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@47.3.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +8 -0
  19. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@46.1.1 → @ckeditor_ckeditor5-cloud-services@47.3.0}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -1
  20. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@46.1.1 → @ckeditor_ckeditor5-code-block@47.3.0}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -1
  21. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@47.3.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -0
  22. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-editor-classic@46.1.1 → @ckeditor_ckeditor5-editor-classic@47.3.0}/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -1
  23. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-engine@47.3.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +3 -0
  24. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@46.1.1 → @ckeditor_ckeditor5-enter@47.3.0}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
  25. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@46.1.1 → @ckeditor_ckeditor5-essentials@47.3.0}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
  26. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-find-and-replace@46.1.1 → @ckeditor_ckeditor5-find-and-replace@47.3.0}/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +2 -2
  27. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-font@46.1.1 → @ckeditor_ckeditor5-font@47.3.0}/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -1
  28. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@46.1.1 → @ckeditor_ckeditor5-heading@47.3.0}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
  29. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-highlight@46.1.1 → @ckeditor_ckeditor5-highlight@47.3.0}/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -1
  30. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-horizontal-line@46.1.1 → @ckeditor_ckeditor5-horizontal-line@47.3.0}/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -1
  31. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@47.3.0/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -0
  32. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@47.3.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +3 -0
  33. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-icons@46.1.1 → @ckeditor_ckeditor5-icons@47.3.0}/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +1 -1
  34. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@47.3.0/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -0
  35. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-indent@46.1.1 → @ckeditor_ckeditor5-indent@47.3.0}/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -1
  36. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@46.1.1 → @ckeditor_ckeditor5-language@47.3.0}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
  37. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@47.3.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -0
  38. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@47.3.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -0
  39. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@46.1.1 → @ckeditor_ckeditor5-markdown-gfm@47.3.0}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
  40. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-media-embed@46.1.1 → @ckeditor_ckeditor5-media-embed@47.3.0}/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -1
  41. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@46.1.1 → @ckeditor_ckeditor5-mention@47.3.0}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
  42. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-page-break@47.3.0/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -0
  43. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@46.1.1 → @ckeditor_ckeditor5-paragraph@47.3.0}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
  44. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@47.3.0/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -0
  45. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-remove-format@46.1.1 → @ckeditor_ckeditor5-remove-format@47.3.0}/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -1
  46. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-select-all@46.1.1 → @ckeditor_ckeditor5-select-all@47.3.0}/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -1
  47. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-show-blocks@46.1.1 → @ckeditor_ckeditor5-show-blocks@47.3.0}/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -1
  48. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-source-editing@46.1.1 → @ckeditor_ckeditor5-source-editing@47.3.0}/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -1
  49. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@47.3.0/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -0
  50. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@46.1.1 → @ckeditor_ckeditor5-style@47.3.0}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
  51. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@47.3.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -0
  52. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-typing@46.1.1 → @ckeditor_ckeditor5-typing@47.3.0}/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +1 -1
  53. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@47.3.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -0
  54. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@46.1.1 → @ckeditor_ckeditor5-undo@47.3.0}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -1
  55. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@46.1.1 → @ckeditor_ckeditor5-upload@47.3.0}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
  56. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@47.3.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +8 -0
  57. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@47.3.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -0
  58. package/dist/node_modules/.pnpm/@vitest_expect@4.0.15/node_modules/@vitest/expect/dist/index.js +58 -0
  59. package/dist/node_modules/.pnpm/@vitest_pretty-format@4.0.15/node_modules/@vitest/pretty-format/dist/index.js +5 -0
  60. package/dist/node_modules/.pnpm/@vitest_runner@4.0.15/node_modules/@vitest/runner/dist/chunk-tasks.js +2 -0
  61. package/dist/node_modules/.pnpm/@vitest_runner@4.0.15/node_modules/@vitest/runner/dist/index.js +4 -0
  62. package/dist/node_modules/.pnpm/@vitest_snapshot@4.0.15/node_modules/@vitest/snapshot/dist/index.js +21 -0
  63. package/dist/node_modules/.pnpm/@vitest_spy@4.0.15/node_modules/@vitest/spy/dist/index.js +1 -0
  64. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +1 -0
  65. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +1 -0
  66. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/diff.js +42 -0
  67. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/display.js +2 -0
  68. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/error.js +2 -0
  69. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/helpers.js +1 -0
  70. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/serialize.js +1 -0
  71. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/source-map.js +1 -0
  72. package/dist/node_modules/.pnpm/@vitest_utils@4.0.15/node_modules/@vitest/utils/dist/timers.js +1 -0
  73. package/dist/node_modules/.pnpm/chai@6.2.1/node_modules/chai/index.js +2 -0
  74. package/dist/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.js +1 -0
  75. package/dist/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js +1 -1
  76. package/dist/node_modules/.pnpm/vitest@4.0.15_@types_node@24.10.1_@vitest_browser-playwright@4.0.15_@vitest_ui@4.0.15_j_fb60b0c8197ead7c9a3bf797f7983b25/node_modules/vitest/browser/context.js +1 -0
  77. package/dist/node_modules/.pnpm/vitest@4.0.15_@types_node@24.10.1_@vitest_browser-playwright@4.0.15_@vitest_ui@4.0.15_j_fb60b0c8197ead7c9a3bf797f7983b25/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +1 -0
  78. package/dist/node_modules/.pnpm/vitest@4.0.15_@types_node@24.10.1_@vitest_browser-playwright@4.0.15_@vitest_ui@4.0.15_j_fb60b0c8197ead7c9a3bf797f7983b25/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +8 -0
  79. package/dist/node_modules/.pnpm/vitest@4.0.15_@types_node@24.10.1_@vitest_browser-playwright@4.0.15_@vitest_ui@4.0.15_j_fb60b0c8197ead7c9a3bf797f7983b25/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +11 -0
  80. package/dist/types/generated/locale-codes.d.ts +13 -0
  81. package/dist/types/generated/locales/es-419.d.ts +65 -0
  82. package/dist/types/generated/locales/fr-CA.d.ts +65 -0
  83. package/dist/types/generated/locales/zh-Hans.d.ts +65 -0
  84. package/dist/utils/vitest-a11y-utils.js +1 -1
  85. package/package.json +21 -20
  86. package/web-types.json +1 -1
  87. package/dist/_virtual/___vite-browser-external.js +0 -1
  88. package/dist/_virtual/__vite-browser-external.js +0 -1
  89. package/dist/_virtual/api-request.js +0 -1
  90. package/dist/_virtual/constants.js +0 -1
  91. package/dist/_virtual/events.js +0 -1
  92. package/dist/_virtual/external.js +0 -1
  93. package/dist/_virtual/external2.js +0 -1
  94. package/dist/_virtual/external3.js +0 -1
  95. package/dist/_virtual/external_types.js +0 -1
  96. package/dist/_virtual/fetch.js +0 -1
  97. package/dist/_virtual/figma_client.js +0 -1
  98. package/dist/_virtual/figma_rest_api.js +0 -1
  99. package/dist/_virtual/helpers.js +0 -1
  100. package/dist/_virtual/index10.js +0 -1
  101. package/dist/_virtual/index11.js +0 -1
  102. package/dist/_virtual/index12.js +0 -1
  103. package/dist/_virtual/index2.js +0 -1
  104. package/dist/_virtual/index3.js +0 -1
  105. package/dist/_virtual/index4.js +0 -1
  106. package/dist/_virtual/index5.js +0 -1
  107. package/dist/_virtual/index6.js +0 -1
  108. package/dist/_virtual/index7.js +0 -1
  109. package/dist/_virtual/index8.js +0 -1
  110. package/dist/_virtual/index9.js +0 -1
  111. package/dist/_virtual/index_common.js +0 -1
  112. package/dist/_virtual/index_html.js +0 -1
  113. package/dist/_virtual/index_html2.js +0 -1
  114. package/dist/_virtual/index_react.js +0 -1
  115. package/dist/_virtual/index_react2.js +0 -1
  116. package/dist/_virtual/inherits_browser.js +0 -1
  117. package/dist/_virtual/logging.js +0 -1
  118. package/dist/_virtual/main.js +0 -1
  119. package/dist/_virtual/main2.js +0 -1
  120. package/dist/_virtual/mock-interceptor.js +0 -1
  121. package/dist/_virtual/react.production.js +0 -1
  122. package/dist/_virtual/string_decoder.js +0 -1
  123. package/dist/_virtual/template_literal.js +0 -1
  124. package/dist/_virtual/types.js +0 -1
  125. package/dist/_virtual/updates.js +0 -1
  126. package/dist/_virtual/util.js +0 -1
  127. package/dist/_virtual/utils.js +0 -1
  128. package/dist/assets/node_modules/.pnpm/ckeditor5@46.1.1/node_modules/ckeditor5/dist/ckeditor5.css +0 -1
  129. package/dist/components/accordion/gator/base/accordion.gator.figma.js +0 -10
  130. package/dist/components/accordion/gator/group/accordion-group.gator.figma.js +0 -3
  131. package/dist/components/alert/alert.gator.figma.js +0 -7
  132. package/dist/components/avatar/gator/avatar.gator.figma.js +0 -9
  133. package/dist/components/banner/gator/banner.gator.figma.js +0 -8
  134. package/dist/components/boolean/boolean.gator.figma.js +0 -11
  135. package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.figma.js +0 -3
  136. package/dist/components/breadcrumbs/gator/container/breadcrumbs.gator.figma.js +0 -5
  137. package/dist/components/button/gator/button.gator.figma.js +0 -12
  138. package/dist/components/button-group/gator/button-group.gator.figma.js +0 -7
  139. package/dist/components/icon/gator/icon.gator.figma.js +0 -7
  140. package/dist/components/icon/gator/icons.gator.figma.js +0 -1
  141. package/dist/components/text-detail/gator/text-detail.gator.figma.js +0 -30
  142. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +0 -8
  143. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js +0 -1
  144. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +0 -3
  145. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@46.1.1/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +0 -1
  146. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@46.1.1/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +0 -3
  147. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@46.1.1/node_modules/@ckeditor/ckeditor5-image/dist/index.js +0 -1
  148. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@46.1.1/node_modules/@ckeditor/ckeditor5-link/dist/index.js +0 -1
  149. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@46.1.1/node_modules/@ckeditor/ckeditor5-list/dist/index.js +0 -1
  150. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-page-break@46.1.1/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +0 -1
  151. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@46.1.1/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +0 -1
  152. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@46.1.1/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +0 -1
  153. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@46.1.1/node_modules/@ckeditor/ckeditor5-table/dist/index.js +0 -1
  154. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +0 -1
  155. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +0 -8
  156. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +0 -1
  157. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js +0 -3
  158. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js +0 -3
  159. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js +0 -1
  160. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js +0 -1
  161. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/main.js +0 -1
  162. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/types/multipart.js +0 -1
  163. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/types/urlencoded.js +0 -1
  164. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/Decoder.js +0 -1
  165. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js +0 -1
  166. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/decodeText.js +0 -1
  167. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/getLimit.js +0 -1
  168. package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/parseParams.js +0 -3
  169. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/client/external.js +0 -1
  170. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/client/figma_client.js +0 -1
  171. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/common/fetch.js +0 -1
  172. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/common/logging.js +0 -1
  173. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/common/updates.js +0 -4
  174. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/connect/external_types.js +0 -1
  175. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +0 -1
  176. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/connect/helpers.js +0 -1
  177. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/connect/index_common.js +0 -1
  178. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/html/external.js +0 -1
  179. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/html/index_html.js +0 -1
  180. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/html/template_literal.js +0 -1
  181. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/react/external.js +0 -1
  182. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/dist/react/index_react.js +0 -1
  183. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/package.json.js +0 -1
  184. package/dist/node_modules/.pnpm/@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.10.1_typescript@5.9.3__playwright@1.57.0_4c7b68e67853c98910921d3bcdc3c508/node_modules/@vitest/browser/context.js +0 -1
  185. package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.js +0 -58
  186. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +0 -5
  187. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +0 -5
  188. package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +0 -21
  189. package/dist/node_modules/.pnpm/@vitest_spy@3.2.4/node_modules/@vitest/spy/dist/index.js +0 -1
  190. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +0 -1
  191. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.js +0 -42
  192. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.js +0 -2
  193. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js +0 -1
  194. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js +0 -1
  195. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js +0 -1
  196. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +0 -1
  197. package/dist/node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js +0 -1
  198. package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js +0 -1
  199. package/dist/node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js +0 -1
  200. package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js +0 -1
  201. package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js +0 -1
  202. package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js +0 -1
  203. package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js +0 -1
  204. package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js +0 -1
  205. package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js +0 -1
  206. package/dist/node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js +0 -1
  207. package/dist/node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js +0 -1
  208. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js +0 -2
  209. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +0 -2
  210. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +0 -2
  211. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +0 -4
  212. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +0 -1
  213. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +0 -1
  214. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +0 -1
  215. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +0 -1
  216. package/dist/node_modules/.pnpm/compare-versions@6.1.1/node_modules/compare-versions/lib/esm/compare.js +0 -1
  217. package/dist/node_modules/.pnpm/compare-versions@6.1.1/node_modules/compare-versions/lib/esm/compareVersions.js +0 -1
  218. package/dist/node_modules/.pnpm/compare-versions@6.1.1/node_modules/compare-versions/lib/esm/index.js +0 -1
  219. package/dist/node_modules/.pnpm/compare-versions@6.1.1/node_modules/compare-versions/lib/esm/satisfies.js +0 -1
  220. package/dist/node_modules/.pnpm/compare-versions@6.1.1/node_modules/compare-versions/lib/esm/utils.js +0 -1
  221. package/dist/node_modules/.pnpm/compare-versions@6.1.1/node_modules/compare-versions/lib/esm/validate.js +0 -1
  222. package/dist/node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js +0 -1
  223. package/dist/node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js +0 -3
  224. package/dist/node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/package.json.js +0 -1
  225. package/dist/node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js +0 -1
  226. package/dist/node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js +0 -1
  227. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js +0 -1
  228. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js +0 -1
  229. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js +0 -1
  230. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js +0 -1
  231. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js +0 -1
  232. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js +0 -1
  233. package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js +0 -1
  234. package/dist/node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js +0 -1
  235. package/dist/node_modules/.pnpm/events@3.3.0/node_modules/events/events.js +0 -1
  236. package/dist/node_modules/.pnpm/for-each@0.3.5/node_modules/for-each/index.js +0 -1
  237. package/dist/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js +0 -1
  238. package/dist/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js +0 -1
  239. package/dist/node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js +0 -1
  240. package/dist/node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js +0 -1
  241. package/dist/node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -1
  242. package/dist/node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js +0 -1
  243. package/dist/node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js +0 -1
  244. package/dist/node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js +0 -1
  245. package/dist/node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js +0 -1
  246. package/dist/node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js +0 -1
  247. package/dist/node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js +0 -1
  248. package/dist/node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js +0 -1
  249. package/dist/node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js +0 -1
  250. package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js +0 -1
  251. package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +0 -1
  252. package/dist/node_modules/.pnpm/is-arguments@1.2.0/node_modules/is-arguments/index.js +0 -1
  253. package/dist/node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js +0 -1
  254. package/dist/node_modules/.pnpm/is-generator-function@1.1.0/node_modules/is-generator-function/index.js +0 -1
  255. package/dist/node_modules/.pnpm/is-regex@1.2.1/node_modules/is-regex/index.js +0 -1
  256. package/dist/node_modules/.pnpm/is-typed-array@1.1.15/node_modules/is-typed-array/index.js +0 -1
  257. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +0 -1
  258. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +0 -1
  259. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +0 -1
  260. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +0 -1
  261. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +0 -1
  262. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +0 -1
  263. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +0 -1
  264. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +0 -1
  265. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +0 -1
  266. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +0 -2
  267. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +0 -1
  268. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +0 -1
  269. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +0 -1
  270. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +0 -1
  271. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +0 -1
  272. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +0 -1
  273. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +0 -1
  274. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +0 -1
  275. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +0 -1
  276. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +0 -1
  277. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js +0 -1
  278. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js +0 -1
  279. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js +0 -1
  280. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js +0 -1
  281. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js +0 -1
  282. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js +0 -1
  283. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js +0 -1
  284. package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js +0 -1
  285. package/dist/node_modules/.pnpm/possible-typed-array-names@1.1.0/node_modules/possible-typed-array-names/index.js +0 -1
  286. package/dist/node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.production.js +0 -1
  287. package/dist/node_modules/.pnpm/react@19.2.0/node_modules/react/index.js +0 -1
  288. package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js +0 -1
  289. package/dist/node_modules/.pnpm/safe-regex-test@1.1.0/node_modules/safe-regex-test/index.js +0 -1
  290. package/dist/node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js +0 -1
  291. package/dist/node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.js +0 -1
  292. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js +0 -1
  293. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/browser.js +0 -1
  294. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.js +0 -1
  295. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +0 -1
  296. package/dist/node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.js +0 -1
  297. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/index.js +0 -1
  298. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/agent.js +0 -1
  299. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/abort-signal.js +0 -1
  300. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/api-connect.js +0 -1
  301. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/api-pipeline.js +0 -1
  302. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/api-request.js +0 -1
  303. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/api-stream.js +0 -1
  304. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/api-upgrade.js +0 -1
  305. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/index.js +0 -1
  306. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/readable.js +0 -1
  307. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/util.js +0 -1
  308. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/balanced-pool.js +0 -1
  309. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/cache.js +0 -1
  310. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/cachestorage.js +0 -1
  311. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/symbols.js +0 -1
  312. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/util.js +0 -1
  313. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/client.js +0 -26
  314. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/compat/dispatcher-weakref.js +0 -1
  315. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cookies/constants.js +0 -1
  316. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cookies/index.js +0 -1
  317. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cookies/parse.js +0 -1
  318. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cookies/util.js +0 -1
  319. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/connect.js +0 -1
  320. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/constants.js +0 -1
  321. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/errors.js +0 -1
  322. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/request.js +0 -5
  323. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/symbols.js +0 -1
  324. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/util.js +0 -1
  325. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/dispatcher-base.js +0 -1
  326. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/dispatcher.js +0 -1
  327. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/body.js +0 -9
  328. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/constants.js +0 -1
  329. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/dataURL.js +0 -3
  330. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/file.js +0 -3
  331. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/formdata.js +0 -1
  332. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/global.js +0 -1
  333. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/headers.js +0 -1
  334. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/index.js +0 -1
  335. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/request.js +0 -1
  336. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/response.js +0 -1
  337. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/symbols.js +0 -1
  338. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/util.js +0 -2
  339. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/webidl.js +0 -1
  340. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fileapi/encoding.js +0 -1
  341. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fileapi/filereader.js +0 -1
  342. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fileapi/progressevent.js +0 -1
  343. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fileapi/symbols.js +0 -1
  344. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fileapi/util.js +0 -1
  345. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/global.js +0 -1
  346. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/handler/DecoratorHandler.js +0 -1
  347. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/handler/RedirectHandler.js +0 -1
  348. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/handler/RetryHandler.js +0 -1
  349. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/interceptor/redirectInterceptor.js +0 -1
  350. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/llhttp/constants.js +0 -1
  351. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/llhttp/llhttp-wasm.js +0 -1
  352. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +0 -1
  353. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/llhttp/utils.js +0 -1
  354. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-agent.js +0 -5
  355. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-client.js +0 -1
  356. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-errors.js +0 -1
  357. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-interceptor.js +0 -1
  358. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-pool.js +0 -1
  359. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-symbols.js +0 -1
  360. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/mock-utils.js +0 -1
  361. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/pending-interceptors-formatter.js +0 -1
  362. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/mock/pluralizer.js +0 -1
  363. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/node/fixed-queue.js +0 -1
  364. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/pool-base.js +0 -1
  365. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/pool-stats.js +0 -1
  366. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/pool.js +0 -1
  367. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/proxy-agent.js +0 -1
  368. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/timers.js +0 -1
  369. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/connection.js +0 -1
  370. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/constants.js +0 -1
  371. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/events.js +0 -1
  372. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/frame.js +0 -1
  373. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/receiver.js +0 -1
  374. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/symbols.js +0 -1
  375. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/util.js +0 -1
  376. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/websocket.js +0 -1
  377. package/dist/node_modules/.pnpm/util@0.12.5/node_modules/util/support/isBufferBrowser.js +0 -1
  378. package/dist/node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js +0 -1
  379. package/dist/node_modules/.pnpm/util@0.12.5/node_modules/util/util.js +0 -10
  380. package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.1_@vitest_browser@3.2.4_@vitest_ui@3_6e27007ba0535c26eedf5a22febb1842/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -1
  381. package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.1_@vitest_browser@3.2.4_@vitest_ui@3_6e27007ba0535c26eedf5a22febb1842/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -1
  382. package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.1_@vitest_browser@3.2.4_@vitest_ui@3_6e27007ba0535c26eedf5a22febb1842/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -8
  383. package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.1_@vitest_browser@3.2.4_@vitest_ui@3_6e27007ba0535c26eedf5a22febb1842/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -12
  384. package/dist/node_modules/.pnpm/which-typed-array@1.1.19/node_modules/which-typed-array/index.js +0 -1
  385. /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@46.1.1 → @ckeditor_ckeditor5-watchdog@47.3.0}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +0 -0
  386. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/ParseError.js +0 -0
  387. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/PhoneNumber.js +0 -0
  388. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/constants.js +0 -0
  389. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/format.js +0 -0
  390. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +0 -0
  391. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -0
  392. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -0
  393. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -0
  394. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -0
  395. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -0
  396. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -0
  397. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -0
  398. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -0
  399. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -0
  400. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -0
  401. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -0
  402. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -0
  403. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -0
  404. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -0
  405. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +0 -0
  406. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -0
  407. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/isObject.js +0 -0
  408. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -0
  409. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -0
  410. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +0 -0
  411. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -0
  412. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/isPossible.js +0 -0
  413. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/isValid.js +0 -0
  414. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/metadata.js +0 -0
  415. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/normalizeArguments.js +0 -0
  416. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/parse.js +0 -0
  417. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -0
  418. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +0 -0
  419. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -0
  420. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +0 -0
  421. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/es6/tools/semver-compare.js +0 -0
  422. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/metadata.min.json.js +0 -0
  423. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +0 -0
  424. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.30 → libphonenumber-js@1.12.31}/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +0 -0
  425. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/_browser-chunks/chunk-A242L54C.js +0 -0
  426. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/_browser-chunks/chunk-EZSQOHRI.js +0 -0
  427. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/_browser-chunks/chunk-JP7NCOJX.js +0 -0
  428. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/_browser-chunks/chunk-RP5RXKFU.js +0 -0
  429. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/_browser-chunks/chunk-ZUWEVLDX.js +0 -0
  430. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/client-logger/index.js +0 -0
  431. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/core-events/index.js +0 -0
  432. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/instrumenter/index.js +0 -0
  433. /package/dist/node_modules/.pnpm/{storybook@10.1.2_@testing-library_dom@10.4.1_prettier@3.6.2_react-dom@19.2.0_react@19.2.0__react@19.2.0 → storybook@10.1.4_@testing-library_dom@10.4.1_prettier@3.7.4_react-dom@19.2.0_react@19.2.0__react@19.2.0}/node_modules/storybook/dist/test/index.js +0 -0
@@ -1 +1 @@
1
- import{Plugin as h,Command as k}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as _,View as g,ViewCollection as w,FocusCycler as A,LabelView as V,addKeyboardHandlingForGrid as B,ButtonView as F}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{first as T,logWarning as v,FocusTracker as S,KeystrokeHandler as b}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{findAttributeRange as U,findAttributeRangeBound as E}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{isObject as x}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isObject.js";class C extends F{styleDefinition;previewView;constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new g(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}class G extends g{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new S,this.keystrokes=new b,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const s of t){const i=new C(e,s);this.children.add(i)}this.on("change:activeStyles",()=>{for(const s of this.children)s.isOn=this.activeStyles.includes(s.styleDefinition.name)}),this.on("change:enabledStyles",()=>{for(const s of this.children)s.isEnabled=this.enabledStyles.includes(s.styleDefinition.name)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);B({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}class y extends g{gridView;labelView;constructor(e,t,s){super(e),this.labelView=new V(e),this.labelView.text=t,this.gridView=new G(e,s),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}class D extends g{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);const s=e.t;this.focusTracker=new S,this.keystrokes=new b,this.children=this.createCollection(),this.blockStylesGroupView=new y(e,s("Block styles"),t.block),this.inlineStylesGroupView=new y(e,s("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new w,this._focusCycler=new A({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),t.block.length&&this.children.add(this.blockStylesGroupView),t.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const P=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class d extends h{_htmlSupport;static get pluginName(){return"StyleUtils"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const s={block:[],inline:[]};for(const i of t){const l=[],o=[];for(const n of e.getDefinitionsForView(i.element)){const u="appliesToBlock"in n?n.appliesToBlock:!1;if(n.isBlock||u){if(typeof u=="string")l.push(u);else if(n.isBlock){const a=n;l.push(n.model),a.paragraphLikeModel&&l.push(a.paragraphLikeModel)}}else o.push(n.model)}const c=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);l.length?s.block.push({...i,previewTemplate:c,modelElements:l,isBlock:!0}):s.inline.push({...i,previewTemplate:c,ghsAttributes:o})}return s}isStyleEnabledForBlock(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);return s.schema.checkAttribute(t,i)?e.modelElements.includes(t.name):!1}isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this.hasAllClasses(i,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const s=this.editor.model;for(const i of e.ghsAttributes)if(s.schema.checkAttributeInSelection(t,i))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const s of e.ghsAttributes){const i=this._getValueFromFirstAllowedNode(t,s);if(this.hasAllClasses(i,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:s,classes:i}=e;return{tag:N(s)?s:"div",attributes:{class:i},children:t}}hasAllClasses(e,t){return x(e)&&H(e)&&t.every(s=>e.classes.includes(s))}configureGHSDataFilter({block:e,inline:t}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(e.map(m)),s.loadAllowedConfig(t.map(m))}_getValueFromFirstAllowedNode(e,t){const i=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const l of e.getRanges())for(const o of l.getItems())if(i.checkAttribute(o,t))return o.getAttribute(t);return null}}function H(r){return!!r.classes&&Array.isArray(r.classes)}function N(r){return!P.includes(r)}function m({element:r,classes:e}){return{name:r,classes:e}}class I extends h{static get pluginName(){return"StyleUI"}static get isOfficialPlugin(){return!0}static get requires(){return[d]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),s=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),l=s.normalizeConfig(t,i);e.ui.componentFactory.add("style",o=>{const c=o.t,n=_(o),u=e.commands.get("style");return n.once("change:isOpen",()=>{const a=new D(o,l);n.panelView.children.add(a),a.delegate("execute").to(n),a.bind("activeStyles").to(u,"value"),a.bind("enabledStyles").to(u,"enabledStyles")}),n.bind("isEnabled").to(u),n.buttonView.withText=!0,n.buttonView.bind("label").to(u,"value",a=>a.length>1?c("Multiple styles"):a.length===1?a[0]:c("Styles")),n.bind("class").to(u,"value",a=>{const f=["ck-style-dropdown"];return a.length>1&&f.push("ck-style-dropdown_multiple-active"),f.join(" ")}),n.on("execute",a=>{e.execute("style",{styleName:a.source.styleDefinition.name}),e.editing.view.focus()}),n})}}class L extends k{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(d)}refresh(){const e=this.editor.model,t=e.document.selection,s=new Set,i=new Set;for(const o of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(o,t)&&i.add(o.name),this._styleUtils.isStyleActiveForInlineSelection(o,t)&&s.add(o.name);const l=T(t.getSelectedBlocks())||t.getFirstPosition().parent;if(l){const o=l.getAncestors({includeSelf:!0,parentFirst:!0});for(const c of o){if(c.is("rootElement"))break;for(const n of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(n,c)&&(i.add(n.name),this._styleUtils.isStyleActiveForBlock(n,c)&&s.add(n.name));if(e.schema.isObject(c))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(s).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e)){v("style-command-executed-with-incorrect-style-name");return}const s=this.editor.model,i=s.document.selection,l=this.editor.plugins.get("GeneralHtmlSupport"),o=[...this._styleDefinitions.inline,...this._styleDefinitions.block],c=o.filter(({name:a})=>this.value.includes(a)),n=o.find(({name:a})=>a==e),u=t===void 0?!this.value.includes(n.name):t;s.change(()=>{let a;O(n)?a=this._findAffectedBlocks(z(i),n):a=[this._styleUtils.getAffectedInlineSelectable(n,i)];for(const f of a)u?l.addModelHtmlClass(n.element,n.classes,f):l.removeModelHtmlClass(n.element,R(c,n),f)})}_findAffectedBlocks(e,t){const s=new Set;for(const i of e){const l=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const o of l){if(o.is("rootElement"))break;const c=this._styleUtils.getAffectedBlocks(t,o);if(c){for(const n of c)s.add(n);break}}}return s}}function R(r,e){return r.reduce((t,s)=>s.name===e.name?t:t.filter(i=>!s.classes.includes(i)),e.classes)}function O(r){return"isBlock"in r}function z(r){const e=Array.from(r.getSelectedBlocks());return e.length?e:[r.getFirstPosition().parent]}class M extends h{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return"ListStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(d),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[s,i])=>{this._isStyleEnabledForBlock(s,i)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(t,[s,i])=>{this._isStyleActiveForBlock(s,i)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[s,i])=>{const l=this._getAffectedBlocks(s,i);l&&(t.return=l,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(t,[s,i])=>{const l=this._getStylePreview(s,i);l&&(t.return=l,t.stop())},{priority:"high"}))}_isStyleEnabledForBlock(e,t){const s=this.editor.model;if(!["ol","ul","li"].includes(e.element)||!this._listUtils.isListItemBlock(t))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(e.element=="ol"||e.element=="ul"){if(!s.schema.checkAttribute(t,i))return!1;const o=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==o}else return s.schema.checkAttribute(t,i)}_isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this._styleUtils.hasAllClasses(i,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?e.element=="li"?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:s,classes:i}=e;return s=="ol"||s=="ul"?{tag:s,attributes:{class:i},children:[{tag:"li",children:t}]}:s=="li"?{tag:"ol",children:[{tag:s,attributes:{class:i},children:t}]}:null}}class q extends h{_tableUtils;_styleUtils;static get pluginName(){return"TableStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(d),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[s,i])=>{this._isApplicable(s,i)&&(t.return=this._isStyleEnabledForBlock(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[s,i])=>{this._isApplicable(s,i)&&(t.return=this._getAffectedBlocks(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(t,[{block:s}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(s.filter(l=>l.element=="figcaption").map(l=>({name:"caption",classes:l.classes})))}))}_isApplicable(e,t){return["td","th"].includes(e.element)?t.name=="tableCell":["thead","tbody"].includes(e.element)?t.name=="table":!1}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const s=this._tableUtils.getCellLocation(t),l=t.parent.parent,o=l.getAttribute("headingRows")||0,c=l.getAttribute("headingColumns")||0,n=s.row<o||s.column<c;return e.element=="th"?n:!n}if(["thead","tbody"].includes(e.element)){const s=t.getAttribute("headingRows")||0;return e.element=="thead"?s>0:s<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}class j extends h{_styleUtils;_htmlSupport;static get pluginName(){return"LinkStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(d),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(t,[s,i])=>{s.element=="a"&&(t.return=this._isStyleEnabled(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(t,[s,i])=>{s.element=="a"&&(t.return=this._isStyleActive(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(t,[s,i])=>{if(s.element!="a")return;const l=this._getAffectedSelectable(s,i);l&&(t.return=l,t.stop())},{priority:"high"}))}_isStyleEnabled(e,t){const s=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const i of t.getRanges())for(const l of i.getItems())if((l.is("$textProxy")||s.schema.isInline(l))&&l.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const l=t.getAttribute(i);if(this._styleUtils.hasAllClasses(l,e.classes))return!0}return!1}for(const l of t.getRanges())for(const o of l.getItems())if((o.is("$textProxy")||s.schema.isInline(o))&&o.hasAttribute("linkHref")){const c=o.getAttribute(i);return this._styleUtils.hasAllClasses(c,e.classes)}return!1}_getAffectedSelectable(e,t){const s=this.editor.model;if(t.isCollapsed){const l=t.getAttribute("linkHref");return U(t.getFirstPosition(),"linkHref",l,s)}const i=[];for(const l of t.getRanges()){const o=s.createRange(p(l.start,"linkHref",!0,s),p(l.end,"linkHref",!1,s));for(const c of o.getItems())(c.is("$textProxy")||s.schema.isInline(c))&&c.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(c))}return $(i)}}function p(r,e,t,s){const i=r.textNode||(t?r.nodeAfter:r.nodeBefore);if(!i||!i.hasAttribute(e))return r;const l=i.getAttribute(e);return E(r,e,l,t,s)}function $(r){for(let e=1;e<r.length;e++){const t=r[e-1].getJoined(r[e]);t&&r.splice(--e,2,t)}return r}class J extends h{static get pluginName(){return"StyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["GeneralHtmlSupport",d,M,q,j]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),s=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),l=s.normalizeConfig(t,i);e.commands.add("style",new L(e,l)),s.configureGHSDataFilter(l)}}class Z extends h{static get pluginName(){return"Style"}static get isOfficialPlugin(){return!0}static get requires(){return[J,I]}}export{j as LinkStyleSupport,M as ListStyleSupport,Z as Style,L as StyleCommand,J as StyleEditing,I as StyleUI,d as StyleUtils,q as TableStyleSupport,C as _StyleGridButtonView,G as _StyleGridView,y as _StyleGroupView,D as _StylePanelView};
1
+ import{Plugin as h,Command as k}from"../../../../../@ckeditor_ckeditor5-core@47.3.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as _,View as g,ViewCollection as w,FocusCycler as A,LabelView as V,addKeyboardHandlingForGrid as B,ButtonView as F}from"../../../../../@ckeditor_ckeditor5-ui@47.3.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{first as T,logWarning as v,FocusTracker as S,KeystrokeHandler as b}from"../../../../../@ckeditor_ckeditor5-utils@47.3.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{findAttributeRange as U,findAttributeRangeBound as E}from"../../../../../@ckeditor_ckeditor5-typing@47.3.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{isObject as x}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isObject.js";class C extends F{styleDefinition;previewView;constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new g(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}class G extends g{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new S,this.keystrokes=new b,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const s of t){const i=new C(e,s);this.children.add(i)}this.on("change:activeStyles",()=>{for(const s of this.children)s.isOn=this.activeStyles.includes(s.styleDefinition.name)}),this.on("change:enabledStyles",()=>{for(const s of this.children)s.isEnabled=this.enabledStyles.includes(s.styleDefinition.name)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);B({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}class y extends g{gridView;labelView;constructor(e,t,s){super(e),this.labelView=new V(e),this.labelView.text=t,this.gridView=new G(e,s),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}class D extends g{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);const s=e.t;this.focusTracker=new S,this.keystrokes=new b,this.children=this.createCollection(),this.blockStylesGroupView=new y(e,s("Block styles"),t.block),this.inlineStylesGroupView=new y(e,s("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new w,this._focusCycler=new A({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),t.block.length&&this.children.add(this.blockStylesGroupView),t.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const P=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class d extends h{_htmlSupport;static get pluginName(){return"StyleUtils"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const s={block:[],inline:[]};for(const i of t){const l=[],o=[];for(const n of e.getDefinitionsForView(i.element)){const u="appliesToBlock"in n?n.appliesToBlock:!1;if(n.isBlock||u){if(typeof u=="string")l.push(u);else if(n.isBlock){const a=n;l.push(n.model),a.paragraphLikeModel&&l.push(a.paragraphLikeModel)}}else o.push(n.model)}const c=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);l.length?s.block.push({...i,previewTemplate:c,modelElements:l,isBlock:!0}):s.inline.push({...i,previewTemplate:c,ghsAttributes:o})}return s}isStyleEnabledForBlock(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);return s.schema.checkAttribute(t,i)?e.modelElements.includes(t.name):!1}isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this.hasAllClasses(i,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const s=this.editor.model;for(const i of e.ghsAttributes)if(s.schema.checkAttributeInSelection(t,i))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const s of e.ghsAttributes){const i=this._getValueFromFirstAllowedNode(t,s);if(this.hasAllClasses(i,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:s,classes:i}=e;return{tag:N(s)?s:"div",attributes:{class:i},children:t}}hasAllClasses(e,t){return x(e)&&H(e)&&t.every(s=>e.classes.includes(s))}configureGHSDataFilter({block:e,inline:t}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(e.map(m)),s.loadAllowedConfig(t.map(m))}_getValueFromFirstAllowedNode(e,t){const i=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const l of e.getRanges())for(const o of l.getItems())if(i.checkAttribute(o,t))return o.getAttribute(t);return null}}function H(r){return!!r.classes&&Array.isArray(r.classes)}function N(r){return!P.includes(r)}function m({element:r,classes:e}){return{name:r,classes:e}}class I extends h{static get pluginName(){return"StyleUI"}static get isOfficialPlugin(){return!0}static get requires(){return[d]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),s=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),l=s.normalizeConfig(t,i);e.ui.componentFactory.add("style",o=>{const c=o.t,n=_(o),u=e.commands.get("style");return n.once("change:isOpen",()=>{const a=new D(o,l);n.panelView.children.add(a),a.delegate("execute").to(n),a.bind("activeStyles").to(u,"value"),a.bind("enabledStyles").to(u,"enabledStyles")}),n.bind("isEnabled").to(u),n.buttonView.withText=!0,n.buttonView.bind("label").to(u,"value",a=>a.length>1?c("Multiple styles"):a.length===1?a[0]:c("Styles")),n.bind("class").to(u,"value",a=>{const f=["ck-style-dropdown"];return a.length>1&&f.push("ck-style-dropdown_multiple-active"),f.join(" ")}),n.on("execute",a=>{e.execute("style",{styleName:a.source.styleDefinition.name}),e.editing.view.focus()}),n})}}class L extends k{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(d)}refresh(){const e=this.editor.model,t=e.document.selection,s=new Set,i=new Set;for(const o of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(o,t)&&i.add(o.name),this._styleUtils.isStyleActiveForInlineSelection(o,t)&&s.add(o.name);const l=T(t.getSelectedBlocks())||t.getFirstPosition().parent;if(l){const o=l.getAncestors({includeSelf:!0,parentFirst:!0});for(const c of o){if(c.is("rootElement"))break;for(const n of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(n,c)&&(i.add(n.name),this._styleUtils.isStyleActiveForBlock(n,c)&&s.add(n.name));if(e.schema.isObject(c))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(s).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e)){v("style-command-executed-with-incorrect-style-name");return}const s=this.editor.model,i=s.document.selection,l=this.editor.plugins.get("GeneralHtmlSupport"),o=[...this._styleDefinitions.inline,...this._styleDefinitions.block],c=o.filter(({name:a})=>this.value.includes(a)),n=o.find(({name:a})=>a==e),u=t===void 0?!this.value.includes(n.name):t;s.change(()=>{let a;O(n)?a=this._findAffectedBlocks(z(i),n):a=[this._styleUtils.getAffectedInlineSelectable(n,i)];for(const f of a)u?l.addModelHtmlClass(n.element,n.classes,f):l.removeModelHtmlClass(n.element,R(c,n),f)})}_findAffectedBlocks(e,t){const s=new Set;for(const i of e){const l=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const o of l){if(o.is("rootElement"))break;const c=this._styleUtils.getAffectedBlocks(t,o);if(c){for(const n of c)s.add(n);break}}}return s}}function R(r,e){return r.reduce((t,s)=>s.name===e.name?t:t.filter(i=>!s.classes.includes(i)),e.classes)}function O(r){return"isBlock"in r}function z(r){const e=Array.from(r.getSelectedBlocks());return e.length?e:[r.getFirstPosition().parent]}class M extends h{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return"ListStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(d),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[s,i])=>{this._isStyleEnabledForBlock(s,i)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(t,[s,i])=>{this._isStyleActiveForBlock(s,i)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[s,i])=>{const l=this._getAffectedBlocks(s,i);l&&(t.return=l,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(t,[s,i])=>{const l=this._getStylePreview(s,i);l&&(t.return=l,t.stop())},{priority:"high"}))}_isStyleEnabledForBlock(e,t){const s=this.editor.model;if(!["ol","ul","li"].includes(e.element)||!this._listUtils.isListItemBlock(t))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(e.element=="ol"||e.element=="ul"){if(!s.schema.checkAttribute(t,i))return!1;const o=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==o}else return s.schema.checkAttribute(t,i)}_isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this._styleUtils.hasAllClasses(i,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?e.element=="li"?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:s,classes:i}=e;return s=="ol"||s=="ul"?{tag:s,attributes:{class:i},children:[{tag:"li",children:t}]}:s=="li"?{tag:"ol",children:[{tag:s,attributes:{class:i},children:t}]}:null}}class q extends h{_tableUtils;_styleUtils;static get pluginName(){return"TableStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(d),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[s,i])=>{this._isApplicable(s,i)&&(t.return=this._isStyleEnabledForBlock(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[s,i])=>{this._isApplicable(s,i)&&(t.return=this._getAffectedBlocks(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(t,[{block:s}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(s.filter(l=>l.element=="figcaption").map(l=>({name:"caption",classes:l.classes})))}))}_isApplicable(e,t){return["td","th"].includes(e.element)?t.name=="tableCell":["thead","tbody"].includes(e.element)?t.name=="table":!1}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const s=this._tableUtils.getCellLocation(t),l=t.parent.parent,o=l.getAttribute("headingRows")||0,c=l.getAttribute("headingColumns")||0,n=s.row<o||s.column<c;return e.element=="th"?n:!n}if(["thead","tbody"].includes(e.element)){const s=t.getAttribute("headingRows")||0;return e.element=="thead"?s>0:s<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}class j extends h{_styleUtils;_htmlSupport;static get pluginName(){return"LinkStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(d),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(t,[s,i])=>{s.element=="a"&&(t.return=this._isStyleEnabled(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(t,[s,i])=>{s.element=="a"&&(t.return=this._isStyleActive(s,i),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(t,[s,i])=>{if(s.element!="a")return;const l=this._getAffectedSelectable(s,i);l&&(t.return=l,t.stop())},{priority:"high"}))}_isStyleEnabled(e,t){const s=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const i of t.getRanges())for(const l of i.getItems())if((l.is("$textProxy")||s.schema.isInline(l))&&l.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const l=t.getAttribute(i);if(this._styleUtils.hasAllClasses(l,e.classes))return!0}return!1}for(const l of t.getRanges())for(const o of l.getItems())if((o.is("$textProxy")||s.schema.isInline(o))&&o.hasAttribute("linkHref")){const c=o.getAttribute(i);return this._styleUtils.hasAllClasses(c,e.classes)}return!1}_getAffectedSelectable(e,t){const s=this.editor.model;if(t.isCollapsed){const l=t.getAttribute("linkHref");return U(t.getFirstPosition(),"linkHref",l,s)}const i=[];for(const l of t.getRanges()){const o=s.createRange(p(l.start,"linkHref",!0,s),p(l.end,"linkHref",!1,s));for(const c of o.getItems())(c.is("$textProxy")||s.schema.isInline(c))&&c.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(c))}return $(i)}}function p(r,e,t,s){const i=r.textNode||(t?r.nodeAfter:r.nodeBefore);if(!i||!i.hasAttribute(e))return r;const l=i.getAttribute(e);return E(r,e,l,t,s)}function $(r){for(let e=1;e<r.length;e++){const t=r[e-1].getJoined(r[e]);t&&r.splice(--e,2,t)}return r}class J extends h{static get pluginName(){return"StyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["GeneralHtmlSupport",d,M,q,j]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),s=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),l=s.normalizeConfig(t,i);e.commands.add("style",new L(e,l)),s.configureGHSDataFilter(l)}}class Z extends h{static get pluginName(){return"Style"}static get isOfficialPlugin(){return!0}static get requires(){return[J,I]}}export{j as LinkStyleSupport,M as ListStyleSupport,Z as Style,L as StyleCommand,J as StyleEditing,I as StyleUI,d as StyleUtils,q as TableStyleSupport,C as _StyleGridButtonView,G as _StyleGridView,y as _StyleGroupView,D as _StylePanelView};
@@ -0,0 +1 @@
1
+ import{Plugin as y,Command as S}from"../../../../../@ckeditor_ckeditor5-core@47.3.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as cn,WidgetToolbarRepository as Ge,toWidgetEditable as _t,isWidget as dn,toWidget as un}from"../../../../../@ckeditor_ckeditor5-widget@47.3.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Collection as yt,first as fe,getLocalizedArrowKeyCodeDirection as mn,DomEmitterMixin as hn,global as re,Rect as ae,toUnit as gn,CKEditorError as Ke,KeystrokeHandler as pe,FocusTracker as Ce}from"../../../../../@ckeditor_ckeditor5-utils@47.3.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconTable as qe,IconTableColumn as bn,IconTableRow as fn,IconTableMergeCell as pn,IconCaption as Cn,IconTableCellProperties as wn,IconTableProperties as Tn,IconCheck as At,IconCancel as vt,IconObjectInlineRight as _n,IconObjectCenter as yn,IconObjectInlineLeft as An,IconAlignBottom as vn,IconAlignMiddle as Sn,IconAlignTop as Rn,IconAlignJustify as In,IconAlignRight as kn,IconAlignCenter as xn,IconAlignLeft as Pn}from"../../../../../@ckeditor_ckeditor5-icons@47.3.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{createDropdown as oe,MenuBarMenuView as Vn,SwitchButtonView as En,addListToDropdown as Ne,ButtonView as E,ContextualBalloon as ce,normalizeColorOptions as de,getLocalizedColorOptions as ue,clickOutsideHandler as St,SplitButtonView as Ln,View as O,addKeyboardHandlingForGrid as Wn,UIModel as Rt,ViewCollection as De,FocusCycler as Fe,FormHeaderView as It,FormRowView as I,submitHandler as kt,LabelView as W,LabeledFieldView as k,createLabeledDropdown as xt,createLabeledInputText as F,ToolbarView as Ae,BalloonPanelView as D,InputTextView as Bn,ColorSelectorView as Nn}from"../../../../../@ckeditor_ckeditor5-ui@47.3.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{ClipboardMarkersUtils as _e,ClipboardPipeline as Xe}from"../../../../../@ckeditor_ckeditor5-clipboard@47.3.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{enableViewPlaceholder as Dn,ModelElement as Fn,addBorderStylesRules as Pt,addPaddingStylesRules as On,addBackgroundStylesRules as Vt,addMarginStylesRules as Mn,DomEventObserver as zn,isColorStyleValue as Hn,isLengthStyleValue as Et,isPercentageStyleValue as Un}from"../../../../../@ckeditor_ckeditor5-engine@47.3.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{debounce as Lt}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/debounce.js";import{isEqual as Je}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/predicate/isEqual.js";import{throttle as $n}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/throttle.js";import{isObject as jn}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/predicate/isObject.js";const Gn=/^(left|center|right)$/,Kn=/^(left|none|right)$/;function Oe(i,e){const{modelAttribute:t,styleName:n,attributeName:o,attributeType:l,viewElement:s,defaultValue:r,shouldUpcast:a=()=>!0,reduceBoxSides:c=!1}=e;i.for("upcast").attributeToAttribute({view:{name:s,styles:{[n]:/[\s\S]+/}},model:{key:t,value:(d,u,m)=>{if(!a(d))return;const h=P(r,"",m),g=d.getNormalizedStyle(n),b=c?ie(g):g;if(h!==b)return b;u.consumable.consume(d,{styles:n})}}}),o&&i.for("upcast").attributeToAttribute({view:{name:s,attributes:{[o]:/.+/}},model:{key:t,value:(d,u,m)=>{if(d.name=="figure"||d.hasStyle(n)||d.name=="table"&&d.parent.name=="figure"&&d.parent.hasStyle(n))return;const h=P(r,"",m);let g=d.getAttribute(o);if(g&&l=="length"&&!g.endsWith("px")&&(g+="px"),h!==g)return g;u.consumable.consume(d,{attributes:o})}}})}function ve(i,e,t,n){const{conversion:o}=i;o.for("upcast").add(l=>l.on("element:"+e,(s,r,a)=>{if(!r.modelRange)return;const c=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(f=>r.viewItem.hasStyle(f));if(!c.length)return;const d={styles:c};if(!a.consumable.test(r.viewItem,d))return;const u=[...r.modelRange.getItems({shallow:!0})].pop(),m=u.findAncestor("table",{includeSelf:!0});let h=n;m&&m.getAttribute("tableType")=="layout"&&(h={style:"none",color:"",width:""}),a.consumable.consume(r.viewItem,d);const g={style:r.viewItem.getNormalizedStyle("border-style"),color:r.viewItem.getNormalizedStyle("border-color"),width:r.viewItem.getNormalizedStyle("border-width")},b={style:ie(g.style),color:ie(g.color),width:ie(g.width)};b.style!==h.style&&a.writer.setAttribute(t.style,b.style,u),b.color!==h.color&&a.writer.setAttribute(t.color,b.color,u),b.width!==h.width&&a.writer.setAttribute(t.width,b.width,u)})),i.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&o.for("upcast").add(l=>{l.on(`element:${e}`,(s,r,a)=>{const{modelRange:c,viewItem:d}=r,u=d.is("element","table")?d:d.findAncestor("table");if(!a.consumable.test(u,{attributes:"border"})||u.getAttribute("border")!=="0")return;const m=c?.start?.nodeAfter;!m||m.hasAttribute(t.style)||(a.writer.setAttribute(t.style,"none",m),d.is("element","table")&&a.consumable.consume(d,{attributes:"border"}))})})}function K(i,e){const{modelElement:t,modelAttribute:n,styleName:o}=e;i.for("downcast").attributeToAttribute({model:{name:t,key:n},view:l=>({key:"style",value:{[o]:l}})})}function le(i,e){const{modelAttribute:t,styleName:n}=e;i.for("downcast").add(o=>o.on(`attribute:${t}:table`,(l,s,r)=>{const{item:a,attributeNewValue:c}=s,{mapper:d,writer:u}=r;if(!r.consumable.consume(s.item,l.name))return;const m=[...d.toViewElement(a).getChildren()].find(h=>h.is("element","table"));c?u.setStyle(n,c,m):u.removeStyle(n,m)}))}function P(i,e,t){const n=t.modelRange&&fe(t.modelRange.getItems({shallow:!0})),o=n&&n.is("element")&&n.findAncestor("table",{includeSelf:!0});return o&&o.getAttribute("tableType")==="layout"?e:i}function ie(i){if(!i)return;const e=["top","right","bottom","left"];if(!e.every(l=>i[l]))return i;const n=i.top;return e.every(l=>i[l]===n)?n:i}const v={left:{className:"table-style-align-left"},center:{className:"table-style-align-center"},right:{className:"table-style-align-right"},blockLeft:{className:"table-style-block-align-left"},blockRight:{className:"table-style-block-align-right"}},qn=[{view:{name:/^(table|figure)$/,styles:{float:Kn}},getAlign:i=>{let e=i.getStyle("float");return e==="none"&&(e="center"),e},getConsumables(i){const e=i.getStyle("float"),t=["float"];return e==="left"&&i.hasStyle("margin-right")?t.push("margin-right"):e==="right"&&i.hasStyle("margin-left")&&t.push("margin-left"),{styles:t}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},getAlign:()=>"center",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,key:"class",value:"table-style-align-left"},getAlign:()=>"left",getConsumables(){return{classes:v.left.className}}},{view:{name:/^(table|figure)$/,key:"class",value:v.right.className},getAlign:()=>"right",getConsumables(){return{classes:v.right.className}}},{view:{name:/^(table|figure)$/,key:"class",value:v.center.className},getAlign:()=>"center",getConsumables(){return{classes:v.center.className}}},{view:{name:/^(table|figure)$/,key:"class",value:v.blockLeft.className},getAlign:()=>"blockLeft",getConsumables(){return{classes:v.blockLeft.className}}},{view:{name:/^(table|figure)$/,key:"class",value:v.blockRight.className},getAlign:()=>"blockRight",getConsumables(){return{classes:v.blockRight.className}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"0","margin-right":"auto"}},getAlign:()=>"blockLeft",getConsumables(){return{styles:["margin-left","margin-right"]}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"0"}},getAlign:()=>"blockRight",getConsumables(){return{styles:["margin-left","margin-right"]}}},{view:{name:"table",attributes:{align:Gn}},getAlign:i=>i.getAttribute("align"),getConsumables(){return{attributes:"align"}}}],Q={center:{align:"center",style:"margin-left: auto; margin-right: auto;",className:"table-style-align-center"},left:{align:"left",style:"float: left;",className:"table-style-align-left"},right:{align:"right",style:"float: right;",className:"table-style-align-right"},blockLeft:{align:void 0,style:"margin-left: 0; margin-right: auto;",className:v.blockLeft.className},blockRight:{align:void 0,style:"margin-left: auto; margin-right: 0;",className:v.blockRight.className}};function _(i,e,t,n,o=1){e!=null&&o!==void 0&&o!==null&&e>o?n.setAttribute(i,e,t):n.removeAttribute(i,t)}function M(i,e,t={}){const n=i.createElement("tableCell",t);return i.insertElement("paragraph",n),i.insert(n,e),n}function Se(i,e){const t=e.parent.parent,n=parseInt(t.getAttribute("headingColumns")||"0"),{column:o}=i.getCellLocation(e);return!!n&&o<n}function se(i,e,t){const{modelAttribute:n}=t;i.extend("tableCell",{allowAttributes:[n]}),i.setAttributeProperties(n,{isFormatting:!0}),Oe(e,{viewElement:/^(td|th)$/,...t}),K(e,{modelElement:"tableCell",...t})}function B(i){const e=i.getSelectedElement();return e&&e.is("element","table")?e:i.getFirstPosition().findAncestor("table")}class w{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{const o=e.getChild(this._cellIndex);if(!o)return this._advanceToNextRow();const l=parseInt(o.getAttribute("colspan")||"1"),s=parseInt(o.getAttribute("rowspan")||"1");(l>1||s>1)&&this._recordSpans(o,s,l),this._shouldSkipSlot()||(t=this._formatOutValue(o)),this._nextCellAtColumn=this._column+l}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new Xn(this,e,t,n)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,o=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||n||o}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){const o={cell:e,row:this._row,column:this._column};for(let l=this._row;l<this._row+t;l++)for(let s=this._column;s<this._column+n;s++)(l!=this._row||s!=this._column)&&this._markSpannedCell(l,s,o)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((n,o)=>n+parseInt(o.getAttribute("colspan")||"1"),0)}}class Xn{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,n,o){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=o,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function Wt(i,e,t){const{startRow:n,startColumn:o,endRow:l,endColumn:s}=e,r=t.createElement("table"),a=i.getAttribute("tableType");a&&t.setAttribute("tableType",a,r);const c=l-n+1;for(let u=0;u<c;u++)t.insertElement("tableRow",r,"end");const d=[...new w(i,{startRow:n,endRow:l,startColumn:o,endColumn:s,includeAllSlots:!0})];for(const{row:u,column:m,cell:h,isAnchor:g,cellAnchorRow:b,cellAnchorColumn:f}of d){const p=u-n,C=r.getChild(p);if(!g)(b<n||f<o)&&M(t,t.createPositionAt(C,"end"));else{const T=t.cloneElement(h);t.append(T,C),Ot(T,u,m,l,s,t)}}return Jn(r,i,n,o,t),r}function Bt(i,e,t=0){const n=[],o=new w(i,{startRow:t,endRow:e-1});for(const l of o){const{row:s,cellHeight:r}=l,a=s+r-1;s<e&&e<=a&&n.push(l)}return n}function Nt(i,e,t){const n=i.parent,o=n.parent,l=n.index,s=parseInt(i.getAttribute("rowspan")),r=e-l,a={},c=s-r;c>1&&(a.rowspan=c);const d=parseInt(i.getAttribute("colspan")||"1");d>1&&(a.colspan=d);const u=l,m=u+r,h=[...new w(o,{startRow:u,endRow:m,includeAllSlots:!0})];let g=null,b;for(const f of h){const{row:p,column:C,cell:T}=f;T===i&&b===void 0&&(b=C),b!==void 0&&b===C&&p===m&&(g=M(t,f.getPositionBefore(),a))}return _("rowspan",r,i,t),g}function Dt(i,e){const t=[],n=new w(i);for(const o of n){const{column:l,cellWidth:s}=o,r=l+s-1;l<e&&e<=r&&t.push(o)}return t}function Ft(i,e,t,n){const o=parseInt(i.getAttribute("colspan")),l=t-e,s={},r=o-l;r>1&&(s.colspan=r);const a=parseInt(i.getAttribute("rowspan")||"1");a>1&&(s.rowspan=a);const c=M(n,n.createPositionAfter(i),s);return _("colspan",l,i,n),c}function Ot(i,e,t,n,o,l){const s=parseInt(i.getAttribute("colspan")||"1"),r=parseInt(i.getAttribute("rowspan")||"1");if(t+s-1>o){const d=o-t+1;_("colspan",d,i,l,1)}if(e+r-1>n){const d=n-e+1;_("rowspan",d,i,l,1)}}function Jn(i,e,t,n,o){const l=parseInt(e.getAttribute("headingRows")||"0");if(l>0){const r=l-t;_("headingRows",r,i,o,0)}const s=parseInt(e.getAttribute("headingColumns")||"0");if(s>0){const r=s-n;_("headingColumns",r,i,o,0)}}function Re(i,e){const t=e.getColumns(i),n=new Array(t).fill(0);for(const{column:l}of new w(i))n[l]++;const o=n.reduce((l,s,r)=>s?l:[...l,r],[]);if(o.length>0){const l=o[o.length-1];return e.removeColumns(i,{at:l}),!0}return!1}function Ie(i,e){const t=[],n=e.getRows(i);for(let o=0;o<n;o++)i.getChild(o).isEmpty&&t.push(o);if(t.length>0){const o=t[t.length-1];return e.removeRows(i,{at:o}),!0}return!1}function Me(i,e){Re(i,e)||Ie(i,e)}function Mt(i,e){const t=Array.from(new w(i,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:l})=>l===1))return e.lastRow;const o=t[0].cellHeight-1;return e.lastRow+o}function zt(i,e){const t=Array.from(new w(i,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:l})=>l===1))return e.lastColumn;const o=t[0].cellWidth-1;return e.lastColumn+o}function Ht(i){for(const e of i.getChildren())if(e.is("element","table"))return e}function Zn(){return i=>{i.on("element:figure",(e,t,n)=>{if(!n.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const o=Ht(t.viewItem);if(!o||!n.consumable.test(o,{name:!0}))return;n.consumable.consume(t.viewItem,{name:!0,classes:"table"});const l=n.convertItem(o,t.modelCursor),s=fe(l.modelRange.getItems());if(!s||!s.is("element","table")){n.consumable.revert(t.viewItem,{name:!0,classes:"table"}),l.modelRange&&!l.modelRange.isCollapsed&&(t.modelRange=l.modelRange,t.modelCursor=l.modelCursor);return}n.convertChildren(t.viewItem,n.writer.createPositionAt(s,"end")),n.updateConversionResult(s,t)})}}function Yn(){return i=>{i.on("element:table",(e,t,n)=>{const o=t.viewItem;if(!n.consumable.test(o,{name:!0}))return;const{rows:l,headingRows:s,headingColumns:r}=eo(o),a={};r&&(a.headingColumns=r),s&&(a.headingRows=s);const c=n.writer.createElement("table",a);if(n.safeInsert(c,t.modelCursor)){if(n.consumable.consume(o,{name:!0}),l.forEach(d=>n.convertItem(d,n.writer.createPositionAt(c,"end"))),n.convertChildren(o,n.writer.createPositionAt(c,"end")),c.isEmpty){const d=n.writer.createElement("tableRow");n.writer.insert(d,n.writer.createPositionAt(c,"end")),M(n.writer,n.writer.createPositionAt(d,"end"))}n.updateConversionResult(c,t)}})}}function Qn(){return i=>{i.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&t.modelCursor.index==0&&e.stop()},{priority:"high"})}}function Ze(i){return e=>{e.on(`element:${i}`,(t,n,{writer:o})=>{if(!n.modelRange)return;const l=n.modelRange.start.nodeAfter,s=o.createPositionAt(l,0);if(n.viewItem.isEmpty){o.insertElement("paragraph",s);return}const r=Array.from(l.getChildren());if(r.every(a=>a.is("element","$marker"))){const a=o.createElement("paragraph");o.insert(a,o.createPositionAt(l,0));for(const c of r)o.move(o.createRangeOn(c),o.createPositionAt(a,"end"))}},{priority:"low"})}}function eo(i){let e=0,t;const n=[],o=[];let l;for(const r of Array.from(i.getChildren())){if(r.name!=="tbody"&&r.name!=="thead"&&r.name!=="tfoot")continue;r.name==="thead"&&!l&&(l=r);const a=Array.from(r.getChildren()).filter(d=>d.is("element","tr"));let c=null;for(const d of a){const u=Array.from(d.getChildren()).filter(m=>m.is("element","td")||m.is("element","th"));l&&r===l||r.name==="tbody"&&u.length>0&&(c===null||u.length===c)&&u.every(m=>m.is("element","th"))?(e++,n.push(d)):o.push(d),c=Math.max(c||0,u.length)}}const s=to(o);for(const r of s){let a=0;for(;a<r.length&&r[a]?.name==="th";)a+=1;(!t||a<t)&&(t=a)}return{headingRows:e,headingColumns:t||0,rows:[...n,...o]}}function to(i){let e=new Map,t=0;const n=i.map(o=>{const l=[],s=Array.from(o.getChildren()).filter(a=>a.name==="th"||a.name==="td"),r=new Map;for(;s.length||l.length<t;){const a=e.get(l.length);if(a&&a.remaining>0)l.push(a.cell);else{const c=s.shift();if(c){const d=parseInt(c.getAttribute("colspan")||"1"),u=parseInt(c.getAttribute("rowspan")||"1");for(let m=0;m<d;m++)u>1&&r.set(l.length,{cell:c,remaining:u-1}),l.push(c)}else{l.push(null);continue}}}for(const[a,c]of e.entries())c.remaining-=1,c.remaining>0&&!r.has(a)&&r.set(a,c);return e=r,t=Math.max(t,l.length),l});for(const o of n)for(;o.length<t;)o.push(null);return n}function z(i){if(!i||!jn(i))return i;const{top:e,right:t,bottom:n,left:o}=i;if(e==t&&t==n&&n==o)return e}function H(i,e){const t=parseFloat(i);return Number.isNaN(t)||String(t)!==String(i)?i:`${t}${e}`}function we(i,e={}){const t={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...i};return e.includeAlignmentProperty&&!t.alignment&&(t.alignment="center"),e.includePaddingProperty&&!t.padding&&(t.padding=""),e.includeVerticalAlignmentProperty&&!t.verticalAlignment&&(t.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!t.horizontalAlignment&&(t.horizontalAlignment=e.isRightToLeftContent?"right":"left"),t}function ze(i,e){return we({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...i},e)}function He(i,e){return we({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...i},e)}function Ye(i,e){return(t,{writer:n})=>{const o=t.getAttribute("headingRows")||0,l=n.createContainerElement("table",null,[]),s=n.createContainerElement("figure",{class:"table"},l);o>0&&n.insert(n.createPositionAt(l,"end"),n.createContainerElement("thead",null,n.createSlot(r=>r.is("element","tableRow")&&r.index<o))),o<i.getRows(t)&&n.insert(n.createPositionAt(l,"end"),n.createContainerElement("tbody",null,n.createSlot(r=>r.is("element","tableRow")&&r.index>=o)));for(const{positionOffset:r,filter:a}of e.additionalSlots)n.insert(n.createPositionAt(l,r),n.createSlot(a));return n.insert(n.createPositionAt(l,"after"),n.createSlot(r=>r.is("element","tableRow")?!1:!e.additionalSlots.some(({filter:a})=>a(r)))),e.asWidget?oo(s,n):s}}function no(){return(i,{writer:e})=>i.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}function Qe(i={}){return(e,{writer:t})=>{const n=e.parent,o=n.parent,l=o.getChildIndex(n),s=new w(o,{row:l}),r=o.getAttribute("headingRows")||0,a=o.getAttribute("headingColumns")||0;let c=null;for(const d of s)if(d.cell==e){const m=d.row<r||d.column<a?"th":"td";c=i.asWidget?_t(t.createEditableElement(m),t,{withAriaRole:!1}):t.createContainerElement(m);break}return c}}function et(i={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!Ut(e))return null;if(i.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const n=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,n),n}}}function Ut(i){return i.parent.childCount==1&&!lo(i)}function oo(i,e){return e.setCustomProperty("table",!0,i),un(i,e,{hasSelectionHandle:!0})}function lo(i){for(const e of i.getAttributeKeys())if(!(e.startsWith("selection:")||e=="htmlEmptyBlock"))return!0;return!1}function io(i){return(e,t)=>{const n=i.plugins.has("PlainTableOutput"),o=t.options.isClipboardPipeline,l=i.config.get("experimentalFlags.useExtendedTableBlockAlignment");return!n&&!(l&&o)?null:ro(e,t,i)}}function so(i){return(e,{writer:t,options:n})=>{const o=i.plugins.has("PlainTableOutput"),l=n.isClipboardPipeline,s=i.config.get("experimentalFlags.useExtendedTableBlockAlignment");return!o&&!(s&&l)?null:e.parent.name==="table"?t.createContainerElement("caption"):null}}function ro(i,e,t){const n=e.writer,o=i.getAttribute("headingRows")||0,l=n.createSlot(m=>m.is("element","tableRow")&&m.index<o),s=n.createSlot(m=>m.is("element","tableRow")&&m.index>=o),r=n.createSlot(m=>!m.is("element","tableRow")),a=n.createContainerElement("thead",null,l),c=n.createContainerElement("tbody",null,s),d=[];o&&d.push(a),o<i.childCount&&d.push(c);const u={class:"table"};if(t.plugins.has("TableProperties")&&e.options.isClipboardPipeline){const m=ze(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),h=i.getAttribute("tableAlignment");let g=m.alignment;i.getAttribute("tableType")==="layout"&&(g="");const b=h||g;b&&(u.class+=" "+Q[b].className,u.style=Q[b].style,Q[b].align!==void 0&&(u.align=Q[b].align))}return n.createContainerElement("table",u,[r,...d])}function ao(i){const e={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[t,n]of Object.entries(e))i.conversion.for("dataDowncast").add(o=>o.on(`attribute:${n}:table`,(l,s,r)=>{const{item:a,attributeNewValue:c}=s,{mapper:d,writer:u}=r,m=i.plugins.has("PlainTableOutput"),h=r.options.isClipboardPipeline,g=i.config.get("experimentalFlags.useExtendedTableBlockAlignment");if(!m&&!(g&&h)||!r.consumable.consume(a,l.name))return;const b=d.toViewElement(a);c?u.setStyle(t,c,b):u.removeStyle(t,b)},{priority:"high"}))}class co extends S{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=uo(t,n)}execute(e={}){const t=this.editor,n=t.model,o=t.plugins.get("TableUtils"),l=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&l&&(e.headingRows=l),e.headingColumns===void 0&&s&&(e.headingColumns=s),n.change(r=>{const a=o.createTable(r,e);n.insertObject(a,null,null,{findOptimalPosition:"auto"}),r.setSelection(r.createPositionAt(a.getNodeByPath([0,0,0]),0))})}}function uo(i,e){const t=i.getFirstPosition().parent,n=t===t.root?t:t.parent;return e.checkChild(n,"table")}class tt extends S{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,n=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=n}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),o=this.order==="above",l=n.getSelectionAffectedTableCells(t),s=n.getRowIndexes(l),r=o?s.first:s.last,a=l[0].findAncestor("table");n.insertRows(a,{at:o?r:r+1,copyStructureFromAbove:!o})}}class nt extends S{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,n=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=n}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),o=this.order==="left",l=n.getSelectionAffectedTableCells(t),s=n.getColumnIndexes(l),r=o?s.first:s.last,a=l[0].findAncestor("table");n.insertColumns(a,{columns:1,at:o?r:r+1})}}class ot extends S{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length===1}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}class ee extends S{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,o=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],l=this.value,s=this.direction;e.change(r=>{const a=s=="right"||s=="down",c=a?o:l,d=a?l:o,u=d.parent;go(d,c,r);const m=this.isHorizontal?"colspan":"rowspan",h=parseInt(o.getAttribute(m)||"1"),g=parseInt(l.getAttribute(m)||"1");r.setAttribute(m,h+g,c),r.setSelection(r.createRangeIn(c));const b=this.editor.plugins.get("TableUtils"),f=u.findAncestor("table");Me(f,b)})}_getMergeableCell(){const t=this.editor.model.document,n=this.editor.plugins.get("TableUtils"),o=n.getTableCellsContainingSelection(t.selection)[0];if(!o)return;const l=this.isHorizontal?mo(o,this.direction,n):ho(o,this.direction,n);if(!l)return;const s=this.isHorizontal?"rowspan":"colspan",r=parseInt(o.getAttribute(s)||"1");if(parseInt(l.getAttribute(s)||"1")===r)return l}}function mo(i,e,t){const o=i.parent.parent,l=e=="right"?i.nextSibling:i.previousSibling,s=(o.getAttribute("headingColumns")||0)>0;if(!l)return;const r=e=="right"?i:l,a=e=="right"?l:i,{column:c}=t.getCellLocation(r),{column:d}=t.getCellLocation(a),u=parseInt(r.getAttribute("colspan")||"1"),m=Se(t,r),h=Se(t,a);return s&&m!=h?void 0:c+u===d?l:void 0}function ho(i,e,t){const n=i.parent,o=n.parent,l=o.getChildIndex(n);if(e=="down"&&l===t.getRows(o)-1||e=="up"&&l===0)return null;const s=parseInt(i.getAttribute("rowspan")||"1"),r=o.getAttribute("headingRows")||0,a=e=="down"&&l+s===r,c=e=="up"&&l===r;if(r&&(a||c))return null;const d=parseInt(i.getAttribute("rowspan")||"1"),u=e=="down"?l+d:l,m=[...new w(o,{endRow:u})],g=m.find(f=>f.cell===i).column,b=m.find(({row:f,cellHeight:p,column:C})=>C!==g?!1:e=="down"?f===u:u===f+p);return b&&b.cell?b.cell:null}function go(i,e,t){lt(i)||(lt(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(i),t.createPositionAt(e,"end"))),t.remove(i)}function lt(i){const e=i.getChild(0);return i.childCount==1&&e.is("element","paragraph")&&e.isEmpty}class bo extends S{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const o=n.findAncestor("table"),s=e.getRows(o)-1,r=e.getRowIndexes(t),a=r.first===0&&r.last===s;this.isEnabled=!a}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),o=t.getRowIndexes(n),l=n[0],s=l.findAncestor("table"),r=t.getCellLocation(l).column;e.change(a=>{const c=o.last-o.first+1;t.removeRows(s,{at:o.first,rows:c});const d=fo(s,o.first,r,t.getRows(s));a.setSelection(a.createPositionAt(d,0))})}}function fo(i,e,t,n){const o=i.getChild(Math.min(e,n-1));let l=o.getChild(0),s=0;for(const r of o.getChildren()){if(s>t)return l;l=r,s+=parseInt(r.getAttribute("colspan")||"1")}return l}class po extends S{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const o=n.findAncestor("table"),l=e.getColumns(o),{first:s,last:r}=e.getColumnIndexes(t);this.isEnabled=r-s<l-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,n]=wo(this.editor.model.document.selection,e),o=t.parent.parent,l=[...new w(o)],s={first:l.find(a=>a.cell===t).column,last:l.find(a=>a.cell===n).column},r=Co(l,t,n,s);this.editor.model.change(a=>{const c=s.last-s.first+1;e.removeColumns(o,{at:s.first,columns:c}),a.setSelection(a.createPositionAt(r,0))})}}function Co(i,e,t,n){return parseInt(t.getAttribute("colspan")||"1")>1?t:e.previousSibling||t.nextSibling?t.nextSibling||e.previousSibling:n.first?i.reverse().find(({column:l})=>l<n.first).cell:i.reverse().find(({column:l})=>l>n.last).cell}function wo(i,e){const t=e.getSelectionAffectedTableCells(i),n=t[0],o=t.pop(),l=[n,o];return n.isBefore(o)?l:l.reverse()}class To extends S{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection);if(n.length===0){this.isEnabled=!1,this.value=!1;return}const o=n[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(o,"headingRows"),this.value=n.every(l=>this._isInHeading(l,l.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,o=t.getSelectionAffectedTableCells(n.document.selection),l=o[0].findAncestor("table"),{first:s,last:r}=t.getRowIndexes(o),a=this.value?s:r+1,c=l.getAttribute("headingRows")||0;n.change(d=>{if(a){const u=a>c?c:0,m=Bt(l,a,u);for(const{cell:h}of m)Nt(h,a,d)}_("headingRows",a,l,d,0)})}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||"0");return!!n&&e.parent.index<n}}class _o extends S{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection);if(n.length===0){this.isEnabled=!1,this.value=!1;return}const o=n[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(o,"headingColumns"),this.value=n.every(l=>Se(e,l))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,o=t.getSelectionAffectedTableCells(n.document.selection),l=o[0].findAncestor("table"),{first:s,last:r}=t.getColumnIndexes(o),a=this.value?s:r+1;n.change(c=>{if(a){const d=Dt(l,a);for(const{cell:u,column:m}of d)Ft(u,m,a,c)}_("headingColumns",a,l,c,0)})}}const yo=5,ke=40,Ao=2,vo=3;function So(i){const e=new Set;for(const t of i.document.differ.getChanges()){let n=null;switch(t.type){case"insert":n=["table","tableRow","tableCell"].includes(t.name)?t.position:null;break;case"remove":n=["tableRow","tableCell"].includes(t.name)?t.position:null;break;case"attribute":t.range.start.nodeAfter&&(n=["table","tableRow","tableCell"].includes(t.range.start.nodeAfter.name)?t.range.start:null);break}if(!n)continue;const o=n.nodeAfter&&n.nodeAfter.is("element","table")?n.nodeAfter:n.findAncestor("table");for(const l of i.createRangeOn(o).getItems())l.is("element","table")&&J(l)&&e.add(l)}return e}function Ro(i,e){return ke*100/$t(i,e)}function $t(i,e){const t=it(i,"tbody",e)||it(i,"thead",e),n=e.editing.view.domConverter.mapViewToDom(t);return xe(n)}function it(i,e,t){return[...[...t.editing.mapper.toViewElement(i).getChildren()].find(l=>l.is("element","table")).getChildren()].find(l=>l.is("element",e))}function xe(i){const e=re.window.getComputedStyle(i);return e.boxSizing==="border-box"?parseFloat(e.width)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderLeftWidth)-parseFloat(e.borderRightWidth):parseFloat(e.width)}function Io(i,e){const t=e.getCellLocation(i).column,n=i.getAttribute("colspan")||1;return{leftEdge:t,rightEdge:t+n-1}}function R(i){const e=Math.pow(10,Ao),t=typeof i=="number"?i:parseFloat(i);return Math.round(t*e)/e}function ko(i,e,t){return i<=e?R(e):i>=t?R(t):R(i)}function xo(i,e){return Array(i).fill(e)}function X(i){return i.map(e=>typeof e=="number"?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function Ue(i){const e=i.map(o=>o==="auto"||o===void 0?"auto":parseFloat(o.replace("%","")));let t=Po(e);const n=X(t);return n!==100&&(t=t.map(o=>R(o*100/n)).map((o,l,s)=>{if(!(l===s.length-1))return o;const a=X(s);return R(o+100-a)})),t.map(o=>o+"%")}function Po(i){const e=i.filter(o=>o==="auto").length;if(e===0)return i.map(o=>R(o));const t=X(i),n=Math.max((100-t)/e,yo);return i.map(o=>o==="auto"?n:o).map(o=>R(o))}function Vo(i){const e=re.window.getComputedStyle(i);return e.boxSizing==="border-box"?parseInt(e.width):parseFloat(e.width)+parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderWidth)}function jt(i,e,t,n){for(let o=0;o<Math.max(t.length,i.length);o++){const l=i[o],s=t[o];s?l?n.setAttribute("columnWidth",s,l):n.appendElement("tableColumn",{columnWidth:s},e):n.remove(l)}}function J(i){if(i.is("element","tableColumnGroup"))return i;const e=i.getChildren();return Array.from(e).find(t=>t.is("element","tableColumnGroup"))}function Z(i){const e=J(i);return e?Array.from(e.getChildren()):[]}function Eo(i){return Z(i).map(e=>e.getAttribute("columnWidth"))}function Lo(i,e){return Z(i).reduce((n,o)=>{const l=o.getAttribute("columnWidth"),s=o.getAttribute("colSpan");if(!s)return n.push(l),n;for(let r=0;r<s;r++)n.push(l);return e.removeAttribute("colSpan",o),n},[])}class A extends y{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,n=t.parent,o=n.getChildIndex(t),l=new w(n,{row:o});for(const{cell:s,row:r,column:a}of l)if(s===e)return{row:r,column:a};}createTable(e,t){const n=e.createElement("table"),o=t.rows||2,l=t.columns||2;return ye(e,n,0,o,l),t.headingRows&&_("headingRows",Math.min(t.headingRows,o),n,e,0),t.headingColumns&&_("headingColumns",Math.min(t.headingColumns,l),n,e,0),n}insertRows(e,t={}){const n=this.editor.model,o=t.at||0,l=t.rows||1,s=t.copyStructureFromAbove!==void 0,r=t.copyStructureFromAbove?o-1:o,a=this.getRows(e),c=this.getColumns(e);if(o>a)throw new Ke("tableutils-insertrows-insert-out-of-range",this,{options:t});n.change(d=>{const u=e.getAttribute("headingRows")||0;if(u>o&&_("headingRows",u+l,e,d,0),!s&&(o===0||o===a)){ye(d,e,o,l,c);return}const m=s?Math.max(o,r):o,h=new w(e,{endRow:m}),g=new Array(c).fill(1);for(const{row:b,column:f,cellHeight:p,cellWidth:C,cell:T}of h){const x=b+p-1,V=b<o&&o<=x,G=b<=r&&r<=x;V?(d.setAttribute("rowspan",p+l,T),g[f]=-C):s&&G&&(g[f]=C)}for(let b=0;b<l;b++){const f=d.createElement("tableRow");d.insert(f,e,o);for(let p=0;p<g.length;p++){const C=g[p],T=d.createPositionAt(f,"end");C>0&&M(d,T,C>1?{colspan:C}:void 0),p+=Math.abs(C)-1}}})}insertColumns(e,t={}){const n=this.editor.model,o=t.at||0,l=t.columns||1;n.change(s=>{const r=e.getAttribute("headingColumns");o<r&&s.setAttribute("headingColumns",r+l,e);const a=this.getColumns(e);if(o===0||a===o){for(const d of e.getChildren())d.is("element","tableRow")&&j(l,s,s.createPositionAt(d,o?"end":0));return}const c=new w(e,{column:o,includeAllSlots:!0});for(const d of c){const{row:u,cell:m,cellAnchorColumn:h,cellAnchorRow:g,cellWidth:b,cellHeight:f}=d;if(h<o){s.setAttribute("colspan",b+l,m);const p=g+f-1;for(let C=u;C<=p;C++)c.skipRow(C)}else j(l,s,d.getPositionBefore())}})}removeRows(e,t){const n=this.editor.model,o=t.rows||1,l=this.getRows(e),s=t.at,r=s+o-1;if(r>l-1)throw new Ke("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});n.change(a=>{const c={first:s,last:r},{cellsToMove:d,cellsToTrim:u}=No(e,c);if(d.size){const m=r+1;Do(e,m,d,a)}for(let m=r;m>=s;m--)a.remove(e.getChild(m));for(const{rowspan:m,cell:h}of u)_("rowspan",m,h,a);Bo(e,c,a),Re(e,this)||Ie(e,this)})}removeColumns(e,t){const n=this.editor.model,o=t.at,l=t.columns||1,s=t.at+l-1;n.change(r=>{Wo(e,{first:o,last:s},r);const a=Z(e);for(let c=s;c>=o;c--){for(const{cell:d,column:u,cellWidth:m}of[...new w(e)])u<=c&&m>1&&u+m>c?_("colspan",m-1,d,r):u===c&&r.remove(d);if(a[c]){const d=c===0?a[1]:a[c-1],u=parseFloat(a[c].getAttribute("columnWidth")),m=parseFloat(d.getAttribute("columnWidth"));r.remove(a[c]),r.setAttribute("columnWidth",u+m+"%",d)}}Ie(e,this)||Re(e,this)})}splitCellVertically(e,t=2){const n=this.editor.model,l=e.parent.parent,s=parseInt(e.getAttribute("rowspan")||"1"),r=parseInt(e.getAttribute("colspan")||"1");n.change(a=>{if(r>1){const{newCellsSpan:c,updatedSpan:d}=st(r,t);_("colspan",d,e,a);const u={};c>1&&(u.colspan=c),s>1&&(u.rowspan=s);const m=r>t?t-1:r-1;j(m,a,a.createPositionAfter(e),u)}if(r<t){const c=t-r,d=[...new w(l)],{column:u}=d.find(({cell:b})=>b===e),m=d.filter(({cell:b,cellWidth:f,column:p})=>{const C=b!==e&&p===u,T=p<u&&p+f>u;return C||T});for(const{cell:b,cellWidth:f}of m)a.setAttribute("colspan",f+c,b);const h={};s>1&&(h.rowspan=s),j(c,a,a.createPositionAfter(e),h);const g=l.getAttribute("headingColumns")||0;g>u&&_("headingColumns",g+c,l,a)}})}splitCellHorizontally(e,t=2){const n=this.editor.model,o=e.parent,l=o.parent,s=l.getChildIndex(o),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");n.change(c=>{if(r>1){const d=[...new w(l,{startRow:s,endRow:s+r-1,includeAllSlots:!0})],{newCellsSpan:u,updatedSpan:m}=st(r,t);_("rowspan",m,e,c);const{column:h}=d.find(({cell:f})=>f===e),g={};u>1&&(g.rowspan=u),a>1&&(g.colspan=a);let b=0;for(const f of d){const{column:p,row:C}=f,T=C>=s+m,x=p===h;b>=u&&x&&(b=0),T&&x&&(b||j(1,c,f.getPositionBefore(),g),b++)}}if(r<t){const d=t-r,u=[...new w(l,{startRow:0,endRow:s})];for(const{cell:g,cellHeight:b,row:f}of u)if(g!==e&&f+b>s){const p=b+d;c.setAttribute("rowspan",p,g)}const m={};a>1&&(m.colspan=a),ye(c,l,s+1,d,1,m);const h=l.getAttribute("headingRows")||0;h>s&&_("headingRows",h+d,l,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(n=>n.is("element","tableCell")).reduce((n,o)=>{const l=parseInt(o.getAttribute("colspan")||"1");return n+l},0)}getRows(e){return Array.from(e.getChildren()).reduce((t,n)=>n.is("element","tableRow")?t+1:t,0)}createTableWalker(e,t={}){return new w(e,t)}getSelectedTableCells(e){const t=[];for(const n of this.sortRanges(e.getRanges())){const o=n.getContainedElement();o&&o.is("element","tableCell")&&t.push(o)}return t}getTableCellsContainingSelection(e){const t=[];for(const n of e.getRanges()){const o=n.start.findAncestor("tableCell");o&&t.push(o)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(n=>n.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),o=[...new w(t)].filter(l=>e.includes(l.cell)).map(l=>l.column);return this._getFirstLastIndexesObject(o)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,n=new Set;let o=0;for(const s of e){const{row:r,column:a}=this.getCellLocation(s),c=parseInt(s.getAttribute("rowspan"))||1,d=parseInt(s.getAttribute("colspan"))||1;t.add(r),n.add(a),c>1&&t.add(r+c-1),d>1&&n.add(a+d-1),o+=c*d}return Oo(t,n)==o}sortRanges(e){return Array.from(e).sort(Fo)}_getFirstLastIndexesObject(e){const t=e.sort((l,s)=>l-s),n=t[0],o=t[t.length-1];return{first:n,last:o}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),n=this.getRowIndexes(e),o=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,o))return!1;const l=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(l,s)}_areIndexesInSameSection({first:e,last:t},n){const o=e<n,l=t<n;return o===l}}function ye(i,e,t,n,o,l={}){for(let s=0;s<n;s++){const r=i.createElement("tableRow");i.insert(r,e,t),j(o,i,i.createPositionAt(r,"end"),l)}}function j(i,e,t,n={}){for(let o=0;o<i;o++)M(e,t,n)}function st(i,e){if(i<e)return{newCellsSpan:1,updatedSpan:1};const t=Math.floor(i/e),n=i-t*e+t;return{newCellsSpan:t,updatedSpan:n}}function Wo(i,e,t){const n=i.getAttribute("headingColumns")||0;if(n&&e.first<n){const o=Math.min(n-1,e.last)-e.first+1;t.setAttribute("headingColumns",n-o,i)}}function Bo(i,{first:e,last:t},n){const o=i.getAttribute("headingRows")||0;if(e<o){const l=t<o?o-(t-e+1):e;_("headingRows",l,i,n,0)}}function No(i,{first:e,last:t}){const n=new Map,o=[];for(const{row:l,column:s,cellHeight:r,cell:a}of new w(i,{endRow:t})){const c=l+r-1;if(l>=e&&l<=t&&c>t){const m=t-l+1,h=r-m;n.set(s,{cell:a,rowspan:h})}if(l<e&&c>=e){let m;c>=t?m=t-e+1:m=c-e+1,o.push({cell:a,rowspan:r-m})}}return{cellsToMove:n,cellsToTrim:o}}function Do(i,e,t,n){const l=[...new w(i,{includeAllSlots:!0,row:e})],s=i.getChild(e);let r;for(const{column:a,cell:c,isAnchor:d}of l)if(t.has(a)){const{cell:u,rowspan:m}=t.get(a),h=r?n.createPositionAfter(r):n.createPositionAt(s,0);n.move(n.createRangeOn(u),h),_("rowspan",m,u,n),r=u}else d&&(r=c)}function Fo(i,e){const t=i.start,n=e.start;return t.isBefore(n)?-1:1}function Oo(i,e){const t=Array.from(i.values()),n=Array.from(e.values()),o=Math.max(...t),l=Math.min(...t),s=Math.max(...n),r=Math.min(...n);return(o-l+1)*(s-r+1)}class Mo extends S{refresh(){const e=this.editor.plugins.get(A),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(A);e.change(n=>{const o=t.getSelectedTableCells(e.document.selection),l=o.shift(),{mergeWidth:s,mergeHeight:r}=Ho(l,o,t);_("colspan",s,l,n),_("rowspan",r,l,n);for(const c of o)zo(c,l,n);const a=l.findAncestor("table");Me(a,t),n.setSelection(l,"in")})}}function zo(i,e,t){rt(i)||(rt(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(i),t.createPositionAt(e,"end"))),t.remove(i)}function rt(i){const e=i.getChild(0);return i.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function Ho(i,e,t){let n=0,o=0;for(const c of e){const{row:d,column:u}=t.getCellLocation(c);n=at(c,u,n,"colspan"),o=at(c,d,o,"rowspan")}const{row:l,column:s}=t.getCellLocation(i),r=n-s,a=o-l;return{mergeWidth:r,mergeHeight:a}}function at(i,e,t,n){const o=parseInt(i.getAttribute(n)||"1");return Math.max(t,e+o)}class Uo extends S{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),o=t.getRowIndexes(n),l=n[0].findAncestor("table"),s=[];for(let r=o.first;r<=o.last;r++)for(const a of l.getChild(r).getChildren())s.push(e.createRangeOn(a));e.change(r=>{r.setSelection(s)})}}class $o extends S{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),o=n[0],l=n.pop(),s=o.findAncestor("table"),r=e.getCellLocation(o),a=e.getCellLocation(l),c=Math.min(r.column,a.column),d=Math.max(r.column,a.column),u=[];for(const m of new w(s,{startColumn:c,endColumn:d}))u.push(t.createRangeOn(m.cell));t.change(m=>{m.setSelection(u)})}}function jo(i){i.document.registerPostFixer(e=>Go(e,i))}function Go(i,e){const t=e.document.differ.getChanges();let n=!1;const o=new Set;for(const l of t){let s=null;l.type=="insert"&&l.name=="table"&&(s=l.position.nodeAfter),(l.type=="insert"||l.type=="remove")&&(l.name=="tableRow"||l.name=="tableCell")&&(s=l.position.findAncestor("table")),Zo(l)&&(s=l.range.start.findAncestor("table")),s&&!o.has(s)&&(n=Ko(s,i)||n,n=qo(s,i)||n,o.add(s))}return n}function Ko(i,e){let t=!1;const n=Xo(i);if(n.length){t=!0;for(const o of n)_("rowspan",o.rowspan,o.cell,e,1)}return t}function qo(i,e){let t=!1;const n=Jo(i),o=[];for(const[a,c]of n.entries())!c&&i.getChild(a).is("element","tableRow")&&o.push(a);if(o.length){t=!0;for(const a of o.reverse())e.remove(i.getChild(a)),n.splice(a,1)}const l=n.filter((a,c)=>i.getChild(c).is("element","tableRow")),s=l[0];if(!l.every(a=>a===s)){const a=l.reduce((c,d)=>d>c?d:c,0);for(const[c,d]of l.entries()){const u=a-d;if(u){for(let m=0;m<u;m++)M(e,e.createPositionAt(i.getChild(c),"end"));t=!0}}}return t}function Xo(i){const e=parseInt(i.getAttribute("headingRows")||"0"),t=Array.from(i.getChildren()).reduce((o,l)=>l.is("element","tableRow")?o+1:o,0),n=[];for(const{row:o,cell:l,cellHeight:s}of new w(i)){if(s<2)continue;const a=o<e?e:t;if(o+s>a){const c=a-o;n.push({cell:l,rowspan:c})}}return n}function Jo(i){const e=new Array(i.childCount).fill(0);for(const{rowIndex:t}of new w(i,{includeAllSlots:!0}))e[t]++;return e}function Zo(i){if(i.type!=="attribute")return!1;const e=i.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}function Yo(i){i.document.registerPostFixer(e=>Qo(e,i))}function Qo(i,e){const t=e.document.differ.getChanges();let n=!1;for(const o of t)o.type=="insert"&&o.name=="table"&&(n=el(o.position.nodeAfter,i)||n),o.type=="insert"&&o.name=="tableRow"&&(n=Gt(o.position.nodeAfter,i)||n),o.type=="insert"&&o.name=="tableCell"&&(n=Pe(o.position.nodeAfter,i)||n),(o.type=="remove"||o.type=="insert")&&tl(o)&&(n=Pe(o.position.parent,i)||n);return n}function el(i,e){let t=!1;for(const n of i.getChildren())n.is("element","tableRow")&&(t=Gt(n,e)||t);return t}function Gt(i,e){let t=!1;for(const n of i.getChildren())t=Pe(n,e)||t;return t}function Pe(i,e){if(i.childCount==0)return e.insertElement("paragraph",i),!0;const t=Array.from(i.getChildren()).filter(n=>n.is("$text"));for(const n of t)e.wrap(e.createRangeOn(n),"paragraph");return!!t.length}function tl(i){return i.position.parent.is("element","tableCell")?i.type=="insert"&&i.name=="$text"||i.type=="remove":!1}function nl(i,e){const t=i.document.differ;for(const n of t.getChanges()){let o,l=!1;if(n.type=="attribute"){const c=n.range.start.nodeAfter;if(!c||!c.is("element","table")||n.attributeKey!="headingRows"&&n.attributeKey!="headingColumns")continue;o=c,l=n.attributeKey=="headingRows"}else(n.name=="tableRow"||n.name=="tableCell")&&(o=n.position.findAncestor("table"),l=n.name=="tableRow");if(!o)continue;const s=o.getAttribute("headingRows")||0,r=o.getAttribute("headingColumns")||0,a=new w(o);for(const c of a){const u=c.row<s||c.column<r?"th":"td",m=e.mapper.toViewElement(c.cell);m&&m.is("element")&&m.name!=u&&e.reconvertItem(l?c.cell.parent:c.cell)}}}function ol(i,e){const t=i.document.differ,n=new Set;for(const o of t.getChanges()){const l=o.type=="attribute"?o.range.start.parent:o.position.parent;l.is("element","tableCell")&&n.add(l)}for(const o of n.values()){const l=Array.from(o.getChildren()).filter(s=>ll(s,e.mapper));for(const s of l)e.reconvertItem(s)}}function ll(i,e){if(!i.is("element","paragraph"))return!1;const t=e.toViewElement(i);return t?Ut(i)!==t.is("element","span"):!1}class Y extends y{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[A]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,n=t.schema,o=e.conversion,l=e.plugins.get(A);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),o.for("upcast").add(Zn()),o.for("upcast").add(Yn()),o.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Ye(l,{asWidget:!0,additionalSlots:this._additionalSlots})}),o.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Ye(l,{additionalSlots:this._additionalSlots})}),o.for("upcast").elementToElement({model:"tableRow",view:"tr"}),o.for("upcast").add(Qn()),o.for("downcast").elementToElement({model:"tableRow",view:no()}),o.for("upcast").elementToElement({model:"tableCell",view:"td"}),o.for("upcast").elementToElement({model:"tableCell",view:"th"}),o.for("upcast").add(Ze("td")),o.for("upcast").add(Ze("th")),o.for("editingDowncast").elementToElement({model:"tableCell",view:Qe({asWidget:!0})}),o.for("dataDowncast").elementToElement({model:"tableCell",view:Qe()}),o.for("editingDowncast").elementToElement({model:"paragraph",view:et({asWidget:!0}),converterPriority:"high"}),o.for("dataDowncast").elementToElement({model:"paragraph",view:et(),converterPriority:"high"}),o.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),o.for("upcast").attributeToAttribute({model:{key:"colspan",value:ct("colspan")},view:"colspan"}),o.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),o.for("upcast").attributeToAttribute({model:{key:"rowspan",value:ct("rowspan")},view:"rowspan"}),this._addPlainTableOutputConverters(),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new co(e)),e.commands.add("insertTableRowAbove",new tt(e,{order:"above"})),e.commands.add("insertTableRowBelow",new tt(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new nt(e,{order:"left"})),e.commands.add("insertTableColumnRight",new nt(e,{order:"right"})),e.commands.add("removeTableRow",new bo(e)),e.commands.add("removeTableColumn",new po(e)),e.commands.add("splitTableCellVertically",new ot(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new ot(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Mo(e)),e.commands.add("mergeTableCellRight",new ee(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new ee(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new ee(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new ee(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new _o(e)),e.commands.add("setTableRowHeader",new To(e)),e.commands.add("selectTableRow",new Uo(e)),e.commands.add("selectTableColumn",new $o(e)),jo(t),Yo(t),this.listenTo(t.document,"change:data",()=>{nl(t,e.editing),ol(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}_addPlainTableOutputConverters(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:io(e),converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:so(e),converterPriority:"high"}),e.plugins.has("TableProperties")&&ao(e)}}function ct(i){return e=>{const t=parseInt(e.getAttribute(i));return Number.isNaN(t)||t<=0?null:t}}class dt extends O{items;keystrokes;focusTracker;constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new pe,this.focusTracker=new Ce,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(n,o)=>`${o} × ${n}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(n=>{n.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(n,o)=>{const{row:l,column:s}=o.target.dataset;this.items.get((parseInt(l,10)-1)*10+(parseInt(s,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(n,o,l)=>{if(!l)return;const{row:s,column:r}=l.dataset;this.set({rows:parseInt(s),columns:parseInt(r)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Wn({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((n,o)=>{const l=Math.floor(o/10),s=o%10,r=l<e&&s<t;n.set("isOn",r)})}_createGridButton(e,t,n,o){const l=new E(e);return l.set({label:o,class:"ck-insert-table-dropdown-grid-box"}),l.extendTemplate({attributes:{"data-row":t,"data-column":n}}),l}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const n=Math.floor(t/10),o=t%10,l=`${n+1} × ${o+1}`;e.push(this._createGridButton(this.locale,n+1,o+1,l))}return this.createCollection(e)}}class il extends y{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t,o=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",l=>{const s=e.commands.get("insertTable"),r=oe(l);r.bind("isEnabled").to(s),r.buttonView.set({icon:qe,label:t("Insert table"),tooltip:!0});let a;return r.on("change:isOpen",()=>{a||(a=new dt(l),r.panelView.children.add(a),a.delegate("execute").to(r),r.on("execute",()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()}))}),r}),e.ui.componentFactory.add("menuBar:insertTable",l=>{const s=e.commands.get("insertTable"),r=new Vn(l),a=new dt(l);return a.delegate("execute").to(r),r.on("change:isOpen",(c,d,u)=>{u||a.reset()}),a.on("execute",()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()}),r.buttonView.set({label:t("Table"),icon:qe}),r.panelView.children.add(a),r.bind("isEnabled").to(s),r}),e.ui.componentFactory.add("tableColumn",l=>{const s=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),bn,s,l)}),e.ui.componentFactory.add("tableRow",l=>{const s=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),fn,s,l)}),e.ui.componentFactory.add("mergeTableCells",l=>{const s=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),pn,s,l)})}_prepareDropdown(e,t,n,o){const l=this.editor,s=oe(o),r=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(r,"isEnabled",(...a)=>a.some(c=>c)),this.listenTo(s,"execute",a=>{l.execute(a.source.commandName),a.source instanceof En||l.editing.view.focus()}),s}_prepareMergeSplitButtonDropdown(e,t,n,o){const l=this.editor,s=oe(o,Ln),r="mergeTableCells",a=l.commands.get(r),c=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([a,...c],"isEnabled",(...d)=>d.some(u=>u)),this.listenTo(s.buttonView,"execute",()=>{l.execute(r),l.editing.view.focus()}),this.listenTo(s,"execute",d=>{l.execute(d.source.commandName),l.editing.view.focus()}),s}_fillDropdownWithListOptions(e,t){const n=this.editor,o=[],l=new yt;for(const s of t)sl(s,n,o,l);return Ne(e,l),o}}function sl(i,e,t,n){if(i.type==="button"||i.type==="switchbutton"){const o=i.model=new Rt(i.model),{commandName:l,bindIsOn:s}=i.model,r=e.commands.get(l);t.push(r),o.set({commandName:l}),o.bind("isEnabled").to(r),s&&o.bind("isOn").to(r,"value"),o.set({withText:!0})}n.add(i)}class N extends y{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[A,A]}init(){const e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,"deleteContent",(o,l)=>this._handleDeleteContent(o,l),{priority:"high"}),this.listenTo(n.document,"insertText",(o,l)=>this._handleInsertTextEvent(o,l),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(A),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return n.length==0?null:n}getSelectionAsFragment(){const e=this.editor.plugins.get(A),t=this.getSelectedTableCells();return t?this.editor.model.change(n=>{const o=n.createDocumentFragment(),{first:l,last:s}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),c=t[0].findAncestor("table");let d=a,u=s;if(e.isSelectionRectangular(t)){const g={firstColumn:l,lastColumn:s,firstRow:r,lastRow:a};d=Mt(c,g),u=zt(c,g)}const h=Wt(c,{startRow:r,startColumn:l,endRow:d,endColumn:u},n);return n.insert(h,o,0),o}):null}setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change(o=>{o.setSelection(n.cells.map(l=>o.createRangeOn(l)),{backward:n.backward})})}getFocusCell(){const n=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return n&&n.is("element","tableCell")?n:null}getAnchorCell(){const e=this.editor.model.document.selection,n=fe(e.getRanges()).getContainedElement();return n&&n.is("element","tableCell")?n:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(o=>o.on("selection",(l,s,r)=>{const a=r.writer;n(a);const c=this.getSelectedTableCells();if(!c)return;for(const u of c){const m=r.mapper.toViewElement(u);a.addClass("ck-editor__editable_selected",m),t.add(m)}const d=r.mapper.toViewElement(c[c.length-1]);a.setSelection(d,0)},{priority:"lowest"}));function n(o){for(const l of t)o.removeClass("ck-editor__editable_selected",l);t.clear()}}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(n=>{const o=n.createPositionAt(t[0],0),l=e.model.schema.getNearestSelectionRange(o);n.setSelection(l)})}})}_handleDeleteContent(e,t){const n=this.editor.plugins.get(A),o=t[0],l=t[1],s=this.editor.model,r=!l||l.direction=="backward",a=n.getSelectedTableCells(o);a.length&&(e.stop(),s.change(c=>{const d=a[r?a.length-1:0];s.change(m=>{for(const h of a)s.deleteContent(m.createSelection(h,"in"))});const u=s.schema.getNearestSelectionRange(c.createPositionAt(d,0));o.is("documentSelection")?c.setSelection(u):o.setTo(u)}))}_handleInsertTextEvent(e,t){const n=this.editor,o=this.getSelectedTableCells();if(!o)return;const l=n.editing.view,s=n.editing.mapper,r=o.map(a=>l.createRangeOn(s.toViewElement(a)));t.selection=l.createSelection(r),t.preventDefault()}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),o=n.getCellLocation(e),l=n.getCellLocation(t),s=Math.min(o.row,l.row),r=Math.max(o.row,l.row),a=Math.min(o.column,l.column),c=parseInt(t.getAttribute("colspan")||"1")-1,d=Math.max(o.column,l.column+c),u=new Array(r-s+1).fill(null).map(()=>[]),m={startRow:s,endRow:r,startColumn:a,endColumn:d};for(const{row:b,cell:f}of new w(e.findAncestor("table"),m))u[b-s].push(f);const h=l.row<o.row,g=l.column<o.column;return h&&u.reverse(),g&&u.forEach(b=>b.reverse()),{cells:u.flat(),backward:h||g}}}class rl extends y{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[_e,Xe,N,A]}init(){const t=this.editor.editing.view.document;this.listenTo(t,"copy",(n,o)=>this._onCopyCut(n,o)),this.listenTo(t,"cut",(n,o)=>this._onCopyCut(n,o)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell")}_listenToContentInsertion(){const{editor:e}=this,t=e.plugins.get(Xe),n=e.plugins.get(N);let o=!1;t.on("contentInsertion",(l,s)=>{o=s.method==="paste"}),this.listenTo(e.model,"insertContent",(l,[s,r])=>{(o||n.getSelectedTableCells()!==null)&&this._onInsertContent(l,s,r)},{priority:"high"}),t.on("contentInsertion",()=>{o=!1},{priority:"lowest"})}_onCopyCut(e,t){const n=this.editor.editing.view,o=this.editor.plugins.get(N),l=this.editor.plugins.get(_e);o.getSelectedTableCells()&&(e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name==="cut"},()=>{const s=l._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>o.getSelectionAsFragment());n.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(s),method:e.name})})))}_onInsertContent(e,t,n){if(n&&!n.is("documentSelection"))return;const o=this.editor.model,l=this.editor.plugins.get(A),s=this.editor.plugins.get(_e),r=this.getTableIfOnlyTableInContent(t,o);if(!r)return;const a=l.getSelectionAffectedTableCells(o.document.selection);if(!a.length){Me(r,l);return}e.stop(),t.is("documentFragment")?s._pasteMarkersIntoTransformedElement(t.markers,c=>this._replaceSelectedCells(r,a,c)):this.editor.model.change(c=>{this._replaceSelectedCells(r,a,c)})}_replaceSelectedCells(e,t,n){const o=this.editor.plugins.get(A),l={width:o.getColumns(e),height:o.getRows(e)},s=al(t,l,n,o),r=s.lastRow-s.firstRow+1,a=s.lastColumn-s.firstColumn+1,c={startRow:0,startColumn:0,endRow:Math.min(r,l.height)-1,endColumn:Math.min(a,l.width)-1};e=Wt(e,c,n);const d=t[0].findAncestor("table"),u=this._replaceSelectedCellsWithPasted(e,l,d,s,n);if(this.editor.plugins.get("TableSelection").isEnabled){const m=o.sortRanges(u.map(h=>n.createRangeOn(h)));n.setSelection(m)}else n.setSelection(u[0],0);return d}_replaceSelectedCellsWithPasted(e,t,n,o,l){const{width:s,height:r}=t,a=dl(e,s,r),c=[...new w(n,{startRow:o.firstRow,endRow:o.lastRow,startColumn:o.firstColumn,endColumn:o.lastColumn,includeAllSlots:!0})],d=[];let u;for(const f of c){const{row:p,column:C}=f;C===o.firstColumn&&(u=f.getPositionBefore());const T=p-o.firstRow,x=C-o.firstColumn,V=a[T%r][x%s],G=V?l.cloneElement(V):null,$=this._replaceTableSlotCell(f,G,u,l);$&&(Ot($,p,C,o.lastRow,o.lastColumn,l),d.push($),u=l.createPositionAfter($))}const m=parseInt(n.getAttribute("headingRows")||"0"),h=parseInt(n.getAttribute("headingColumns")||"0"),g=o.firstRow<m&&m<=o.lastRow,b=o.firstColumn<h&&h<=o.lastColumn;if(g){const f={first:o.firstColumn,last:o.lastColumn},p=Ve(n,m,f,l,o.firstRow);d.push(...p)}if(b){const f={first:o.firstRow,last:o.lastRow},p=Ee(n,h,f,l);d.push(...p)}return d}_replaceTableSlotCell(e,t,n,o){const{cell:l,isAnchor:s}=e;return s&&o.remove(l),t?(o.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);const n=t.createRangeIn(e);for(const o of n.getItems())if(o.is("element","table")){const l=t.createRange(n.start,t.createPositionBefore(o));if(t.hasContent(l,{ignoreWhitespaces:!0}))return null;const s=t.createRange(t.createPositionAfter(o),n.end);return t.hasContent(s,{ignoreWhitespaces:!0})?null:o}return null}}function al(i,e,t,n){const o=i[0].findAncestor("table"),l=n.getColumnIndexes(i),s=n.getRowIndexes(i),r={firstColumn:l.first,lastColumn:l.last,firstRow:s.first,lastRow:s.last},a=i.length===1;return a&&(r.lastRow+=e.height-1,r.lastColumn+=e.width-1,cl(o,r.lastRow+1,r.lastColumn+1,n)),a||!n.isSelectionRectangular(i)?ul(o,r,t):(r.lastRow=Mt(o,r),r.lastColumn=zt(o,r)),r}function cl(i,e,t,n){const o=n.getColumns(i),l=n.getRows(i);t>o&&n.insertColumns(i,{at:o,columns:t-o}),e>l&&n.insertRows(i,{at:l,rows:e-l})}function dl(i,e,t){const n=new Array(t).fill(null).map(()=>new Array(e).fill(null));for(const{column:o,row:l,cell:s}of new w(i))n[l][o]=s;return n}function ul(i,e,t){const{firstRow:n,lastRow:o,firstColumn:l,lastColumn:s}=e,r={first:n,last:o},a={first:l,last:s};Ee(i,l,r,t),Ee(i,s+1,r,t),Ve(i,n,a,t),Ve(i,o+1,a,t,n)}function Ve(i,e,t,n,o=0){return e<1?void 0:Bt(i,e,o).filter(({column:r,cellWidth:a})=>Kt(r,a,t)).map(({cell:r})=>Nt(r,e,n))}function Ee(i,e,t,n){return e<1?void 0:Dt(i,e).filter(({row:s,cellHeight:r})=>Kt(s,r,t)).map(({cell:s,column:r})=>Ft(s,r,e,n))}function Kt(i,e,t){const n=i+e-1,{first:o,last:l}=t,s=i>=o&&i<=l,r=i<o&&n>=o;return s||r}class ml extends y{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[N,A]}init(){const e=this.editor,n=e.editing.view.document,o=e.t;this.listenTo(n,"arrowKey",(...l)=>this._onArrowKey(...l),{context:"table"}),this.listenTo(n,"tab",(...l)=>this._handleTabOnSelectedTable(...l),{context:"figure"}),this.listenTo(n,"tab",(...l)=>this._handleTab(...l),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:o("Keystrokes that can be used in a table cell"),keystrokes:[{label:o("Move the selection to the next cell"),keystroke:"Tab"},{label:o("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:o("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:o("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const l=this.editor.model.document.selection.getSelectedElement();!l||!l.is("element","table")||t.stopPropagation()}_handleTab(e,t){const n=this.editor,o=this.editor.plugins.get(A),l=this.editor.plugins.get("TableSelection"),s=n.model.document.selection,r=!t.shiftKey;let a=o.getTableCellsContainingSelection(s)[0];if(a||(a=l.getFocusCell()),!a)return;t.stopPropagation();const c=a.parent,d=c.parent,u=d.getChildIndex(c),h=c.getChildIndex(a)===c.childCount-1,g=u===o.getRows(d)-1;r&&g&&h&&n.execute("insertTableRowBelow")}_onArrowKey(e,t){const n=this.editor,o=t.keyCode,l=mn(o,n.locale.contentLanguageDirection);this._handleArrowKeys(l,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const n=this.editor.plugins.get(A),o=this.editor.plugins.get("TableSelection"),l=this.editor.model,s=l.document.selection,r=["right","down"].includes(e),a=n.getSelectedTableCells(s);if(a.length){let d;return t?d=o.getFocusCell():d=r?a[a.length-1]:a[0],this._navigateFromCellInDirection(d,e,t),!0}const c=s.focus.findAncestor("tableCell");if(!c)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==r&&!s.containsEntireContent(c))return!1}else{const d=s.getSelectedElement();if(!d||!l.schema.isObject(d))return!1}return this._isSelectionAtCellEdge(s,c,r)?(this._navigateFromCellInDirection(c,e,t),!0):!1}_isSelectionAtCellEdge(e,t,n){const o=this.editor.model,l=this.editor.model.schema,s=n?e.getLastPosition():e.getFirstPosition();if(!l.getLimitElement(s).is("element","tableCell"))return o.createPositionAt(t,n?"end":0).isTouching(s);const r=o.createSelection(s);return o.modifySelection(r,{direction:n?"forward":"backward"}),s.isEqual(r.focus)}_navigateFromCellInDirection(e,t,n=!1){const o=this.editor.model,l=e.findAncestor("table"),s=[...new w(l,{includeAllSlots:!0})],{row:r,column:a}=s[s.length-1],c=s.find(({cell:C})=>C==e);let{row:d,column:u}=c;switch(t){case"left":u--;break;case"up":d--;break;case"right":u+=c.cellWidth;break;case"down":d+=c.cellHeight;break}const m=d<0||d>r,h=u<0&&d<=0,g=u>a&&d>=r;if(m||h||g){o.change(C=>{C.setSelection(C.createRangeOn(l))});return}u<0?(u=n?0:a,d--):u>a&&(u=n?a:0,d++);const b=s.find(C=>C.row==d&&C.column==u).cell,f=["right","down"].includes(t),p=this.editor.plugins.get("TableSelection");if(n&&p.isEnabled){const C=p.getAnchorCell()||e;p.setCellSelection(C,b)}else{const C=o.createPositionAt(b,f?0:"end");o.change(T=>{T.setSelection(C)})}}}class qt extends zn{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}}class hl extends y{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[N,A]}init(){this.editor.editing.view.addObserver(qt),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(A);let n=!1;const o=e.plugins.get(N);this.listenTo(e.editing.view.document,"mousedown",(l,s)=>{const r=e.model.document.selection;if(!this.isEnabled||!o.isEnabled||!s.domEvent.shiftKey)return;const a=o.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const c=this._getModelTableCellFromDomEvent(s);c&&ut(a,c)&&(n=!0,o.setCellSelection(a,c),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1}),this.listenTo(e.editing.view.document,"selectionChange",l=>{n&&l.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,o=!1,l=!1;const s=e.plugins.get(N);this.listenTo(e.editing.view.document,"mousedown",(r,a)=>{!this.isEnabled||!s.isEnabled||a.domEvent.shiftKey||a.domEvent.ctrlKey||a.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(a))}),this.listenTo(e.editing.view.document,"mousemove",(r,a)=>{if(!a.domEvent.buttons||!t)return;const c=this._getModelTableCellFromDomEvent(a);c&&ut(t,c)&&(n=c,!o&&n!=t&&(o=!0)),o&&(l=!0,s.setCellSelection(t,n),a.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{o=!1,l=!1,t=null,n=null}),this.listenTo(e.editing.view.document,"selectionChange",r=>{l&&r.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function ut(i,e){return i.parent.parent==e.parent.parent}class _i extends y{static get requires(){return[Y,il,N,hl,ml,rl,cn]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}function me(i){const e=Xt(i);return e||Te(i)}function Xt(i){const e=i.getSelectedElement();return e&&Jt(e)?e:null}function Te(i){const e=i.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&Jt(t))return t;t=t.parent}return null}function Jt(i){return i.is("element")&&!!i.getCustomProperty("table")&&dn(i)}class yi extends y{static get requires(){return[Ge]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.t,n=e.plugins.get(Ge),o=e.config.get("table.contentToolbar"),l=e.config.get("table.tableToolbar");o&&n.register("tableContent",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:Te}),l&&n.register("table",{ariaLabel:t("Table toolbar"),items:l,getRelatedElement:Xt})}}class gl extends O{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new Ce,this._focusables=new De,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new pe,this._stillTyping=!1,this.focusCycler=new Fe({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(n,o,l)=>this._setInputValue(l))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,n=this.bindTemplate,o=this._createColorSelector(e),l=oe(e),s=new O;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:n.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",n.if("value","ck-hidden",r=>r!="")]}}]}),l.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),l.buttonView.children.add(s),l.buttonView.label=t("Color picker"),l.buttonView.tooltip=!0,l.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",l.panelView.children.add(o),l.bind("isEnabled").to(this,"isReadOnly",r=>!r),l.on("change:isOpen",(r,a,c)=>{c&&(o.updateSelectedColors(),o.showColorGridsFragment())}),l}_createInputTextView(){const e=this.locale,t=new Bn(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const n=t.element.value,o=this.options.colorDefinitions.find(l=>n===l.label);this._stillTyping=!0,this.value=o&&o.color||n}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,n=this.options.defaultColorValue||"",o=t(n?"Restore default":"Remove color"),l=new Nn(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:o,colorPickerLabel:t("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig===!1?!1:{...this.options.colorPickerConfig,hideInput:!0}});l.appendUI(),l.on("execute",(r,a)=>{if(a.source==="colorPickerSaveButton"){this.dropdownView.isOpen=!1;return}this.value=a.value||n,this.fire("input"),a.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)});let s=this.value;return l.on("colorPicker:cancel",()=>{this.value=s,this.fire("input"),this.dropdownView.isOpen=!1}),l.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{s=this.value}),l.bind("selectedColor").to(this,"value"),l}_setInputValue(e){if(!this._stillTyping){const t=mt(e),n=this.options.colorDefinitions.find(o=>t===mt(o.color));n?this.inputView.value=n.label:this.inputView.value=e||""}}}function mt(i){return i.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const $e=i=>i==="";function je(i){return{none:i("None"),solid:i("Solid"),dotted:i("Dotted"),dashed:i("Dashed"),double:i("Double"),groove:i("Groove"),ridge:i("Ridge"),inset:i("Inset"),outset:i("Outset")}}function Zt(i){return i('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Yt(i){return i('The value is invalid. Try "10px" or "2em" or simply "2".')}function he(i){return i=i.trim().toLowerCase(),$e(i)||Hn(i)}function q(i){return i=i.trim(),$e(i)||tn(i)||Et(i)||Un(i)}function Qt(i){return i=i.trim(),$e(i)||tn(i)||Et(i)}function en(i,e){const t=new yt,n=je(i.t);for(const o in n){const l={type:"button",model:new Rt({_borderStyleValue:o,label:n[o],role:"menuitemradio",withText:!0})};o==="none"?l.model.bind("isOn").to(i,"borderStyle",s=>e==="none"?!s:s===o):l.model.bind("isOn").to(i,"borderStyle",s=>s===o),t.add(l)}return t}function Le(i){const{view:e,icons:t,toolbar:n,labels:o,propertyName:l,nameToValue:s,defaultValue:r}=i;for(const a in o){const c=new E(e.locale);c.set({role:"radio",isToggleable:!0,label:o[a],icon:t[a],tooltip:o[a]});const d=s?s(a):a;c.bind("isOn").to(e,l,u=>{let m=u;return u===""&&r&&(m=r),d===m}),c.on("execute",()=>{!r&&d&&e[l]===d?e[l]=void 0:e[l]=d}),n.items.add(c)}}const ge=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function be(i){return(e,t,n)=>{const o=new gl(e.locale,{colorDefinitions:bl(i.colorConfig),columns:i.columns,defaultColorValue:i.defaultColorValue,colorPickerConfig:i.colorPickerConfig});return o.inputView.set({id:t,ariaDescribedById:n}),o.bind("isReadOnly").to(e,"isEnabled",l=>!l),o.bind("hasError").to(e,"errorText",l=>!!l),o.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused").to(o),o}}function tn(i){const e=parseFloat(i);return!Number.isNaN(e)&&i===String(e)}function bl(i){return i.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))}class fl extends O{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:o,borderColorInput:l,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:m}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:g,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new Ce,this.keystrokes=new pe,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=o,this.borderColorInput=l,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=g;const{saveButtonView:f,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=p,this._focusables=new De,this._focusCycler=new Fe({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new It(e,{label:this.t("Cell properties")})),this.children.add(new I(e,{labelView:s,children:[s,n,l,o],class:"ck-table-form__border-row"})),this.children.add(new I(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})),this.children.add(new I(e,{children:[new I(e,{labelView:m,children:[m,c,d,u],class:"ck-table-form__dimensions-row"}),new I(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new I(e,{labelView:b,children:[b,h,g],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new I(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),kt({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=be({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),o=this.locale,l=this.t,s=l("Style"),r=new W(o);r.text=l("Border");const a=je(l),c=new k(o,xt);c.set({label:s,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>a[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),Ne(c.fieldView,en(this,t.style),{role:"menu",ariaLabel:s});const d=new k(o,F);d.set({label:l("Width"),class:"ck-table-form__border-width"}),d.fieldView.bind("value").to(this,"borderWidth"),d.bind("isEnabled").to(this,"borderStyle",te),d.fieldView.on("input",()=>{this.borderWidth=d.fieldView.element.value});const u=new k(o,n);return u.set({label:l("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",te),u.fieldView.on("input",()=>{this.borderColor=u.fieldView.value}),this.on("change:borderStyle",(m,h,g,b)=>{te(g)||(this.borderColor="",this.borderWidth=""),te(b)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:d}}_createBackgroundFields(){const e=this.locale,t=this.t,n=new W(e);n.text=t("Background");const o=be({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new k(e,o);return l.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:n,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,n=new W(e);n.text=t("Dimensions");const o=new k(e,F);o.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),o.fieldView.bind("value").to(this,"width"),o.fieldView.on("input",()=>{this.width=o.fieldView.element.value});const l=new O(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new k(e,F);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",()=>{this.height=s.fieldView.element.value}),{dimensionsLabel:n,widthInput:o,operatorLabel:l,heightInput:s}}_createPaddingField(){const e=this.locale,t=this.t,n=new k(e,F);return n.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),n.fieldView.bind("value").to(this,"padding"),n.fieldView.on("input",()=>{this.padding=n.fieldView.element.value}),n}_createAlignmentFields(){const e=this.locale,t=this.t,n=new W(e),o={left:Pn,center:xn,right:kn,justify:In,top:Rn,middle:Sn,bottom:vn};n.text=t("Table cell text alignment");const l=new Ae(e),s=e.contentLanguageDirection==="rtl";l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),Le({view:this,icons:o,toolbar:l,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:a=>{if(s){if(a==="left")return"right";if(a==="right")return"left"}return a},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new Ae(e);return r.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),Le({view:this,icons:o,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:l,verticalAlignmentToolbar:r,alignmentLabel:n}}_createActionButtons(){const e=this.locale,t=this.t,n=new E(e),o=new E(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:t("Save"),icon:At,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(l,"errorText",(...s)=>s.every(r=>!r)),o.set({label:t("Cancel"),icon:vt,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:o}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,n=t("Align cell text to the left"),o=t("Align cell text to the center"),l=t("Align cell text to the right"),s=t("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:l,center:o,left:n,justify:s}:{left:n,center:o,right:l,justify:s}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function te(i){return i!=="none"}const We=[D.defaultPositions.northArrowSouth,D.defaultPositions.northArrowSouthWest,D.defaultPositions.northArrowSouthEast,D.defaultPositions.southArrowNorth,D.defaultPositions.southArrowNorthWest,D.defaultPositions.southArrowNorthEast,D.defaultPositions.viewportStickyNorth];function nn(i,e){const t=i.plugins.get("ContextualBalloon"),n=i.editing.view.document.selection;let o;e==="cell"?Te(n)&&(o=ln(i)):me(n)&&(o=on(i)),o&&t.updatePosition(o)}function on(i){const e=i.model.document.selection,t=B(e),n=i.editing.mapper.toViewElement(t);return{target:i.editing.view.domConverter.mapViewToDom(n),positions:We}}function ln(i){const e=i.editing.mapper,t=i.editing.view.domConverter,n=i.model.document.selection;if(n.rangeCount>1)return{target:()=>pl(n.getRanges(),i),positions:We};const o=sn(n.getFirstPosition()),l=e.toViewElement(o);return{target:t.mapViewToDom(l),positions:We}}function sn(i){return i.nodeAfter&&i.nodeAfter.is("element","tableCell")?i.nodeAfter:i.findAncestor("tableCell")}function pl(i,e){const t=e.editing.mapper,n=e.editing.view.domConverter,o=Array.from(i).map(l=>{const s=sn(l.start),r=t.toViewElement(s);return new ae(n.mapViewToDom(r))});return ae.getBoundingRect(o)}const Cl=500,ht={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class wl extends y{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[ce]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:ge,backgroundColors:ge})}init(){const e=this.editor,t=e.t;this._defaultContentTableCellProperties=He(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._defaultLayoutTableCellProperties=we(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._balloon=e.plugins.get(ce),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",n=>{const o=new E(n);o.set({label:t("Cell properties"),icon:wn,tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const l=Object.values(ht).map(s=>e.commands.get(s));return o.bind("isEnabled").toMany(l,"isEnabled",(...s)=>s.some(r=>r)),o})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,n=t.config.get("table.tableCellProperties"),o=de(n.borderColors),l=ue(t.locale,o),s=de(n.backgroundColors),r=ue(t.locale,s),a=n.colorPicker!==!1,c=new fl(t.locale,{borderColors:l,backgroundColors:r,defaultTableCellProperties:e,colorPickerConfig:a?n.colorPicker||{}:!1}),d=t.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),c.keystrokes.set("Esc",(h,g)=>{this._hideView(),g()}),St({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const u=Zt(d),m=Yt(d);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableCellBorderColor",errorText:u,validator:he})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableCellBorderWidth",errorText:m,validator:Qt})),c.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:c.paddingInput,commandName:"tableCellPadding",errorText:m,validator:q})),c.on("change:width",this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:"tableCellWidth",errorText:m,validator:q})),c.on("change:height",this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:"tableCellHeight",errorText:m,validator:q})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableCellBackgroundColor",errorText:u,validator:he})),c.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),c.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),c}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(ht).map(([n,o])=>{const l=n,s=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[l]||"":this._defaultLayoutTableCellProperties[l]||"";return[n,e.get(o).value||s]}).forEach(([n,o])=>{(n==="borderColor"||n==="borderWidth")&&t.value==="none"||this.view.set(n,o)}),this._isReady=!0}_showView(){const e=this.editor,t=me(e.editing.view.document.selection),n=t&&e.editing.mapper.toModelElement(t),o=!n||n.getAttribute("tableType")!=="layout";o&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):!o&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=o?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ln(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor,t=e.editing.view.document;Te(t.selection)?this._isViewVisible&&nn(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,o)=>{this._isReady&&this.editor.execute(e,{value:o,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:n,validator:o,errorText:l}=e,s=Lt(()=>{n.errorText=l},Cl);return(r,a,c)=>{s.cancel(),this._isReady&&(o(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),n.errorText=null):s())}}}class L extends S{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,n){switch(super(e),this.attributeName=t,this._defaultContentTableValue=n,t){case"tableCellBorderStyle":this._defaultLayoutTableValue="none";break;case"tableCellHorizontalAlignment":this._defaultLayoutTableValue="left";break;case"tableCellVerticalAlignment":this._defaultLayoutTableValue="middle";break;default:this._defaultLayoutTableValue=void 0}}refresh(){const t=this.editor.model.document.selection,o=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t),l=B(t);this._defaultValue=!l||l.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!o.length,this.value=this._getSingleValue(o)}execute(e={}){const{value:t,batch:n}=e,o=this.editor.model,s=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(o.document.selection),r=this._getValueToSet(t);o.enqueueChange(n,a=>{r?s.forEach(c=>a.setAttribute(this.attributeName,r,c)):s.forEach(c=>a.removeAttribute(this.attributeName,c))})}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(o=>this._getAttribute(o)===t)?t:void 0}}class Tl extends L{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if(e=H(e,"px"),e!==this._defaultValue)return e}}class rn extends y{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Y]}init(){const e=this.editor,t=He(e.config.get("table.tableCellProperties.defaultProperties"));se(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:t.width}),e.commands.add("tableCellWidth",new Tl(e,t.width))}}class _l extends L{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class yl extends L{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class Al extends L{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class vl extends L{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class Sl extends L{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class Rl extends L{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class Il extends L{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class kl extends L{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}const gt=/^(top|middle|bottom)$/,bt=/^(left|center|right|justify)$/;class xl extends y{static get pluginName(){return"TableCellPropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[Y,rn]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const o=He(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"});e.data.addStyleProcessorRules(Pt),Pl(e,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),e.commands.add("tableCellBorderStyle",new Rl(e,o.borderStyle)),e.commands.add("tableCellBorderColor",new Il(e,o.borderColor)),e.commands.add("tableCellBorderWidth",new kl(e,o.borderWidth)),se(t,n,{modelAttribute:"tableCellHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:o.height}),e.commands.add("tableCellHeight",new yl(e,o.height)),e.data.addStyleProcessorRules(On),se(t,n,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:o.padding}),e.commands.add("tableCellPadding",new _l(e,o.padding)),e.data.addStyleProcessorRules(Vt),se(t,n,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:o.backgroundColor}),e.commands.add("tableCellBackgroundColor",new Al(e,o.backgroundColor)),Vl(t,n,o.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new Sl(e,o.horizontalAlignment)),El(t,n,o.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new vl(e,o.verticalAlignment))}}function Pl(i,e){const{conversion:t}=i,{schema:n}=i.model,o={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};n.extend("tableCell",{allowAttributes:Object.values(o)});for(const l of Object.values(o))n.setAttributeProperties(l,{isFormatting:!0});ve(i,"td",o,e),ve(i,"th",o,e),K(t,{modelElement:"tableCell",modelAttribute:o.style,styleName:"border-style"}),K(t,{modelElement:"tableCell",modelAttribute:o.color,styleName:"border-color"}),K(t,{modelElement:"tableCell",modelAttribute:o.width,styleName:"border-width"})}function Vl(i,e,t){i.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),i.setAttributeProperties("tableCellHorizontalAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:n=>({key:"style",value:{"text-align":n}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":bt}},model:{key:"tableCellHorizontalAlignment",value:(n,o,l)=>{const s=P(t,"left",l),r=n.getStyle("text-align");if(r!==s)return r;o.consumable.consume(n,{styles:"text-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:bt}},model:{key:"tableCellHorizontalAlignment",value:(n,o,l)=>{const s=P(t,"left",l),r=n.getAttribute("align");if(r!==s)return r;o.consumable.consume(n,{attributes:"align"})}}})}function El(i,e,t){i.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),i.setAttributeProperties("tableCellVerticalAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:n=>({key:"style",value:{"vertical-align":n}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":gt}},model:{key:"tableCellVerticalAlignment",value:(n,o,l)=>{const s=P(t,"middle",l),r=n.getStyle("vertical-align");if(r!==s)return r;o.consumable.consume(n,{styles:"vertical-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:gt}},model:{key:"tableCellVerticalAlignment",value:(n,o,l)=>{const s=P(t,"middle",l),r=n.getAttribute("valign");if(r!==s)return r;o.consumable.consume(n,{attributes:"valign"})}}})}class Ai extends y{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[xl,wl]}}class Ll extends S{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:n}=this.editor;let{table:o=t.document.selection.getSelectedElement(),columnWidths:l,tableWidth:s}=e;l&&(l=Array.isArray(l)?l:l.split(",")),t.change(r=>{s?r.setAttribute("tableWidth",s,o):r.removeAttribute("tableWidth",o);const a=n.get("TableColumnResizeEditing").getColumnGroupElement(o);if(!l&&!a)return;if(!l)return r.remove(a);const c=Ue(l);if(a)Array.from(a.getChildren()).forEach((d,u)=>r.setAttribute("columnWidth",c[u],d));else{const d=r.createElement("tableColumnGroup");c.forEach(u=>r.appendElement("tableColumn",{columnWidth:u},d)),r.append(d,o)}})}}function Wl(i){return e=>e.on("element:colgroup",(t,n,o)=>{const l=n.modelCursor.findAncestor("table"),s=J(l);if(!s)return;const r=Z(s),a=i.getColumns(l);let c=Lo(s,o.writer);c=Array.from({length:a},(d,u)=>c[u]||"auto"),(c.length!=r.length||c.includes("auto"))&&jt(r,s,Ue(c),o.writer)},{priority:"low"})}function Bl(){return i=>i.on("insert:table",(e,t,n)=>{const o=n.writer,l=t.item,s=n.mapper.toViewElement(l),r=s.is("element","table")?s:Array.from(s.getChildren()).find(c=>c.is("element","table"));J(l)?o.addClass("ck-table-resized",r):o.removeClass("ck-table-resized",r)},{priority:"low"})}function Nl(){return i=>{i.on("element:table",(e,t,n)=>{n.consumable.consume(t.viewItem,{classes:"ck-table-resized"})})}}const ft=gn("px");class Dl extends y{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;_initialMouseEventData=null;static get requires(){return[Y,A]}static get pluginName(){return"TableColumnResizeEditing"}static get licenseFeatureCode(){return"TCR"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(hn()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(t,n,o)=>{const l=o?"removeClass":"addClass";e.editing.view.change(s=>{for(const r of e.editing.view.document.roots)s[l]("ck-column-resize_disabled",e.editing.view.document.getRoot(r.rootName))})})}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:l=>l.is("element","tableColumnGroup"),positionOffset:0});const o=new Ll(e);e.commands.add("resizeTableWidth",o),e.commands.add("resizeColumnWidths",o),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",o,"isEnabled",(l,s,r)=>!l&&s&&r)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return J(e)}getTableColumnElements(e){return Z(e)}getTableColumnsWidths(e){return Eo(e)}_extendSchema(){const e=this.editor.model.schema;e.extend("table",{allowAttributes:["tableWidth"]}),e.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),e.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0}),e.setAttributeProperties("columnWidth",{isFormatting:!0})}_registerPostFixer(){const t=this.editor.model;t.document.registerPostFixer(l=>{let s=!1;for(const r of So(t)){const a=this.getColumnGroupElement(r),c=this.getTableColumnElements(a),d=this.getTableColumnsWidths(a);let u=Ue(d);u=n(u,r,this),!Je(d,u)&&(jt(c,a,u,l),s=!0)}return s});function n(l,s,r){const a=r._tableUtilsPlugin.getColumns(s);if(a-l.length===0)return l;const d=l.map(m=>Number(m.replace("%",""))),u=o(r.editor.model.document.differ,s);for(const m of u){const h=a-d.length;if(h===0)continue;const g=h>0,b=r._tableUtilsPlugin.getCellLocation(m).column;if(g){const f=Ro(s,r.editor),p=xo(h,f);d.splice(b,0,...p)}else{const f=d.splice(b,Math.abs(h));d[b]+=X(f)}}return d.map(m=>m+"%")}function o(l,s){const r=new Set;for(const a of l.getChanges())if(a.type=="insert"&&a.position.nodeAfter&&a.position.nodeAfter.name=="tableCell"&&a.position.nodeAfter.getAncestors().includes(s))r.add(a.position.nodeAfter);else if(a.type=="remove"){const c=a.position.nodeBefore||a.position.nodeAfter;c.name=="tableCell"&&c.getAncestors().includes(s)&&r.add(c)}return r}}_registerConverters(){const t=this.editor.conversion;t.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{key:"tableWidth",value:n=>{if(!n.parent.is("element","figure"))return n.getStyle("width")}}}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:n=>({name:"figure",key:"style",value:{width:n}})}),t.elementToElement({model:"tableColumnGroup",view:"colgroup"}),t.elementToElement({model:"tableColumn",view:"col"}),t.for("downcast").add(Bl()),t.for("upcast").add(Nl()),t.for("upcast").add(Wl(this._tableUtilsPlugin)),t.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:n=>{const o=n.getStyle("width");return!o||!o.endsWith("%")&&!o.endsWith("pt")?"auto":o}}}),t.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),t.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:n=>({key:"style",value:{width:n}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver(qt),e.document.on("mouseover",this._onMouseOverHandler.bind(this),{priority:"high"}),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),e.document.on("mouseout",this._onMouseOutHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(re.window.document,"mousemove",$n(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(re.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){const t=this.editor,n=t.editing.view.domConverter,o=n.mapViewToDom(e.findAncestor("table")),l=n.mapViewToDom(e.findAncestor(d=>["td","th"].includes(d.name))),s=new ae(o),r=new ae(l),a=ft(Number((s.top-r.top).toFixed(4))),c=ft(Number((r.bottom-s.bottom).toFixed(4)));t.editing.view.change(d=>{d.setStyle("top",a,e),d.setStyle("bottom",c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(t=>{t.removeStyle("top",e),t.removeStyle("bottom",e)})}_onMouseOverHandler(e,t){const n=t.target;n.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(n)}_onMouseOutHandler(e,t){const n=t.target;n.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(n))}_onMouseDownHandler(e,t){const n=t.target;if(!n.hasClass("ck-table-column-resizer")||!this._isResizingAllowed)return;const o=this.editor,l=o.editing.mapper.toModelElement(n.findAncestor("figure"));o.model.canEditAt(l)&&(t.preventDefault(),e.stop(),this._initialMouseEventData=t)}_startResizingAfterThreshold(){const e=this._initialMouseEventData,{target:t}=e,n=this.editor.editing.mapper.toModelElement(t.findAncestor("figure")),o=t.findAncestor("table"),l=s(n,this._tableUtilsPlugin,this.editor);Array.from(o.getChildren()).find(c=>c.is("element","colgroup"))||this.editor.editing.view.change(c=>{r(c,l,o)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,l),this.editor.editing.view.change(c=>a(c,o,this._resizingData));function s(c,d,u){const m=Array(d.getColumns(c)),h=new w(c);for(const g of h){const b=u.editing.mapper.toViewElement(g.cell),f=u.editing.view.domConverter.mapViewToDom(b),p=Vo(f);(!m[g.column]||p<m[g.column])&&(m[g.column]=R(p))}return m}function r(c,d,u){const m=c.createContainerElement("colgroup");for(let h=0;h<d.length;h++){const g=c.createEmptyElement("col"),b=`${R(d[h]/X(d)*100)}%`;c.setStyle("width",b,g),c.insert(c.createPositionAt(m,"end"),g)}c.insert(c.createPositionAt(u,0),m)}function a(c,d,u){const m=u.widths.viewFigureWidth/u.widths.viewFigureParentWidth;c.addClass("ck-table-resized",d),c.addClass("ck-table-column-resizer__active",u.elements.viewResizer),c.setStyle("width",`${R(m*100)}%`,d.findAncestor("figure"))}}_onMouseMoveHandler(e,t){if(this._initialMouseEventData){const T=this._initialMouseEventData.domEvent;if(Math.abs(t.clientX-T.clientX)>=vo)this._startResizingAfterThreshold(),this._initialMouseEventData=null;else return}if(!this._isResizingActive)return;if(!this._isResizingAllowed){this._onMouseUpHandler();return}const{columnPosition:n,flags:{isRightEdge:o,isTableCentered:l,isLtrContent:s},elements:{viewFigure:r,viewLeftColumn:a,viewRightColumn:c,viewResizer:d},widths:{viewFigureParentWidth:u,tableWidth:m,leftColumnWidth:h,rightColumnWidth:g}}=this._resizingData,b=-h+ke,f=o?u-m:g-ke,p=(s?1:-1)*(o&&l?2:1),C=ko((t.clientX-n)*p,Math.min(b,0),Math.max(f,0));C!==0&&(this.editor.editing.view.change(T=>{const x=R((h+C)*100/m);if(T.setStyle("width",`${x}%`,a),o){const V=R((m+C)*100/u);T.setStyle("width",`${V}%`,r)}else{const V=R((g-C)*100/m);T.setStyle("width",`${V}%`,c)}}),this._recalculateResizerElement(d))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:n,viewColgroup:o}=this._resizingData.elements,l=this.editor,s=l.editing.view,r=this.getColumnGroupElement(t),a=Array.from(o.getChildren()).filter(f=>f.is("view:element")),c=r?this.getTableColumnsWidths(r):null,d=a.map(f=>f.getStyle("width")),u=!Je(c,d),m=t.getAttribute("tableWidth"),h=n.getStyle("width"),g=m!==h;(u||g)&&(this._isResizingAllowed?l.execute("resizeTableWidth",{table:t,tableWidth:`${R(h)}%`,columnWidths:d}):s.change(f=>{if(c)for(const p of a)f.setStyle("width",c.shift(),p);else f.remove(o);g&&(m?f.setStyle("width",m,n):f.removeStyle("width",n)),!c&&!m&&f.removeClass("ck-table-resized",[...n.getChildren()].find(p=>p.name==="table"))})),s.change(f=>{f.removeClass("ck-table-column-resizer__active",e)}),s.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const n=this.editor,o=e.domEvent.clientX,l=e.target,s=l.findAncestor("td")||l.findAncestor("th"),r=n.editing.mapper.toModelElement(s),a=r.findAncestor("table"),c=Io(r,this._tableUtilsPlugin).rightEdge,d=this._tableUtilsPlugin.getColumns(a)-1,u=c===d,m=!a.hasAttribute("tableAlignment"),h=n.locale.contentLanguageDirection!=="rtl",g=s.findAncestor("table"),b=g.findAncestor("figure"),f=[...g.getChildren()].find(an=>an.is("element","colgroup")),p=f.getChild(c),C=u?void 0:f.getChild(c+1),T=xe(n.editing.view.domConverter.mapViewToDom(b.parent)),x=xe(n.editing.view.domConverter.mapViewToDom(b)),V=$t(a,n),G=t[c],$=u?void 0:t[c+1];return{columnPosition:o,flags:{isRightEdge:u,isTableCentered:m,isLtrContent:h},elements:{viewResizer:l,modelTable:a,viewFigure:b,viewColgroup:f,viewLeftColumn:p,viewRightColumn:C},widths:{viewFigureParentWidth:T,viewFigureWidth:x,tableWidth:V,leftColumnWidth:G,rightColumnWidth:$}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(t,n,o)=>{const l=n.item,s=o.mapper.toViewElement(l),r=o.writer;r.insert(r.createPositionAt(s,"end"),r.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}}class vi extends y{static get requires(){return[Dl,rn]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}class U extends S{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,n){super(e),this.attributeName=t,this._defaultContentTableValue=n,this._defaultLayoutTableValue=t==="tableBorderStyle"?"none":void 0}refresh(){const t=this.editor.model.document.selection,n=B(t);this._defaultValue=!n||n.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!n,this.value=this._getValue(n)}execute(e={}){const t=this.editor.model,n=t.document.selection,{value:o,batch:l}=e,s=B(n),r=this._getValueToSet(o);t.enqueueChange(l,a=>{r?a.setAttribute(this.attributeName,r,s):a.removeAttribute(this.attributeName,s)})}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}}class Fl extends U{constructor(e,t){super(e,"tableBackgroundColor",t)}}class Ol extends U{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class Ml extends U{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class zl extends U{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=z(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class Hl extends U{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if(e=H(e,"px"),e!==this._defaultValue)return e}}class Ul extends U{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if(e=H(e,"px"),e!==this._defaultValue)return e}}class $l extends U{constructor(e,t){super(e,"tableAlignment",t)}}class jl extends y{static get pluginName(){return"TablePropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[Y]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const o=ze(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),l=e.config.get("table.tableProperties.alignment.useInlineStyles")!==!1;if(e.data.addStyleProcessorRules(Mn),e.data.addStyleProcessorRules(Pt),Kl(e,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),e.commands.add("tableBorderColor",new Ol(e,o.borderColor)),e.commands.add("tableBorderStyle",new Ml(e,o.borderStyle)),e.commands.add("tableBorderWidth",new zl(e,o.borderWidth)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")?ql(t,n,o.alignment,l):Xl(t,n,o.alignment),e.commands.add("tableAlignment",new $l(e,o.alignment)),Ct(t,n,{modelAttribute:"tableWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:o.width}),e.commands.add("tableWidth",new Hl(e,o.width)),Ct(t,n,{modelAttribute:"tableHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:o.height}),e.commands.add("tableHeight",new Ul(e,o.height)),e.data.addStyleProcessorRules(Vt),Yl(t,n,{modelAttribute:"tableBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:o.backgroundColor}),e.commands.add("tableBackgroundColor",new Fl(e,o.backgroundColor)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")){const s=e.editing.view.document;this.listenTo(s,"clipboardOutput",(r,a)=>{e.editing.view.change(c=>{for(const{item:d}of c.createRangeIn(a.content))Gl(d,c);a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content))})},{priority:"lowest"})}}}function Gl(i,e){if(!i.is("element","table"))return;const t=i.getAttribute("align"),n=i.getStyle("float"),o=i.getStyle("margin-left"),l=i.getStyle("margin-right");if(t&&t==="center"||n&&n==="right"&&t&&t==="right"){pt(e,t,i);return}n===void 0&&o==="auto"&&l==="0"&&pt(e,"right",i)}function pt(i,e,t){const n=i.createPositionBefore(t),o=i.createContainerElement("div",{align:e},t);i.insert(n,o)}function Kl(i,e){const{conversion:t}=i,{schema:n}=i.model,o={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};n.extend("table",{allowAttributes:Object.values(o)});for(const l of Object.values(o))n.setAttributeProperties(l,{isFormatting:!0});ve(i,"table",o,e),le(t,{modelAttribute:o.color,styleName:"border-color"}),le(t,{modelAttribute:o.style,styleName:"border-style"}),le(t,{modelAttribute:o.width,styleName:"border-width"})}function ql(i,e,t,n){i.extend("table",{allowAttributes:["tableAlignment"]}),i.setAttributeProperties("tableAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right","blockLeft","blockRight"]},view:{left:n?{key:"style",value:{float:"left","margin-right":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:v.left.className},right:n?{key:"style",value:{float:"right","margin-left":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:v.right.className},center:n?{key:"style",value:{"margin-left":"auto","margin-right":"auto"}}:{key:"class",value:v.center.className},blockLeft:n?{key:"style",value:{"margin-left":"0","margin-right":"auto"}}:{key:"class",value:v.blockLeft.className},blockRight:n?{key:"style",value:{"margin-left":"auto","margin-right":"0"}}:{key:"class",value:v.blockRight.className}},converterPriority:"high"}),qn.forEach(o=>{e.for("upcast").attributeToAttribute({view:o.view,model:{key:"tableAlignment",value:(l,s,r)=>{if(Ql(l))return;const a=P(t,"",r),c=o.getAlign(l),d=o.getConsumables(l);if(s.consumable.consume(l,d),c!==a)return c}}})}),e.for("upcast").add(Jl(t))}function Xl(i,e,t){const n=/^(left|center|right)$/,o=/^(left|none|right)$/;i.extend("table",{allowAttributes:["tableAlignment"]}),i.setAttributeProperties("tableAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}},center:(l,s,r)=>({key:"style",value:r.item.getAttribute("tableType")!=="layout"?{float:"none"}:{"margin-left":"auto","margin-right":"auto"}})},converterPriority:"high"}),e.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:o}},model:{key:"tableAlignment",value:(l,s,r)=>{if(l.name=="figure"&&!l.hasClass("table"))return;const a=P(t,"",r);let c=l.getStyle("float");if(c==="none"&&(c="center"),c!==a)return c;s.consumable.consume(l,{styles:"float"})}}}).attributeToAttribute({view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},model:{key:"tableAlignment",value:(l,s,r)=>{if(l.name=="figure"&&!l.hasClass("table"))return;const a=P(t,"",r),c="center";if(c!==a)return c;s.consumable.consume(l,{styles:["margin-left","margin-right"]})}}}).attributeToAttribute({view:{name:"table",attributes:{align:n}},model:{key:"tableAlignment",value:(l,s,r)=>{const a=P(t,"",r),c=l.getAttribute("align");if(c!==a)return c;s.consumable.consume(l,{attributes:"align"})}}})}function Jl(i){return e=>{e.on("element:div",(t,n,o)=>{if(!o.consumable.test(n.viewItem,{name:!0,attributes:"align"}))return;const l=Ht(n.viewItem);if(!l||!o.consumable.test(l,{name:!0}))return;o.consumable.consume(n.viewItem,{name:!0,attributes:"align"});const s=o.convertItem(l,n.modelCursor),r=fe(s.modelRange.getItems());if(!r||!r.is("element","table")){o.consumable.revert(n.viewItem,{name:!0,attributes:"align"}),s.modelRange&&!s.modelRange.isCollapsed&&(n.modelRange=s.modelRange,n.modelCursor=s.modelCursor);return}const a=n.viewItem.getAttribute("align"),c=l.getAttribute("align"),d=P(i,"",n),u=Zl(a,c,d);u&&o.writer.setAttribute("tableAlignment",u,r),o.convertChildren(n.viewItem,o.writer.createPositionAt(r,"end")),o.updateConversionResult(r,n)})}}function Zl(i,e,t){if(i)switch(i){case"right":return e==="right"?"right":e==="left"?"left":"blockRight";case"center":return"center";case"left":return e===void 0?"blockLeft":"left";default:return t}}function Yl(i,e,t){const{modelAttribute:n}=t;i.extend("table",{allowAttributes:[n]}),i.setAttributeProperties(n,{isFormatting:!0}),Oe(e,{viewElement:"table",...t}),le(e,t)}function Ct(i,e,t){const{modelAttribute:n}=t;i.extend("table",{allowAttributes:[n]}),i.setAttributeProperties(n,{isFormatting:!0}),Oe(e,{viewElement:/^(table|figure)$/,shouldUpcast:o=>!(o.name=="table"&&o.parent.name=="figure"||o.name=="figure"&&!o.hasClass("table")),...t}),K(e,{modelElement:"table",...t})}function Ql(i){return i.name=="figure"&&!i.hasClass("table")}class ei extends O{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:o,borderColorInput:l,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:m}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new Ce,this.keystrokes=new pe,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=o,this.borderColorInput=l,this.backgroundInput=a,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=h;const{saveButtonView:b,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=b,this.cancelButtonView=f,this._focusables=new De,this._focusCycler=new Fe({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new It(e,{label:this.t("Table properties")})),this.children.add(new I(e,{labelView:s,children:[s,n,l,o],class:"ck-table-form__border-row"})),this.children.add(new I(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})),this.children.add(new I(e,{children:[new I(e,{labelView:m,children:[m,c,d,u],class:"ck-table-form__dimensions-row"}),new I(e,{labelView:g,children:[g,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new I(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),kt({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=be({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),o=this.locale,l=this.t,s=l("Style"),r=new W(o);r.text=l("Border");const a=je(l),c=new k(o,xt);c.set({label:s,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>a[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),Ne(c.fieldView,en(this,t.style),{role:"menu",ariaLabel:s});const d=new k(o,F);d.set({label:l("Width"),class:"ck-table-form__border-width"}),d.fieldView.bind("value").to(this,"borderWidth"),d.bind("isEnabled").to(this,"borderStyle",ne),d.fieldView.on("input",()=>{this.borderWidth=d.fieldView.element.value});const u=new k(o,n);return u.set({label:l("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",ne),u.fieldView.on("input",()=>{this.borderColor=u.fieldView.value}),this.on("change:borderStyle",(m,h,g,b)=>{ne(g)||(this.borderColor="",this.borderWidth=""),ne(b)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:d}}_createBackgroundFields(){const e=this.locale,t=this.t,n=new W(e);n.text=t("Background");const o=be({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new k(e,o);return l.set({label:t("Color"),class:"ck-table-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:n,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,n=new W(e);n.text=t("Dimensions");const o=new k(e,F);o.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),o.fieldView.bind("value").to(this,"width"),o.fieldView.on("input",()=>{this.width=o.fieldView.element.value});const l=new O(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new k(e,F);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",()=>{this.height=s.fieldView.element.value}),{dimensionsLabel:n,widthInput:o,operatorLabel:l,heightInput:s}}_createAlignmentFields(){const e=this.locale,t=this.t,n=new W(e);n.text=t("Alignment");const o=new Ae(e);return o.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Le({view:this,icons:{left:An,center:yn,right:_n},toolbar:o,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:o}}_createActionButtons(){const e=this.locale,t=this.t,n=new E(e),o=new E(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:t("Save"),icon:At,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(l,"errorText",(...s)=>s.every(r=>!r)),o.set({label:t("Cancel"),icon:vt,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:o}}get _alignmentLabels(){const e=this.locale,t=this.t,n=t("Align table to the left"),o=t("Center table"),l=t("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:l,center:o,left:n}:{left:n,center:o,right:l}}}function ne(i){return i!=="none"}const ti=500,wt={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class ni extends y{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[ce]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:ge,backgroundColors:ge})}init(){const e=this.editor;this._defaultContentTableProperties=ze(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=we(),this._balloon=e.plugins.get(ce),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,t=e.t,n=new E(e.locale);n.set({label:t("Table properties"),icon:Tn,tooltip:!0}),this.listenTo(n,"execute",()=>this._showView());const o=Object.values(wt).map(l=>e.commands.get(l));return n.bind("isEnabled").toMany(o,"isEnabled",(...l)=>l.some(s=>s)),n}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,n=t.config.get("table.tableProperties"),o=de(n.borderColors),l=ue(t.locale,o),s=de(n.backgroundColors),r=ue(t.locale,s),a=n.colorPicker!==!1,c=new ei(t.locale,{borderColors:l,backgroundColors:r,defaultTableProperties:e,colorPickerConfig:a?n.colorPicker||{}:!1}),d=t.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),c.keystrokes.set("Esc",(h,g)=>{this._hideView(),g()}),St({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const u=Zt(d),m=Yt(d);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableBorderColor",errorText:u,validator:he})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableBorderWidth",errorText:m,validator:Qt})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableBackgroundColor",errorText:u,validator:he})),c.on("change:width",this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:"tableWidth",errorText:m,validator:q})),c.on("change:height",this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:"tableHeight",errorText:m,validator:q})),c.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),c}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(wt).map(([n,o])=>{const l=n,s=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[l]||"":this._defaultLayoutTableProperties[l]||"";return[l,e.get(o).value||s]}).forEach(([n,o])=>{(n==="borderColor"||n==="borderWidth")&&t.value==="none"||this.view.set(n,o)}),this._isReady=!0}_showView(){const e=this.editor,t=me(e.editing.view.document.selection),n=t&&e.editing.mapper.toModelElement(t),o=!n||n.getAttribute("tableType")!=="layout";o&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):!o&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=o?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:on(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor,t=e.editing.view.document;me(t.selection)?this._isViewVisible&&nn(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,o)=>{this._isReady&&this.editor.execute(e,{value:o,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:n,validator:o,errorText:l}=e,s=Lt(()=>{n.errorText=l},ti);return(r,a,c)=>{s.cancel(),this._isReady&&(o(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),n.errorText=null):s())}}}class Si extends y{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[jl,ni]}}function oi(i){i.document.registerPostFixer(e=>li(e,i))}function li(i,e){const t=e.document.differ.getChanges();let n=!1;for(const o of t){if(o.type!="insert")continue;const l=o.position.parent;if(l.is("element","table")||o.name=="table"){const s=o.name=="table"?o.position.nodeAfter:l,r=Array.from(s.getChildren()).filter(c=>c.is("element","caption")),a=r.shift();if(!a)continue;for(const c of r)i.move(i.createRangeIn(c),a,"end"),i.remove(c);a.nextSibling&&(i.move(i.createRangeOn(a),s,"end"),n=!0),n=!!r.length||n}}return n}function Tt(i){return!!i&&i.is("element","table")}function Be(i){for(const e of i.getChildren())if(e.is("element","caption"))return e;return null}function ii(i){const e=B(i);return e?Be(e):null}function si(i){const e=i.parent;return i.name=="figcaption"&&e&&e.is("element","figure")&&e.hasClass("table")?{name:!0}:i.name=="caption"&&e&&e.is("element","table")?{name:!0}:null}class ri extends S{refresh(){const e=this.editor,t=B(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,"caption"),this.isEnabled?this.value=!!Be(t):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)})}_showTableCaption(e,t){const n=this.editor.model,o=B(n.document.selection),r=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(o)||e.createElement("caption");n.insertContent(r,o,"end"),t&&e.setSelection(r,"in")}_hideTableCaption(e){const t=this.editor.model,n=B(t.document.selection),o=this.editor.plugins.get("TableCaptionEditing"),l=Be(n);o._saveCaption(n,l),t.deleteContent(e.createSelection(l,"on"))}}class ai extends y{_savedCaptionsMap=new WeakMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.editing.view,o=e.t,l=e.config.get("table.tableCaption.useCaptionElement");t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new ri(this.editor)),l&&e.plugins.get("TableEditing").registerAdditionalSlot({filter:r=>r.is("element","caption"),positionOffset:"end"}),e.conversion.for("upcast").elementToElement({view:si,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(s,{writer:r})=>Tt(s.parent)?r.createContainerElement(l?"caption":"figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(s,{writer:r})=>{if(!Tt(s.parent))return null;const a=r.createEditableElement(l?"caption":"figcaption");return r.setCustomProperty("tableCaption",!0,a),a.placeholder=o("Enter table caption"),Dn({view:n,element:a,keepOnFocus:!0}),_t(a,r)}}),oi(e.model)}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Fn.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class ci extends y{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=e.t;e.ui.componentFactory.add("toggleTableCaption",o=>{const l=e.commands.get("toggleTableCaption"),s=new E(o);return s.set({icon:Cn,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(l,"value","isEnabled"),s.bind("label").to(l,"value",r=>n(r?"Toggle caption off":"Toggle caption on")),this.listenTo(s,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),l.value){const r=ii(e.model.document.selection),a=e.editing.mapper.toViewElement(r);if(!a)return;t.scrollToTheSelection(),t.change(c=>{c.addClass("table__caption_highlighted",a)})}e.editing.view.focus()}),s})}}class Ri extends y{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[ai,ci]}}export{nt as InsertColumnCommand,tt as InsertRowCommand,co as InsertTableCommand,ee as MergeCellCommand,Mo as MergeCellsCommand,po as RemoveColumnCommand,bo as RemoveRowCommand,$o as SelectColumnCommand,Uo as SelectRowCommand,_o as SetHeaderColumnCommand,To as SetHeaderRowCommand,ot as SplitCellCommand,_i as Table,$l as TableAlignmentCommand,Fl as TableBackgroundColorCommand,Ol as TableBorderColorCommand,Ml as TableBorderStyleCommand,zl as TableBorderWidthCommand,Ri as TableCaption,ai as TableCaptionEditing,ci as TableCaptionUI,Al as TableCellBackgroundColorCommand,Il as TableCellBorderColorCommand,Rl as TableCellBorderStyleCommand,kl as TableCellBorderWidthCommand,yl as TableCellHeightCommand,Sl as TableCellHorizontalAlignmentCommand,_l as TableCellPaddingCommand,Ai as TableCellProperties,xl as TableCellPropertiesEditing,wl as TableCellPropertiesUI,fl as TableCellPropertiesView,L as TableCellPropertyCommand,vl as TableCellVerticalAlignmentCommand,Tl as TableCellWidthCommand,rn as TableCellWidthEditing,rl as TableClipboard,vi as TableColumnResize,Dl as TableColumnResizeEditing,Y as TableEditing,Ul as TableHeightCommand,ml as TableKeyboard,hl as TableMouse,Si as TableProperties,jl as TablePropertiesEditing,ni as TablePropertiesUI,ei as TablePropertiesView,U as TablePropertyCommand,N as TableSelection,yi as TableToolbar,il as TableUI,A as TableUtils,w as TableWalker,Hl as TableWidthCommand,Ll as TableWidthsCommand,ri as ToggleTableCaptionCommand,dt as _InsertTableView,yo as _TABLE_COLUMN_MIN_WIDTH_AS_PERCENTAGE,ke as _TABLE_COLUMN_MIN_WIDTH_IN_PIXELS,vo as _TABLE_COLUMN_RESIZE_DISTANCE_THRESHOLD,Ao as _TABLE_COLUMN_WIDTH_PRECISION,ge as _TABLE_DEFAULT_COLORS,gl as _TableColorInputView,qt as _TableMouseEventsObserver,H as _addDefaultUnitToNumericValue,zt as _adjustLastTableColumnIndex,Mt as _adjustLastTableRowIndex,ko as _clamp,he as _colorTableFieldValidator,et as _convertParagraphInTableCell,M as _createEmptyTableCell,xo as _createFilledArray,Wt as _cropTableToDimensions,Ye as _downcastTable,le as _downcastTableAttribute,K as _downcastTableAttributeToStyle,Qe as _downcastTableCell,Bl as _downcastTableResizedClass,no as _downcastTableRow,se as _enableTableCellProperty,Ze as _ensureParagraphInTableCell,Le as _fillTableOrCellToolbar,ln as _getBalloonTableCellPositionData,on as _getBalloonTablePositionData,je as _getBorderTableStyleLabels,So as _getChangedResizedTables,P as _getDefaultTableValueAdjusted,Vo as _getDomTableCellOuterWidth,xe as _getElementWidthInPixels,Dt as _getHorizontallyOverlappingTableCells,be as _getLabeledTableColorInputCreator,Zt as _getLocalizedTableColorErrorText,Yt as _getLocalizedTableLengthErrorText,we as _getNormalizedDefaultTableBaseProperties,He as _getNormalizedDefaultTableCellProperties,ze as _getNormalizedDefaultTableProperties,Xt as _getSelectedTableWidget,B as _getSelectionAffectedTable,me as _getSelectionAffectedTableWidget,z as _getTableBorderBoxSingleValue,Be as _getTableCaptionFromModelElement,ii as _getTableCaptionFromModelSelection,Io as _getTableColumnEdgesIndexes,Z as _getTableColumnElements,J as _getTableColumnGroupElement,Ro as _getTableColumnMinWidthAsPercentage,Eo as _getTableColumnsWidths,en as _getTableOrCellBorderStyleDefinitions,Te as _getTableWidgetAncestor,$t as _getTableWidthInPixels,Bt as _getVerticallyOverlappingTableCells,oi as _injectTableCaptionPostFixer,Yo as _injectTableCellParagraphPostFixer,jo as _injectTableLayoutPostFixer,Ut as _isSingleTableParagraphWithoutAttributes,Se as _isTableHeadingColumnCell,Tt as _isTableModelElement,q as _lengthTableFieldValidator,Qt as _lineWidthTableFieldValidator,si as _matchTableCaptionViewElement,Ue as _normalizeTableColumnWidths,Re as _removeEmptyTableColumns,Ie as _removeEmptyTableRows,Me as _removeEmptyTableRowsColumns,nn as _repositionTableContextualBalloon,Qn as _skipEmptyTableRow,Nt as _splitTableCellHorizontally,Ft as _splitTableCellVertically,X as _sumArray,ol as _tableCellRefreshHandler,nl as _tableHeadingsRefreshHandler,R as _toPrecision,Lo as _translateTableColspanAttribute,Ot as _trimTableCellIfNeeded,Oe as _upcastNormalizedTableStyleToAttribute,Yn as _upcastTable,ve as _upcastTableBorderStyles,Wl as _upcastTableColgroupElement,Zn as _upcastTableFigure,jt as _updateTableColumnElements,_ as _updateTableNumericAttribute};
@@ -1 +1 @@
1
- import{Plugin as k,Command as z}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{keyCodes as y,ObservableMixin as V,env as E,count as Y,isInsideSurrogatePair as J,isInsideCombinedSymbol as X,isInsideEmojiSequence as Z,EventInfo as ee}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{_tryFixingModelRange as $,BubblingEventInfo as D,ViewDocumentDomEventData as S,Observer as W,MouseObserver as te,TouchObserver as ne,ModelLiveRange as ie,FocusObserver as se}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{escapeRegExp as oe}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";import{debounce as re}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/debounce.js";class U{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(n,s)=>{s.isLocal&&s.isUndoable&&s!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}}class ce extends z{_buffer;constructor(e,t){super(e),this._buffer=new U(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,s=e.text||"",i=s.length;let c=n.selection;if(e.selection?c=e.selection:e.range&&(c=t.createSelection(e.range)),!t.canEditAt(c))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const a=Array.from(n.selection.getAttributes());t.deleteContent(c),s&&t.insertContent(l.createText(s,a),c),r?l.setSelection(r):c.is("documentSelection")||l.setSelection(c),this._buffer.unlock(),this._buffer.input(i)})}}const Q=["insertText","insertReplacementText"],le=[...Q,"insertCompositionText"];class ae extends W{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(se);const t=E.isAndroid?le:Q,n=e.document;n.on("beforeinput",(s,i)=>{if(!this.isEnabled)return;const{data:c,targetRanges:r,inputType:l,domEvent:a,isComposing:u}=i;if(!t.includes(l))return;this.focusObserver.flush();const d=new ee(n,"insertText");n.fire(d,new S(e,a,{text:c,selection:e.createSelection(r),isComposing:u})),d.stop.called&&s.stop()}),E.isAndroid||n.on("compositionend",(s,{data:i,domEvent:c})=>{this.isEnabled&&i&&n.fire("insertText",new S(e,c,{text:i,isComposing:!0}))},{priority:"low"})}observe(){}stopObserving(){}}class ue extends k{_typingQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.editing.mapper,i=t.document.selection;this._typingQueue=new de(e),n.addObserver(ae);const c=new ce(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",c),e.commands.add("input",c),this.listenTo(n.document,"beforeinput",()=>{this._typingQueue.flush("next beforeinput")},{priority:"high"}),this.listenTo(n.document,"insertText",(r,l)=>{const{text:a,selection:u}=l;if(n.document.selection.isFake&&u&&n.document.selection.isSimilar(u)&&l.preventDefault(),u&&Array.from(u.getRanges()).some(f=>!f.isCollapsed)&&l.preventDefault(),!c.isEnabled){l.preventDefault();return}let d;u?d=Array.from(u.getRanges()).map(f=>s.toModelRange(f)).map(f=>$(f,t.schema)||f):d=Array.from(i.getRanges());let h=a;if(E.isAndroid){const f=Array.from(d[0].getItems()).reduce((b,v)=>b+(v.is("$textProxy")?v.data:""),"");if(f&&(f.length<=h.length?h.startsWith(f)&&(h=h.substring(f.length),d[0].start=d[0].start.getShiftedBy(f.length)):f.startsWith(h)&&(d[0].start=d[0].start.getShiftedBy(h.length),h="")),h.length==0&&d[0].isCollapsed)return}const g={text:h,selection:t.createSelection(d)};this._typingQueue.push(g,!!l.isComposing),l.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented")}),E.isAndroid?this.listenTo(n.document,"keydown",(r,l)=>{i.isCollapsed||l.keyCode!=229||!n.document.isComposing||F(t,c)}):this.listenTo(n.document,"compositionstart",()=>{i.isCollapsed||F(t,c)},{priority:"high"}),this.listenTo(n.document,"mutations",(r,{mutations:l})=>{if(this._typingQueue.hasAffectedElements())for(const{node:a}of l){const u=he(a,s),d=s.toModelElement(u);if(this._typingQueue.isElementAffected(d)){this._typingQueue.flush("mutations");return}}}),this.listenTo(n.document,"compositionend",()=>{this._typingQueue.flush("before composition end")},{priority:"high"}),this.listenTo(n.document,"compositionend",()=>{this._typingQueue.flush("after composition end");const r=[];if(this._typingQueue.hasAffectedElements())for(const l of this._typingQueue.flushAffectedElements()){const a=s.toViewElement(l);a&&r.push({type:"children",node:a})}(r.length||!E.isAndroid)&&n.document.fire("mutations",{mutations:r})},{priority:"lowest"})}destroy(){super.destroy(),this._typingQueue.destroy()}}class de{editor;flushDebounced=re(()=>this.flush("timeout"),50);_queue=[];_isComposing=!1;_affectedElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e,t){const n={text:e.text};if(e.selection){n.selectionRanges=[];for(const s of e.selection.getRanges())n.selectionRanges.push(ie.fromRange(s)),this._affectedElements.add(s.start.parent)}this._queue.push(n),this._isComposing||=t,this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const n=e.selectionRanges.map(s=>fe(s)).filter(s=>!!s);n.length&&(t.selection=this.editor.model.createSelection(n))}return t}flush(e){const t=this.editor,n=t.model,s=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const c=t.commands.get("insertText").buffer;n.enqueueChange(c.batch,()=>{for(c.lock();this._queue.length;){const r=this.shift();t.execute("insertText",r)}c.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1}),s.scrollToTheSelection()}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){const e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}}function F(o,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),o.enqueueChange(t.batch,()=>{o.deleteContent(o.document.selection)}),t.unlock()}function fe(o){const e=o.toRange();return o.detach(),e.root.rootName=="$graveyard"?null:e}function he(o,e){let t=o.is("$text")?o.parent:o;for(;!e.toModelElement(t);)t=t.parent;return t}class I extends z{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new U(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const i=s.createSelection(e.selection||n.selection);if(!t.canEditAt(i))return;const c=e.sequence||1,r=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(c)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(i,c)){this.editor.execute("paragraph",{selection:i});return}if(i.isCollapsed)return;let l=0;i.getFirstRange().getMinimalFlatRanges().forEach(a=>{l+=Y(a.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(l),s.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,i=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(i))||!t.schema.checkChild(i,"paragraph"))return!1;const r=i.getChild(0);return!(r&&r.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,i=t.schema.getLimitElement(s),c=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(c,i),e.setSelection(c,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),i=n.schema.getLimitElement(s),c=i.getChild(0);return!(s.parent!=c||!e.containsEntireContent(c)||!n.schema.checkChild(i,"paragraph")||c.name=="paragraph")}}const me="character",L="word",ge="codePoint",_="selection",C="backward",A="forward",j={deleteContent:{unit:_,direction:C},deleteContentBackward:{unit:ge,direction:C},deleteWordBackward:{unit:L,direction:C},deleteHardLineBackward:{unit:_,direction:C},deleteSoftLineBackward:{unit:_,direction:C},deleteContentForward:{unit:me,direction:A},deleteWordForward:{unit:L,direction:A},deleteHardLineForward:{unit:_,direction:A},deleteSoftLineForward:{unit:_,direction:A}};class pe extends W{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(s,i)=>{if(!this.isEnabled)return;const{targetRanges:c,domEvent:r,inputType:l}=i,a=j[l];if(!a)return;const u={direction:a.direction,unit:a.unit,sequence:n};u.unit==_&&(u.selectionToRemove=e.createSelection(c[0])),l==="deleteContentBackward"&&(E.isAndroid&&(u.sequence=1),_e(c)&&(u.unit=_,u.selectionToRemove=e.createSelection(c)));const d=new D(t,"delete",c[0]);t.fire(d,new S(e,r,u)),d.stop.called&&s.stop()}),E.isBlink&&be(this)}observe(){}stopObserving(){}}function be(o){const e=o.view,t=e.document;let n=null,s=!1;t.on("keydown",(r,{keyCode:l})=>{n=l,s=!1}),t.on("keyup",(r,{keyCode:l,domEvent:a})=>{const u=t.selection,d=o.isEnabled&&l==n&&i(l)&&!u.isCollapsed&&!s;if(n=null,d){const h=u.getFirstRange(),g=new D(t,"delete",h),f={unit:_,direction:c(l),selectionToRemove:u};t.fire(g,new S(e,a,f))}}),t.on("beforeinput",(r,{inputType:l})=>{const a=j[l];i(n)&&a&&a.direction==c(n)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(r,{inputType:l,data:a})=>{n==y.delete&&l=="insertText"&&a==""&&r.stop()},{priority:"high"});function i(r){return r==y.backspace||r==y.delete}function c(r){return r==y.backspace?C:A}}function _e(o){if(o.length!=1||o[0].isCollapsed)return!1;const e=o[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:n,item:s}of e){if(n.parent.is("$text")){const i=n.parent.data,c=n.offset;if(J(i,c)||X(i,c)||Z(i,c))continue;t++}else(s.is("containerElement")||s.is("emptyElement"))&&t++;if(t>1)return!0}return!1}class ve extends k{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,s=e.model.document;t.addObserver(pe),this._undoOnBackspace=!1;const i=new I(e,"forward");e.commands.add("deleteForward",i),e.commands.add("forwardDelete",i),e.commands.add("delete",new I(e,"backward")),this.listenTo(n,"delete",(c,r)=>{n.isComposing||r.preventDefault();const{direction:l,sequence:a,selectionToRemove:u,unit:d}=r,h=l==="forward"?"deleteForward":"delete",g={sequence:a};if(d=="selection"){const f=Array.from(u.getRanges()).map(b=>e.editing.mapper.toModelRange(b)).map(b=>$(b,e.model.schema)||b);g.selection=e.model.createSelection(f)}else g.unit=d;e.execute(h,g),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(n,"keydown",(c,r)=>{if(n.isComposing||r.keyCode!=y.backspace||!s.selection.isCollapsed)return;const l=e.model.schema.getLimitElement(s.selection),a=e.model.createPositionAt(l,0);if(a.isTouching(s.selection.getFirstPosition())){r.preventDefault();const u=e.model.schema.getNearestSelectionRange(a,"forward");if(!u)return;const d=t.createSelection(e.editing.mapper.toViewRange(u)),h=d.getFirstRange(),g=new D(document,"delete",h),f={unit:"selection",direction:"backward",selectionToRemove:d};n.fire(g,new S(t,r.domEvent,f))}}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(c,r)=>{this._undoOnBackspace&&r.direction=="backward"&&r.sequence==1&&r.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),r.preventDefault(),c.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Fe extends k{static get requires(){return[ue,ve]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}function ye(o,e){let t=o.start;return{text:Array.from(o.getWalker({ignoreElementEnd:!1})).reduce((s,{item:i})=>i.is("$text")||i.is("$textProxy")?s+i.data:(t=e.createPositionAfter(i),""),""),range:e.createRange(t,o.end)}}class Ee extends V(){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",(n,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(n,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,c=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:r,range:l}=ye(c,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const u=Object.assign(t,{text:r,range:l});typeof a=="object"&&Object.assign(u,a),this.fire(`matched:${e}`,u)}}}class Ie extends k{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.locale,i=t.document.selection;this.listenTo(n.document,"arrowKey",(c,r)=>{if(!i.isCollapsed||r.shiftKey||r.altKey||r.ctrlKey)return;const l=r.keyCode==y.arrowright,a=r.keyCode==y.arrowleft;if(!l&&!a)return;const u=s.contentLanguageDirection;let d=!1;u==="ltr"&&l||u==="rtl"&&a?d=this._handleForwardMovement(r):d=this._handleBackwardMovement(r),d===!0&&c.stop()},{context:"$text",priority:"highest"}),this.listenTo(i,"change:range",(c,r)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!r.directChange&&m(i.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,i=s.getFirstPosition();return this._isGravityOverridden||i.isAtStart&&p(s,t)?!1:m(i,t)?(e&&w(e),p(s,t)&&m(i,t,!0)?x(n,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,i=s.getFirstPosition();return this._isGravityOverridden?(e&&w(e),this._restoreGravity(),m(i,t,!0)?x(n,t):R(n,t,i),!0):i.isAtStart?p(s,t)?(e&&w(e),R(n,t,i),!0):!1:!p(s,t)&&m(i,t,!0)?(e&&w(e),R(n,t,i),!0):q(i,t)?i.isAtEnd&&!p(s,t)&&m(i,t)?(e&&w(e),R(n,t,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(te),e.editing.view.addObserver(ne);let i=!1,c=!1;this.listenTo(s,"touchstart",()=>{c=!1,i=!0}),this.listenTo(s,"mousedown",()=>{c=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!c&&!i||(c=!1,i=!1,!n.isCollapsed)||!p(n,r))return;const l=n.getFirstPosition();m(l,r)&&(l.isAtStart||m(l,r,!0)?x(t,r):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,n=t.document.selection,s=this.attributes;this.listenTo(t,"insertContent",()=>{const i=n.getFirstPosition();p(n,s)&&m(i,s)&&x(t,s)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view;let i=!1,c=!1;this.listenTo(s.document,"delete",(r,l)=>{i=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!i)return;const r=n.getFirstPosition();c=p(n,this.attributes)&&!q(r,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{i&&(i=!1,!c&&e.model.enqueueChange(()=>{const r=n.getFirstPosition();p(n,this.attributes)&&m(r,this.attributes)&&(r.isAtStart||m(r,this.attributes,!0)?x(t,this.attributes):this._isGravityOverridden||this._overrideGravity())}))},{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function p(o,e){for(const t of e)if(o.hasAttribute(t))return!0;return!1}function R(o,e,t){const n=t.nodeBefore;o.change(s=>{if(n){const i=[],c=o.schema.isObject(n)&&o.schema.isInline(n);for(const[r,l]of n.getAttributes())o.schema.checkAttribute("$text",r)&&(!c||o.schema.getAttributeProperties(r).copyFromObject!==!1)&&i.push([r,l]);s.setSelectionAttribute(i)}else s.removeSelectionAttribute(e)})}function x(o,e){o.change(t=>{t.removeSelectionAttribute(e)})}function w(o){o.preventDefault()}function q(o,e){const t=o.getShiftedBy(-1);return m(t,e)}function m(o,e,t=!1){const{nodeBefore:n,nodeAfter:s}=o;for(const i of e){const c=n?n.getAttribute(i):void 0,r=s?s.getAttribute(i):void 0;if(!(t&&(c===void 0||r===void 0))&&r!==c)return!0}return!1}const N={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:T('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:T("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:T("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:T('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:T('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:T("'"),to:[null,"‚",null,"’"]}},M={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Te=["symbols","mathematical","typography","quotes"];class Le extends k{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("typing",{transformations:{include:Te}})}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,n=e.plugins.get("Delete"),s=Ae(e.config.get("typing.transformations")),i=r=>{for(const l of s)if(l.from.test(r))return{normalizedTransformation:l}},c=new Ee(e.model,i);c.on("matched:data",(r,l)=>{if(!l.batch.isTyping)return;const{from:a,to:u}=l.normalizedTransformation,d=a.exec(l.text),h=u(d.slice(1)),g=l.range;let f=d.index;t.enqueueChange(b=>{for(let v=1;v<d.length;v++){const B=d[v],O=h[v-1];if(O==null){f+=B.length;continue}const P=g.start.getShiftedBy(f),H=t.createRange(P,P.getShiftedBy(B.length)),K=we(P);t.insertContent(b.createText(O,K),H),f+=O.length}t.enqueueChange(()=>{n.requestUndoOnBackspace()})})}),c.bind("isEnabled").to(this)}}function Ce(o){return typeof o=="string"?new RegExp(`(${oe(o)})$`):o}function xe(o){return typeof o=="string"?()=>[o]:o instanceof Array?()=>o:o}function we(o){return(o.textNode?o.textNode:o.nodeAfter).getAttributes()}function T(o){return new RegExp(`(^|\\s)(${o})([^${o}]*)(${o})$`)}function Ae(o){const e=o.extra||[],t=o.remove||[],n=i=>!t.includes(i),s=o.include.concat(e).filter(n);return Se(s).filter(n).map(i=>typeof i=="string"&&N[i]?N[i]:i).filter(i=>typeof i=="object").map(i=>({from:Ce(i.from),to:xe(i.to)}))}function Se(o){const e=new Set;for(const t of o)if(typeof t=="string"&&M[t])for(const n of M[t])e.add(n);else e.add(t);return Array.from(e)}function ke(o,e,t,n){return n.createRange(G(o,e,t,!0,n),G(o,e,t,!1,n))}function G(o,e,t,n,s){let i=o.textNode||(n?o.nodeBefore:o.nodeAfter),c=null;for(;i&&i.getAttribute(e)==t;)c=i,i=n?i.previousSibling:i.nextSibling;return c?s.createPositionAt(c,n?"before":"after"):o}function qe(o,e,t,n){const s=o.editing.view,i=new Set;s.document.registerPostFixer(c=>{const r=o.model.document.selection;let l=!1;if(r.hasAttribute(e)){const a=ke(r.getFirstPosition(),e,r.getAttribute(e),o.model),u=o.editing.mapper.toViewRange(a);for(const d of u.getItems())d.is("element",t)&&!d.hasClass(n)&&(c.addClass(n,d),i.add(d),l=!0)}return l}),o.conversion.for("editingDowncast").add(c=>{c.on("insert",r,{priority:"highest"}),c.on("remove",r,{priority:"highest"}),c.on("attribute",r,{priority:"highest"}),c.on("selection",r,{priority:"highest"});function r(){s.change(l=>{for(const a of i.values())l.removeClass(n,a),i.delete(a)})}})}export{ve as Delete,I as DeleteCommand,ue as Input,ce as InsertTextCommand,Le as TextTransformation,Ee as TextWatcher,Ie as TwoStepCaretMovement,Fe as Typing,U as TypingChangeBuffer,pe as _DeleteObserver,ke as findAttributeRange,G as findAttributeRangeBound,ye as getLastTextLine,qe as inlineHighlight};
1
+ import{Plugin as k,Command as z}from"../../../../../@ckeditor_ckeditor5-core@47.3.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{keyCodes as y,ObservableMixin as V,env as E,count as Y,isInsideSurrogatePair as J,isInsideCombinedSymbol as X,isInsideEmojiSequence as Z,EventInfo as ee}from"../../../../../@ckeditor_ckeditor5-utils@47.3.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{_tryFixingModelRange as $,BubblingEventInfo as D,ViewDocumentDomEventData as S,Observer as W,MouseObserver as te,TouchObserver as ne,ModelLiveRange as ie,FocusObserver as se}from"../../../../../@ckeditor_ckeditor5-engine@47.3.0/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{escapeRegExp as oe}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";import{debounce as re}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/function/debounce.js";class U{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(n,s)=>{s.isLocal&&s.isUndoable&&s!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}}class ce extends z{_buffer;constructor(e,t){super(e),this._buffer=new U(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,s=e.text||"",i=s.length;let c=n.selection;if(e.selection?c=e.selection:e.range&&(c=t.createSelection(e.range)),!t.canEditAt(c))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const a=Array.from(n.selection.getAttributes());t.deleteContent(c),s&&t.insertContent(l.createText(s,a),c),r?l.setSelection(r):c.is("documentSelection")||l.setSelection(c),this._buffer.unlock(),this._buffer.input(i)})}}const Q=["insertText","insertReplacementText"],le=[...Q,"insertCompositionText"];class ae extends W{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(se);const t=E.isAndroid?le:Q,n=e.document;n.on("beforeinput",(s,i)=>{if(!this.isEnabled)return;const{data:c,targetRanges:r,inputType:l,domEvent:a,isComposing:u}=i;if(!t.includes(l))return;this.focusObserver.flush();const d=new ee(n,"insertText");n.fire(d,new S(e,a,{text:c,selection:e.createSelection(r),isComposing:u})),d.stop.called&&s.stop()}),E.isAndroid||n.on("compositionend",(s,{data:i,domEvent:c})=>{this.isEnabled&&i&&n.fire("insertText",new S(e,c,{text:i,isComposing:!0}))},{priority:"low"})}observe(){}stopObserving(){}}class ue extends k{_typingQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.editing.mapper,i=t.document.selection;this._typingQueue=new de(e),n.addObserver(ae);const c=new ce(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",c),e.commands.add("input",c),this.listenTo(n.document,"beforeinput",()=>{this._typingQueue.flush("next beforeinput")},{priority:"high"}),this.listenTo(n.document,"insertText",(r,l)=>{const{text:a,selection:u}=l;if(n.document.selection.isFake&&u&&n.document.selection.isSimilar(u)&&l.preventDefault(),u&&Array.from(u.getRanges()).some(f=>!f.isCollapsed)&&l.preventDefault(),!c.isEnabled){l.preventDefault();return}let d;u?d=Array.from(u.getRanges()).map(f=>s.toModelRange(f)).map(f=>$(f,t.schema)||f):d=Array.from(i.getRanges());let h=a;if(E.isAndroid){const f=Array.from(d[0].getItems()).reduce((b,v)=>b+(v.is("$textProxy")?v.data:""),"");if(f&&(f.length<=h.length?h.startsWith(f)&&(h=h.substring(f.length),d[0].start=d[0].start.getShiftedBy(f.length)):f.startsWith(h)&&(d[0].start=d[0].start.getShiftedBy(h.length),h="")),h.length==0&&d[0].isCollapsed)return}const g={text:h,selection:t.createSelection(d)};this._typingQueue.push(g,!!l.isComposing),l.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented")}),E.isAndroid?this.listenTo(n.document,"keydown",(r,l)=>{i.isCollapsed||l.keyCode!=229||!n.document.isComposing||F(t,c)}):this.listenTo(n.document,"compositionstart",()=>{i.isCollapsed||F(t,c)},{priority:"high"}),this.listenTo(n.document,"mutations",(r,{mutations:l})=>{if(this._typingQueue.hasAffectedElements())for(const{node:a}of l){const u=he(a,s),d=s.toModelElement(u);if(this._typingQueue.isElementAffected(d)){this._typingQueue.flush("mutations");return}}}),this.listenTo(n.document,"compositionend",()=>{this._typingQueue.flush("before composition end")},{priority:"high"}),this.listenTo(n.document,"compositionend",()=>{this._typingQueue.flush("after composition end");const r=[];if(this._typingQueue.hasAffectedElements())for(const l of this._typingQueue.flushAffectedElements()){const a=s.toViewElement(l);a&&r.push({type:"children",node:a})}(r.length||!E.isAndroid)&&n.document.fire("mutations",{mutations:r})},{priority:"lowest"})}destroy(){super.destroy(),this._typingQueue.destroy()}}class de{editor;flushDebounced=re(()=>this.flush("timeout"),50);_queue=[];_isComposing=!1;_affectedElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e,t){const n={text:e.text};if(e.selection){n.selectionRanges=[];for(const s of e.selection.getRanges())n.selectionRanges.push(ie.fromRange(s)),this._affectedElements.add(s.start.parent)}this._queue.push(n),this._isComposing||=t,this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const n=e.selectionRanges.map(s=>fe(s)).filter(s=>!!s);n.length&&(t.selection=this.editor.model.createSelection(n))}return t}flush(e){const t=this.editor,n=t.model,s=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const c=t.commands.get("insertText").buffer;n.enqueueChange(c.batch,()=>{for(c.lock();this._queue.length;){const r=this.shift();t.execute("insertText",r)}c.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1}),s.scrollToTheSelection()}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){const e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}}function F(o,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),o.enqueueChange(t.batch,()=>{o.deleteContent(o.document.selection)}),t.unlock()}function fe(o){const e=o.toRange();return o.detach(),e.root.rootName=="$graveyard"?null:e}function he(o,e){let t=o.is("$text")?o.parent:o;for(;!e.toModelElement(t);)t=t.parent;return t}class I extends z{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new U(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const i=s.createSelection(e.selection||n.selection);if(!t.canEditAt(i))return;const c=e.sequence||1,r=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(c)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(i,c)){this.editor.execute("paragraph",{selection:i});return}if(i.isCollapsed)return;let l=0;i.getFirstRange().getMinimalFlatRanges().forEach(a=>{l+=Y(a.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(l),s.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,i=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(i))||!t.schema.checkChild(i,"paragraph"))return!1;const r=i.getChild(0);return!(r&&r.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,i=t.schema.getLimitElement(s),c=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(c,i),e.setSelection(c,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),i=n.schema.getLimitElement(s),c=i.getChild(0);return!(s.parent!=c||!e.containsEntireContent(c)||!n.schema.checkChild(i,"paragraph")||c.name=="paragraph")}}const me="character",L="word",ge="codePoint",_="selection",C="backward",A="forward",j={deleteContent:{unit:_,direction:C},deleteContentBackward:{unit:ge,direction:C},deleteWordBackward:{unit:L,direction:C},deleteHardLineBackward:{unit:_,direction:C},deleteSoftLineBackward:{unit:_,direction:C},deleteContentForward:{unit:me,direction:A},deleteWordForward:{unit:L,direction:A},deleteHardLineForward:{unit:_,direction:A},deleteSoftLineForward:{unit:_,direction:A}};class pe extends W{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(s,i)=>{if(!this.isEnabled)return;const{targetRanges:c,domEvent:r,inputType:l}=i,a=j[l];if(!a)return;const u={direction:a.direction,unit:a.unit,sequence:n};u.unit==_&&(u.selectionToRemove=e.createSelection(c[0])),l==="deleteContentBackward"&&(E.isAndroid&&(u.sequence=1),_e(c)&&(u.unit=_,u.selectionToRemove=e.createSelection(c)));const d=new D(t,"delete",c[0]);t.fire(d,new S(e,r,u)),d.stop.called&&s.stop()}),E.isBlink&&be(this)}observe(){}stopObserving(){}}function be(o){const e=o.view,t=e.document;let n=null,s=!1;t.on("keydown",(r,{keyCode:l})=>{n=l,s=!1}),t.on("keyup",(r,{keyCode:l,domEvent:a})=>{const u=t.selection,d=o.isEnabled&&l==n&&i(l)&&!u.isCollapsed&&!s;if(n=null,d){const h=u.getFirstRange(),g=new D(t,"delete",h),f={unit:_,direction:c(l),selectionToRemove:u};t.fire(g,new S(e,a,f))}}),t.on("beforeinput",(r,{inputType:l})=>{const a=j[l];i(n)&&a&&a.direction==c(n)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(r,{inputType:l,data:a})=>{n==y.delete&&l=="insertText"&&a==""&&r.stop()},{priority:"high"});function i(r){return r==y.backspace||r==y.delete}function c(r){return r==y.backspace?C:A}}function _e(o){if(o.length!=1||o[0].isCollapsed)return!1;const e=o[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:n,item:s}of e){if(n.parent.is("$text")){const i=n.parent.data,c=n.offset;if(J(i,c)||X(i,c)||Z(i,c))continue;t++}else(s.is("containerElement")||s.is("emptyElement"))&&t++;if(t>1)return!0}return!1}class ve extends k{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,s=e.model.document;t.addObserver(pe),this._undoOnBackspace=!1;const i=new I(e,"forward");e.commands.add("deleteForward",i),e.commands.add("forwardDelete",i),e.commands.add("delete",new I(e,"backward")),this.listenTo(n,"delete",(c,r)=>{n.isComposing||r.preventDefault();const{direction:l,sequence:a,selectionToRemove:u,unit:d}=r,h=l==="forward"?"deleteForward":"delete",g={sequence:a};if(d=="selection"){const f=Array.from(u.getRanges()).map(b=>e.editing.mapper.toModelRange(b)).map(b=>$(b,e.model.schema)||b);g.selection=e.model.createSelection(f)}else g.unit=d;e.execute(h,g),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(n,"keydown",(c,r)=>{if(n.isComposing||r.keyCode!=y.backspace||!s.selection.isCollapsed)return;const l=e.model.schema.getLimitElement(s.selection),a=e.model.createPositionAt(l,0);if(a.isTouching(s.selection.getFirstPosition())){r.preventDefault();const u=e.model.schema.getNearestSelectionRange(a,"forward");if(!u)return;const d=t.createSelection(e.editing.mapper.toViewRange(u)),h=d.getFirstRange(),g=new D(document,"delete",h),f={unit:"selection",direction:"backward",selectionToRemove:d};n.fire(g,new S(t,r.domEvent,f))}}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(c,r)=>{this._undoOnBackspace&&r.direction=="backward"&&r.sequence==1&&r.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),r.preventDefault(),c.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Fe extends k{static get requires(){return[ue,ve]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}function ye(o,e){let t=o.start;return{text:Array.from(o.getWalker({ignoreElementEnd:!1})).reduce((s,{item:i})=>i.is("$text")||i.is("$textProxy")?s+i.data:(t=e.createPositionAfter(i),""),""),range:e.createRange(t,o.end)}}class Ee extends V(){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",(n,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(n,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,c=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:r,range:l}=ye(c,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const u=Object.assign(t,{text:r,range:l});typeof a=="object"&&Object.assign(u,a),this.fire(`matched:${e}`,u)}}}class Ie extends k{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.locale,i=t.document.selection;this.listenTo(n.document,"arrowKey",(c,r)=>{if(!i.isCollapsed||r.shiftKey||r.altKey||r.ctrlKey)return;const l=r.keyCode==y.arrowright,a=r.keyCode==y.arrowleft;if(!l&&!a)return;const u=s.contentLanguageDirection;let d=!1;u==="ltr"&&l||u==="rtl"&&a?d=this._handleForwardMovement(r):d=this._handleBackwardMovement(r),d===!0&&c.stop()},{context:"$text",priority:"highest"}),this.listenTo(i,"change:range",(c,r)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!r.directChange&&m(i.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,i=s.getFirstPosition();return this._isGravityOverridden||i.isAtStart&&p(s,t)?!1:m(i,t)?(e&&w(e),p(s,t)&&m(i,t,!0)?x(n,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,i=s.getFirstPosition();return this._isGravityOverridden?(e&&w(e),this._restoreGravity(),m(i,t,!0)?x(n,t):R(n,t,i),!0):i.isAtStart?p(s,t)?(e&&w(e),R(n,t,i),!0):!1:!p(s,t)&&m(i,t,!0)?(e&&w(e),R(n,t,i),!0):q(i,t)?i.isAtEnd&&!p(s,t)&&m(i,t)?(e&&w(e),R(n,t,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(te),e.editing.view.addObserver(ne);let i=!1,c=!1;this.listenTo(s,"touchstart",()=>{c=!1,i=!0}),this.listenTo(s,"mousedown",()=>{c=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!c&&!i||(c=!1,i=!1,!n.isCollapsed)||!p(n,r))return;const l=n.getFirstPosition();m(l,r)&&(l.isAtStart||m(l,r,!0)?x(t,r):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,n=t.document.selection,s=this.attributes;this.listenTo(t,"insertContent",()=>{const i=n.getFirstPosition();p(n,s)&&m(i,s)&&x(t,s)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view;let i=!1,c=!1;this.listenTo(s.document,"delete",(r,l)=>{i=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!i)return;const r=n.getFirstPosition();c=p(n,this.attributes)&&!q(r,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{i&&(i=!1,!c&&e.model.enqueueChange(()=>{const r=n.getFirstPosition();p(n,this.attributes)&&m(r,this.attributes)&&(r.isAtStart||m(r,this.attributes,!0)?x(t,this.attributes):this._isGravityOverridden||this._overrideGravity())}))},{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function p(o,e){for(const t of e)if(o.hasAttribute(t))return!0;return!1}function R(o,e,t){const n=t.nodeBefore;o.change(s=>{if(n){const i=[],c=o.schema.isObject(n)&&o.schema.isInline(n);for(const[r,l]of n.getAttributes())o.schema.checkAttribute("$text",r)&&(!c||o.schema.getAttributeProperties(r).copyFromObject!==!1)&&i.push([r,l]);s.setSelectionAttribute(i)}else s.removeSelectionAttribute(e)})}function x(o,e){o.change(t=>{t.removeSelectionAttribute(e)})}function w(o){o.preventDefault()}function q(o,e){const t=o.getShiftedBy(-1);return m(t,e)}function m(o,e,t=!1){const{nodeBefore:n,nodeAfter:s}=o;for(const i of e){const c=n?n.getAttribute(i):void 0,r=s?s.getAttribute(i):void 0;if(!(t&&(c===void 0||r===void 0))&&r!==c)return!0}return!1}const N={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:T('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:T("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:T("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:T('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:T('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:T("'"),to:[null,"‚",null,"’"]}},M={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Te=["symbols","mathematical","typography","quotes"];class Le extends k{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("typing",{transformations:{include:Te}})}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,n=e.plugins.get("Delete"),s=Ae(e.config.get("typing.transformations")),i=r=>{for(const l of s)if(l.from.test(r))return{normalizedTransformation:l}},c=new Ee(e.model,i);c.on("matched:data",(r,l)=>{if(!l.batch.isTyping)return;const{from:a,to:u}=l.normalizedTransformation,d=a.exec(l.text),h=u(d.slice(1)),g=l.range;let f=d.index;t.enqueueChange(b=>{for(let v=1;v<d.length;v++){const B=d[v],O=h[v-1];if(O==null){f+=B.length;continue}const P=g.start.getShiftedBy(f),H=t.createRange(P,P.getShiftedBy(B.length)),K=we(P);t.insertContent(b.createText(O,K),H),f+=O.length}t.enqueueChange(()=>{n.requestUndoOnBackspace()})})}),c.bind("isEnabled").to(this)}}function Ce(o){return typeof o=="string"?new RegExp(`(${oe(o)})$`):o}function xe(o){return typeof o=="string"?()=>[o]:o instanceof Array?()=>o:o}function we(o){return(o.textNode?o.textNode:o.nodeAfter).getAttributes()}function T(o){return new RegExp(`(^|\\s)(${o})([^${o}]*)(${o})$`)}function Ae(o){const e=o.extra||[],t=o.remove||[],n=i=>!t.includes(i),s=o.include.concat(e).filter(n);return Se(s).filter(n).map(i=>typeof i=="string"&&N[i]?N[i]:i).filter(i=>typeof i=="object").map(i=>({from:Ce(i.from),to:xe(i.to)}))}function Se(o){const e=new Set;for(const t of o)if(typeof t=="string"&&M[t])for(const n of M[t])e.add(n);else e.add(t);return Array.from(e)}function ke(o,e,t,n){return n.createRange(G(o,e,t,!0,n),G(o,e,t,!1,n))}function G(o,e,t,n,s){let i=o.textNode||(n?o.nodeBefore:o.nodeAfter),c=null;for(;i&&i.getAttribute(e)==t;)c=i,i=n?i.previousSibling:i.nextSibling;return c?s.createPositionAt(c,n?"before":"after"):o}function qe(o,e,t,n){const s=o.editing.view,i=new Set;s.document.registerPostFixer(c=>{const r=o.model.document.selection;let l=!1;if(r.hasAttribute(e)){const a=ke(r.getFirstPosition(),e,r.getAttribute(e),o.model),u=o.editing.mapper.toViewRange(a);for(const d of u.getItems())d.is("element",t)&&!d.hasClass(n)&&(c.addClass(n,d),i.add(d),l=!0)}return l}),o.conversion.for("editingDowncast").add(c=>{c.on("insert",r,{priority:"highest"}),c.on("remove",r,{priority:"highest"}),c.on("attribute",r,{priority:"highest"}),c.on("selection",r,{priority:"highest"});function r(){s.change(l=>{for(const a of i.values())l.removeClass(n,a),i.delete(a)})}})}export{ve as Delete,I as DeleteCommand,ue as Input,ce as InsertTextCommand,Le as TextTransformation,Ee as TextWatcher,Ie as TwoStepCaretMovement,Fe as Typing,U as TypingChangeBuffer,pe as _DeleteObserver,ke as findAttributeRange,G as findAttributeRangeBound,ye as getLastTextLine,qe as inlineHighlight};