@ncino/web-components 4.2.1 → 4.3.0-preview.10
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.
- package/dist/_virtual/external3.js +1 -0
- package/dist/_virtual/index10.js +1 -1
- package/dist/_virtual/index11.js +1 -1
- package/dist/_virtual/index12.js +1 -0
- package/dist/_virtual/index13.js +1 -0
- package/dist/_virtual/index2.js +1 -1
- package/dist/_virtual/index3.js +1 -1
- package/dist/_virtual/index4.js +1 -1
- package/dist/_virtual/index5.js +1 -1
- package/dist/_virtual/index6.js +1 -1
- package/dist/_virtual/index7.js +1 -1
- package/dist/_virtual/index8.js +1 -1
- package/dist/_virtual/index9.js +1 -1
- package/dist/_virtual/index_react.js +1 -0
- package/dist/_virtual/index_react2.js +1 -0
- package/dist/_virtual/react.production.js +1 -0
- package/dist/assets/node_modules/.pnpm/{ckeditor5@45.1.0 → ckeditor5@45.2.1}/node_modules/ckeditor5/dist/ckeditor5.css +1 -1
- package/dist/components/alert/alert.gator.figma.js +7 -0
- package/dist/components/avatar/gator/avatar.gator.figma.js +9 -0
- package/dist/components/banner/gator/banner.gator.figma.js +8 -0
- package/dist/components/banner/gator/banner.gator.js +6 -5
- package/dist/components/button/gator/button.gator.figma.js +12 -4
- package/dist/components/button-group/gator/button-group.gator.figma.js +7 -0
- package/dist/components/checkbox/checkbox.gator.js +9 -6
- package/dist/components/icon/gator/icon.gator.figma.js +7 -2
- package/dist/components/icon/gator/icons.gator.figma.js +1 -0
- package/dist/components/input/gator/dropdown/input-dropdown.gator.js +1 -1
- package/dist/components/input/gator/input-date/input-date.gator.js +1 -1
- package/dist/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.js +6 -3
- package/dist/components/input/gator/input-file/input-file.gator.js +7 -4
- package/dist/components/input/gator/input-phone/input-phone.gator.js +1 -1
- package/dist/components/input/gator/input-time/input-time.gator.js +1 -1
- package/dist/components/input-rich-text/ckeditor-config.js +1 -1
- package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
- package/dist/components/menu/base/gator/menu.gator.js +1 -1
- package/dist/components/menu/menu-item/gator/menu-item.gator.js +2 -2
- package/dist/components/panel/gator/panel.storybook-test.js +1 -1
- package/dist/components/popover/gator/popover.gator.js +1 -1
- package/dist/components/table/gator/__tests__/test-table-data.js +1 -1
- package/dist/components/table/gator/table.gator.js +77 -32
- package/dist/components/tooltip/gator/tooltip.gator.js +1 -1
- package/dist/components/tooltip/slds/tooltip.slds.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-alignment@45.1.0 → @ckeditor_ckeditor5-alignment@45.2.1}/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@45.1.0 → @ckeditor_ckeditor5-autoformat@45.2.1}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@45.1.0 → @ckeditor_ckeditor5-autosave@45.2.1}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-basic-styles@45.1.0 → @ckeditor_ckeditor5-basic-styles@45.2.1}/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@45.1.0 → @ckeditor_ckeditor5-block-quote@45.2.1}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-clipboard@45.1.0 → @ckeditor_ckeditor5-clipboard@45.2.1}/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@45.1.0 → @ckeditor_ckeditor5-cloud-services@45.2.1}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@45.1.0 → @ckeditor_ckeditor5-code-block@45.2.1}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-core@45.1.0 → @ckeditor_ckeditor5-core@45.2.1}/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-editor-classic@45.1.0 → @ckeditor_ckeditor5-editor-classic@45.2.1}/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-engine@45.1.0 → @ckeditor_ckeditor5-engine@45.2.1}/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +10 -10
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@45.1.0 → @ckeditor_ckeditor5-enter@45.2.1}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@45.1.0 → @ckeditor_ckeditor5-essentials@45.2.1}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-find-and-replace@45.1.0 → @ckeditor_ckeditor5-find-and-replace@45.2.1}/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-font@45.1.0 → @ckeditor_ckeditor5-font@45.2.1}/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@45.1.0 → @ckeditor_ckeditor5-heading@45.2.1}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-highlight@45.1.0 → @ckeditor_ckeditor5-highlight@45.2.1}/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-horizontal-line@45.1.0 → @ckeditor_ckeditor5-horizontal-line@45.2.1}/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-embed@45.1.0 → @ckeditor_ckeditor5-html-embed@45.2.1}/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-support@45.1.0 → @ckeditor_ckeditor5-html-support@45.2.1}/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-image@45.1.0 → @ckeditor_ckeditor5-image@45.2.1}/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-indent@45.1.0 → @ckeditor_ckeditor5-indent@45.2.1}/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@45.1.0 → @ckeditor_ckeditor5-language@45.2.1}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-link@45.1.0 → @ckeditor_ckeditor5-link@45.2.1}/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-list@45.1.0 → @ckeditor_ckeditor5-list@45.2.1}/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@45.1.0 → @ckeditor_ckeditor5-markdown-gfm@45.2.1}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-media-embed@45.1.0 → @ckeditor_ckeditor5-media-embed@45.2.1}/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@45.1.0 → @ckeditor_ckeditor5-mention@45.2.1}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-page-break@45.1.0 → @ckeditor_ckeditor5-page-break@45.2.1}/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@45.1.0 → @ckeditor_ckeditor5-paragraph@45.2.1}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@45.2.1/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +28 -0
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-remove-format@45.1.0 → @ckeditor_ckeditor5-remove-format@45.2.1}/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-select-all@45.1.0 → @ckeditor_ckeditor5-select-all@45.2.1}/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-show-blocks@45.1.0 → @ckeditor_ckeditor5-show-blocks@45.2.1}/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@45.2.1/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +4 -0
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-special-characters@45.1.0 → @ckeditor_ckeditor5-special-characters@45.2.1}/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@45.1.0 → @ckeditor_ckeditor5-style@45.2.1}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-table@45.1.0 → @ckeditor_ckeditor5-table@45.2.1}/node_modules/@ckeditor/ckeditor5-table/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +13 -0
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-ui@45.1.0 → @ckeditor_ckeditor5-ui@45.2.1}/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@45.1.0 → @ckeditor_ckeditor5-undo@45.2.1}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@45.1.0 → @ckeditor_ckeditor5-upload@45.2.1}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +112 -0
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-widget@45.1.0 → @ckeditor_ckeditor5-widget@45.2.1}/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/client/external.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/common/updates.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/react/external.js +1 -0
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/react/index_react.js +1 -0
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -0
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +1 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +1 -0
- package/dist/node_modules/.pnpm/{@storybook_instrumenter@8.6.14_storybook@8.6.14_prettier@3.5.3_ → @storybook_instrumenter@8.6.14_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/instrumenter/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@storybook_test@8.6.14_storybook@8.6.14_prettier@3.5.3_ → @storybook_test@8.6.14_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/test/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@vitest_expect@3.2.0 → @vitest_expect@3.2.4}/node_modules/@vitest/expect/dist/index.js +10 -10
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +5 -0
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +27 -0
- package/dist/node_modules/.pnpm/@vitest_spy@3.2.4/node_modules/@vitest/spy/dist/index.js +1 -0
- package/dist/node_modules/.pnpm/{@vitest_utils@3.2.0 → @vitest_utils@3.2.4}/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +1 -1
- package/dist/node_modules/.pnpm/{@vitest_utils@3.2.0 → @vitest_utils@3.2.4}/node_modules/@vitest/utils/dist/diff.js +1 -1
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.js +2 -0
- package/dist/node_modules/.pnpm/{@vitest_utils@3.2.0 → @vitest_utils@3.2.4}/node_modules/@vitest/utils/dist/helpers.js +1 -1
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js +1 -0
- package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +1 -1
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js +1 -1
- package/dist/node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js +1 -1
- package/dist/node_modules/.pnpm/color-parse@1.4.2/node_modules/color-parse/index.js +1 -1
- package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js +1 -1
- package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +1 -0
- package/dist/node_modules/.pnpm/libphonenumber-js@1.12.9/node_modules/libphonenumber-js/metadata.min.json.js +1 -0
- package/dist/node_modules/.pnpm/loupe@3.1.4/node_modules/loupe/lib/html.js +2 -0
- package/dist/node_modules/.pnpm/loupe@3.1.4/node_modules/loupe/lib/index.js +1 -0
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +9 -0
- package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +1 -0
- package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js +1 -1
- package/dist/node_modules/.pnpm/strip-literal@3.0.0/node_modules/strip-literal/dist/index.js +1 -0
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/index.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/api/index.js +1 -1
- package/dist/node_modules/.pnpm/{vitest@3.2.0_@types_debug@4.1.12_@types_node@22.15.29_@vitest_browser@3.2.0_@vitest_ui@_380928fb48d45118a64498d466bac5bf → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5}/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +1 -1
- package/dist/node_modules/.pnpm/{vitest@3.2.0_@types_debug@4.1.12_@types_node@22.15.29_@vitest_browser@3.2.0_@vitest_ui@_380928fb48d45118a64498d466bac5bf → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5}/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +1 -1
- package/dist/packages/web-components/src/components/banner/gator/banner.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-file/input-file.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/table/gator/table.gator.scss.js +1 -1
- package/dist/types/components/alert/alert.gator.figma.d.ts +1 -0
- package/dist/types/components/avatar/gator/avatar.gator.figma.d.ts +1 -0
- package/dist/types/components/banner/gator/banner.gator.d.ts +5 -0
- package/dist/types/components/banner/gator/banner.gator.figma.d.ts +1 -0
- package/dist/types/components/button-group/gator/button-group.gator.figma.d.ts +1 -0
- package/dist/types/components/checkbox/checkbox.gator.d.ts +4 -0
- package/dist/types/components/icon/gator/icons.gator.figma.d.ts +1 -0
- package/dist/types/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.d.ts +4 -0
- package/dist/types/components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.test.d.ts +0 -0
- package/dist/types/components/input/gator/input-file/input-file.gator.d.ts +4 -0
- package/dist/types/components/menu/menu-item/gator/menu-item.gator.d.ts +1 -0
- package/dist/types/components/table/gator/__tests__/test-table-data.d.ts +31 -0
- package/dist/types/components/table/gator/table.gator.d.ts +5 -0
- package/dist/types/components/table/table.d.ts +2 -0
- package/dist/utils/vitest-a11y-utils.js +1 -1
- package/package.json +21 -20
- package/web-types.json +26 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@45.1.0/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +0 -28
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@45.1.0/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +0 -12
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@45.1.0/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +0 -13
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@45.1.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +0 -104
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.1/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.1/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.0/node_modules/@vitest/runner/dist/chunk-hooks.js +0 -5
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.0/node_modules/@vitest/snapshot/dist/index.js +0 -27
- package/dist/node_modules/.pnpm/@vitest_spy@3.2.0/node_modules/@vitest/spy/dist/index.js +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.0/node_modules/@vitest/utils/dist/error.js +0 -2
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.0/node_modules/@vitest/utils/dist/index.js +0 -1
- package/dist/node_modules/.pnpm/libphonenumber-js@1.12.8/node_modules/libphonenumber-js/metadata.min.json.js +0 -1
- package/dist/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.js +0 -2
- package/dist/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.js +0 -1
- /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-icons@45.1.0 → @ckeditor_ckeditor5-icons@45.2.1}/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@45.1.0 → @ckeditor_ckeditor5-watchdog@45.2.1}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_ → @storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/core/dist/channels/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_ → @storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/core/dist/client-logger/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_ → @storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/core/dist/core-events/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_ → @storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/core/dist/csf/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_ → @storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/core/dist/preview-api/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@storybook_core@8.6.14_prettier@3.5.3_storybook@8.6.14_prettier@3.5.3_ → @storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_}/node_modules/@storybook/core/dist/preview-errors.js +0 -0
- /package/dist/node_modules/.pnpm/{@vitest_browser@3.2.0_msw@2.7.3_@types_node@22.15.29_typescript@5.8.3__playwright@1.52._b8e25df0066052f4b376435335cc964b → @vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.7_typescript@5.8.3__playwright@1.53.1__894c207534f0ba223b8299d9f5ff1049}/node_modules/@vitest/browser/context.js +0 -0
- /package/dist/node_modules/.pnpm/{@vitest_pretty-format@3.2.0 → @vitest_pretty-format@3.2.4}/node_modules/@vitest/pretty-format/dist/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@vitest_utils@3.2.0 → @vitest_utils@3.2.4}/node_modules/@vitest/utils/dist/source-map.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/ParseError.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/PhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/constants.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/format.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/isObject.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/isPossible.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/isValid.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/metadata.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/normalizeArguments.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/parse.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/es6/tools/semver-compare.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +0 -0
- /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.8 → libphonenumber-js@1.12.9}/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/arguments.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/array.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/bigint.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/class.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/date.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/error.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/function.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/helpers.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/map.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/number.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/object.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/promise.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/regexp.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/set.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/string.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/symbol.js +0 -0
- /package/dist/node_modules/.pnpm/{loupe@3.1.3 → loupe@3.1.4}/node_modules/loupe/lib/typedarray.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.0_@types_debug@4.1.12_@types_node@22.15.29_@vitest_browser@3.2.0_@vitest_ui@_380928fb48d45118a64498d466bac5bf → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.0_@types_debug@4.1.12_@types_node@22.15.29_@vitest_browser@3.2.0_@vitest_ui@_380928fb48d45118a64498d466bac5bf → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5}/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var so=Object.defineProperty;var ro=(i,t,e)=>t in i?so(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var g=(i,t,e)=>ro(i,typeof t!="symbol"?t+"":t,e);import{Plugin as v,Command as S}from"../../../../../@ckeditor_ckeditor5-core@45.1
|
|
1
|
+
var so=Object.defineProperty;var ro=(i,t,e)=>t in i?so(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var g=(i,t,e)=>ro(i,typeof t!="symbol"?t+"":t,e);import{Plugin as v,Command as S}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as ao,WidgetToolbarRepository as $e,toWidgetEditable as wt,isWidget as co,toWidget as uo}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Collection as Ct,first as Le,getLocalizedArrowKeyCodeDirection as ho,DomEmitterMixin as mo,global as se,Rect as re,toUnit as go,CKEditorError as Ge,KeystrokeHandler as be,FocusTracker as fe}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconTable as je,IconTableColumn as bo,IconTableRow as fo,IconTableMergeCell as po,IconCaption as wo,IconTableCellProperties as Co,IconTableProperties as To,IconCheck as Tt,IconCancel as _t,IconObjectInlineRight as _o,IconObjectCenter as yo,IconObjectInlineLeft as vo,IconAlignBottom as Ao,IconAlignMiddle as So,IconAlignTop as Ro,IconAlignJustify as Io,IconAlignRight as xo,IconAlignCenter as ko,IconAlignLeft as Vo}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{createDropdown as oe,MenuBarMenuView as Po,SwitchButtonView as Eo,addListToDropdown as Be,ButtonView as E,ContextualBalloon as ae,normalizeColorOptions as ce,getLocalizedColorOptions as de,clickOutsideHandler as yt,SplitButtonView as Wo,View as O,addKeyboardHandlingForGrid as Lo,ViewModel as vt,ViewCollection as De,FocusCycler as Fe,FormHeaderView as At,FormRowView as x,submitHandler as St,LabelView as L,LabeledFieldView as k,createLabeledDropdown as Rt,createLabeledInputText as M,ToolbarView as _e,BalloonPanelView as N,InputTextView as Bo,ColorSelectorView as Do}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{ClipboardMarkersUtils as Ce,ClipboardPipeline as Ke}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{enablePlaceholder as Fo,Element as No,addBorderRules as It,addPaddingRules as Mo,addBackgroundRules as xt,DomEventObserver as Oo,isColor as zo,isLength as kt,isPercentage as Ho}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{debounce as Vt}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";import{isEqual as qe}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{throttle as Uo}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/throttle.js";import{isObject as $o}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObject.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/function Ne(i,t){const{modelAttribute:e,styleName:o,viewElement:n,defaultValue:l,reduceBoxSides:s=!1,shouldUpcast:r=()=>!0}=t;i.for("upcast").attributeToAttribute({view:{name:n,styles:{[o]:/[\s\S]+/}},model:{key:e,value:(a,d,c)=>{if(!r(a))return;const u=B(l,"",c),h=a.getNormalizedStyle(o),m=s?le(h):h;if(u!==m)return m}}})}function ye(i,t,e,o){i.for("upcast").add(n=>n.on("element:"+t,(l,s,r)=>{if(!s.modelRange)return;const a=["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(b=>s.viewItem.hasStyle(b));if(!a.length)return;const d={styles:a};if(!r.consumable.test(s.viewItem,d))return;const c=[...s.modelRange.getItems({shallow:!0})].pop(),u=c.findAncestor("table",{includeSelf:!0});let h=o;u&&u.getAttribute("tableType")=="layout"&&(h={style:"none",color:"",width:""}),r.consumable.consume(s.viewItem,d);const m={style:s.viewItem.getNormalizedStyle("border-style"),color:s.viewItem.getNormalizedStyle("border-color"),width:s.viewItem.getNormalizedStyle("border-width")},p={style:le(m.style),color:le(m.color),width:le(m.width)};p.style!==h.style&&r.writer.setAttribute(e.style,p.style,c),p.color!==h.color&&r.writer.setAttribute(e.color,p.color,c),p.width!==h.width&&r.writer.setAttribute(e.width,p.width,c)}))}function K(i,t){const{modelElement:e,modelAttribute:o,styleName:n}=t;i.for("downcast").attributeToAttribute({model:{name:e,key:o},view:l=>({key:"style",value:{[n]:l}})})}function ne(i,t){const{modelAttribute:e,styleName:o}=t;i.for("downcast").add(n=>n.on(`attribute:${e}:table`,(l,s,r)=>{const{item:a,attributeNewValue:d}=s,{mapper:c,writer:u}=r;if(!r.consumable.consume(s.item,l.name))return;const h=[...c.toViewElement(a).getChildren()].find(m=>m.is("element","table"));d?u.setStyle(o,d,h):u.removeStyle(o,h)}))}function B(i,t,e){const o=e.modelRange&&Le(e.modelRange.getItems({shallow:!0})),n=o&&o.is("element")&&o.findAncestor("table",{includeSelf:!0});return n&&n.getAttribute("tableType")==="layout"?t:i}function le(i){if(!i)return;const t=["top","right","bottom","left"];if(!t.every(l=>i[l]))return i;const o=i.top;return t.every(l=>i[l]===o)?o:i}function y(i,t,e,o,n=1){t!=null&&n!==void 0&&n!==null&&t>n?o.setAttribute(i,t,e):o.removeAttribute(i,e)}function z(i,t,e={}){const o=i.createElement("tableCell",e);return i.insertElement("paragraph",o),i.insert(o,t),o}function ve(i,t){const e=t.parent.parent,o=parseInt(e.getAttribute("headingColumns")||"0"),{column:n}=i.getCellLocation(t);return!!o&&n<o}function ie(i,t,e){const{modelAttribute:o}=e;i.extend("tableCell",{allowAttributes:[o]}),Ne(t,{viewElement:/^(td|th)$/,...e}),K(t,{modelElement:"tableCell",...e})}function D(i){const t=i.getSelectedElement();return t&&t.is("element","table")?t:i.getFirstPosition().findAncestor("table")}function Go(){return i=>{i.on("element:figure",(t,e,o)=>{if(!o.consumable.test(e.viewItem,{name:!0,classes:"table"}))return;const n=qo(e.viewItem);if(!n||!o.consumable.test(n,{name:!0}))return;o.consumable.consume(e.viewItem,{name:!0,classes:"table"});const l=o.convertItem(n,e.modelCursor),s=Le(l.modelRange.getItems());if(!s){o.consumable.revert(e.viewItem,{name:!0,classes:"table"});return}o.convertChildren(e.viewItem,o.writer.createPositionAt(s,"end")),o.updateConversionResult(s,e)})}}function jo(){return i=>{i.on("element:table",(t,e,o)=>{const n=e.viewItem;if(!o.consumable.test(n,{name:!0}))return;const{rows:l,headingRows:s,headingColumns:r}=Xo(n),a={};r&&(a.headingColumns=r),s&&(a.headingRows=s);const d=o.writer.createElement("table",a);if(o.safeInsert(d,e.modelCursor)){if(o.consumable.consume(n,{name:!0}),l.forEach(c=>o.convertItem(c,o.writer.createPositionAt(d,"end"))),o.convertChildren(n,o.writer.createPositionAt(d,"end")),d.isEmpty){const c=o.writer.createElement("tableRow");o.writer.insert(c,o.writer.createPositionAt(d,"end")),z(o.writer,o.writer.createPositionAt(c,"end"))}o.updateConversionResult(d,e)}})}}function Ko(){return i=>{i.on("element:tr",(t,e)=>{e.viewItem.isEmpty&&e.modelCursor.index==0&&t.stop()},{priority:"high"})}}function Xe(i){return t=>{t.on(`element:${i}`,(e,o,{writer:n})=>{if(!o.modelRange)return;const l=o.modelRange.start.nodeAfter,s=n.createPositionAt(l,0);if(o.viewItem.isEmpty){n.insertElement("paragraph",s);return}const r=Array.from(l.getChildren());if(r.every(a=>a.is("element","$marker"))){const a=n.createElement("paragraph");n.insert(a,n.createPositionAt(l,0));for(const d of r)n.move(n.createRangeOn(d),n.createPositionAt(a,"end"))}},{priority:"low"})}}function qo(i){for(const t of i.getChildren())if(t.is("element","table"))return t}function Xo(i){let t=0,e;const o=[],n=[];let l;for(const s of Array.from(i.getChildren())){if(s.name!=="tbody"&&s.name!=="thead"&&s.name!=="tfoot")continue;s.name==="thead"&&!l&&(l=s);const r=Array.from(s.getChildren()).filter(d=>d.is("element","tr"));let a=null;for(const d of r){const c=Array.from(d.getChildren()).filter(u=>u.is("element","td")||u.is("element","th"));if(l&&s===l||s.name==="tbody"&&c.length>0&&(a===null||c.length===a)&&c.every(u=>u.is("element","th")))t++,o.push(d);else{n.push(d);const u=Jo(d);(!e||u<e)&&(e=u)}a=Math.max(a||0,c.length)}}return{headingRows:t,headingColumns:e||0,rows:[...o,...n]}}function Jo(i){let t=0,e=0;const o=Array.from(i.getChildren()).filter(n=>n.name==="th"||n.name==="td");for(;e<o.length&&o[e].name==="th";){const n=o[e],l=parseInt(n.getAttribute("colspan")||"1");t=t+l,e++}return t}/**
|
|
@@ -10,7 +10,7 @@ var so=Object.defineProperty;var ro=(i,t,e)=>t in i?so(i,t,{enumerable:!0,config
|
|
|
10
10
|
*/const bn=5,Re=40,fn=2,pn=3;function wn(i){const t=new Set;for(const e of i.document.differ.getChanges()){let o=null;switch(e.type){case"insert":o=["table","tableRow","tableCell"].includes(e.name)?e.position:null;break;case"remove":o=["tableRow","tableCell"].includes(e.name)?e.position:null;break;case"attribute":e.range.start.nodeAfter&&(o=["table","tableRow","tableCell"].includes(e.range.start.nodeAfter.name)?e.range.start:null);break}if(!o)continue;const n=o.nodeAfter&&o.nodeAfter.is("element","table")?o.nodeAfter:o.findAncestor("table");for(const l of i.createRangeOn(n).getItems())l.is("element","table")&&J(l)&&t.add(l)}return t}function Cn(i,t){return Re*100/Ot(i,t)}function Ot(i,t){const e=nt(i,"tbody",t)||nt(i,"thead",t),o=t.editing.view.domConverter.mapViewToDom(e);return Ie(o)}function nt(i,t,e){return[...[...e.editing.mapper.toViewElement(i).getChildren()].find(l=>l.is("element","table")).getChildren()].find(l=>l.is("element",t))}function Ie(i){const t=se.window.getComputedStyle(i);return t.boxSizing==="border-box"?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function Tn(i,t){const e=t.getCellLocation(i).column,o=i.getAttribute("colspan")||1;return{leftEdge:e,rightEdge:e+o-1}}function I(i){const t=Math.pow(10,fn),e=typeof i=="number"?i:parseFloat(i);return Math.round(e*t)/t}function _n(i,t,e){return i<=t?I(t):i>=e?I(e):I(i)}function yn(i,t){return Array(i).fill(t)}function X(i){return i.map(t=>typeof t=="number"?t:parseFloat(t)).filter(t=>!Number.isNaN(t)).reduce((t,e)=>t+e,0)}function Oe(i){const t=i.map(n=>n==="auto"?n:parseFloat(n.replace("%","")));let e=vn(t);const o=X(e);return o!==100&&(e=e.map(n=>I(n*100/o)).map((n,l,s)=>{if(!(l===s.length-1))return n;const a=X(s);return I(n+100-a)})),e.map(n=>n+"%")}function vn(i){const t=i.filter(n=>n==="auto").length;if(t===0)return i.map(n=>I(n));const e=X(i),o=Math.max((100-e)/t,bn);return i.map(n=>n==="auto"?o:n).map(n=>I(n))}function An(i){const t=se.window.getComputedStyle(i);return t.boxSizing==="border-box"?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function zt(i,t,e,o){for(let n=0;n<Math.max(e.length,i.length);n++){const l=i[n],s=e[n];s?l?o.setAttribute("columnWidth",s,l):o.appendElement("tableColumn",{columnWidth:s},t):o.remove(l)}}function J(i){if(i.is("element","tableColumnGroup"))return i;const t=i.getChildren();return Array.from(t).find(e=>e.is("element","tableColumnGroup"))}function Y(i){const t=J(i);return t?Array.from(t.getChildren()):[]}function Sn(i){return Y(i).map(t=>t.getAttribute("columnWidth"))}function Rn(i,t){return Y(i).reduce((o,n)=>{const l=n.getAttribute("columnWidth"),s=n.getAttribute("colSpan");if(!s)return o.push(l),o;for(let r=0;r<s;r++)o.push(l);return t.removeAttribute("colSpan",n),o},[])}class A extends v{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(t){const e=t.parent,o=e.parent,n=o.getChildIndex(e),l=new T(o,{row:n});for(const{cell:s,row:r,column:a}of l)if(s===t)return{row:r,column:a};/* istanbul ignore next -- @preserve */}createTable(t,e){const o=t.createElement("table"),n=e.rows||2,l=e.columns||2;return Te(t,o,0,n,l),e.headingRows&&y("headingRows",Math.min(e.headingRows,n),o,t,0),e.headingColumns&&y("headingColumns",Math.min(e.headingColumns,l),o,t,0),o}insertRows(t,e={}){const o=this.editor.model,n=e.at||0,l=e.rows||1,s=e.copyStructureFromAbove!==void 0,r=e.copyStructureFromAbove?n-1:n,a=this.getRows(t),d=this.getColumns(t);if(n>a)throw new Ge("tableutils-insertrows-insert-out-of-range",this,{options:e});o.change(c=>{const u=t.getAttribute("headingRows")||0;if(u>n&&y("headingRows",u+l,t,c,0),!s&&(n===0||n===a)){Te(c,t,n,l,d);return}const h=s?Math.max(n,r):n,m=new T(t,{endRow:h}),p=new Array(d).fill(1);for(const{row:b,column:w,cellHeight:f,cellWidth:C,cell:_}of m){const R=b+f-1,V=b<n&&n<=R,P=b<=r&&r<=R;V?(c.setAttribute("rowspan",f+l,_),p[w]=-C):s&&P&&(p[w]=C)}for(let b=0;b<l;b++){const w=c.createElement("tableRow");c.insert(w,t,n);for(let f=0;f<p.length;f++){const C=p[f],_=c.createPositionAt(w,"end");C>0&&z(c,_,C>1?{colspan:C}:void 0),f+=Math.abs(C)-1}}})}insertColumns(t,e={}){const o=this.editor.model,n=e.at||0,l=e.columns||1;o.change(s=>{const r=t.getAttribute("headingColumns");n<r&&s.setAttribute("headingColumns",r+l,t);const a=this.getColumns(t);if(n===0||a===n){for(const c of t.getChildren())c.is("element","tableRow")&&j(l,s,s.createPositionAt(c,n?"end":0));return}const d=new T(t,{column:n,includeAllSlots:!0});for(const c of d){const{row:u,cell:h,cellAnchorColumn:m,cellAnchorRow:p,cellWidth:b,cellHeight:w}=c;if(m<n){s.setAttribute("colspan",b+l,h);const f=p+w-1;for(let C=u;C<=f;C++)d.skipRow(C)}else j(l,s,c.getPositionBefore())}})}removeRows(t,e){const o=this.editor.model,n=e.rows||1,l=this.getRows(t),s=e.at,r=s+n-1;if(r>l-1)throw new Ge("tableutils-removerows-row-index-out-of-range",this,{table:t,options:e});o.change(a=>{const d={first:s,last:r},{cellsToMove:c,cellsToTrim:u}=kn(t,d);if(c.size){const h=r+1;Vn(t,h,c,a)}for(let h=r;h>=s;h--)a.remove(t.getChild(h));for(const{rowspan:h,cell:m}of u)y("rowspan",h,m,a);xn(t,d,a),Ae(t,this)||Se(t,this)})}removeColumns(t,e){const o=this.editor.model,n=e.at,l=e.columns||1,s=e.at+l-1;o.change(r=>{In(t,{first:n,last:s},r);const a=Y(t);for(let d=s;d>=n;d--){for(const{cell:c,column:u,cellWidth:h}of[...new T(t)])u<=d&&h>1&&u+h>d?y("colspan",h-1,c,r):u===d&&r.remove(c);if(a[d]){const c=d===0?a[1]:a[d-1],u=parseFloat(a[d].getAttribute("columnWidth")),h=parseFloat(c.getAttribute("columnWidth"));r.remove(a[d]),r.setAttribute("columnWidth",u+h+"%",c)}}Se(t,this)||Ae(t,this)})}splitCellVertically(t,e=2){const o=this.editor.model,l=t.parent.parent,s=parseInt(t.getAttribute("rowspan")||"1"),r=parseInt(t.getAttribute("colspan")||"1");o.change(a=>{if(r>1){const{newCellsSpan:d,updatedSpan:c}=lt(r,e);y("colspan",c,t,a);const u={};d>1&&(u.colspan=d),s>1&&(u.rowspan=s);const h=r>e?e-1:r-1;j(h,a,a.createPositionAfter(t),u)}if(r<e){const d=e-r,c=[...new T(l)],{column:u}=c.find(({cell:b})=>b===t),h=c.filter(({cell:b,cellWidth:w,column:f})=>{const C=b!==t&&f===u,_=f<u&&f+w>u;return C||_});for(const{cell:b,cellWidth:w}of h)a.setAttribute("colspan",w+d,b);const m={};s>1&&(m.rowspan=s),j(d,a,a.createPositionAfter(t),m);const p=l.getAttribute("headingColumns")||0;p>u&&y("headingColumns",p+d,l,a)}})}splitCellHorizontally(t,e=2){const o=this.editor.model,n=t.parent,l=n.parent,s=l.getChildIndex(n),r=parseInt(t.getAttribute("rowspan")||"1"),a=parseInt(t.getAttribute("colspan")||"1");o.change(d=>{if(r>1){const c=[...new T(l,{startRow:s,endRow:s+r-1,includeAllSlots:!0})],{newCellsSpan:u,updatedSpan:h}=lt(r,e);y("rowspan",h,t,d);const{column:m}=c.find(({cell:w})=>w===t),p={};u>1&&(p.rowspan=u),a>1&&(p.colspan=a);let b=0;for(const w of c){const{column:f,row:C}=w,_=C>=s+h,R=f===m;b>=u&&R&&(b=0),_&&R&&(b||j(1,d,w.getPositionBefore(),p),b++)}}if(r<e){const c=e-r,u=[...new T(l,{startRow:0,endRow:s})];for(const{cell:p,cellHeight:b,row:w}of u)if(p!==t&&w+b>s){const f=b+c;d.setAttribute("rowspan",f,p)}const h={};a>1&&(h.colspan=a),Te(d,l,s+1,c,1,h);const m=l.getAttribute("headingRows")||0;m>s&&y("headingRows",m+c,l,d)}})}getColumns(t){return[...t.getChild(0).getChildren()].filter(o=>o.is("element","tableCell")).reduce((o,n)=>{const l=parseInt(n.getAttribute("colspan")||"1");return o+l},0)}getRows(t){return Array.from(t.getChildren()).reduce((e,o)=>o.is("element","tableRow")?e+1:e,0)}createTableWalker(t,e={}){return new T(t,e)}getSelectedTableCells(t){const e=[];for(const o of this.sortRanges(t.getRanges())){const n=o.getContainedElement();n&&n.is("element","tableCell")&&e.push(n)}return e}getTableCellsContainingSelection(t){const e=[];for(const o of t.getRanges()){const n=o.start.findAncestor("tableCell");n&&e.push(n)}return e}getSelectionAffectedTableCells(t){const e=this.getSelectedTableCells(t);return e.length?e:this.getTableCellsContainingSelection(t)}getRowIndexes(t){const e=t.map(o=>o.parent.index);return this._getFirstLastIndexesObject(e)}getColumnIndexes(t){const e=t[0].findAncestor("table"),n=[...new T(e)].filter(l=>t.includes(l.cell)).map(l=>l.column);return this._getFirstLastIndexesObject(n)}isSelectionRectangular(t){if(t.length<2||!this._areCellInTheSameTableSection(t))return!1;const e=new Set,o=new Set;let n=0;for(const s of t){const{row:r,column:a}=this.getCellLocation(s),d=parseInt(s.getAttribute("rowspan"))||1,c=parseInt(s.getAttribute("colspan"))||1;e.add(r),o.add(a),d>1&&e.add(r+d-1),c>1&&o.add(a+c-1),n+=d*c}return En(e,o)==n}sortRanges(t){return Array.from(t).sort(Pn)}_getFirstLastIndexesObject(t){const e=t.sort((l,s)=>l-s),o=e[0],n=e[e.length-1];return{first:o,last:n}}_areCellInTheSameTableSection(t){const e=t[0].findAncestor("table"),o=this.getRowIndexes(t),n=parseInt(e.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(o,n))return!1;const l=this.getColumnIndexes(t),s=parseInt(e.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(l,s)}_areIndexesInSameSection({first:t,last:e},o){const n=t<o,l=e<o;return n===l}}function Te(i,t,e,o,n,l={}){for(let s=0;s<o;s++){const r=i.createElement("tableRow");i.insert(r,t,e),j(n,i,i.createPositionAt(r,"end"),l)}}function j(i,t,e,o={}){for(let n=0;n<i;n++)z(t,e,o)}function lt(i,t){if(i<t)return{newCellsSpan:1,updatedSpan:1};const e=Math.floor(i/t),o=i-e*t+e;return{newCellsSpan:e,updatedSpan:o}}function In(i,t,e){const o=i.getAttribute("headingColumns")||0;if(o&&t.first<o){const n=Math.min(o-1,t.last)-t.first+1;e.setAttribute("headingColumns",o-n,i)}}function xn(i,{first:t,last:e},o){const n=i.getAttribute("headingRows")||0;if(t<n){const l=e<n?n-(e-t+1):t;y("headingRows",l,i,o,0)}}function kn(i,{first:t,last:e}){const o=new Map,n=[];for(const{row:l,column:s,cellHeight:r,cell:a}of new T(i,{endRow:e})){const d=l+r-1;if(l>=t&&l<=e&&d>e){const h=e-l+1,m=r-h;o.set(s,{cell:a,rowspan:m})}if(l<t&&d>=t){let h;d>=e?h=e-t+1:h=d-t+1,n.push({cell:a,rowspan:r-h})}}return{cellsToMove:o,cellsToTrim:n}}function Vn(i,t,e,o){const l=[...new T(i,{includeAllSlots:!0,row:t})],s=i.getChild(t);let r;for(const{column:a,cell:d,isAnchor:c}of l)if(e.has(a)){const{cell:u,rowspan:h}=e.get(a),m=r?o.createPositionAfter(r):o.createPositionAt(s,0);o.move(o.createRangeOn(u),m),y("rowspan",h,u,o),r=u}else c&&(r=d)}function Pn(i,t){const e=i.start,o=t.start;return e.isBefore(o)?-1:1}function En(i,t){const e=Array.from(i.values()),o=Array.from(t.values()),n=Math.max(...e),l=Math.min(...e),s=Math.max(...o),r=Math.min(...o);return(n-l+1)*(s-r+1)}class Wn extends S{refresh(){const t=this.editor.plugins.get(A),e=t.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=t.isSelectionRectangular(e)}execute(){const t=this.editor.model,e=this.editor.plugins.get(A);t.change(o=>{const n=e.getSelectedTableCells(t.document.selection),l=n.shift(),{mergeWidth:s,mergeHeight:r}=Bn(l,n,e);y("colspan",s,l,o),y("rowspan",r,l,o);for(const d of n)Ln(d,l,o);const a=l.findAncestor("table");Me(a,e),o.setSelection(l,"in")})}}function Ln(i,t,e){it(i)||(it(t)&&e.remove(e.createRangeIn(t)),e.move(e.createRangeIn(i),e.createPositionAt(t,"end"))),e.remove(i)}function it(i){const t=i.getChild(0);return i.childCount==1&&t.is("element","paragraph")&&t.isEmpty}function Bn(i,t,e){let o=0,n=0;for(const d of t){const{row:c,column:u}=e.getCellLocation(d);o=st(d,u,o,"colspan"),n=st(d,c,n,"rowspan")}const{row:l,column:s}=e.getCellLocation(i),r=o-s,a=n-l;return{mergeWidth:r,mergeHeight:a}}function st(i,t,e,o){const n=parseInt(i.getAttribute(o)||"1");return Math.max(e,t+n)}class Dn extends S{constructor(t){super(t),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const t=this.editor.model,e=this.editor.plugins.get("TableUtils"),o=e.getSelectionAffectedTableCells(t.document.selection),n=e.getRowIndexes(o),l=o[0].findAncestor("table"),s=[];for(let r=n.first;r<=n.last;r++)for(const a of l.getChild(r).getChildren())s.push(t.createRangeOn(a));t.change(r=>{r.setSelection(s)})}}class Fn extends S{constructor(t){super(t),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const t=this.editor.plugins.get("TableUtils"),e=this.editor.model,o=t.getSelectionAffectedTableCells(e.document.selection),n=o[0],l=o.pop(),s=n.findAncestor("table"),r=t.getCellLocation(n),a=t.getCellLocation(l),d=Math.min(r.column,a.column),c=Math.max(r.column,a.column),u=[];for(const h of new T(s,{startColumn:d,endColumn:c}))u.push(e.createRangeOn(h.cell));e.change(h=>{h.setSelection(u)})}}function Nn(i){i.document.registerPostFixer(t=>Mn(t,i))}function Mn(i,t){const e=t.document.differ.getChanges();let o=!1;const n=new Set;for(const l of e){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")),$n(l)&&(s=l.range.start.findAncestor("table")),s&&!n.has(s)&&(o=On(s,i)||o,o=zn(s,i)||o,n.add(s))}return o}function On(i,t){let e=!1;const o=Hn(i);if(o.length){e=!0;for(const n of o)y("rowspan",n.rowspan,n.cell,t,1)}return e}function zn(i,t){let e=!1;const o=Un(i),n=[];for(const[a,d]of o.entries())!d&&i.getChild(a).is("element","tableRow")&&n.push(a);if(n.length){e=!0;for(const a of n.reverse())t.remove(i.getChild(a)),o.splice(a,1)}const l=o.filter((a,d)=>i.getChild(d).is("element","tableRow")),s=l[0];if(!l.every(a=>a===s)){const a=l.reduce((d,c)=>c>d?c:d,0);for(const[d,c]of l.entries()){const u=a-c;if(u){for(let h=0;h<u;h++)z(t,t.createPositionAt(i.getChild(d),"end"));e=!0}}}return e}function Hn(i){const t=parseInt(i.getAttribute("headingRows")||"0"),e=Array.from(i.getChildren()).reduce((n,l)=>l.is("element","tableRow")?n+1:n,0),o=[];for(const{row:n,cell:l,cellHeight:s}of new T(i)){if(s<2)continue;const a=n<t?t:e;if(n+s>a){const d=a-n;o.push({cell:l,rowspan:d})}}return o}function Un(i){const t=new Array(i.childCount).fill(0);for(const{rowIndex:e}of new T(i,{includeAllSlots:!0}))t[e]++;return t}function $n(i){if(i.type!=="attribute")return!1;const t=i.attributeKey;return t==="headingRows"||t==="colspan"||t==="rowspan"}/**
|
|
11
11
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
12
12
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
13
|
-
*/function Gn(i){i.document.registerPostFixer(t=>jn(t,i))}function jn(i,t){const e=t.document.differ.getChanges();let o=!1;for(const n of e)n.type=="insert"&&n.name=="table"&&(o=Kn(n.position.nodeAfter,i)||o),n.type=="insert"&&n.name=="tableRow"&&(o=Ht(n.position.nodeAfter,i)||o),n.type=="insert"&&n.name=="tableCell"&&(o=xe(n.position.nodeAfter,i)||o),(n.type=="remove"||n.type=="insert")&&qn(n)&&(o=xe(n.position.parent,i)||o);return o}function Kn(i,t){let e=!1;for(const o of i.getChildren())o.is("element","tableRow")&&(e=Ht(o,t)||e);return e}function Ht(i,t){let e=!1;for(const o of i.getChildren())e=xe(o,t)||e;return e}function xe(i,t){if(i.childCount==0)return t.insertElement("paragraph",i),!0;const e=Array.from(i.getChildren()).filter(o=>o.is("$text"));for(const o of e)t.wrap(t.createRangeOn(o),"paragraph");return!!e.length}function qn(i){return i.position.parent.is("element","tableCell")?i.type=="insert"&&i.name=="$text"||i.type=="remove":!1}function Xn(i,t){const e=i.document.differ;for(const o of e.getChanges()){let n,l=!1;if(o.type=="attribute"){const d=o.range.start.nodeAfter;if(!d||!d.is("element","table")||o.attributeKey!="headingRows"&&o.attributeKey!="headingColumns")continue;n=d,l=o.attributeKey=="headingRows"}else(o.name=="tableRow"||o.name=="tableCell")&&(n=o.position.findAncestor("table"),l=o.name=="tableRow");if(!n)continue;const s=n.getAttribute("headingRows")||0,r=n.getAttribute("headingColumns")||0,a=new T(n);for(const d of a){const u=d.row<s||d.column<r?"th":"td",h=t.mapper.toViewElement(d.cell);h&&h.is("element")&&h.name!=u&&t.reconvertItem(l?d.cell.parent:d.cell)}}}function Jn(i,t){const e=i.document.differ,o=new Set;for(const n of e.getChanges()){const l=n.type=="attribute"?n.range.start.parent:n.position.parent;l.is("element","tableCell")&&o.add(l)}for(const n of o.values()){const l=Array.from(n.getChildren()).filter(s=>Yn(s,t.mapper));for(const s of l)t.reconvertItem(s)}}function Yn(i,t){if(!i.is("element","paragraph"))return!1;const e=t.toViewElement(i);return e?Pt(i)!==e.is("element","span"):!1}class Z extends v{constructor(e){super(e);g(this,"_additionalSlots");this._additionalSlots=[]}static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[A]}init(){const e=this.editor,o=e.model,n=o.schema,l=e.conversion,s=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}),l.for("upcast").add(Go()),l.for("upcast").add(jo()),l.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Je(s,{asWidget:!0,additionalSlots:this._additionalSlots})}),l.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Je(s,{additionalSlots:this._additionalSlots})}),l.for("upcast").elementToElement({model:"tableRow",view:"tr"}),l.for("upcast").add(Ko()),l.for("downcast").elementToElement({model:"tableRow",view:Zo()}),l.for("upcast").elementToElement({model:"tableCell",view:"td"}),l.for("upcast").elementToElement({model:"tableCell",view:"th"}),l.for("upcast").add(Xe("td")),l.for("upcast").add(Xe("th")),l.for("editingDowncast").elementToElement({model:"tableCell",view:Ye({asWidget:!0})}),l.for("dataDowncast").elementToElement({model:"tableCell",view:Ye()}),l.for("editingDowncast").elementToElement({model:"paragraph",view:Ze({asWidget:!0}),converterPriority:"high"}),l.for("dataDowncast").elementToElement({model:"paragraph",view:Ze(),converterPriority:"high"}),l.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),l.for("upcast").attributeToAttribute({model:{key:"colspan",value:rt("colspan")},view:"colspan"}),l.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),l.for("upcast").attributeToAttribute({model:{key:"rowspan",value:rt("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new tn(e)),e.commands.add("insertTableRowAbove",new Qe(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Qe(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new et(e,{order:"left"})),e.commands.add("insertTableColumnRight",new et(e,{order:"right"})),e.commands.add("removeTableRow",new an(e)),e.commands.add("removeTableColumn",new dn(e)),e.commands.add("splitTableCellVertically",new tt(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new tt(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Wn(e)),e.commands.add("mergeTableCellRight",new Q(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Q(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Q(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Q(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new gn(e)),e.commands.add("setTableRowHeader",new mn(e)),e.commands.add("selectTableRow",new Dn(e)),e.commands.add("selectTableColumn",new Fn(e)),Nn(o),Gn(o),this.listenTo(o.document,"change:data",()=>{Xn(o,e.editing),Jn(o,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function rt(i){return t=>{const e=parseInt(t.getAttribute(i));return Number.isNaN(e)||e<=0?null:e}}class at extends O{constructor(e){super(e);g(this,"items");g(this,"keystrokes");g(this,"focusTracker");const o=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new be,this.focusTracker=new fe,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(n,l)=>`${l} × ${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":o.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:o.to("label")}]}],on:{mousedown:o.to(n=>{n.preventDefault()}),click:o.to(()=>{this.fire("execute")})}}),this.on("boxover",(n,l)=>{const{row:s,column:r}=l.target.dataset;this.items.get((parseInt(s,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(n,l,s)=>{if(!s)return;const{row:r,column:a}=s.dataset;this.set({rows:parseInt(r),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Lo({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,o=this.columns;this.items.map((n,l)=>{const s=Math.floor(l/10),r=l%10,a=s<e&&r<o;n.set("isOn",a)})}_createGridButton(e,o,n,l){const s=new E(e);return s.set({label:l,class:"ck-insert-table-dropdown-grid-box"}),s.extendTemplate({attributes:{"data-row":o,"data-column":n}}),s}_createGridCollection(){const e=[];for(let o=0;o<100;o++){const n=Math.floor(o/10),l=o%10,s=`${n+1} × ${l+1}`;e.push(this._createGridButton(this.locale,n+1,l+1,s))}return this.createCollection(e)}}class Zn extends v{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t,n=t.locale.contentLanguageDirection==="ltr";t.ui.componentFactory.add("insertTable",l=>{const s=t.commands.get("insertTable"),r=oe(l);r.bind("isEnabled").to(s),r.buttonView.set({icon:je,label:e("Insert table"),tooltip:!0});let a;return r.on("change:isOpen",()=>{a||(a=new at(l),r.panelView.children.add(a),a.delegate("execute").to(r),r.on("execute",()=>{t.execute("insertTable",{rows:a.rows,columns:a.columns}),t.editing.view.focus()}))}),r}),t.ui.componentFactory.add("menuBar:insertTable",l=>{const s=t.commands.get("insertTable"),r=new Po(l),a=new at(l);return a.delegate("execute").to(r),r.on("change:isOpen",(d,c,u)=>{u||a.reset()}),a.on("execute",()=>{t.execute("insertTable",{rows:a.rows,columns:a.columns}),t.editing.view.focus()}),r.buttonView.set({label:e("Table"),icon:je}),r.panelView.children.add(a),r.bind("isEnabled").to(s),r}),t.ui.componentFactory.add("tableColumn",l=>{const s=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:e("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:e("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:e("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:e("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:e("Select column")}}];return this._prepareDropdown(e("Column"),bo,s,l)}),t.ui.componentFactory.add("tableRow",l=>{const s=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:e("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:e("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:e("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:e("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:e("Select row")}}];return this._prepareDropdown(e("Row"),fo,s,l)}),t.ui.componentFactory.add("mergeTableCells",l=>{const s=[{type:"button",model:{commandName:"mergeTableCellUp",label:e("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:e("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:e("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:e("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:e("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:e("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(e("Merge cells"),po,s,l)})}_prepareDropdown(t,e,o,n){const l=this.editor,s=oe(n),r=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:t,icon:e,tooltip:!0}),s.bind("isEnabled").toMany(r,"isEnabled",(...a)=>a.some(d=>d)),this.listenTo(s,"execute",a=>{l.execute(a.source.commandName),a.source instanceof Eo||l.editing.view.focus()}),s}_prepareMergeSplitButtonDropdown(t,e,o,n){const l=this.editor,s=oe(n,Wo),r="mergeTableCells",a=l.commands.get(r),d=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:t,icon:e,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([a,...d],"isEnabled",(...c)=>c.some(u=>u)),this.listenTo(s.buttonView,"execute",()=>{l.execute(r),l.editing.view.focus()}),this.listenTo(s,"execute",c=>{l.execute(c.source.commandName),l.editing.view.focus()}),s}_fillDropdownWithListOptions(t,e){const o=this.editor,n=[],l=new Ct;for(const s of e)Qn(s,o,n,l);return Be(t,l),n}}function Qn(i,t,e,o){if(i.type==="button"||i.type==="switchbutton"){const n=i.model=new vt(i.model),{commandName:l,bindIsOn:s}=i.model,r=t.commands.get(l);e.push(r),n.set({commandName:l}),n.bind("isEnabled").to(r),s&&n.bind("isOn").to(r,"value"),n.set({withText:!0})}o.add(i)}class F extends v{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[A,A]}init(){const t=this.editor,e=t.model,o=t.editing.view;this.listenTo(e,"deleteContent",(n,l)=>this._handleDeleteContent(n,l),{priority:"high"}),this.listenTo(o.document,"insertText",(n,l)=>this._handleInsertTextEvent(n,l),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const t=this.editor.plugins.get(A),e=this.editor.model.document.selection,o=t.getSelectedTableCells(e);return o.length==0?null:o}getSelectionAsFragment(){const t=this.editor.plugins.get(A),e=this.getSelectedTableCells();return e?this.editor.model.change(o=>{const n=o.createDocumentFragment(),{first:l,last:s}=t.getColumnIndexes(e),{first:r,last:a}=t.getRowIndexes(e),d=e[0].findAncestor("table");let c=a,u=s;if(t.isSelectionRectangular(e)){const p={firstColumn:l,lastColumn:s,firstRow:r,lastRow:a};c=Nt(d,p),u=Mt(d,p)}const m=Et(d,{startRow:r,startColumn:l,endRow:c,endColumn:u},o);return o.insert(m,n,0),n}):null}setCellSelection(t,e){const o=this._getCellsToSelect(t,e);this.editor.model.change(n=>{n.setSelection(o.cells.map(l=>n.createRangeOn(l)),{backward:o.backward})})}getFocusCell(){const o=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return o&&o.is("element","tableCell")?o:null}getAnchorCell(){const t=this.editor.model.document.selection,o=Le(t.getRanges()).getContainedElement();return o&&o.is("element","tableCell")?o:null}_defineSelectionConverter(){const t=this.editor,e=new Set;t.conversion.for("editingDowncast").add(n=>n.on("selection",(l,s,r)=>{const a=r.writer;o(a);const d=this.getSelectedTableCells();if(!d)return;for(const u of d){const h=r.mapper.toViewElement(u);a.addClass("ck-editor__editable_selected",h),e.add(h)}const c=r.mapper.toViewElement(d[d.length-1]);a.setSelection(c,0)},{priority:"lowest"}));function o(n){for(const l of e)n.removeClass("ck-editor__editable_selected",l);e.clear()}}_enablePluginDisabling(){const t=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const e=this.getSelectedTableCells();if(!e)return;t.model.change(o=>{const n=o.createPositionAt(e[0],0),l=t.model.schema.getNearestSelectionRange(n);o.setSelection(l)})}})}_handleDeleteContent(t,e){const o=this.editor.plugins.get(A),n=e[0],l=e[1],s=this.editor.model,r=!l||l.direction=="backward",a=o.getSelectedTableCells(n);a.length&&(t.stop(),s.change(d=>{const c=a[r?a.length-1:0];s.change(h=>{for(const m of a)s.deleteContent(h.createSelection(m,"in"))});const u=s.schema.getNearestSelectionRange(d.createPositionAt(c,0));n.is("documentSelection")?d.setSelection(u):n.setTo(u)}))}_handleInsertTextEvent(t,e){const o=this.editor,n=this.getSelectedTableCells();if(!n)return;const l=o.editing.view,s=o.editing.mapper,r=n.map(a=>l.createRangeOn(s.toViewElement(a)));e.selection=l.createSelection(r),e.preventDefault()}_getCellsToSelect(t,e){const o=this.editor.plugins.get("TableUtils"),n=o.getCellLocation(t),l=o.getCellLocation(e),s=Math.min(n.row,l.row),r=Math.max(n.row,l.row),a=Math.min(n.column,l.column),d=parseInt(e.getAttribute("colspan")||"1")-1,c=Math.max(n.column,l.column+d),u=new Array(r-s+1).fill(null).map(()=>[]),h={startRow:s,endRow:r,startColumn:a,endColumn:c};for(const{row:b,cell:w}of new T(t.findAncestor("table"),h))u[b-s].push(w);const m=l.row<n.row,p=l.column<n.column;return m&&u.reverse(),p&&u.forEach(b=>b.reverse()),{cells:u.flat(),backward:m||p}}}class el extends v{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Ce,Ke,F,A]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"copy",(o,n)=>this._onCopyCut(o,n)),this.listenTo(e,"cut",(o,n)=>this._onCopyCut(o,n)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell")}_listenToContentInsertion(){const{editor:t}=this,e=t.plugins.get(Ke),o=t.plugins.get(F);let n=!1;e.on("contentInsertion",(l,s)=>{n=s.method==="paste"}),this.listenTo(t.model,"insertContent",(l,[s,r])=>{(n||o.getSelectedTableCells()!==null)&&this._onInsertContent(l,s,r)},{priority:"high"}),e.on("contentInsertion",()=>{n=!1},{priority:"lowest"})}_onCopyCut(t,e){const o=this.editor.editing.view,n=this.editor.plugins.get(F),l=this.editor.plugins.get(Ce);n.getSelectedTableCells()&&(t.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(e.preventDefault(),t.stop(),this.editor.model.enqueueChange({isUndoable:t.name==="cut"},()=>{const s=l._copySelectedFragmentWithMarkers(t.name,this.editor.model.document.selection,()=>n.getSelectionAsFragment());o.document.fire("clipboardOutput",{dataTransfer:e.dataTransfer,content:this.editor.data.toView(s),method:t.name})})))}_onInsertContent(t,e,o){if(o&&!o.is("documentSelection"))return;const n=this.editor.model,l=this.editor.plugins.get(A),s=this.editor.plugins.get(Ce),r=this.getTableIfOnlyTableInContent(e,n);if(!r)return;const a=l.getSelectionAffectedTableCells(n.document.selection);if(!a.length){Me(r,l);return}t.stop(),e.is("documentFragment")?s._pasteMarkersIntoTransformedElement(e.markers,d=>this._replaceSelectedCells(r,a,d)):this.editor.model.change(d=>{this._replaceSelectedCells(r,a,d)})}_replaceSelectedCells(t,e,o){const n=this.editor.plugins.get(A),l={width:n.getColumns(t),height:n.getRows(t)},s=tl(e,l,o,n),r=s.lastRow-s.firstRow+1,a=s.lastColumn-s.firstColumn+1,d={startRow:0,startColumn:0,endRow:Math.min(r,l.height)-1,endColumn:Math.min(a,l.width)-1};t=Et(t,d,o);const c=e[0].findAncestor("table"),u=this._replaceSelectedCellsWithPasted(t,l,c,s,o);if(this.editor.plugins.get("TableSelection").isEnabled){const h=n.sortRanges(u.map(m=>o.createRangeOn(m)));o.setSelection(h)}else o.setSelection(u[0],0);return c}_replaceSelectedCellsWithPasted(t,e,o,n,l){const{width:s,height:r}=e,a=nl(t,s,r),d=[...new T(o,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:!0})],c=[];let u;for(const w of d){const{row:f,column:C}=w;C===n.firstColumn&&(u=w.getPositionBefore());const _=f-n.firstRow,R=C-n.firstColumn,V=a[_%r][R%s],P=V?l.cloneElement(V):null,G=this._replaceTableSlotCell(w,P,u,l);G&&(Ft(G,f,C,n.lastRow,n.lastColumn,l),c.push(G),u=l.createPositionAfter(G))}const h=parseInt(o.getAttribute("headingRows")||"0"),m=parseInt(o.getAttribute("headingColumns")||"0"),p=n.firstRow<h&&h<=n.lastRow,b=n.firstColumn<m&&m<=n.lastColumn;if(p){const w={first:n.firstColumn,last:n.lastColumn},f=ke(o,h,w,l,n.firstRow);c.push(...f)}if(b){const w={first:n.firstRow,last:n.lastRow},f=Ve(o,m,w,l);c.push(...f)}return c}_replaceTableSlotCell(t,e,o,n){const{cell:l,isAnchor:s}=t;return s&&n.remove(l),e?(n.insert(e,o),e):null}getTableIfOnlyTableInContent(t,e){if(!t.is("documentFragment")&&!t.is("element"))return null;if(t.is("element","table"))return t;if(t.childCount==1&&t.getChild(0).is("element","table"))return t.getChild(0);const o=e.createRangeIn(t);for(const n of o.getItems())if(n.is("element","table")){const l=e.createRange(o.start,e.createPositionBefore(n));if(e.hasContent(l,{ignoreWhitespaces:!0}))return null;const s=e.createRange(e.createPositionAfter(n),o.end);return e.hasContent(s,{ignoreWhitespaces:!0})?null:n}return null}}function tl(i,t,e,o){const n=i[0].findAncestor("table"),l=o.getColumnIndexes(i),s=o.getRowIndexes(i),r={firstColumn:l.first,lastColumn:l.last,firstRow:s.first,lastRow:s.last},a=i.length===1;return a&&(r.lastRow+=t.height-1,r.lastColumn+=t.width-1,ol(n,r.lastRow+1,r.lastColumn+1,o)),a||!o.isSelectionRectangular(i)?ll(n,r,e):(r.lastRow=Nt(n,r),r.lastColumn=Mt(n,r)),r}function ol(i,t,e,o){const n=o.getColumns(i),l=o.getRows(i);e>n&&o.insertColumns(i,{at:n,columns:e-n}),t>l&&o.insertRows(i,{at:l,rows:t-l})}function nl(i,t,e){const o=new Array(e).fill(null).map(()=>new Array(t).fill(null));for(const{column:n,row:l,cell:s}of new T(i))o[l][n]=s;return o}function ll(i,t,e){const{firstRow:o,lastRow:n,firstColumn:l,lastColumn:s}=t,r={first:o,last:n},a={first:l,last:s};Ve(i,l,r,e),Ve(i,s+1,r,e),ke(i,o,a,e),ke(i,n+1,a,e,o)}function ke(i,t,e,o,n=0){return t<1?void 0:Wt(i,t,n).filter(({column:r,cellWidth:a})=>Ut(r,a,e)).map(({cell:r})=>Lt(r,t,o))}function Ve(i,t,e,o){return t<1?void 0:Bt(i,t).filter(({row:s,cellHeight:r})=>Ut(s,r,e)).map(({cell:s,column:r})=>Dt(s,r,t,o))}function Ut(i,t,e){const o=i+t-1,{first:n,last:l}=e,s=i>=n&&i<=l,r=i<n&&o>=n;return s||r}class il extends v{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[F,A]}init(){const t=this.editor,o=t.editing.view.document,n=t.t;this.listenTo(o,"arrowKey",(...l)=>this._onArrowKey(...l),{context:"table"}),this.listenTo(o,"tab",(...l)=>this._handleTabOnSelectedTable(...l),{context:"figure"}),this.listenTo(o,"tab",(...l)=>this._handleTab(...l),{context:["th","td"]}),t.accessibility.addKeystrokeInfoGroup({id:"table",label:n("Keystrokes that can be used in a table cell"),keystrokes:[{label:n("Move the selection to the next cell"),keystroke:"Tab"},{label:n("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:n("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:n("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(t,e){const o=this.editor,l=o.model.document.selection.getSelectedElement();!l||!l.is("element","table")||(e.preventDefault(),e.stopPropagation(),t.stop(),o.model.change(s=>{s.setSelection(s.createRangeIn(l.getChild(0).getChild(0)))}))}_handleTab(t,e){const o=this.editor,n=this.editor.plugins.get(A),l=this.editor.plugins.get("TableSelection"),s=o.model.document.selection,r=!e.shiftKey;let a=n.getTableCellsContainingSelection(s)[0];if(a||(a=l.getFocusCell()),!a)return;e.preventDefault(),e.stopPropagation(),t.stop();const d=a.parent,c=d.parent,u=c.getChildIndex(d),h=d.getChildIndex(a),m=h===0;if(!r&&m&&u===0){o.model.change(f=>{f.setSelection(f.createRangeOn(c))});return}const p=h===d.childCount-1,b=u===n.getRows(c)-1;if(r&&b&&p&&(o.execute("insertTableRowBelow"),u===n.getRows(c)-1)){o.model.change(f=>{f.setSelection(f.createRangeOn(c))});return}let w;if(r&&p)w=c.getChild(u+1).getChild(0);else if(!r&&m){const f=c.getChild(u-1);w=f.getChild(f.childCount-1)}else w=d.getChild(h+(r?1:-1));o.model.change(f=>{f.setSelection(f.createRangeIn(w))})}_onArrowKey(t,e){const o=this.editor,n=e.keyCode,l=ho(n,o.locale.contentLanguageDirection);this._handleArrowKeys(l,e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),t.stop())}_handleArrowKeys(t,e){const o=this.editor.plugins.get(A),n=this.editor.plugins.get("TableSelection"),l=this.editor.model,s=l.document.selection,r=["right","down"].includes(t),a=o.getSelectedTableCells(s);if(a.length){let c;return e?c=n.getFocusCell():c=r?a[a.length-1]:a[0],this._navigateFromCellInDirection(c,t,e),!0}const d=s.focus.findAncestor("tableCell");/* istanbul ignore if: paranoid check -- @preserve */if(!d)return!1;if(!s.isCollapsed)if(e){if(s.isBackward==r&&!s.containsEntireContent(d))return!1}else{const c=s.getSelectedElement();if(!c||!l.schema.isObject(c))return!1}return this._isSelectionAtCellEdge(s,d,r)?(this._navigateFromCellInDirection(d,t,e),!0):!1}_isSelectionAtCellEdge(t,e,o){const n=this.editor.model,l=this.editor.model.schema,s=o?t.getLastPosition():t.getFirstPosition();if(!l.getLimitElement(s).is("element","tableCell"))return n.createPositionAt(e,o?"end":0).isTouching(s);const r=n.createSelection(s);return n.modifySelection(r,{direction:o?"forward":"backward"}),s.isEqual(r.focus)}_navigateFromCellInDirection(t,e,o=!1){const n=this.editor.model,l=t.findAncestor("table"),s=[...new T(l,{includeAllSlots:!0})],{row:r,column:a}=s[s.length-1],d=s.find(({cell:C})=>C==t);let{row:c,column:u}=d;switch(e){case"left":u--;break;case"up":c--;break;case"right":u+=d.cellWidth;break;case"down":c+=d.cellHeight;break}const h=c<0||c>r,m=u<0&&c<=0,p=u>a&&c>=r;if(h||m||p){n.change(C=>{C.setSelection(C.createRangeOn(l))});return}u<0?(u=o?0:a,c--):u>a&&(u=o?a:0,c++);const b=s.find(C=>C.row==c&&C.column==u).cell,w=["right","down"].includes(e),f=this.editor.plugins.get("TableSelection");if(o&&f.isEnabled){const C=f.getAnchorCell()||t;f.setCellSelection(C,b)}else{const C=n.createPositionAt(b,w?0:"end");n.change(_=>{_.setSelection(C)})}}}class $t extends Oo{constructor(){super(...arguments);g(this,"domEventType",["mousemove","mouseleave"])}onDomEvent(e){this.fire(e.type,e)}}class sl extends v{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[F,A]}init(){this.editor.editing.view.addObserver($t),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const t=this.editor,e=t.plugins.get(A);let o=!1;const n=t.plugins.get(F);this.listenTo(t.editing.view.document,"mousedown",(l,s)=>{const r=t.model.document.selection;if(!this.isEnabled||!n.isEnabled||!s.domEvent.shiftKey)return;const a=n.getAnchorCell()||e.getTableCellsContainingSelection(r)[0];if(!a)return;const d=this._getModelTableCellFromDomEvent(s);d&&ct(a,d)&&(o=!0,n.setCellSelection(a,d),s.preventDefault())}),this.listenTo(t.editing.view.document,"mouseup",()=>{o=!1}),this.listenTo(t.editing.view.document,"selectionChange",l=>{o&&l.stop()},{priority:"highest"})}_enableMouseDragSelection(){const t=this.editor;let e,o,n=!1,l=!1;const s=t.plugins.get(F);this.listenTo(t.editing.view.document,"mousedown",(r,a)=>{!this.isEnabled||!s.isEnabled||a.domEvent.shiftKey||a.domEvent.ctrlKey||a.domEvent.altKey||(e=this._getModelTableCellFromDomEvent(a))}),this.listenTo(t.editing.view.document,"mousemove",(r,a)=>{if(!a.domEvent.buttons||!e)return;const d=this._getModelTableCellFromDomEvent(a);d&&ct(e,d)&&(o=d,!n&&o!=e&&(n=!0)),n&&(l=!0,s.setCellSelection(e,o),a.preventDefault())}),this.listenTo(t.editing.view.document,"mouseup",()=>{n=!1,l=!1,e=null,o=null}),this.listenTo(t.editing.view.document,"selectionChange",r=>{l&&r.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(t){const e=t.target,o=this.editor.editing.view.createPositionAt(e,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function ct(i,t){return i.parent.parent==t.parent.parent}class ui extends v{static get requires(){return[Z,Zn,F,sl,il,el,ao]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}function ue(i){const t=Gt(i);return t||pe(i)}function Gt(i){const t=i.getSelectedElement();return t&&jt(t)?t:null}function pe(i){const t=i.getFirstPosition();if(!t)return null;let e=t.parent;for(;e;){if(e.is("element")&&jt(e))return e;e=e.parent}return null}function jt(i){return!!i.getCustomProperty("table")&&co(i)}class hi extends v{static get requires(){return[$e]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const t=this.editor,e=t.t,o=t.plugins.get($e),n=t.config.get("table.contentToolbar"),l=t.config.get("table.tableToolbar");n&&o.register("tableContent",{ariaLabel:e("Table toolbar"),items:n,getRelatedElement:pe}),l&&o.register("table",{ariaLabel:e("Table toolbar"),items:l,getRelatedElement:Gt})}}class rl extends O{constructor(e,o){super(e);g(this,"options");g(this,"focusTracker");g(this,"focusCycler");g(this,"_focusables");g(this,"dropdownView");g(this,"inputView");g(this,"keystrokes");g(this,"_stillTyping");this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=o,this.focusTracker=new fe,this._focusables=new De,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new be,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,l,s)=>this._setInputValue(s))}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,o=e.t,n=this.bindTemplate,l=this._createColorSelector(e),s=oe(e),r=new O;return r.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",a=>a!="")]}}]}),s.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),s.buttonView.children.add(r),s.buttonView.label=o("Color picker"),s.buttonView.tooltip=!0,s.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",s.panelView.children.add(l),s.bind("isEnabled").to(this,"isReadOnly",a=>!a),s.on("change:isOpen",(a,d,c)=>{c&&(l.updateSelectedColors(),l.showColorGridsFragment())}),s}_createInputTextView(){const e=this.locale,o=new Bo(e);return o.extendTemplate({on:{blur:o.bindTemplate.to("blur")}}),o.value=this.value,o.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(o),o.on("input",()=>{const n=o.element.value,l=this.options.colorDefinitions.find(s=>n===s.label);this._stillTyping=!0,this.value=l&&l.color||n}),o.on("blur",()=>{this._stillTyping=!1,this._setInputValue(o.element.value)}),o.delegate("input").to(this),o}_createColorSelector(e){const o=e.t,n=this.options.defaultColorValue||"",l=o(n?"Restore default":"Remove color"),s=new Do(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:l,colorPickerLabel:o("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig===!1?!1:{...this.options.colorPickerConfig,hideInput:!0}});s.appendUI(),s.on("execute",(a,d)=>{if(d.source==="colorPickerSaveButton"){this.dropdownView.isOpen=!1;return}this.value=d.value||n,this.fire("input"),d.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)});let r=this.value;return s.on("colorPicker:cancel",()=>{this.value=r,this.fire("input"),this.dropdownView.isOpen=!1}),s.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{r=this.value}),s.bind("selectedColor").to(this,"value"),s}_setInputValue(e){if(!this._stillTyping){const o=dt(e),n=this.options.colorDefinitions.find(l=>o===dt(l.color));n?this.inputView.value=n.label:this.inputView.value=e||""}}}function dt(i){return i.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const ze=i=>i==="";function He(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 Kt(i){return i('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function qt(i){return i('The value is invalid. Try "10px" or "2em" or simply "2".')}function he(i){return i=i.trim().toLowerCase(),ze(i)||zo(i)}function q(i){return i=i.trim(),ze(i)||Yt(i)||kt(i)||Ho(i)}function Xt(i){return i=i.trim(),ze(i)||Yt(i)||kt(i)}function Jt(i,t){const e=new Ct,o=He(i.t);for(const n in o){const l={type:"button",model:new vt({_borderStyleValue:n,label:o[n],role:"menuitemradio",withText:!0})};n==="none"?l.model.bind("isOn").to(i,"borderStyle",s=>t==="none"?!s:s===n):l.model.bind("isOn").to(i,"borderStyle",s=>s===n),e.add(l)}return e}function Pe(i){const{view:t,icons:e,toolbar:o,labels:n,propertyName:l,nameToValue:s,defaultValue:r}=i;for(const a in n){const d=new E(t.locale);d.set({role:"radio",isToggleable:!0,label:n[a],icon:e[a],tooltip:n[a]});const c=s?s(a):a;d.bind("isOn").to(t,l,u=>{let h=u;return u===""&&r&&(h=r),c===h}),d.on("execute",()=>{!r&&c&&t[l]===c?t[l]=void 0:t[l]=c}),o.items.add(d)}}const me=[{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 ge(i){return(t,e,o)=>{const n=new rl(t.locale,{colorDefinitions:al(i.colorConfig),columns:i.columns,defaultColorValue:i.defaultColorValue,colorPickerConfig:i.colorPickerConfig});return n.inputView.set({id:e,ariaDescribedById:o}),n.bind("isReadOnly").to(t,"isEnabled",l=>!l),n.bind("hasError").to(t,"errorText",l=>!!l),n.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(n),n}}function Yt(i){const t=parseFloat(i);return!Number.isNaN(t)&&i===String(t)}function al(i){return i.map(t=>({color:t.model,label:t.label,options:{hasBorder:t.hasBorder}}))}class cl extends O{constructor(e,o){super(e);g(this,"options");g(this,"focusTracker");g(this,"keystrokes");g(this,"children");g(this,"borderStyleDropdown");g(this,"borderWidthInput");g(this,"borderColorInput");g(this,"backgroundInput");g(this,"paddingInput");g(this,"widthInput");g(this,"heightInput");g(this,"horizontalAlignmentToolbar");g(this,"verticalAlignmentToolbar");g(this,"saveButtonView");g(this,"cancelButtonView");g(this,"_focusables");g(this,"_focusCycler");this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=o;const{borderStyleDropdown:n,borderWidthInput:l,borderColorInput:s,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:d}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{horizontalAlignmentToolbar:p,verticalAlignmentToolbar:b,alignmentLabel:w}=this._createAlignmentFields();this.focusTracker=new fe,this.keystrokes=new be,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=l,this.borderColorInput=s,this.backgroundInput=d,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=h,this.horizontalAlignmentToolbar=p,this.verticalAlignmentToolbar=b;const{saveButtonView:f,cancelButtonView:C}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=C,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 At(e,{label:this.t("Cell properties")})),this.children.add(new x(e,{labelView:r,children:[r,n,s,l],class:"ck-table-form__border-row"})),this.children.add(new x(e,{labelView:a,children:[a,d],class:"ck-table-form__background-row"})),this.children.add(new x(e,{children:[new x(e,{labelView:m,children:[m,c,u,h],class:"ck-table-form__dimensions-row"}),new x(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new x(e,{labelView:w,children:[w,p,b],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new x(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(),St({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,o={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=ge({colorConfig:this.options.borderColors,columns:5,defaultColorValue:o.color,colorPickerConfig:this.options.colorPickerConfig}),l=this.locale,s=this.t,r=s("Style"),a=new L(l);a.text=s("Border");const d=He(s),c=new k(l,Rt);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>d[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),Be(c.fieldView,Jt(this,o.style),{role:"menu",ariaLabel:r});const u=new k(l,M);u.set({label:s("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",ee),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});const h=new k(l,n);return h.set({label:s("Color"),class:"ck-table-form__border-color"}),h.fieldView.bind("value").to(this,"borderColor"),h.bind("isEnabled").to(this,"borderStyle",ee),h.fieldView.on("input",()=>{this.borderColor=h.fieldView.value}),this.on("change:borderStyle",(m,p,b,w)=>{ee(b)||(this.borderColor="",this.borderWidth=""),ee(w)||(this.borderColor=o.color,this.borderWidth=o.width)}),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:h,borderWidthInput:u}}_createBackgroundFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Background");const l=ge({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),s=new k(e,l);return s.set({label:o("Color"),class:"ck-table-cell-properties-form__background"}),s.fieldView.bind("value").to(this,"backgroundColor"),s.fieldView.on("input",()=>{this.backgroundColor=s.fieldView.value}),{backgroundRowLabel:n,backgroundInput:s}}_createDimensionFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Dimensions");const l=new k(e,M);l.set({label:o("Width"),class:"ck-table-form__dimensions-row__width"}),l.fieldView.bind("value").to(this,"width"),l.fieldView.on("input",()=>{this.width=l.fieldView.element.value});const s=new O(e);s.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new k(e,M);return r.set({label:o("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:n,widthInput:l,operatorLabel:s,heightInput:r}}_createPaddingField(){const e=this.locale,o=this.t,n=new k(e,M);return n.set({label:o("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,o=this.t,n=new L(e),l={left:Vo,center:ko,right:xo,justify:Io,top:Ro,middle:So,bottom:Ao};n.text=o("Table cell text alignment");const s=new _e(e),r=e.contentLanguageDirection==="rtl";s.set({isCompact:!0,role:"radiogroup",ariaLabel:o("Horizontal text alignment toolbar")}),Pe({view:this,icons:l,toolbar:s,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:d=>{if(r){if(d==="left")return"right";if(d==="right")return"left"}return d},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const a=new _e(e);return a.set({isCompact:!0,role:"radiogroup",ariaLabel:o("Vertical text alignment toolbar")}),Pe({view:this,icons:l,toolbar:a,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:s,verticalAlignmentToolbar:a,alignmentLabel:n}}_createActionButtons(){const e=this.locale,o=this.t,n=new E(e),l=new E(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:o("Save"),icon:Tt,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(s,"errorText",(...r)=>r.every(a=>!a)),l.set({label:o("Cancel"),icon:_t,class:"ck-button-cancel",withText:!0}),l.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:l}}get _horizontalAlignmentLabels(){const e=this.locale,o=this.t,n=o("Align cell text to the left"),l=o("Align cell text to the center"),s=o("Align cell text to the right"),r=o("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:s,center:l,left:n,justify:r}:{left:n,center:l,right:s,justify:r}}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 ee(i){return i!=="none"}const Ee=[N.defaultPositions.northArrowSouth,N.defaultPositions.northArrowSouthWest,N.defaultPositions.northArrowSouthEast,N.defaultPositions.southArrowNorth,N.defaultPositions.southArrowNorthWest,N.defaultPositions.southArrowNorthEast,N.defaultPositions.viewportStickyNorth];function Zt(i,t){const e=i.plugins.get("ContextualBalloon"),o=i.editing.view.document.selection;let n;t==="cell"?pe(o)&&(n=eo(i)):ue(o)&&(n=Qt(i)),n&&e.updatePosition(n)}function Qt(i){const t=i.model.document.selection,e=D(t),o=i.editing.mapper.toViewElement(e);return{target:i.editing.view.domConverter.mapViewToDom(o),positions:Ee}}function eo(i){const t=i.editing.mapper,e=i.editing.view.domConverter,o=i.model.document.selection;if(o.rangeCount>1)return{target:()=>dl(o.getRanges(),i),positions:Ee};const n=to(o.getFirstPosition()),l=t.toViewElement(n);return{target:e.mapViewToDom(l),positions:Ee}}function to(i){return i.nodeAfter&&i.nodeAfter.is("element","tableCell")?i.nodeAfter:i.findAncestor("tableCell")}function dl(i,t){const e=t.editing.mapper,o=t.editing.view.domConverter,n=Array.from(i).map(l=>{const s=to(l.start),r=e.toViewElement(s);return new re(o.mapViewToDom(r))});return re.getBoundingRect(n)}function H(i){if(!i||!$o(i))return i;const{top:t,right:e,bottom:o,left:n}=i;if(t==e&&e==o&&o==n)return t}function U(i,t){const e=parseFloat(i);return Number.isNaN(e)||String(e)!==String(i)?i:`${e}${t}`}function we(i,t={}){const e={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...i};return t.includeAlignmentProperty&&!e.alignment&&(e.alignment="center"),t.includePaddingProperty&&!e.padding&&(e.padding=""),t.includeVerticalAlignmentProperty&&!e.verticalAlignment&&(e.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!e.horizontalAlignment&&(e.horizontalAlignment=t.isRightToLeftContent?"right":"left"),e}function oo(i,t){return we({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...i},t)}function Ue(i,t){return we({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...i},t)}const ul=500,ut={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class hl extends v{constructor(e){super(e);g(this,"_defaultContentTableCellProperties");g(this,"_defaultLayoutTableCellProperties");g(this,"_balloon");g(this,"view");g(this,"_viewWithContentTableDefaults");g(this,"_viewWithLayoutTableDefaults");g(this,"_undoStepBatch");g(this,"_isReady");e.config.define("table.tableCellProperties",{borderColors:me,backgroundColors:me})}static get requires(){return[ae]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t;this._defaultContentTableCellProperties=Ue(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(ae),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",n=>{const l=new E(n);l.set({label:o("Cell properties"),icon:Co,tooltip:!0}),this.listenTo(l,"execute",()=>this._showView());const s=Object.values(ut).map(r=>e.commands.get(r));return l.bind("isEnabled").toMany(s,"isEnabled",(...r)=>r.some(a=>a)),l})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const o=this.editor,n=o.config.get("table.tableCellProperties"),l=ce(n.borderColors),s=de(o.locale,l),r=ce(n.backgroundColors),a=de(o.locale,r),d=n.colorPicker!==!1,c=new cl(o.locale,{borderColors:s,backgroundColors:a,defaultTableCellProperties:e,colorPickerConfig:d?n.colorPicker||{}:!1}),u=o.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&o.execute("undo",this._undoStepBatch),this._hideView()}),c.keystrokes.set("Esc",(p,b)=>{this._hideView(),b()}),yt({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const h=Kt(u),m=qt(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableCellBorderColor",errorText:h,validator:he})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableCellBorderWidth",errorText:m,validator:Xt})),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:h,validator:he})),c.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),c.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),c}_fillViewFormFromCommandValues(){const e=this.editor.commands,o=e.get("tableCellBorderStyle");Object.entries(ut).map(([n,l])=>{const s=n,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[s]||"":this._defaultLayoutTableCellProperties[s]||"";return[n,e.get(l).value||r]}).forEach(([n,l])=>{(n==="borderColor"||n==="borderWidth")&&o.value==="none"||this.view.set(n,l)}),this._isReady=!0}_showView(){const e=this.editor,o=ue(e.editing.view.document.selection),n=o&&e.editing.mapper.toModelElement(o),l=!n||n.getAttribute("tableType")!=="layout";l&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):!l&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=l?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:eo(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,o=e.editing.view.document;pe(o.selection)?this._isViewVisible&&Zt(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(o,n,l)=>{this._isReady&&this.editor.execute(e,{value:l,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:o,viewField:n,validator:l,errorText:s}=e,r=Vt(()=>{n.errorText=s},ul);return(a,d,c)=>{r.cancel(),this._isReady&&(l(c)?(this.editor.execute(o,{value:c,batch:this._undoStepBatch}),n.errorText=null):r())}}}class W extends S{constructor(e,o,n){super(e);g(this,"attributeName");g(this,"_defaultValue");g(this,"_defaultContentTableValue");g(this,"_defaultLayoutTableValue");switch(this.attributeName=o,this._defaultContentTableValue=n,o){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 o=this.editor.model.document.selection,l=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(o),s=D(o);this._defaultValue=!s||s.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!l.length,this.value=this._getSingleValue(l)}execute(e={}){const{value:o,batch:n}=e,l=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(l.document.selection),a=this._getValueToSet(o);l.enqueueChange(n,d=>{a?r.forEach(c=>d.setAttribute(this.attributeName,a,c)):r.forEach(c=>d.removeAttribute(this.attributeName,c))})}_getAttribute(e){if(!e)return;const o=e.getAttribute(this.attributeName);if(o!==this._defaultValue)return o}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const o=this._getAttribute(e[0]);return e.every(l=>this._getAttribute(l)===o)?o:void 0}}class ml extends W{constructor(t,e){super(t,"tableCellWidth",e)}_getValueToSet(t){if(t=U(t,"px"),t!==this._defaultValue)return t}}class no extends v{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Z]}init(){const t=this.editor,e=Ue(t.config.get("table.tableCellProperties.defaultProperties"));ie(t.model.schema,t.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:e.width}),t.commands.add("tableCellWidth",new ml(t,e.width))}}class gl extends W{constructor(t,e){super(t,"tableCellPadding",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}class bl extends W{constructor(t,e){super(t,"tableCellHeight",e)}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}class fl extends W{constructor(t,e){super(t,"tableCellBackgroundColor",e)}}class pl extends W{constructor(t,e){super(t,"tableCellVerticalAlignment",e)}}class wl extends W{constructor(t,e){super(t,"tableCellHorizontalAlignment",e)}}class Cl extends W{constructor(t,e){super(t,"tableCellBorderStyle",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class Tl extends W{constructor(t,e){super(t,"tableCellBorderColor",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class _l extends W{constructor(t,e){super(t,"tableCellBorderWidth",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}const ht=/^(top|middle|bottom)$/,mt=/^(left|center|right|justify)$/;class yl extends v{static get pluginName(){return"TableCellPropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Z,no]}init(){const t=this.editor,e=t.model.schema,o=t.conversion;t.config.define("table.tableCellProperties.defaultProperties",{});const n=Ue(t.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:t.locale.contentLanguageDirection==="rtl"});t.data.addStyleProcessorRules(It),vl(e,o,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),t.commands.add("tableCellBorderStyle",new Cl(t,n.borderStyle)),t.commands.add("tableCellBorderColor",new Tl(t,n.borderColor)),t.commands.add("tableCellBorderWidth",new _l(t,n.borderWidth)),ie(e,o,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:n.height}),t.commands.add("tableCellHeight",new bl(t,n.height)),t.data.addStyleProcessorRules(Mo),ie(e,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:n.padding}),t.commands.add("tableCellPadding",new gl(t,n.padding)),t.data.addStyleProcessorRules(xt),ie(e,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),t.commands.add("tableCellBackgroundColor",new fl(t,n.backgroundColor)),Al(e,o,n.horizontalAlignment),t.commands.add("tableCellHorizontalAlignment",new wl(t,n.horizontalAlignment)),Sl(e,o,n.verticalAlignment),t.commands.add("tableCellVerticalAlignment",new pl(t,n.verticalAlignment))}}function vl(i,t,e){const o={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};i.extend("tableCell",{allowAttributes:Object.values(o)}),ye(t,"td",o,e),ye(t,"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 Al(i,t,e){i.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:o=>({key:"style",value:{"text-align":o}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":mt}},model:{key:"tableCellHorizontalAlignment",value:(o,n,l)=>{const s=B(e,"left",l),r=o.getStyle("text-align");return r===s?null:r}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:mt}},model:{key:"tableCellHorizontalAlignment",value:(o,n,l)=>{const s=B(e,"left",l),r=o.getAttribute("align");return r===s?null:r}}})}function Sl(i,t,e){i.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:o=>({key:"style",value:{"vertical-align":o}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":ht}},model:{key:"tableCellVerticalAlignment",value:(o,n,l)=>{const s=B(e,"middle",l),r=o.getStyle("vertical-align");return r===s?null:r}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:ht}},model:{key:"tableCellVerticalAlignment",value:(o,n,l)=>{const s=B(e,"middle",l),r=o.getAttribute("valign");return r===s?null:r}}})}class mi extends v{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[yl,hl]}}class Rl extends S{refresh(){this.isEnabled=!0}execute(t={}){const{model:e,plugins:o}=this.editor;let{table:n=e.document.selection.getSelectedElement(),columnWidths:l,tableWidth:s}=t;l&&(l=Array.isArray(l)?l:l.split(",")),e.change(r=>{s?r.setAttribute("tableWidth",s,n):r.removeAttribute("tableWidth",n);const a=o.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!l&&!a)return;if(!l)return r.remove(a);const d=Oe(l);if(a)Array.from(a.getChildren()).forEach((c,u)=>r.setAttribute("columnWidth",d[u],c));else{const c=r.createElement("tableColumnGroup");d.forEach(u=>r.appendElement("tableColumn",{columnWidth:u},c)),r.append(c,n)}})}}function Il(i){return t=>t.on("element:colgroup",(e,o,n)=>{const l=o.modelCursor.findAncestor("table"),s=J(l);if(!s)return;const r=Y(s),a=i.getColumns(l);let d=Rn(s,n.writer);d=Array.from({length:a},(c,u)=>d[u]||"auto"),(d.length!=r.length||d.includes("auto"))&&zt(r,s,Oe(d),n.writer)},{priority:"low"})}function xl(){return i=>i.on("insert:table",(t,e,o)=>{const n=o.writer,l=e.item,s=o.mapper.toViewElement(l),r=s.is("element","table")?s:Array.from(s.getChildren()).find(d=>d.is("element","table"));J(l)?n.addClass("ck-table-resized",r):n.removeClass("ck-table-resized",r)},{priority:"low"})}const gt=go("px");class kl extends v{constructor(e){super(e);g(this,"_isResizingActive");g(this,"_resizingData");g(this,"_domEmitter");g(this,"_tableUtilsPlugin");g(this,"_initialMouseEventData",null);this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(mo()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(o,n,l)=>{const s=l?"removeClass":"addClass";e.editing.view.change(r=>{for(const a of e.editing.view.document.roots)r[s]("ck-column-resize_disabled",e.editing.view.document.getRoot(a.rootName))})})}static get requires(){return[Z,A]}static get pluginName(){return"TableColumnResizeEditing"}static get isOfficialPlugin(){return!0}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,o=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:s=>s.is("element","tableColumnGroup"),positionOffset:0});const l=new Rl(e);e.commands.add("resizeTableWidth",l),e.commands.add("resizeColumnWidths",l),this.bind("_isResizingAllowed").to(e,"isReadOnly",o,"isEnabled",l,"isEnabled",(s,r,a)=>!s&&r&&a)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return J(e)}getTableColumnElements(e){return Y(e)}getTableColumnsWidths(e){return Sn(e)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){const o=this.editor.model;o.document.registerPostFixer(s=>{let r=!1;for(const a of wn(o)){const d=this.getColumnGroupElement(a),c=this.getTableColumnElements(d),u=this.getTableColumnsWidths(d);let h=Oe(u);h=n(h,a,this),!qe(u,h)&&(zt(c,d,h,s),r=!0)}return r});function n(s,r,a){const d=a._tableUtilsPlugin.getColumns(r);if(d-s.length===0)return s;const u=s.map(m=>Number(m.replace("%",""))),h=l(a.editor.model.document.differ,r);for(const m of h){const p=d-u.length;if(p===0)continue;const b=p>0,w=a._tableUtilsPlugin.getCellLocation(m).column;if(b){const f=Cn(r,a.editor),C=yn(p,f);u.splice(w,0,...C)}else{const f=u.splice(w,Math.abs(p));u[w]+=X(f)}}return u.map(m=>m+"%")}function l(s,r){const a=new Set;for(const d of s.getChanges())if(d.type=="insert"&&d.position.nodeAfter&&d.position.nodeAfter.name=="tableCell"&&d.position.nodeAfter.getAncestors().includes(r))a.add(d.position.nodeAfter);else if(d.type=="remove"){const c=d.position.nodeBefore||d.position.nodeAfter;c.name=="tableCell"&&c.getAncestors().includes(r)&&a.add(c)}return a}}_registerConverters(){const o=this.editor.conversion;o.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:n=>n.getStyle("width")}}),o.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:n=>({name:"figure",key:"style",value:{width:n}})}),o.elementToElement({model:"tableColumnGroup",view:"colgroup"}),o.elementToElement({model:"tableColumn",view:"col"}),o.for("downcast").add(xl()),o.for("upcast").add(Il(this._tableUtilsPlugin)),o.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:n=>{const l=n.getStyle("width");return!l||!l.endsWith("%")&&!l.endsWith("pt")?"auto":l}}}),o.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),o.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:n=>({key:"style",value:{width:n}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver($t),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(se.window.document,"mousemove",Uo(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(se.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){const o=this.editor,n=o.editing.view.domConverter,l=n.mapViewToDom(e.findAncestor("table")),s=n.mapViewToDom(e.findAncestor(u=>["td","th"].includes(u.name))),r=new re(l),a=new re(s),d=gt(Number((r.top-a.top).toFixed(4))),c=gt(Number((a.bottom-r.bottom).toFixed(4)));o.editing.view.change(u=>{u.setStyle("top",d,e),u.setStyle("bottom",c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(o=>{o.removeStyle("top",e),o.removeStyle("bottom",e)})}_onMouseOverHandler(e,o){const n=o.target;n.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(n)}_onMouseOutHandler(e,o){const n=o.target;n.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(n))}_onMouseDownHandler(e,o){const n=o.target;if(!n.hasClass("ck-table-column-resizer")||!this._isResizingAllowed)return;const l=this.editor,s=l.editing.mapper.toModelElement(n.findAncestor("figure"));l.model.canEditAt(s)&&(o.preventDefault(),e.stop(),this._initialMouseEventData=o)}_startResizingAfterThreshold(){const e=this._initialMouseEventData,{target:o}=e,n=this.editor.editing.mapper.toModelElement(o.findAncestor("figure")),l=o.findAncestor("table"),s=r(n,this._tableUtilsPlugin,this.editor);Array.from(l.getChildren()).find(c=>c.is("element","colgroup"))||this.editor.editing.view.change(c=>{a(c,s,l)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,s),this.editor.editing.view.change(c=>d(c,l,this._resizingData));function r(c,u,h){const m=Array(u.getColumns(c)),p=new T(c);for(const b of p){const w=h.editing.mapper.toViewElement(b.cell),f=h.editing.view.domConverter.mapViewToDom(w),C=An(f);(!m[b.column]||C<m[b.column])&&(m[b.column]=I(C))}return m}function a(c,u,h){const m=c.createContainerElement("colgroup");for(let p=0;p<u.length;p++){const b=c.createEmptyElement("col"),w=`${I(u[p]/X(u)*100)}%`;c.setStyle("width",w,b),c.insert(c.createPositionAt(m,"end"),b)}c.insert(c.createPositionAt(h,0),m)}function d(c,u,h){const m=h.widths.viewFigureWidth/h.widths.viewFigureParentWidth;c.addClass("ck-table-resized",u),c.addClass("ck-table-column-resizer__active",h.elements.viewResizer),c.setStyle("width",`${I(m*100)}%`,u.findAncestor("figure"))}}_onMouseMoveHandler(e,o){if(this._initialMouseEventData){const R=this._initialMouseEventData.domEvent;if(Math.abs(o.clientX-R.clientX)>=pn)this._startResizingAfterThreshold(),this._initialMouseEventData=null;else return}if(!this._isResizingActive)return;if(!this._isResizingAllowed){this._onMouseUpHandler();return}const{columnPosition:n,flags:{isRightEdge:l,isTableCentered:s,isLtrContent:r},elements:{viewFigure:a,viewLeftColumn:d,viewRightColumn:c,viewResizer:u},widths:{viewFigureParentWidth:h,tableWidth:m,leftColumnWidth:p,rightColumnWidth:b}}=this._resizingData,w=-p+Re,f=l?h-m:b-Re,C=(r?1:-1)*(l&&s?2:1),_=_n((o.clientX-n)*C,Math.min(w,0),Math.max(f,0));_!==0&&(this.editor.editing.view.change(R=>{const V=I((p+_)*100/m);if(R.setStyle("width",`${V}%`,d),l){const P=I((m+_)*100/h);R.setStyle("width",`${P}%`,a)}else{const P=I((b-_)*100/m);R.setStyle("width",`${P}%`,c)}}),this._recalculateResizerElement(u))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;const{viewResizer:e,modelTable:o,viewFigure:n,viewColgroup:l}=this._resizingData.elements,s=this.editor,r=s.editing.view,a=this.getColumnGroupElement(o),d=Array.from(l.getChildren()).filter(f=>f.is("view:element")),c=a?this.getTableColumnsWidths(a):null,u=d.map(f=>f.getStyle("width")),h=!qe(c,u),m=o.getAttribute("tableWidth"),p=n.getStyle("width"),b=m!==p;(h||b)&&(this._isResizingAllowed?s.execute("resizeTableWidth",{table:o,tableWidth:`${I(p)}%`,columnWidths:u}):r.change(f=>{if(c)for(const C of d)f.setStyle("width",c.shift(),C);else f.remove(l);b&&(m?f.setStyle("width",m,n):f.removeStyle("width",n)),!c&&!m&&f.removeClass("ck-table-resized",[...n.getChildren()].find(C=>C.name==="table"))})),r.change(f=>{f.removeClass("ck-table-column-resizer__active",e)}),r.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,o){const n=this.editor,l=e.domEvent.clientX,s=e.target,r=s.findAncestor("td")||s.findAncestor("th"),a=n.editing.mapper.toModelElement(r),d=a.findAncestor("table"),c=Tn(a,this._tableUtilsPlugin).rightEdge,u=this._tableUtilsPlugin.getColumns(d)-1,h=c===u,m=!d.hasAttribute("tableAlignment"),p=n.locale.contentLanguageDirection!=="rtl",b=r.findAncestor("table"),w=b.findAncestor("figure"),f=[...b.getChildren()].find(io=>io.is("element","colgroup")),C=f.getChild(c),_=h?void 0:f.getChild(c+1),R=Ie(n.editing.view.domConverter.mapViewToDom(w.parent)),V=Ie(n.editing.view.domConverter.mapViewToDom(w)),P=Ot(d,n),G=o[c],lo=h?void 0:o[c+1];return{columnPosition:l,flags:{isRightEdge:h,isTableCentered:m,isLtrContent:p},elements:{viewResizer:s,modelTable:d,viewFigure:w,viewColgroup:f,viewLeftColumn:C,viewRightColumn:_},widths:{viewFigureParentWidth:R,viewFigureWidth:V,tableWidth:P,leftColumnWidth:G,rightColumnWidth:lo}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(o,n,l)=>{const s=n.item,r=l.mapper.toViewElement(s),a=l.writer;a.insert(a.createPositionAt(r,"end"),a.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}}class gi extends v{static get requires(){return[kl,no]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}class $ extends S{constructor(e,o,n){super(e);g(this,"attributeName");g(this,"_defaultValue");g(this,"_defaultContentTableValue");g(this,"_defaultLayoutTableValue");this.attributeName=o,this._defaultContentTableValue=n,this._defaultLayoutTableValue=o==="tableBorderStyle"?"none":void 0}refresh(){const o=this.editor.model.document.selection,n=D(o);this._defaultValue=!n||n.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!n,this.value=this._getValue(n)}execute(e={}){const o=this.editor.model,n=o.document.selection,{value:l,batch:s}=e,r=D(n),a=this._getValueToSet(l);o.enqueueChange(s,d=>{a?d.setAttribute(this.attributeName,a,r):d.removeAttribute(this.attributeName,r)})}_getValue(e){if(!e)return;const o=e.getAttribute(this.attributeName);if(o!==this._defaultValue)return o}_getValueToSet(e){if(e!==this._defaultValue)return e}}class Vl extends ${constructor(t,e){super(t,"tableBackgroundColor",e)}}class Pl extends ${constructor(t,e){super(t,"tableBorderColor",e)}_getValue(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class El extends ${constructor(t,e){super(t,"tableBorderStyle",e)}_getValue(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class Wl extends ${constructor(t,e){super(t,"tableBorderWidth",e)}_getValue(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}class Ll extends ${constructor(t,e){super(t,"tableWidth",e)}_getValueToSet(t){if(t=U(t,"px"),t!==this._defaultValue)return t}}class Bl extends ${constructor(t,e){super(t,"tableHeight",e)}_getValueToSet(t){if(t=U(t,"px"),t!==this._defaultValue)return t}}class Dl extends ${constructor(t,e){super(t,"tableAlignment",e)}}const Fl=/^(left|center|right)$/,Nl=/^(left|none|right)$/;class Ml extends v{static get pluginName(){return"TablePropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Z]}init(){const t=this.editor,e=t.model.schema,o=t.conversion;t.config.define("table.tableProperties.defaultProperties",{});const n=oo(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});t.data.addStyleProcessorRules(It),Ol(e,o,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),t.commands.add("tableBorderColor",new Pl(t,n.borderColor)),t.commands.add("tableBorderStyle",new El(t,n.borderStyle)),t.commands.add("tableBorderWidth",new Wl(t,n.borderWidth)),zl(e,o,n.alignment),t.commands.add("tableAlignment",new Dl(t,n.alignment)),bt(e,o,{modelAttribute:"tableWidth",styleName:"width",defaultValue:n.width}),t.commands.add("tableWidth",new Ll(t,n.width)),bt(e,o,{modelAttribute:"tableHeight",styleName:"height",defaultValue:n.height}),t.commands.add("tableHeight",new Bl(t,n.height)),t.data.addStyleProcessorRules(xt),Hl(e,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),t.commands.add("tableBackgroundColor",new Vl(t,n.backgroundColor))}}function Ol(i,t,e){const o={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};i.extend("table",{allowAttributes:Object.values(o)}),ye(t,"table",o,e),ne(t,{modelAttribute:o.color,styleName:"border-color"}),ne(t,{modelAttribute:o.style,styleName:"border-style"}),ne(t,{modelAttribute:o.width,styleName:"border-width"})}function zl(i,t,e){i.extend("table",{allowAttributes:["tableAlignment"]}),t.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:(o,n,l)=>({key:"style",value:l.item.getAttribute("tableType")!=="layout"?{float:"none"}:{"margin-left":"auto","margin-right":"auto"}})},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:Nl}},model:{key:"tableAlignment",value:(o,n,l)=>{const s=B(e,"",l);let r=o.getStyle("float");return r==="none"&&(r="center"),r===s?null:r}}}).attributeToAttribute({view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},model:{key:"tableAlignment",value:(o,n,l)=>{const s=B(e,"",l),r="center";return r===s?null:r}}}).attributeToAttribute({view:{attributes:{align:Fl}},model:{name:"table",key:"tableAlignment",value:(o,n,l)=>{const s=B(e,"",l),r=o.getAttribute("align");return r===s?null:r}}})}function Hl(i,t,e){const{modelAttribute:o}=e;i.extend("table",{allowAttributes:[o]}),Ne(t,{viewElement:"table",...e}),ne(t,e)}function bt(i,t,e){const{modelAttribute:o}=e;i.extend("table",{allowAttributes:[o]}),Ne(t,{viewElement:/^(table|figure)$/,shouldUpcast:n=>!(n.name=="table"&&n.parent.name=="figure"),...e}),K(t,{modelElement:"table",...e})}class Ul extends O{constructor(e,o){super(e);g(this,"options");g(this,"focusTracker");g(this,"keystrokes");g(this,"children");g(this,"borderStyleDropdown");g(this,"borderWidthInput");g(this,"borderColorInput");g(this,"backgroundInput");g(this,"widthInput");g(this,"heightInput");g(this,"alignmentToolbar");g(this,"saveButtonView");g(this,"cancelButtonView");g(this,"_focusables");g(this,"_focusCycler");this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=o;const{borderStyleDropdown:n,borderWidthInput:l,borderColorInput:s,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:d}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{alignmentToolbar:p,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new fe,this.keystrokes=new be,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=l,this.borderColorInput=s,this.backgroundInput=d,this.widthInput=c,this.heightInput=h,this.alignmentToolbar=p;const{saveButtonView:w,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=w,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 At(e,{label:this.t("Table properties")})),this.children.add(new x(e,{labelView:r,children:[r,n,s,l],class:"ck-table-form__border-row"})),this.children.add(new x(e,{labelView:a,children:[a,d],class:"ck-table-form__background-row"})),this.children.add(new x(e,{children:[new x(e,{labelView:m,children:[m,c,u,h],class:"ck-table-form__dimensions-row"}),new x(e,{labelView:b,children:[b,p],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new x(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(),St({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,o={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=ge({colorConfig:this.options.borderColors,columns:5,defaultColorValue:o.color,colorPickerConfig:this.options.colorPickerConfig}),l=this.locale,s=this.t,r=s("Style"),a=new L(l);a.text=s("Border");const d=He(s),c=new k(l,Rt);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>d[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),Be(c.fieldView,Jt(this,o.style),{role:"menu",ariaLabel:r});const u=new k(l,M);u.set({label:s("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",te),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});const h=new k(l,n);return h.set({label:s("Color"),class:"ck-table-form__border-color"}),h.fieldView.bind("value").to(this,"borderColor"),h.bind("isEnabled").to(this,"borderStyle",te),h.fieldView.on("input",()=>{this.borderColor=h.fieldView.value}),this.on("change:borderStyle",(m,p,b,w)=>{te(b)||(this.borderColor="",this.borderWidth=""),te(w)||(this.borderColor=o.color,this.borderWidth=o.width)}),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:h,borderWidthInput:u}}_createBackgroundFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Background");const l=ge({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),s=new k(e,l);return s.set({label:o("Color"),class:"ck-table-properties-form__background"}),s.fieldView.bind("value").to(this,"backgroundColor"),s.fieldView.on("input",()=>{this.backgroundColor=s.fieldView.value}),{backgroundRowLabel:n,backgroundInput:s}}_createDimensionFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Dimensions");const l=new k(e,M);l.set({label:o("Width"),class:"ck-table-form__dimensions-row__width"}),l.fieldView.bind("value").to(this,"width"),l.fieldView.on("input",()=>{this.width=l.fieldView.element.value});const s=new O(e);s.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new k(e,M);return r.set({label:o("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:n,widthInput:l,operatorLabel:s,heightInput:r}}_createAlignmentFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Alignment");const l=new _e(e);return l.set({role:"radiogroup",isCompact:!0,ariaLabel:o("Table alignment toolbar")}),Pe({view:this,icons:{left:vo,center:yo,right:_o},toolbar:l,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:l}}_createActionButtons(){const e=this.locale,o=this.t,n=new E(e),l=new E(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:o("Save"),icon:Tt,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(s,"errorText",(...r)=>r.every(a=>!a)),l.set({label:o("Cancel"),icon:_t,class:"ck-button-cancel",withText:!0}),l.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:l}}get _alignmentLabels(){const e=this.locale,o=this.t,n=o("Align table to the left"),l=o("Center table"),s=o("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:s,center:l,left:n}:{left:n,center:l,right:s}}}function te(i){return i!=="none"}const $l=500,ft={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Gl extends v{constructor(e){super(e);g(this,"_defaultContentTableProperties");g(this,"_defaultLayoutTableProperties");g(this,"_balloon");g(this,"view",null);g(this,"_viewWithContentTableDefaults",null);g(this,"_viewWithLayoutTableDefaults",null);g(this,"_undoStepBatch");g(this,"_isReady");e.config.define("table.tableProperties",{borderColors:me,backgroundColors:me})}static get requires(){return[ae]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;this._defaultContentTableProperties=oo(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=we(),this._balloon=e.plugins.get(ae),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,o=e.t,n=new E(e.locale);n.set({label:o("Table properties"),icon:To,tooltip:!0}),this.listenTo(n,"execute",()=>this._showView());const l=Object.values(ft).map(s=>e.commands.get(s));return n.bind("isEnabled").toMany(l,"isEnabled",(...s)=>s.some(r=>r)),n}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const o=this.editor,n=o.config.get("table.tableProperties"),l=ce(n.borderColors),s=de(o.locale,l),r=ce(n.backgroundColors),a=de(o.locale,r),d=n.colorPicker!==!1,c=new Ul(o.locale,{borderColors:s,backgroundColors:a,defaultTableProperties:e,colorPickerConfig:d?n.colorPicker||{}:!1}),u=o.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&o.execute("undo",this._undoStepBatch),this._hideView()}),c.keystrokes.set("Esc",(p,b)=>{this._hideView(),b()}),yt({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const h=Kt(u),m=qt(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableBorderColor",errorText:h,validator:he})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableBorderWidth",errorText:m,validator:Xt})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableBackgroundColor",errorText:h,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,o=e.get("tableBorderStyle");Object.entries(ft).map(([n,l])=>{const s=n,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[s]||"":this._defaultLayoutTableProperties[s]||"";return[s,e.get(l).value||r]}).forEach(([n,l])=>{(n==="borderColor"||n==="borderWidth")&&o.value==="none"||this.view.set(n,l)}),this._isReady=!0}_showView(){const e=this.editor,o=ue(e.editing.view.document.selection),n=o&&e.editing.mapper.toModelElement(o),l=!n||n.getAttribute("tableType")!=="layout";l&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):!l&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=l?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Qt(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,o=e.editing.view.document;ue(o.selection)?this._isViewVisible&&Zt(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(o,n,l)=>{this._isReady&&this.editor.execute(e,{value:l,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:o,viewField:n,validator:l,errorText:s}=e,r=Vt(()=>{n.errorText=s},$l);return(a,d,c)=>{r.cancel(),this._isReady&&(l(c)?(this.editor.execute(o,{value:c,batch:this._undoStepBatch}),n.errorText=null):r())}}}class bi extends v{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[Ml,Gl]}}/**
|
|
13
|
+
*/function Gn(i){i.document.registerPostFixer(t=>jn(t,i))}function jn(i,t){const e=t.document.differ.getChanges();let o=!1;for(const n of e)n.type=="insert"&&n.name=="table"&&(o=Kn(n.position.nodeAfter,i)||o),n.type=="insert"&&n.name=="tableRow"&&(o=Ht(n.position.nodeAfter,i)||o),n.type=="insert"&&n.name=="tableCell"&&(o=xe(n.position.nodeAfter,i)||o),(n.type=="remove"||n.type=="insert")&&qn(n)&&(o=xe(n.position.parent,i)||o);return o}function Kn(i,t){let e=!1;for(const o of i.getChildren())o.is("element","tableRow")&&(e=Ht(o,t)||e);return e}function Ht(i,t){let e=!1;for(const o of i.getChildren())e=xe(o,t)||e;return e}function xe(i,t){if(i.childCount==0)return t.insertElement("paragraph",i),!0;const e=Array.from(i.getChildren()).filter(o=>o.is("$text"));for(const o of e)t.wrap(t.createRangeOn(o),"paragraph");return!!e.length}function qn(i){return i.position.parent.is("element","tableCell")?i.type=="insert"&&i.name=="$text"||i.type=="remove":!1}function Xn(i,t){const e=i.document.differ;for(const o of e.getChanges()){let n,l=!1;if(o.type=="attribute"){const d=o.range.start.nodeAfter;if(!d||!d.is("element","table")||o.attributeKey!="headingRows"&&o.attributeKey!="headingColumns")continue;n=d,l=o.attributeKey=="headingRows"}else(o.name=="tableRow"||o.name=="tableCell")&&(n=o.position.findAncestor("table"),l=o.name=="tableRow");if(!n)continue;const s=n.getAttribute("headingRows")||0,r=n.getAttribute("headingColumns")||0,a=new T(n);for(const d of a){const u=d.row<s||d.column<r?"th":"td",h=t.mapper.toViewElement(d.cell);h&&h.is("element")&&h.name!=u&&t.reconvertItem(l?d.cell.parent:d.cell)}}}function Jn(i,t){const e=i.document.differ,o=new Set;for(const n of e.getChanges()){const l=n.type=="attribute"?n.range.start.parent:n.position.parent;l.is("element","tableCell")&&o.add(l)}for(const n of o.values()){const l=Array.from(n.getChildren()).filter(s=>Yn(s,t.mapper));for(const s of l)t.reconvertItem(s)}}function Yn(i,t){if(!i.is("element","paragraph"))return!1;const e=t.toViewElement(i);return e?Pt(i)!==e.is("element","span"):!1}class Z extends v{constructor(e){super(e);g(this,"_additionalSlots");this._additionalSlots=[]}static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[A]}init(){const e=this.editor,o=e.model,n=o.schema,l=e.conversion,s=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}),l.for("upcast").add(Go()),l.for("upcast").add(jo()),l.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Je(s,{asWidget:!0,additionalSlots:this._additionalSlots})}),l.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Je(s,{additionalSlots:this._additionalSlots})}),l.for("upcast").elementToElement({model:"tableRow",view:"tr"}),l.for("upcast").add(Ko()),l.for("downcast").elementToElement({model:"tableRow",view:Zo()}),l.for("upcast").elementToElement({model:"tableCell",view:"td"}),l.for("upcast").elementToElement({model:"tableCell",view:"th"}),l.for("upcast").add(Xe("td")),l.for("upcast").add(Xe("th")),l.for("editingDowncast").elementToElement({model:"tableCell",view:Ye({asWidget:!0})}),l.for("dataDowncast").elementToElement({model:"tableCell",view:Ye()}),l.for("editingDowncast").elementToElement({model:"paragraph",view:Ze({asWidget:!0}),converterPriority:"high"}),l.for("dataDowncast").elementToElement({model:"paragraph",view:Ze(),converterPriority:"high"}),l.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),l.for("upcast").attributeToAttribute({model:{key:"colspan",value:rt("colspan")},view:"colspan"}),l.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),l.for("upcast").attributeToAttribute({model:{key:"rowspan",value:rt("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new tn(e)),e.commands.add("insertTableRowAbove",new Qe(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Qe(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new et(e,{order:"left"})),e.commands.add("insertTableColumnRight",new et(e,{order:"right"})),e.commands.add("removeTableRow",new an(e)),e.commands.add("removeTableColumn",new dn(e)),e.commands.add("splitTableCellVertically",new tt(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new tt(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Wn(e)),e.commands.add("mergeTableCellRight",new Q(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Q(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Q(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Q(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new gn(e)),e.commands.add("setTableRowHeader",new mn(e)),e.commands.add("selectTableRow",new Dn(e)),e.commands.add("selectTableColumn",new Fn(e)),Nn(o),Gn(o),this.listenTo(o.document,"change:data",()=>{Xn(o,e.editing),Jn(o,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function rt(i){return t=>{const e=parseInt(t.getAttribute(i));return Number.isNaN(e)||e<=0?null:e}}class at extends O{constructor(e){super(e);g(this,"items");g(this,"keystrokes");g(this,"focusTracker");const o=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new be,this.focusTracker=new fe,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(n,l)=>`${l} × ${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":o.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:o.to("label")}]}],on:{mousedown:o.to(n=>{n.preventDefault()}),click:o.to(()=>{this.fire("execute")})}}),this.on("boxover",(n,l)=>{const{row:s,column:r}=l.target.dataset;this.items.get((parseInt(s,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(n,l,s)=>{if(!s)return;const{row:r,column:a}=s.dataset;this.set({rows:parseInt(r),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Lo({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,o=this.columns;this.items.map((n,l)=>{const s=Math.floor(l/10),r=l%10,a=s<e&&r<o;n.set("isOn",a)})}_createGridButton(e,o,n,l){const s=new E(e);return s.set({label:l,class:"ck-insert-table-dropdown-grid-box"}),s.extendTemplate({attributes:{"data-row":o,"data-column":n}}),s}_createGridCollection(){const e=[];for(let o=0;o<100;o++){const n=Math.floor(o/10),l=o%10,s=`${n+1} × ${l+1}`;e.push(this._createGridButton(this.locale,n+1,l+1,s))}return this.createCollection(e)}}class Zn extends v{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t,n=t.locale.contentLanguageDirection==="ltr";t.ui.componentFactory.add("insertTable",l=>{const s=t.commands.get("insertTable"),r=oe(l);r.bind("isEnabled").to(s),r.buttonView.set({icon:je,label:e("Insert table"),tooltip:!0});let a;return r.on("change:isOpen",()=>{a||(a=new at(l),r.panelView.children.add(a),a.delegate("execute").to(r),r.on("execute",()=>{t.execute("insertTable",{rows:a.rows,columns:a.columns}),t.editing.view.focus()}))}),r}),t.ui.componentFactory.add("menuBar:insertTable",l=>{const s=t.commands.get("insertTable"),r=new Po(l),a=new at(l);return a.delegate("execute").to(r),r.on("change:isOpen",(d,c,u)=>{u||a.reset()}),a.on("execute",()=>{t.execute("insertTable",{rows:a.rows,columns:a.columns}),t.editing.view.focus()}),r.buttonView.set({label:e("Table"),icon:je}),r.panelView.children.add(a),r.bind("isEnabled").to(s),r}),t.ui.componentFactory.add("tableColumn",l=>{const s=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:e("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:e("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:e("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:e("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:e("Select column")}}];return this._prepareDropdown(e("Column"),bo,s,l)}),t.ui.componentFactory.add("tableRow",l=>{const s=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:e("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:e("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:e("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:e("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:e("Select row")}}];return this._prepareDropdown(e("Row"),fo,s,l)}),t.ui.componentFactory.add("mergeTableCells",l=>{const s=[{type:"button",model:{commandName:"mergeTableCellUp",label:e("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:e("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:e("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:e("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:e("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:e("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(e("Merge cells"),po,s,l)})}_prepareDropdown(t,e,o,n){const l=this.editor,s=oe(n),r=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:t,icon:e,tooltip:!0}),s.bind("isEnabled").toMany(r,"isEnabled",(...a)=>a.some(d=>d)),this.listenTo(s,"execute",a=>{l.execute(a.source.commandName),a.source instanceof Eo||l.editing.view.focus()}),s}_prepareMergeSplitButtonDropdown(t,e,o,n){const l=this.editor,s=oe(n,Wo),r="mergeTableCells",a=l.commands.get(r),d=this._fillDropdownWithListOptions(s,o);return s.buttonView.set({label:t,icon:e,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([a,...d],"isEnabled",(...c)=>c.some(u=>u)),this.listenTo(s.buttonView,"execute",()=>{l.execute(r),l.editing.view.focus()}),this.listenTo(s,"execute",c=>{l.execute(c.source.commandName),l.editing.view.focus()}),s}_fillDropdownWithListOptions(t,e){const o=this.editor,n=[],l=new Ct;for(const s of e)Qn(s,o,n,l);return Be(t,l),n}}function Qn(i,t,e,o){if(i.type==="button"||i.type==="switchbutton"){const n=i.model=new vt(i.model),{commandName:l,bindIsOn:s}=i.model,r=t.commands.get(l);e.push(r),n.set({commandName:l}),n.bind("isEnabled").to(r),s&&n.bind("isOn").to(r,"value"),n.set({withText:!0})}o.add(i)}class F extends v{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[A,A]}init(){const t=this.editor,e=t.model,o=t.editing.view;this.listenTo(e,"deleteContent",(n,l)=>this._handleDeleteContent(n,l),{priority:"high"}),this.listenTo(o.document,"insertText",(n,l)=>this._handleInsertTextEvent(n,l),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const t=this.editor.plugins.get(A),e=this.editor.model.document.selection,o=t.getSelectedTableCells(e);return o.length==0?null:o}getSelectionAsFragment(){const t=this.editor.plugins.get(A),e=this.getSelectedTableCells();return e?this.editor.model.change(o=>{const n=o.createDocumentFragment(),{first:l,last:s}=t.getColumnIndexes(e),{first:r,last:a}=t.getRowIndexes(e),d=e[0].findAncestor("table");let c=a,u=s;if(t.isSelectionRectangular(e)){const p={firstColumn:l,lastColumn:s,firstRow:r,lastRow:a};c=Nt(d,p),u=Mt(d,p)}const m=Et(d,{startRow:r,startColumn:l,endRow:c,endColumn:u},o);return o.insert(m,n,0),n}):null}setCellSelection(t,e){const o=this._getCellsToSelect(t,e);this.editor.model.change(n=>{n.setSelection(o.cells.map(l=>n.createRangeOn(l)),{backward:o.backward})})}getFocusCell(){const o=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return o&&o.is("element","tableCell")?o:null}getAnchorCell(){const t=this.editor.model.document.selection,o=Le(t.getRanges()).getContainedElement();return o&&o.is("element","tableCell")?o:null}_defineSelectionConverter(){const t=this.editor,e=new Set;t.conversion.for("editingDowncast").add(n=>n.on("selection",(l,s,r)=>{const a=r.writer;o(a);const d=this.getSelectedTableCells();if(!d)return;for(const u of d){const h=r.mapper.toViewElement(u);a.addClass("ck-editor__editable_selected",h),e.add(h)}const c=r.mapper.toViewElement(d[d.length-1]);a.setSelection(c,0)},{priority:"lowest"}));function o(n){for(const l of e)n.removeClass("ck-editor__editable_selected",l);e.clear()}}_enablePluginDisabling(){const t=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const e=this.getSelectedTableCells();if(!e)return;t.model.change(o=>{const n=o.createPositionAt(e[0],0),l=t.model.schema.getNearestSelectionRange(n);o.setSelection(l)})}})}_handleDeleteContent(t,e){const o=this.editor.plugins.get(A),n=e[0],l=e[1],s=this.editor.model,r=!l||l.direction=="backward",a=o.getSelectedTableCells(n);a.length&&(t.stop(),s.change(d=>{const c=a[r?a.length-1:0];s.change(h=>{for(const m of a)s.deleteContent(h.createSelection(m,"in"))});const u=s.schema.getNearestSelectionRange(d.createPositionAt(c,0));n.is("documentSelection")?d.setSelection(u):n.setTo(u)}))}_handleInsertTextEvent(t,e){const o=this.editor,n=this.getSelectedTableCells();if(!n)return;const l=o.editing.view,s=o.editing.mapper,r=n.map(a=>l.createRangeOn(s.toViewElement(a)));e.selection=l.createSelection(r),e.preventDefault()}_getCellsToSelect(t,e){const o=this.editor.plugins.get("TableUtils"),n=o.getCellLocation(t),l=o.getCellLocation(e),s=Math.min(n.row,l.row),r=Math.max(n.row,l.row),a=Math.min(n.column,l.column),d=parseInt(e.getAttribute("colspan")||"1")-1,c=Math.max(n.column,l.column+d),u=new Array(r-s+1).fill(null).map(()=>[]),h={startRow:s,endRow:r,startColumn:a,endColumn:c};for(const{row:b,cell:w}of new T(t.findAncestor("table"),h))u[b-s].push(w);const m=l.row<n.row,p=l.column<n.column;return m&&u.reverse(),p&&u.forEach(b=>b.reverse()),{cells:u.flat(),backward:m||p}}}class el extends v{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Ce,Ke,F,A]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"copy",(o,n)=>this._onCopyCut(o,n)),this.listenTo(e,"cut",(o,n)=>this._onCopyCut(o,n)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell")}_listenToContentInsertion(){const{editor:t}=this,e=t.plugins.get(Ke),o=t.plugins.get(F);let n=!1;e.on("contentInsertion",(l,s)=>{n=s.method==="paste"}),this.listenTo(t.model,"insertContent",(l,[s,r])=>{(n||o.getSelectedTableCells()!==null)&&this._onInsertContent(l,s,r)},{priority:"high"}),e.on("contentInsertion",()=>{n=!1},{priority:"lowest"})}_onCopyCut(t,e){const o=this.editor.editing.view,n=this.editor.plugins.get(F),l=this.editor.plugins.get(Ce);n.getSelectedTableCells()&&(t.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(e.preventDefault(),t.stop(),this.editor.model.enqueueChange({isUndoable:t.name==="cut"},()=>{const s=l._copySelectedFragmentWithMarkers(t.name,this.editor.model.document.selection,()=>n.getSelectionAsFragment());o.document.fire("clipboardOutput",{dataTransfer:e.dataTransfer,content:this.editor.data.toView(s),method:t.name})})))}_onInsertContent(t,e,o){if(o&&!o.is("documentSelection"))return;const n=this.editor.model,l=this.editor.plugins.get(A),s=this.editor.plugins.get(Ce),r=this.getTableIfOnlyTableInContent(e,n);if(!r)return;const a=l.getSelectionAffectedTableCells(n.document.selection);if(!a.length){Me(r,l);return}t.stop(),e.is("documentFragment")?s._pasteMarkersIntoTransformedElement(e.markers,d=>this._replaceSelectedCells(r,a,d)):this.editor.model.change(d=>{this._replaceSelectedCells(r,a,d)})}_replaceSelectedCells(t,e,o){const n=this.editor.plugins.get(A),l={width:n.getColumns(t),height:n.getRows(t)},s=tl(e,l,o,n),r=s.lastRow-s.firstRow+1,a=s.lastColumn-s.firstColumn+1,d={startRow:0,startColumn:0,endRow:Math.min(r,l.height)-1,endColumn:Math.min(a,l.width)-1};t=Et(t,d,o);const c=e[0].findAncestor("table"),u=this._replaceSelectedCellsWithPasted(t,l,c,s,o);if(this.editor.plugins.get("TableSelection").isEnabled){const h=n.sortRanges(u.map(m=>o.createRangeOn(m)));o.setSelection(h)}else o.setSelection(u[0],0);return c}_replaceSelectedCellsWithPasted(t,e,o,n,l){const{width:s,height:r}=e,a=nl(t,s,r),d=[...new T(o,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:!0})],c=[];let u;for(const w of d){const{row:f,column:C}=w;C===n.firstColumn&&(u=w.getPositionBefore());const _=f-n.firstRow,R=C-n.firstColumn,V=a[_%r][R%s],P=V?l.cloneElement(V):null,G=this._replaceTableSlotCell(w,P,u,l);G&&(Ft(G,f,C,n.lastRow,n.lastColumn,l),c.push(G),u=l.createPositionAfter(G))}const h=parseInt(o.getAttribute("headingRows")||"0"),m=parseInt(o.getAttribute("headingColumns")||"0"),p=n.firstRow<h&&h<=n.lastRow,b=n.firstColumn<m&&m<=n.lastColumn;if(p){const w={first:n.firstColumn,last:n.lastColumn},f=ke(o,h,w,l,n.firstRow);c.push(...f)}if(b){const w={first:n.firstRow,last:n.lastRow},f=Ve(o,m,w,l);c.push(...f)}return c}_replaceTableSlotCell(t,e,o,n){const{cell:l,isAnchor:s}=t;return s&&n.remove(l),e?(n.insert(e,o),e):null}getTableIfOnlyTableInContent(t,e){if(!t.is("documentFragment")&&!t.is("element"))return null;if(t.is("element","table"))return t;if(t.childCount==1&&t.getChild(0).is("element","table"))return t.getChild(0);const o=e.createRangeIn(t);for(const n of o.getItems())if(n.is("element","table")){const l=e.createRange(o.start,e.createPositionBefore(n));if(e.hasContent(l,{ignoreWhitespaces:!0}))return null;const s=e.createRange(e.createPositionAfter(n),o.end);return e.hasContent(s,{ignoreWhitespaces:!0})?null:n}return null}}function tl(i,t,e,o){const n=i[0].findAncestor("table"),l=o.getColumnIndexes(i),s=o.getRowIndexes(i),r={firstColumn:l.first,lastColumn:l.last,firstRow:s.first,lastRow:s.last},a=i.length===1;return a&&(r.lastRow+=t.height-1,r.lastColumn+=t.width-1,ol(n,r.lastRow+1,r.lastColumn+1,o)),a||!o.isSelectionRectangular(i)?ll(n,r,e):(r.lastRow=Nt(n,r),r.lastColumn=Mt(n,r)),r}function ol(i,t,e,o){const n=o.getColumns(i),l=o.getRows(i);e>n&&o.insertColumns(i,{at:n,columns:e-n}),t>l&&o.insertRows(i,{at:l,rows:t-l})}function nl(i,t,e){const o=new Array(e).fill(null).map(()=>new Array(t).fill(null));for(const{column:n,row:l,cell:s}of new T(i))o[l][n]=s;return o}function ll(i,t,e){const{firstRow:o,lastRow:n,firstColumn:l,lastColumn:s}=t,r={first:o,last:n},a={first:l,last:s};Ve(i,l,r,e),Ve(i,s+1,r,e),ke(i,o,a,e),ke(i,n+1,a,e,o)}function ke(i,t,e,o,n=0){return t<1?void 0:Wt(i,t,n).filter(({column:r,cellWidth:a})=>Ut(r,a,e)).map(({cell:r})=>Lt(r,t,o))}function Ve(i,t,e,o){return t<1?void 0:Bt(i,t).filter(({row:s,cellHeight:r})=>Ut(s,r,e)).map(({cell:s,column:r})=>Dt(s,r,t,o))}function Ut(i,t,e){const o=i+t-1,{first:n,last:l}=e,s=i>=n&&i<=l,r=i<n&&o>=n;return s||r}class il extends v{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[F,A]}init(){const t=this.editor,o=t.editing.view.document,n=t.t;this.listenTo(o,"arrowKey",(...l)=>this._onArrowKey(...l),{context:"table"}),this.listenTo(o,"tab",(...l)=>this._handleTabOnSelectedTable(...l),{context:"figure"}),this.listenTo(o,"tab",(...l)=>this._handleTab(...l),{context:["th","td"]}),t.accessibility.addKeystrokeInfoGroup({id:"table",label:n("Keystrokes that can be used in a table cell"),keystrokes:[{label:n("Move the selection to the next cell"),keystroke:"Tab"},{label:n("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:n("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:n("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(t,e){const o=this.editor,l=o.model.document.selection.getSelectedElement();!l||!l.is("element","table")||(e.preventDefault(),e.stopPropagation(),t.stop(),o.model.change(s=>{s.setSelection(s.createRangeIn(l.getChild(0).getChild(0)))}))}_handleTab(t,e){const o=this.editor,n=this.editor.plugins.get(A),l=this.editor.plugins.get("TableSelection"),s=o.model.document.selection,r=!e.shiftKey;let a=n.getTableCellsContainingSelection(s)[0];if(a||(a=l.getFocusCell()),!a)return;e.preventDefault(),e.stopPropagation(),t.stop();const d=a.parent,c=d.parent,u=c.getChildIndex(d),h=d.getChildIndex(a),m=h===0;if(!r&&m&&u===0){o.model.change(f=>{f.setSelection(f.createRangeOn(c))});return}const p=h===d.childCount-1,b=u===n.getRows(c)-1;if(r&&b&&p&&(o.execute("insertTableRowBelow"),u===n.getRows(c)-1)){o.model.change(f=>{f.setSelection(f.createRangeOn(c))});return}let w;if(r&&p)w=c.getChild(u+1).getChild(0);else if(!r&&m){const f=c.getChild(u-1);w=f.getChild(f.childCount-1)}else w=d.getChild(h+(r?1:-1));o.model.change(f=>{f.setSelection(f.createRangeIn(w))})}_onArrowKey(t,e){const o=this.editor,n=e.keyCode,l=ho(n,o.locale.contentLanguageDirection);this._handleArrowKeys(l,e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),t.stop())}_handleArrowKeys(t,e){const o=this.editor.plugins.get(A),n=this.editor.plugins.get("TableSelection"),l=this.editor.model,s=l.document.selection,r=["right","down"].includes(t),a=o.getSelectedTableCells(s);if(a.length){let c;return e?c=n.getFocusCell():c=r?a[a.length-1]:a[0],this._navigateFromCellInDirection(c,t,e),!0}const d=s.focus.findAncestor("tableCell");/* istanbul ignore if: paranoid check -- @preserve */if(!d)return!1;if(!s.isCollapsed)if(e){if(s.isBackward==r&&!s.containsEntireContent(d))return!1}else{const c=s.getSelectedElement();if(!c||!l.schema.isObject(c))return!1}return this._isSelectionAtCellEdge(s,d,r)?(this._navigateFromCellInDirection(d,t,e),!0):!1}_isSelectionAtCellEdge(t,e,o){const n=this.editor.model,l=this.editor.model.schema,s=o?t.getLastPosition():t.getFirstPosition();if(!l.getLimitElement(s).is("element","tableCell"))return n.createPositionAt(e,o?"end":0).isTouching(s);const r=n.createSelection(s);return n.modifySelection(r,{direction:o?"forward":"backward"}),s.isEqual(r.focus)}_navigateFromCellInDirection(t,e,o=!1){const n=this.editor.model,l=t.findAncestor("table"),s=[...new T(l,{includeAllSlots:!0})],{row:r,column:a}=s[s.length-1],d=s.find(({cell:C})=>C==t);let{row:c,column:u}=d;switch(e){case"left":u--;break;case"up":c--;break;case"right":u+=d.cellWidth;break;case"down":c+=d.cellHeight;break}const h=c<0||c>r,m=u<0&&c<=0,p=u>a&&c>=r;if(h||m||p){n.change(C=>{C.setSelection(C.createRangeOn(l))});return}u<0?(u=o?0:a,c--):u>a&&(u=o?a:0,c++);const b=s.find(C=>C.row==c&&C.column==u).cell,w=["right","down"].includes(e),f=this.editor.plugins.get("TableSelection");if(o&&f.isEnabled){const C=f.getAnchorCell()||t;f.setCellSelection(C,b)}else{const C=n.createPositionAt(b,w?0:"end");n.change(_=>{_.setSelection(C)})}}}class $t extends Oo{constructor(){super(...arguments);g(this,"domEventType",["mousemove","mouseleave"])}onDomEvent(e){this.fire(e.type,e)}}class sl extends v{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[F,A]}init(){this.editor.editing.view.addObserver($t),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const t=this.editor,e=t.plugins.get(A);let o=!1;const n=t.plugins.get(F);this.listenTo(t.editing.view.document,"mousedown",(l,s)=>{const r=t.model.document.selection;if(!this.isEnabled||!n.isEnabled||!s.domEvent.shiftKey)return;const a=n.getAnchorCell()||e.getTableCellsContainingSelection(r)[0];if(!a)return;const d=this._getModelTableCellFromDomEvent(s);d&&ct(a,d)&&(o=!0,n.setCellSelection(a,d),s.preventDefault())}),this.listenTo(t.editing.view.document,"mouseup",()=>{o=!1}),this.listenTo(t.editing.view.document,"selectionChange",l=>{o&&l.stop()},{priority:"highest"})}_enableMouseDragSelection(){const t=this.editor;let e,o,n=!1,l=!1;const s=t.plugins.get(F);this.listenTo(t.editing.view.document,"mousedown",(r,a)=>{!this.isEnabled||!s.isEnabled||a.domEvent.shiftKey||a.domEvent.ctrlKey||a.domEvent.altKey||(e=this._getModelTableCellFromDomEvent(a))}),this.listenTo(t.editing.view.document,"mousemove",(r,a)=>{if(!a.domEvent.buttons||!e)return;const d=this._getModelTableCellFromDomEvent(a);d&&ct(e,d)&&(o=d,!n&&o!=e&&(n=!0)),n&&(l=!0,s.setCellSelection(e,o),a.preventDefault())}),this.listenTo(t.editing.view.document,"mouseup",()=>{n=!1,l=!1,e=null,o=null}),this.listenTo(t.editing.view.document,"selectionChange",r=>{l&&r.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(t){const e=t.target,o=this.editor.editing.view.createPositionAt(e,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function ct(i,t){return i.parent.parent==t.parent.parent}class ui extends v{static get requires(){return[Z,Zn,F,sl,il,el,ao]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}function ue(i){const t=Gt(i);return t||pe(i)}function Gt(i){const t=i.getSelectedElement();return t&&jt(t)?t:null}function pe(i){const t=i.getFirstPosition();if(!t)return null;let e=t.parent;for(;e;){if(e.is("element")&&jt(e))return e;e=e.parent}return null}function jt(i){return!!i.getCustomProperty("table")&&co(i)}class hi extends v{static get requires(){return[$e]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const t=this.editor,e=t.t,o=t.plugins.get($e),n=t.config.get("table.contentToolbar"),l=t.config.get("table.tableToolbar");n&&o.register("tableContent",{ariaLabel:e("Table toolbar"),items:n,getRelatedElement:pe}),l&&o.register("table",{ariaLabel:e("Table toolbar"),items:l,getRelatedElement:Gt})}}class rl extends O{constructor(e,o){super(e);g(this,"options");g(this,"focusTracker");g(this,"focusCycler");g(this,"_focusables");g(this,"dropdownView");g(this,"inputView");g(this,"keystrokes");g(this,"_stillTyping");this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=o,this.focusTracker=new fe,this._focusables=new De,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new be,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,l,s)=>this._setInputValue(s))}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,o=e.t,n=this.bindTemplate,l=this._createColorSelector(e),s=oe(e),r=new O;return r.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",a=>a!="")]}}]}),s.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),s.buttonView.children.add(r),s.buttonView.label=o("Color picker"),s.buttonView.tooltip=!0,s.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",s.panelView.children.add(l),s.bind("isEnabled").to(this,"isReadOnly",a=>!a),s.on("change:isOpen",(a,d,c)=>{c&&(l.updateSelectedColors(),l.showColorGridsFragment())}),s}_createInputTextView(){const e=this.locale,o=new Bo(e);return o.extendTemplate({on:{blur:o.bindTemplate.to("blur")}}),o.value=this.value,o.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(o),o.on("input",()=>{const n=o.element.value,l=this.options.colorDefinitions.find(s=>n===s.label);this._stillTyping=!0,this.value=l&&l.color||n}),o.on("blur",()=>{this._stillTyping=!1,this._setInputValue(o.element.value)}),o.delegate("input").to(this),o}_createColorSelector(e){const o=e.t,n=this.options.defaultColorValue||"",l=o(n?"Restore default":"Remove color"),s=new Do(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:l,colorPickerLabel:o("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig===!1?!1:{...this.options.colorPickerConfig,hideInput:!0}});s.appendUI(),s.on("execute",(a,d)=>{if(d.source==="colorPickerSaveButton"){this.dropdownView.isOpen=!1;return}this.value=d.value||n,this.fire("input"),d.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)});let r=this.value;return s.on("colorPicker:cancel",()=>{this.value=r,this.fire("input"),this.dropdownView.isOpen=!1}),s.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{r=this.value}),s.bind("selectedColor").to(this,"value"),s}_setInputValue(e){if(!this._stillTyping){const o=dt(e),n=this.options.colorDefinitions.find(l=>o===dt(l.color));n?this.inputView.value=n.label:this.inputView.value=e||""}}}function dt(i){return i.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const ze=i=>i==="";function He(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 Kt(i){return i('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function qt(i){return i('The value is invalid. Try "10px" or "2em" or simply "2".')}function he(i){return i=i.trim().toLowerCase(),ze(i)||zo(i)}function q(i){return i=i.trim(),ze(i)||Yt(i)||kt(i)||Ho(i)}function Xt(i){return i=i.trim(),ze(i)||Yt(i)||kt(i)}function Jt(i,t){const e=new Ct,o=He(i.t);for(const n in o){const l={type:"button",model:new vt({_borderStyleValue:n,label:o[n],role:"menuitemradio",withText:!0})};n==="none"?l.model.bind("isOn").to(i,"borderStyle",s=>t==="none"?!s:s===n):l.model.bind("isOn").to(i,"borderStyle",s=>s===n),e.add(l)}return e}function Pe(i){const{view:t,icons:e,toolbar:o,labels:n,propertyName:l,nameToValue:s,defaultValue:r}=i;for(const a in n){const d=new E(t.locale);d.set({role:"radio",isToggleable:!0,label:n[a],icon:e[a],tooltip:n[a]});const c=s?s(a):a;d.bind("isOn").to(t,l,u=>{let h=u;return u===""&&r&&(h=r),c===h}),d.on("execute",()=>{!r&&c&&t[l]===c?t[l]=void 0:t[l]=c}),o.items.add(d)}}const me=[{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 ge(i){return(t,e,o)=>{const n=new rl(t.locale,{colorDefinitions:al(i.colorConfig),columns:i.columns,defaultColorValue:i.defaultColorValue,colorPickerConfig:i.colorPickerConfig});return n.inputView.set({id:e,ariaDescribedById:o}),n.bind("isReadOnly").to(t,"isEnabled",l=>!l),n.bind("hasError").to(t,"errorText",l=>!!l),n.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(n),n}}function Yt(i){const t=parseFloat(i);return!Number.isNaN(t)&&i===String(t)}function al(i){return i.map(t=>({color:t.model,label:t.label,options:{hasBorder:t.hasBorder}}))}class cl extends O{constructor(e,o){super(e);g(this,"options");g(this,"focusTracker");g(this,"keystrokes");g(this,"children");g(this,"borderStyleDropdown");g(this,"borderWidthInput");g(this,"borderColorInput");g(this,"backgroundInput");g(this,"paddingInput");g(this,"widthInput");g(this,"heightInput");g(this,"horizontalAlignmentToolbar");g(this,"verticalAlignmentToolbar");g(this,"saveButtonView");g(this,"cancelButtonView");g(this,"_focusables");g(this,"_focusCycler");this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=o;const{borderStyleDropdown:n,borderWidthInput:l,borderColorInput:s,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:d}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{horizontalAlignmentToolbar:p,verticalAlignmentToolbar:b,alignmentLabel:w}=this._createAlignmentFields();this.focusTracker=new fe,this.keystrokes=new be,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=l,this.borderColorInput=s,this.backgroundInput=d,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=h,this.horizontalAlignmentToolbar=p,this.verticalAlignmentToolbar=b;const{saveButtonView:f,cancelButtonView:C}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=C,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 At(e,{label:this.t("Cell properties")})),this.children.add(new x(e,{labelView:r,children:[r,n,s,l],class:"ck-table-form__border-row"})),this.children.add(new x(e,{labelView:a,children:[a,d],class:"ck-table-form__background-row"})),this.children.add(new x(e,{children:[new x(e,{labelView:m,children:[m,c,u,h],class:"ck-table-form__dimensions-row"}),new x(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new x(e,{labelView:w,children:[w,p,b],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new x(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(),St({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,o={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=ge({colorConfig:this.options.borderColors,columns:5,defaultColorValue:o.color,colorPickerConfig:this.options.colorPickerConfig}),l=this.locale,s=this.t,r=s("Style"),a=new L(l);a.text=s("Border");const d=He(s),c=new k(l,Rt);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>d[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),Be(c.fieldView,Jt(this,o.style),{role:"menu",ariaLabel:r});const u=new k(l,M);u.set({label:s("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",ee),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});const h=new k(l,n);return h.set({label:s("Color"),class:"ck-table-form__border-color"}),h.fieldView.bind("value").to(this,"borderColor"),h.bind("isEnabled").to(this,"borderStyle",ee),h.fieldView.on("input",()=>{this.borderColor=h.fieldView.value}),this.on("change:borderStyle",(m,p,b,w)=>{ee(b)||(this.borderColor="",this.borderWidth=""),ee(w)||(this.borderColor=o.color,this.borderWidth=o.width)}),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:h,borderWidthInput:u}}_createBackgroundFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Background");const l=ge({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),s=new k(e,l);return s.set({label:o("Color"),class:"ck-table-cell-properties-form__background"}),s.fieldView.bind("value").to(this,"backgroundColor"),s.fieldView.on("input",()=>{this.backgroundColor=s.fieldView.value}),{backgroundRowLabel:n,backgroundInput:s}}_createDimensionFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Dimensions");const l=new k(e,M);l.set({label:o("Width"),class:"ck-table-form__dimensions-row__width"}),l.fieldView.bind("value").to(this,"width"),l.fieldView.on("input",()=>{this.width=l.fieldView.element.value});const s=new O(e);s.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new k(e,M);return r.set({label:o("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:n,widthInput:l,operatorLabel:s,heightInput:r}}_createPaddingField(){const e=this.locale,o=this.t,n=new k(e,M);return n.set({label:o("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,o=this.t,n=new L(e),l={left:Vo,center:ko,right:xo,justify:Io,top:Ro,middle:So,bottom:Ao};n.text=o("Table cell text alignment");const s=new _e(e),r=e.contentLanguageDirection==="rtl";s.set({isCompact:!0,role:"radiogroup",ariaLabel:o("Horizontal text alignment toolbar")}),Pe({view:this,icons:l,toolbar:s,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:d=>{if(r){if(d==="left")return"right";if(d==="right")return"left"}return d},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const a=new _e(e);return a.set({isCompact:!0,role:"radiogroup",ariaLabel:o("Vertical text alignment toolbar")}),Pe({view:this,icons:l,toolbar:a,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:s,verticalAlignmentToolbar:a,alignmentLabel:n}}_createActionButtons(){const e=this.locale,o=this.t,n=new E(e),l=new E(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:o("Save"),icon:Tt,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(s,"errorText",(...r)=>r.every(a=>!a)),l.set({label:o("Cancel"),icon:_t,class:"ck-button-cancel",withText:!0}),l.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:l}}get _horizontalAlignmentLabels(){const e=this.locale,o=this.t,n=o("Align cell text to the left"),l=o("Align cell text to the center"),s=o("Align cell text to the right"),r=o("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:s,center:l,left:n,justify:r}:{left:n,center:l,right:s,justify:r}}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 ee(i){return i!=="none"}const Ee=[N.defaultPositions.northArrowSouth,N.defaultPositions.northArrowSouthWest,N.defaultPositions.northArrowSouthEast,N.defaultPositions.southArrowNorth,N.defaultPositions.southArrowNorthWest,N.defaultPositions.southArrowNorthEast,N.defaultPositions.viewportStickyNorth];function Zt(i,t){const e=i.plugins.get("ContextualBalloon"),o=i.editing.view.document.selection;let n;t==="cell"?pe(o)&&(n=eo(i)):ue(o)&&(n=Qt(i)),n&&e.updatePosition(n)}function Qt(i){const t=i.model.document.selection,e=D(t),o=i.editing.mapper.toViewElement(e);return{target:i.editing.view.domConverter.mapViewToDom(o),positions:Ee}}function eo(i){const t=i.editing.mapper,e=i.editing.view.domConverter,o=i.model.document.selection;if(o.rangeCount>1)return{target:()=>dl(o.getRanges(),i),positions:Ee};const n=to(o.getFirstPosition()),l=t.toViewElement(n);return{target:e.mapViewToDom(l),positions:Ee}}function to(i){return i.nodeAfter&&i.nodeAfter.is("element","tableCell")?i.nodeAfter:i.findAncestor("tableCell")}function dl(i,t){const e=t.editing.mapper,o=t.editing.view.domConverter,n=Array.from(i).map(l=>{const s=to(l.start),r=e.toViewElement(s);return new re(o.mapViewToDom(r))});return re.getBoundingRect(n)}function H(i){if(!i||!$o(i))return i;const{top:t,right:e,bottom:o,left:n}=i;if(t==e&&e==o&&o==n)return t}function U(i,t){const e=parseFloat(i);return Number.isNaN(e)||String(e)!==String(i)?i:`${e}${t}`}function we(i,t={}){const e={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...i};return t.includeAlignmentProperty&&!e.alignment&&(e.alignment="center"),t.includePaddingProperty&&!e.padding&&(e.padding=""),t.includeVerticalAlignmentProperty&&!e.verticalAlignment&&(e.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!e.horizontalAlignment&&(e.horizontalAlignment=t.isRightToLeftContent?"right":"left"),e}function oo(i,t){return we({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...i},t)}function Ue(i,t){return we({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...i},t)}const ul=500,ut={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class hl extends v{constructor(e){super(e);g(this,"_defaultContentTableCellProperties");g(this,"_defaultLayoutTableCellProperties");g(this,"_balloon");g(this,"view");g(this,"_viewWithContentTableDefaults");g(this,"_viewWithLayoutTableDefaults");g(this,"_undoStepBatch");g(this,"_isReady");e.config.define("table.tableCellProperties",{borderColors:me,backgroundColors:me})}static get requires(){return[ae]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t;this._defaultContentTableCellProperties=Ue(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(ae),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",n=>{const l=new E(n);l.set({label:o("Cell properties"),icon:Co,tooltip:!0}),this.listenTo(l,"execute",()=>this._showView());const s=Object.values(ut).map(r=>e.commands.get(r));return l.bind("isEnabled").toMany(s,"isEnabled",(...r)=>r.some(a=>a)),l})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const o=this.editor,n=o.config.get("table.tableCellProperties"),l=ce(n.borderColors),s=de(o.locale,l),r=ce(n.backgroundColors),a=de(o.locale,r),d=n.colorPicker!==!1,c=new cl(o.locale,{borderColors:s,backgroundColors:a,defaultTableCellProperties:e,colorPickerConfig:d?n.colorPicker||{}:!1}),u=o.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&o.execute("undo",this._undoStepBatch),this._hideView()}),c.keystrokes.set("Esc",(p,b)=>{this._hideView(),b()}),yt({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const h=Kt(u),m=qt(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableCellBorderColor",errorText:h,validator:he})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableCellBorderWidth",errorText:m,validator:Xt})),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:h,validator:he})),c.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),c.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),c}_fillViewFormFromCommandValues(){const e=this.editor.commands,o=e.get("tableCellBorderStyle");Object.entries(ut).map(([n,l])=>{const s=n,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[s]||"":this._defaultLayoutTableCellProperties[s]||"";return[n,e.get(l).value||r]}).forEach(([n,l])=>{(n==="borderColor"||n==="borderWidth")&&o.value==="none"||this.view.set(n,l)}),this._isReady=!0}_showView(){const e=this.editor,o=ue(e.editing.view.document.selection),n=o&&e.editing.mapper.toModelElement(o),l=!n||n.getAttribute("tableType")!=="layout";l&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):!l&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=l?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:eo(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,o=e.editing.view.document;pe(o.selection)?this._isViewVisible&&Zt(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(o,n,l)=>{this._isReady&&this.editor.execute(e,{value:l,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:o,viewField:n,validator:l,errorText:s}=e,r=Vt(()=>{n.errorText=s},ul);return(a,d,c)=>{r.cancel(),this._isReady&&(l(c)?(this.editor.execute(o,{value:c,batch:this._undoStepBatch}),n.errorText=null):r())}}}class W extends S{constructor(e,o,n){super(e);g(this,"attributeName");g(this,"_defaultValue");g(this,"_defaultContentTableValue");g(this,"_defaultLayoutTableValue");switch(this.attributeName=o,this._defaultContentTableValue=n,o){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 o=this.editor.model.document.selection,l=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(o),s=D(o);this._defaultValue=!s||s.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!l.length,this.value=this._getSingleValue(l)}execute(e={}){const{value:o,batch:n}=e,l=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(l.document.selection),a=this._getValueToSet(o);l.enqueueChange(n,d=>{a?r.forEach(c=>d.setAttribute(this.attributeName,a,c)):r.forEach(c=>d.removeAttribute(this.attributeName,c))})}_getAttribute(e){if(!e)return;const o=e.getAttribute(this.attributeName);if(o!==this._defaultValue)return o}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const o=this._getAttribute(e[0]);return e.every(l=>this._getAttribute(l)===o)?o:void 0}}class ml extends W{constructor(t,e){super(t,"tableCellWidth",e)}_getValueToSet(t){if(t=U(t,"px"),t!==this._defaultValue)return t}}class no extends v{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Z]}init(){const t=this.editor,e=Ue(t.config.get("table.tableCellProperties.defaultProperties"));ie(t.model.schema,t.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:e.width}),t.commands.add("tableCellWidth",new ml(t,e.width))}}class gl extends W{constructor(t,e){super(t,"tableCellPadding",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}class bl extends W{constructor(t,e){super(t,"tableCellHeight",e)}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}class fl extends W{constructor(t,e){super(t,"tableCellBackgroundColor",e)}}class pl extends W{constructor(t,e){super(t,"tableCellVerticalAlignment",e)}}class wl extends W{constructor(t,e){super(t,"tableCellHorizontalAlignment",e)}}class Cl extends W{constructor(t,e){super(t,"tableCellBorderStyle",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class Tl extends W{constructor(t,e){super(t,"tableCellBorderColor",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class _l extends W{constructor(t,e){super(t,"tableCellBorderWidth",e)}_getAttribute(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}const ht=/^(top|middle|bottom)$/,mt=/^(left|center|right|justify)$/;class yl extends v{static get pluginName(){return"TableCellPropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Z,no]}init(){const t=this.editor,e=t.model.schema,o=t.conversion;t.config.define("table.tableCellProperties.defaultProperties",{});const n=Ue(t.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:t.locale.contentLanguageDirection==="rtl"});t.data.addStyleProcessorRules(It),vl(e,o,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),t.commands.add("tableCellBorderStyle",new Cl(t,n.borderStyle)),t.commands.add("tableCellBorderColor",new Tl(t,n.borderColor)),t.commands.add("tableCellBorderWidth",new _l(t,n.borderWidth)),ie(e,o,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:n.height}),t.commands.add("tableCellHeight",new bl(t,n.height)),t.data.addStyleProcessorRules(Mo),ie(e,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:n.padding}),t.commands.add("tableCellPadding",new gl(t,n.padding)),t.data.addStyleProcessorRules(xt),ie(e,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),t.commands.add("tableCellBackgroundColor",new fl(t,n.backgroundColor)),Al(e,o,n.horizontalAlignment),t.commands.add("tableCellHorizontalAlignment",new wl(t,n.horizontalAlignment)),Sl(e,o,n.verticalAlignment),t.commands.add("tableCellVerticalAlignment",new pl(t,n.verticalAlignment))}}function vl(i,t,e){const o={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};i.extend("tableCell",{allowAttributes:Object.values(o)}),ye(t,"td",o,e),ye(t,"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 Al(i,t,e){i.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:o=>({key:"style",value:{"text-align":o}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":mt}},model:{key:"tableCellHorizontalAlignment",value:(o,n,l)=>{const s=B(e,"left",l),r=o.getStyle("text-align");return r===s?null:r}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:mt}},model:{key:"tableCellHorizontalAlignment",value:(o,n,l)=>{const s=B(e,"left",l),r=o.getAttribute("align");return r===s?null:r}}})}function Sl(i,t,e){i.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:o=>({key:"style",value:{"vertical-align":o}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":ht}},model:{key:"tableCellVerticalAlignment",value:(o,n,l)=>{const s=B(e,"middle",l),r=o.getStyle("vertical-align");return r===s?null:r}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:ht}},model:{key:"tableCellVerticalAlignment",value:(o,n,l)=>{const s=B(e,"middle",l),r=o.getAttribute("valign");return r===s?null:r}}})}class mi extends v{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[yl,hl]}}class Rl extends S{refresh(){this.isEnabled=!0}execute(t={}){const{model:e,plugins:o}=this.editor;let{table:n=e.document.selection.getSelectedElement(),columnWidths:l,tableWidth:s}=t;l&&(l=Array.isArray(l)?l:l.split(",")),e.change(r=>{s?r.setAttribute("tableWidth",s,n):r.removeAttribute("tableWidth",n);const a=o.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!l&&!a)return;if(!l)return r.remove(a);const d=Oe(l);if(a)Array.from(a.getChildren()).forEach((c,u)=>r.setAttribute("columnWidth",d[u],c));else{const c=r.createElement("tableColumnGroup");d.forEach(u=>r.appendElement("tableColumn",{columnWidth:u},c)),r.append(c,n)}})}}function Il(i){return t=>t.on("element:colgroup",(e,o,n)=>{const l=o.modelCursor.findAncestor("table"),s=J(l);if(!s)return;const r=Y(s),a=i.getColumns(l);let d=Rn(s,n.writer);d=Array.from({length:a},(c,u)=>d[u]||"auto"),(d.length!=r.length||d.includes("auto"))&&zt(r,s,Oe(d),n.writer)},{priority:"low"})}function xl(){return i=>i.on("insert:table",(t,e,o)=>{const n=o.writer,l=e.item,s=o.mapper.toViewElement(l),r=s.is("element","table")?s:Array.from(s.getChildren()).find(d=>d.is("element","table"));J(l)?n.addClass("ck-table-resized",r):n.removeClass("ck-table-resized",r)},{priority:"low"})}const gt=go("px");class kl extends v{constructor(e){super(e);g(this,"_isResizingActive");g(this,"_resizingData");g(this,"_domEmitter");g(this,"_tableUtilsPlugin");g(this,"_initialMouseEventData",null);this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(mo()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(o,n,l)=>{const s=l?"removeClass":"addClass";e.editing.view.change(r=>{for(const a of e.editing.view.document.roots)r[s]("ck-column-resize_disabled",e.editing.view.document.getRoot(a.rootName))})})}static get requires(){return[Z,A]}static get pluginName(){return"TableColumnResizeEditing"}static get isOfficialPlugin(){return!0}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,o=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:s=>s.is("element","tableColumnGroup"),positionOffset:0});const l=new Rl(e);e.commands.add("resizeTableWidth",l),e.commands.add("resizeColumnWidths",l),this.bind("_isResizingAllowed").to(e,"isReadOnly",o,"isEnabled",l,"isEnabled",(s,r,a)=>!s&&r&&a)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return J(e)}getTableColumnElements(e){return Y(e)}getTableColumnsWidths(e){return Sn(e)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){const o=this.editor.model;o.document.registerPostFixer(s=>{let r=!1;for(const a of wn(o)){const d=this.getColumnGroupElement(a),c=this.getTableColumnElements(d),u=this.getTableColumnsWidths(d);let h=Oe(u);h=n(h,a,this),!qe(u,h)&&(zt(c,d,h,s),r=!0)}return r});function n(s,r,a){const d=a._tableUtilsPlugin.getColumns(r);if(d-s.length===0)return s;const u=s.map(m=>Number(m.replace("%",""))),h=l(a.editor.model.document.differ,r);for(const m of h){const p=d-u.length;if(p===0)continue;const b=p>0,w=a._tableUtilsPlugin.getCellLocation(m).column;if(b){const f=Cn(r,a.editor),C=yn(p,f);u.splice(w,0,...C)}else{const f=u.splice(w,Math.abs(p));u[w]+=X(f)}}return u.map(m=>m+"%")}function l(s,r){const a=new Set;for(const d of s.getChanges())if(d.type=="insert"&&d.position.nodeAfter&&d.position.nodeAfter.name=="tableCell"&&d.position.nodeAfter.getAncestors().includes(r))a.add(d.position.nodeAfter);else if(d.type=="remove"){const c=d.position.nodeBefore||d.position.nodeAfter;c.name=="tableCell"&&c.getAncestors().includes(r)&&a.add(c)}return a}}_registerConverters(){const o=this.editor.conversion;o.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:n=>{if(!n.parent.is("element","figure"))return n.getStyle("width")}}}),o.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:n=>({name:"figure",key:"style",value:{width:n}})}),o.elementToElement({model:"tableColumnGroup",view:"colgroup"}),o.elementToElement({model:"tableColumn",view:"col"}),o.for("downcast").add(xl()),o.for("upcast").add(Il(this._tableUtilsPlugin)),o.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:n=>{const l=n.getStyle("width");return!l||!l.endsWith("%")&&!l.endsWith("pt")?"auto":l}}}),o.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),o.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:n=>({key:"style",value:{width:n}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver($t),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(se.window.document,"mousemove",Uo(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(se.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){const o=this.editor,n=o.editing.view.domConverter,l=n.mapViewToDom(e.findAncestor("table")),s=n.mapViewToDom(e.findAncestor(u=>["td","th"].includes(u.name))),r=new re(l),a=new re(s),d=gt(Number((r.top-a.top).toFixed(4))),c=gt(Number((a.bottom-r.bottom).toFixed(4)));o.editing.view.change(u=>{u.setStyle("top",d,e),u.setStyle("bottom",c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(o=>{o.removeStyle("top",e),o.removeStyle("bottom",e)})}_onMouseOverHandler(e,o){const n=o.target;n.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(n)}_onMouseOutHandler(e,o){const n=o.target;n.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(n))}_onMouseDownHandler(e,o){const n=o.target;if(!n.hasClass("ck-table-column-resizer")||!this._isResizingAllowed)return;const l=this.editor,s=l.editing.mapper.toModelElement(n.findAncestor("figure"));l.model.canEditAt(s)&&(o.preventDefault(),e.stop(),this._initialMouseEventData=o)}_startResizingAfterThreshold(){const e=this._initialMouseEventData,{target:o}=e,n=this.editor.editing.mapper.toModelElement(o.findAncestor("figure")),l=o.findAncestor("table"),s=r(n,this._tableUtilsPlugin,this.editor);Array.from(l.getChildren()).find(c=>c.is("element","colgroup"))||this.editor.editing.view.change(c=>{a(c,s,l)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,s),this.editor.editing.view.change(c=>d(c,l,this._resizingData));function r(c,u,h){const m=Array(u.getColumns(c)),p=new T(c);for(const b of p){const w=h.editing.mapper.toViewElement(b.cell),f=h.editing.view.domConverter.mapViewToDom(w),C=An(f);(!m[b.column]||C<m[b.column])&&(m[b.column]=I(C))}return m}function a(c,u,h){const m=c.createContainerElement("colgroup");for(let p=0;p<u.length;p++){const b=c.createEmptyElement("col"),w=`${I(u[p]/X(u)*100)}%`;c.setStyle("width",w,b),c.insert(c.createPositionAt(m,"end"),b)}c.insert(c.createPositionAt(h,0),m)}function d(c,u,h){const m=h.widths.viewFigureWidth/h.widths.viewFigureParentWidth;c.addClass("ck-table-resized",u),c.addClass("ck-table-column-resizer__active",h.elements.viewResizer),c.setStyle("width",`${I(m*100)}%`,u.findAncestor("figure"))}}_onMouseMoveHandler(e,o){if(this._initialMouseEventData){const R=this._initialMouseEventData.domEvent;if(Math.abs(o.clientX-R.clientX)>=pn)this._startResizingAfterThreshold(),this._initialMouseEventData=null;else return}if(!this._isResizingActive)return;if(!this._isResizingAllowed){this._onMouseUpHandler();return}const{columnPosition:n,flags:{isRightEdge:l,isTableCentered:s,isLtrContent:r},elements:{viewFigure:a,viewLeftColumn:d,viewRightColumn:c,viewResizer:u},widths:{viewFigureParentWidth:h,tableWidth:m,leftColumnWidth:p,rightColumnWidth:b}}=this._resizingData,w=-p+Re,f=l?h-m:b-Re,C=(r?1:-1)*(l&&s?2:1),_=_n((o.clientX-n)*C,Math.min(w,0),Math.max(f,0));_!==0&&(this.editor.editing.view.change(R=>{const V=I((p+_)*100/m);if(R.setStyle("width",`${V}%`,d),l){const P=I((m+_)*100/h);R.setStyle("width",`${P}%`,a)}else{const P=I((b-_)*100/m);R.setStyle("width",`${P}%`,c)}}),this._recalculateResizerElement(u))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;const{viewResizer:e,modelTable:o,viewFigure:n,viewColgroup:l}=this._resizingData.elements,s=this.editor,r=s.editing.view,a=this.getColumnGroupElement(o),d=Array.from(l.getChildren()).filter(f=>f.is("view:element")),c=a?this.getTableColumnsWidths(a):null,u=d.map(f=>f.getStyle("width")),h=!qe(c,u),m=o.getAttribute("tableWidth"),p=n.getStyle("width"),b=m!==p;(h||b)&&(this._isResizingAllowed?s.execute("resizeTableWidth",{table:o,tableWidth:`${I(p)}%`,columnWidths:u}):r.change(f=>{if(c)for(const C of d)f.setStyle("width",c.shift(),C);else f.remove(l);b&&(m?f.setStyle("width",m,n):f.removeStyle("width",n)),!c&&!m&&f.removeClass("ck-table-resized",[...n.getChildren()].find(C=>C.name==="table"))})),r.change(f=>{f.removeClass("ck-table-column-resizer__active",e)}),r.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,o){const n=this.editor,l=e.domEvent.clientX,s=e.target,r=s.findAncestor("td")||s.findAncestor("th"),a=n.editing.mapper.toModelElement(r),d=a.findAncestor("table"),c=Tn(a,this._tableUtilsPlugin).rightEdge,u=this._tableUtilsPlugin.getColumns(d)-1,h=c===u,m=!d.hasAttribute("tableAlignment"),p=n.locale.contentLanguageDirection!=="rtl",b=r.findAncestor("table"),w=b.findAncestor("figure"),f=[...b.getChildren()].find(io=>io.is("element","colgroup")),C=f.getChild(c),_=h?void 0:f.getChild(c+1),R=Ie(n.editing.view.domConverter.mapViewToDom(w.parent)),V=Ie(n.editing.view.domConverter.mapViewToDom(w)),P=Ot(d,n),G=o[c],lo=h?void 0:o[c+1];return{columnPosition:l,flags:{isRightEdge:h,isTableCentered:m,isLtrContent:p},elements:{viewResizer:s,modelTable:d,viewFigure:w,viewColgroup:f,viewLeftColumn:C,viewRightColumn:_},widths:{viewFigureParentWidth:R,viewFigureWidth:V,tableWidth:P,leftColumnWidth:G,rightColumnWidth:lo}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(o,n,l)=>{const s=n.item,r=l.mapper.toViewElement(s),a=l.writer;a.insert(a.createPositionAt(r,"end"),a.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}}class gi extends v{static get requires(){return[kl,no]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}class $ extends S{constructor(e,o,n){super(e);g(this,"attributeName");g(this,"_defaultValue");g(this,"_defaultContentTableValue");g(this,"_defaultLayoutTableValue");this.attributeName=o,this._defaultContentTableValue=n,this._defaultLayoutTableValue=o==="tableBorderStyle"?"none":void 0}refresh(){const o=this.editor.model.document.selection,n=D(o);this._defaultValue=!n||n.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!n,this.value=this._getValue(n)}execute(e={}){const o=this.editor.model,n=o.document.selection,{value:l,batch:s}=e,r=D(n),a=this._getValueToSet(l);o.enqueueChange(s,d=>{a?d.setAttribute(this.attributeName,a,r):d.removeAttribute(this.attributeName,r)})}_getValue(e){if(!e)return;const o=e.getAttribute(this.attributeName);if(o!==this._defaultValue)return o}_getValueToSet(e){if(e!==this._defaultValue)return e}}class Vl extends ${constructor(t,e){super(t,"tableBackgroundColor",e)}}class Pl extends ${constructor(t,e){super(t,"tableBorderColor",e)}_getValue(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class El extends ${constructor(t,e){super(t,"tableBorderStyle",e)}_getValue(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}}class Wl extends ${constructor(t,e){super(t,"tableBorderWidth",e)}_getValue(t){if(!t)return;const e=H(t.getAttribute(this.attributeName));if(e!==this._defaultValue)return e}_getValueToSet(t){const e=U(t,"px");if(e!==this._defaultValue)return e}}class Ll extends ${constructor(t,e){super(t,"tableWidth",e)}_getValueToSet(t){if(t=U(t,"px"),t!==this._defaultValue)return t}}class Bl extends ${constructor(t,e){super(t,"tableHeight",e)}_getValueToSet(t){if(t=U(t,"px"),t!==this._defaultValue)return t}}class Dl extends ${constructor(t,e){super(t,"tableAlignment",e)}}const Fl=/^(left|center|right)$/,Nl=/^(left|none|right)$/;class Ml extends v{static get pluginName(){return"TablePropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Z]}init(){const t=this.editor,e=t.model.schema,o=t.conversion;t.config.define("table.tableProperties.defaultProperties",{});const n=oo(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});t.data.addStyleProcessorRules(It),Ol(e,o,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),t.commands.add("tableBorderColor",new Pl(t,n.borderColor)),t.commands.add("tableBorderStyle",new El(t,n.borderStyle)),t.commands.add("tableBorderWidth",new Wl(t,n.borderWidth)),zl(e,o,n.alignment),t.commands.add("tableAlignment",new Dl(t,n.alignment)),bt(e,o,{modelAttribute:"tableWidth",styleName:"width",defaultValue:n.width}),t.commands.add("tableWidth",new Ll(t,n.width)),bt(e,o,{modelAttribute:"tableHeight",styleName:"height",defaultValue:n.height}),t.commands.add("tableHeight",new Bl(t,n.height)),t.data.addStyleProcessorRules(xt),Hl(e,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),t.commands.add("tableBackgroundColor",new Vl(t,n.backgroundColor))}}function Ol(i,t,e){const o={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};i.extend("table",{allowAttributes:Object.values(o)}),ye(t,"table",o,e),ne(t,{modelAttribute:o.color,styleName:"border-color"}),ne(t,{modelAttribute:o.style,styleName:"border-style"}),ne(t,{modelAttribute:o.width,styleName:"border-width"})}function zl(i,t,e){i.extend("table",{allowAttributes:["tableAlignment"]}),t.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:(o,n,l)=>({key:"style",value:l.item.getAttribute("tableType")!=="layout"?{float:"none"}:{"margin-left":"auto","margin-right":"auto"}})},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:Nl}},model:{key:"tableAlignment",value:(o,n,l)=>{const s=B(e,"",l);let r=o.getStyle("float");return r==="none"&&(r="center"),r===s?null:r}}}).attributeToAttribute({view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},model:{key:"tableAlignment",value:(o,n,l)=>{const s=B(e,"",l),r="center";return r===s?null:r}}}).attributeToAttribute({view:{attributes:{align:Fl}},model:{name:"table",key:"tableAlignment",value:(o,n,l)=>{const s=B(e,"",l),r=o.getAttribute("align");return r===s?null:r}}})}function Hl(i,t,e){const{modelAttribute:o}=e;i.extend("table",{allowAttributes:[o]}),Ne(t,{viewElement:"table",...e}),ne(t,e)}function bt(i,t,e){const{modelAttribute:o}=e;i.extend("table",{allowAttributes:[o]}),Ne(t,{viewElement:/^(table|figure)$/,shouldUpcast:n=>!(n.name=="table"&&n.parent.name=="figure"),...e}),K(t,{modelElement:"table",...e})}class Ul extends O{constructor(e,o){super(e);g(this,"options");g(this,"focusTracker");g(this,"keystrokes");g(this,"children");g(this,"borderStyleDropdown");g(this,"borderWidthInput");g(this,"borderColorInput");g(this,"backgroundInput");g(this,"widthInput");g(this,"heightInput");g(this,"alignmentToolbar");g(this,"saveButtonView");g(this,"cancelButtonView");g(this,"_focusables");g(this,"_focusCycler");this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=o;const{borderStyleDropdown:n,borderWidthInput:l,borderColorInput:s,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:d}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{alignmentToolbar:p,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new fe,this.keystrokes=new be,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=l,this.borderColorInput=s,this.backgroundInput=d,this.widthInput=c,this.heightInput=h,this.alignmentToolbar=p;const{saveButtonView:w,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=w,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 At(e,{label:this.t("Table properties")})),this.children.add(new x(e,{labelView:r,children:[r,n,s,l],class:"ck-table-form__border-row"})),this.children.add(new x(e,{labelView:a,children:[a,d],class:"ck-table-form__background-row"})),this.children.add(new x(e,{children:[new x(e,{labelView:m,children:[m,c,u,h],class:"ck-table-form__dimensions-row"}),new x(e,{labelView:b,children:[b,p],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new x(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(),St({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,o={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=ge({colorConfig:this.options.borderColors,columns:5,defaultColorValue:o.color,colorPickerConfig:this.options.colorPickerConfig}),l=this.locale,s=this.t,r=s("Style"),a=new L(l);a.text=s("Border");const d=He(s),c=new k(l,Rt);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>d[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),Be(c.fieldView,Jt(this,o.style),{role:"menu",ariaLabel:r});const u=new k(l,M);u.set({label:s("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",te),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});const h=new k(l,n);return h.set({label:s("Color"),class:"ck-table-form__border-color"}),h.fieldView.bind("value").to(this,"borderColor"),h.bind("isEnabled").to(this,"borderStyle",te),h.fieldView.on("input",()=>{this.borderColor=h.fieldView.value}),this.on("change:borderStyle",(m,p,b,w)=>{te(b)||(this.borderColor="",this.borderWidth=""),te(w)||(this.borderColor=o.color,this.borderWidth=o.width)}),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:h,borderWidthInput:u}}_createBackgroundFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Background");const l=ge({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),s=new k(e,l);return s.set({label:o("Color"),class:"ck-table-properties-form__background"}),s.fieldView.bind("value").to(this,"backgroundColor"),s.fieldView.on("input",()=>{this.backgroundColor=s.fieldView.value}),{backgroundRowLabel:n,backgroundInput:s}}_createDimensionFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Dimensions");const l=new k(e,M);l.set({label:o("Width"),class:"ck-table-form__dimensions-row__width"}),l.fieldView.bind("value").to(this,"width"),l.fieldView.on("input",()=>{this.width=l.fieldView.element.value});const s=new O(e);s.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new k(e,M);return r.set({label:o("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:n,widthInput:l,operatorLabel:s,heightInput:r}}_createAlignmentFields(){const e=this.locale,o=this.t,n=new L(e);n.text=o("Alignment");const l=new _e(e);return l.set({role:"radiogroup",isCompact:!0,ariaLabel:o("Table alignment toolbar")}),Pe({view:this,icons:{left:vo,center:yo,right:_o},toolbar:l,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:l}}_createActionButtons(){const e=this.locale,o=this.t,n=new E(e),l=new E(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:o("Save"),icon:Tt,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(s,"errorText",(...r)=>r.every(a=>!a)),l.set({label:o("Cancel"),icon:_t,class:"ck-button-cancel",withText:!0}),l.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:l}}get _alignmentLabels(){const e=this.locale,o=this.t,n=o("Align table to the left"),l=o("Center table"),s=o("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:s,center:l,left:n}:{left:n,center:l,right:s}}}function te(i){return i!=="none"}const $l=500,ft={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Gl extends v{constructor(e){super(e);g(this,"_defaultContentTableProperties");g(this,"_defaultLayoutTableProperties");g(this,"_balloon");g(this,"view",null);g(this,"_viewWithContentTableDefaults",null);g(this,"_viewWithLayoutTableDefaults",null);g(this,"_undoStepBatch");g(this,"_isReady");e.config.define("table.tableProperties",{borderColors:me,backgroundColors:me})}static get requires(){return[ae]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;this._defaultContentTableProperties=oo(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=we(),this._balloon=e.plugins.get(ae),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,o=e.t,n=new E(e.locale);n.set({label:o("Table properties"),icon:To,tooltip:!0}),this.listenTo(n,"execute",()=>this._showView());const l=Object.values(ft).map(s=>e.commands.get(s));return n.bind("isEnabled").toMany(l,"isEnabled",(...s)=>s.some(r=>r)),n}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const o=this.editor,n=o.config.get("table.tableProperties"),l=ce(n.borderColors),s=de(o.locale,l),r=ce(n.backgroundColors),a=de(o.locale,r),d=n.colorPicker!==!1,c=new Ul(o.locale,{borderColors:s,backgroundColors:a,defaultTableProperties:e,colorPickerConfig:d?n.colorPicker||{}:!1}),u=o.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&o.execute("undo",this._undoStepBatch),this._hideView()}),c.keystrokes.set("Esc",(p,b)=>{this._hideView(),b()}),yt({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const h=Kt(u),m=qt(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableBorderColor",errorText:h,validator:he})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableBorderWidth",errorText:m,validator:Xt})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableBackgroundColor",errorText:h,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,o=e.get("tableBorderStyle");Object.entries(ft).map(([n,l])=>{const s=n,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[s]||"":this._defaultLayoutTableProperties[s]||"";return[s,e.get(l).value||r]}).forEach(([n,l])=>{(n==="borderColor"||n==="borderWidth")&&o.value==="none"||this.view.set(n,l)}),this._isReady=!0}_showView(){const e=this.editor,o=ue(e.editing.view.document.selection),n=o&&e.editing.mapper.toModelElement(o),l=!n||n.getAttribute("tableType")!=="layout";l&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):!l&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=l?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Qt(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,o=e.editing.view.document;ue(o.selection)?this._isViewVisible&&Zt(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(o,n,l)=>{this._isReady&&this.editor.execute(e,{value:l,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:o,viewField:n,validator:l,errorText:s}=e,r=Vt(()=>{n.errorText=s},$l);return(a,d,c)=>{r.cancel(),this._isReady&&(l(c)?(this.editor.execute(o,{value:c,batch:this._undoStepBatch}),n.errorText=null):r())}}}class bi extends v{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[Ml,Gl]}}/**
|
|
14
14
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
15
15
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
16
16
|
*/function jl(i){i.document.registerPostFixer(t=>Kl(t,i))}function Kl(i,t){const e=t.document.differ.getChanges();let o=!1;for(const n of e){if(n.type!="insert")continue;const l=n.position.parent;if(l.is("element","table")||n.name=="table"){const s=n.name=="table"?n.position.nodeAfter:l,r=Array.from(s.getChildren()).filter(d=>d.is("element","caption")),a=r.shift();if(!a)continue;for(const d of r)i.move(i.createRangeIn(d),a,"end"),i.remove(d);a.nextSibling&&(i.move(i.createRangeOn(a),s,"end"),o=!0),o=!!r.length||o}}return o}function pt(i){return!!i&&i.is("element","table")}function We(i){for(const t of i.getChildren())if(t.is("element","caption"))return t;return null}function ql(i){const t=D(i);return t?We(t):null}function Xl(i){const t=i.parent;return i.name=="figcaption"&&t&&t.is("element","figure")&&t.hasClass("table")?{name:!0}:i.name=="caption"&&t&&t.is("element","table")?{name:!0}:null}class Jl extends S{refresh(){const t=this.editor,e=D(t.model.document.selection);this.isEnabled=!!e&&t.model.schema.checkChild(e,"caption"),this.isEnabled?this.value=!!We(e):this.value=!1}execute({focusCaptionOnShow:t=!1}={}){this.editor.model.change(e=>{this.value?this._hideTableCaption(e):this._showTableCaption(e,t)})}_showTableCaption(t,e){const o=this.editor.model,n=D(o.document.selection),r=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||t.createElement("caption");o.insertContent(r,n,"end"),e&&t.setSelection(r,"in")}_hideTableCaption(t){const e=this.editor.model,o=D(e.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),l=We(o);n._saveCaption(o,l),e.deleteContent(t.createSelection(l,"on"))}}class Yl extends v{constructor(e){super(e);g(this,"_savedCaptionsMap");this._savedCaptionsMap=new WeakMap}static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.model.schema,n=e.editing.view,l=e.t;o.isRegistered("caption")?o.extend("caption",{allowIn:"table"}):o.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new Jl(this.editor)),e.conversion.for("upcast").elementToElement({view:Xl,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(s,{writer:r})=>pt(s.parent)?r.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(s,{writer:r})=>{if(!pt(s.parent))return null;const a=r.createEditableElement("figcaption");return r.setCustomProperty("tableCaption",!0,a),a.placeholder=l("Enter table caption"),Fo({view:n,element:a,keepOnFocus:!0}),wt(a,r)}}),jl(e.model)}_getSavedCaption(e){const o=this._savedCaptionsMap.get(e);return o?No.fromJSON(o):null}_saveCaption(e,o){this._savedCaptionsMap.set(e,o.toJSON())}}class Zl extends v{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.editing.view,o=t.t;t.ui.componentFactory.add("toggleTableCaption",n=>{const l=t.commands.get("toggleTableCaption"),s=new E(n);return s.set({icon:wo,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(l,"value","isEnabled"),s.bind("label").to(l,"value",r=>o(r?"Toggle caption off":"Toggle caption on")),this.listenTo(s,"execute",()=>{if(t.execute("toggleTableCaption",{focusCaptionOnShow:!0}),l.value){const r=ql(t.model.document.selection),a=t.editing.mapper.toViewElement(r);if(!a)return;e.scrollToTheSelection(),e.change(d=>{d.addClass("table__caption_highlighted",a)})}t.editing.view.focus()}),s})}}class fi extends v{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[Yl,Zl]}}export{ui as Table,fi as TableCaption,Yl as TableCaptionEditing,Zl as TableCaptionUI,mi as TableCellProperties,yl as TableCellPropertiesEditing,hl as TableCellPropertiesUI,no as TableCellWidthEditing,el as TableClipboard,gi as TableColumnResize,kl as TableColumnResizeEditing,Z as TableEditing,il as TableKeyboard,sl as TableMouse,bi as TableProperties,Ml as TablePropertiesEditing,Gl as TablePropertiesUI,F as TableSelection,hi as TableToolbar,Zn as TableUI,A as TableUtils};
|