@ncino/web-components 8.0.1 → 8.1.0-preview.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/dist/_slds/icons/svg/symbols-rtl.svg +1 -1
  2. package/dist/_slds/icons/svg/symbols.svg +1 -1
  3. package/dist/_slds/icons/symbols-rtl.svg +1 -1
  4. package/dist/_slds/icons/symbols.svg +1 -1
  5. package/dist/_virtual/index5.js +1 -1
  6. package/dist/_virtual/index6.js +1 -1
  7. package/dist/_virtual/index_html.js +1 -1
  8. package/dist/_virtual/index_react.js +1 -1
  9. package/dist/assets/node_modules/.pnpm/ckeditor5@46.1.1/node_modules/ckeditor5/dist/ckeditor5.css +1 -4
  10. package/dist/components/accordion/gator/base/accordion.gator.js +1 -1
  11. package/dist/components/accordion/gator/group/accordion-group.gator.js +1 -1
  12. package/dist/components/alert/gator/base/alert.gator.js +1 -1
  13. package/dist/components/alert/gator/subtitle/alert-subtitle.gator.js +1 -1
  14. package/dist/components/alert/gator/title/alert-title.gator.js +1 -1
  15. package/dist/components/avatar/gator/avatar.gator.js +1 -1
  16. package/dist/components/badge/gator/badge.gator.js +1 -1
  17. package/dist/components/banner/gator/banner.gator.js +1 -1
  18. package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.js +10 -4
  19. package/dist/components/button/gator/button.gator.js +1 -1
  20. package/dist/components/button-card/gator/button-card.gator.js +1 -1
  21. package/dist/components/card/card.js +1 -1
  22. package/dist/components/card/gator/base/card.gator.js +1 -1
  23. package/dist/components/card/gator/content/card-content.gator.js +1 -1
  24. package/dist/components/card/gator/footer/card-footer.gator.js +1 -1
  25. package/dist/components/card/gator/header/card-header.gator.js +1 -1
  26. package/dist/components/checkbox/checkbox.gator.js +1 -1
  27. package/dist/components/chip/gator/chip.gator.js +1 -1
  28. package/dist/components/date-picker/base/gator/datepicker.gator.js +1 -1
  29. package/dist/components/date-picker/year-month-selector/year-month-selector.gator.js +1 -1
  30. package/dist/components/display-card/gator/display-card.gator.js +1 -1
  31. package/dist/components/divider/gator/divider.gator.js +1 -1
  32. package/dist/components/fab/gator/fab.gator.js +1 -1
  33. package/dist/components/icon-button/gator/icon-button.gator.js +1 -1
  34. package/dist/components/illustration/gator/illustration.gator.js +1 -1
  35. package/dist/components/image-card/gator/image-card.gator.js +25 -20
  36. package/dist/components/input/base/input-base.gator.js +1 -1
  37. package/dist/components/input/gator/dropdown/input-dropdown.gator.js +5 -1
  38. package/dist/components/input/gator/help-text/help-text.gator.js +1 -1
  39. package/dist/components/input/gator/input-phone/input-phone.gator.js +3 -1
  40. package/dist/components/loading-spinner/gator/loading-spinner.gator.js +1 -1
  41. package/dist/components/menu/base/gator/menu.gator.js +1 -1
  42. package/dist/components/modal/gator/modal.gator.js +54 -50
  43. package/dist/components/page-header/gator/page-header.gator.js +3 -3
  44. package/dist/components/panel/gator/panel.storybook-test.js +1 -1
  45. package/dist/components/popover/gator/popover.gator.js +1 -1
  46. package/dist/components/progress-bar/gator/progress-bar.gator.js +18 -12
  47. package/dist/components/progress-ring/gator/progress-ring.gator.js +1 -1
  48. package/dist/components/selection-box/selection-box.gator.js +1 -1
  49. package/dist/components/selector/gator/selector.gator.js +1 -1
  50. package/dist/components/skeleton-loader/gator/skeleton-loader.gator.js +1 -1
  51. package/dist/components/switch/gator/switch.gator.js +1 -1
  52. package/dist/components/table/gator/table.gator.js +1 -1
  53. package/dist/components/tabs/gator/tabset/tabset.gator.js +1 -1
  54. package/dist/components/text-detail/gator/text-detail.gator.js +1 -1
  55. package/dist/components/text-link/gator/text-link.gator.js +1 -1
  56. package/dist/components/toast/gator/base/toast.gator.js +1 -1
  57. package/dist/components/toast/gator/subtitle/toast-subtitle.gator.js +1 -1
  58. package/dist/components/toast/gator/title/toast-title.gator.js +1 -1
  59. package/dist/components/toast-container/gator/toast-container.gator.js +1 -1
  60. package/dist/components/toaster/gator/toaster.gator.js +1 -1
  61. package/dist/components/tooltip/gator/tooltip.gator.js +1 -1
  62. package/dist/design-tokens.source.json +1 -1
  63. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-alignment@46.1.1/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -4
  64. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-autoformat@46.1.1/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -7
  65. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-autosave@46.1.1/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -4
  66. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-basic-styles@46.1.1/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -4
  67. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-block-quote@46.1.1/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -4
  68. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +2 -14
  69. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-cloud-services@46.1.1/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -4
  70. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-code-block@46.1.1/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -4
  71. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -4
  72. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-editor-classic@46.1.1/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -4
  73. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +2 -29
  74. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-enter@46.1.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -7
  75. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-essentials@46.1.1/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -4
  76. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-find-and-replace@46.1.1/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +2 -5
  77. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-font@46.1.1/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -7
  78. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-heading@46.1.1/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -7
  79. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-highlight@46.1.1/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -4
  80. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-horizontal-line@46.1.1/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -4
  81. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@46.1.1/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -4
  82. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@46.1.1/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +1 -10
  83. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +1 -4
  84. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@46.1.1/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -10
  85. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@46.1.1/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -10
  86. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-language@46.1.1/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -4
  87. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@46.1.1/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -4
  88. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@46.1.1/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -13
  89. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-markdown-gfm@46.1.1/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +2 -5
  90. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-media-embed@46.1.1/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -7
  91. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-mention@46.1.1/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -4
  92. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-page-break@46.1.1/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -4
  93. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paragraph@46.1.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -4
  94. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@46.1.1/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -31
  95. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-remove-format@46.1.1/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -4
  96. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-select-all@46.1.1/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -4
  97. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-show-blocks@46.1.1/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -4
  98. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@46.1.1/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -4
  99. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@46.1.1/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -4
  100. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-style@46.1.1/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -4
  101. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@46.1.1/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -16
  102. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +1 -13
  103. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -25
  104. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-undo@46.1.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -4
  105. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-upload@46.1.1/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -4
  106. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +3 -108
  107. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-watchdog@46.1.1/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +1 -10
  108. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -4
  109. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.9/node_modules/@figma/code-connect/package.json.js +1 -0
  110. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js +1 -5
  111. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/default-msg.js +1 -5
  112. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/deferred.js +1 -5
  113. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/fnv1a64.js +1 -5
  114. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/locale-status-event.js +1 -5
  115. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-controller.js +1 -5
  116. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-decorator.js +1 -5
  117. package/dist/node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/str-tag.js +1 -5
  118. package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js +1 -5
  119. package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/custom-element.js +1 -5
  120. package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js +1 -5
  121. package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js +1 -5
  122. package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js +1 -5
  123. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +1 -17
  124. package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +1 -7
  125. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +1 -1
  126. package/dist/node_modules/.pnpm/axe-core@4.11.0/node_modules/axe-core/axe.js +1 -11
  127. package/dist/node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js +1 -6
  128. package/dist/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.js +1 -217
  129. package/dist/node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/conversions.js +1 -0
  130. package/dist/node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/index.js +1 -0
  131. package/dist/node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/route.js +1 -0
  132. package/dist/node_modules/.pnpm/color-string@2.1.4/node_modules/color-string/index.js +1 -0
  133. package/dist/node_modules/.pnpm/{color@5.0.2 → color@5.0.3}/node_modules/color/index.js +1 -1
  134. package/dist/node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js +1 -1
  135. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.26/node_modules/libphonenumber-js/metadata.min.json.js +1 -0
  136. package/dist/node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js +1 -5
  137. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/async-directive.js +1 -5
  138. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.js +1 -5
  139. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js +1 -5
  140. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js +1 -5
  141. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/if-defined.js +1 -5
  142. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.js +1 -5
  143. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/ref.js +1 -5
  144. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/repeat.js +1 -5
  145. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js +1 -5
  146. package/dist/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js +1 -5
  147. package/dist/node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.production.js +1 -9
  148. package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js +1 -0
  149. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-JVSKG4YS.js +48 -0
  150. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-MM7DTO55.js +1 -0
  151. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-OPCDBBL3.js +6 -0
  152. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-SN4J4IQ3.js +1 -0
  153. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/_browser-chunks/chunk-VUAFL5XK.js +1 -0
  154. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/client-logger/index.js +1 -0
  155. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/core-events/index.js +1 -0
  156. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/instrumenter/index.js +1 -0
  157. package/dist/node_modules/.pnpm/storybook@10.0.8_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5_e2791259526ede65857ac65f52302a74/node_modules/storybook/dist/test/index.js +152 -0
  158. package/dist/node_modules/.pnpm/{string_decoder@1.3.0 → string_decoder@1.1.1}/node_modules/string_decoder/lib/string_decoder.js +1 -1
  159. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/index.js +1 -1
  160. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/body.js +1 -1
  161. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fileapi/util.js +1 -1
  162. package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/frame.js +1 -1
  163. package/dist/packages/web-components/src/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.scss.js +1 -1
  164. package/dist/packages/web-components/src/components/image-card/gator/image-card.gator.scss.js +1 -1
  165. package/dist/packages/web-components/src/components/input/gator/dropdown/input-dropdown.gator.scss.js +1 -1
  166. package/dist/packages/web-components/src/components/modal/gator/modal.gator.scss.js +1 -1
  167. package/dist/packages/web-components/src/components/progress-bar/gator/progress-bar.gator.scss.js +1 -1
  168. package/dist/packages/web-components/src/components/text-link/gator/text-link.gator.scss.js +1 -1
  169. package/dist/packages/web-components/src/index.slds.scss.js +1 -1
  170. package/dist/types/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.d.ts +3 -5
  171. package/dist/types/components/image-card/gator/image-card.gator.d.ts +5 -0
  172. package/dist/types/components/modal/gator/modal.gator.d.ts +16 -3
  173. package/dist/types/components/page-header/gator/page-header.gator.d.ts +0 -1
  174. package/dist/types/components/progress-bar/gator/progress-bar.gator.d.ts +8 -0
  175. package/dist/types/generated/locale-codes.d.ts +10 -0
  176. package/dist/types/generated/locales/es-419.d.ts +6 -1
  177. package/dist/types/generated/locales/fr-CA.d.ts +6 -1
  178. package/dist/types/generated/locales/zh-Hans.d.ts +6 -1
  179. package/dist/utils/brand-color-utils.js +1 -1
  180. package/dist/utils/components/ngc-component.js +1 -1
  181. package/dist/utils/vitest-a11y-utils.js +1 -1
  182. package/package.json +21 -21
  183. package/web-types.json +30 -15
  184. package/dist/generated/locale-codes.d.js +0 -1
  185. package/dist/generated/locales/es-419.d.js +0 -1
  186. package/dist/generated/locales/fr-CA.d.js +0 -1
  187. package/dist/generated/locales/zh-Hans.d.js +0 -1
  188. package/dist/node_modules/.pnpm/@figma_code-connect@1.3.7/node_modules/@figma/code-connect/package.json.js +0 -1
  189. package/dist/node_modules/.pnpm/color-string@2.0.1/node_modules/color-string/index.js +0 -1
  190. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.24/node_modules/libphonenumber-js/metadata.min.json.js +0 -1
  191. package/dist/node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js +0 -1
  192. package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3___lkgkjokudzf76cn2onqpg4zpmy/node_modules/storybook/dist/client-logger/index.js +0 -1
  193. package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3___lkgkjokudzf76cn2onqpg4zpmy/node_modules/storybook/dist/core-events/index.js +0 -1
  194. package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3___lkgkjokudzf76cn2onqpg4zpmy/node_modules/storybook/dist/instrumenter/index.js +0 -48
  195. package/dist/node_modules/.pnpm/storybook@9.1.13_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3___lkgkjokudzf76cn2onqpg4zpmy/node_modules/storybook/dist/test/index.js +0 -217
  196. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/client/external.js +0 -0
  197. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/client/figma_client.js +0 -0
  198. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/common/fetch.js +0 -0
  199. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/common/logging.js +0 -0
  200. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/common/updates.js +0 -0
  201. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/external_types.js +0 -0
  202. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +0 -0
  203. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/helpers.js +0 -0
  204. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/connect/index_common.js +0 -0
  205. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/html/external.js +0 -0
  206. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/html/index_html.js +0 -0
  207. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/html/template_literal.js +0 -0
  208. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/react/external.js +0 -0
  209. /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.7 → @figma_code-connect@1.3.9}/node_modules/@figma/code-connect/dist/react/index_react.js +0 -0
  210. /package/dist/node_modules/.pnpm/{@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3__playwright@1.56.1_vite@_goyfjr2bjpgz2pt2645hrgmcse → @vitest_browser@3.2.4_msw@2.7.3_@types_node@24.10.0_typescript@5.9.3__playwright@1.56.1_fa5be4b0345b48b65ec4b7072214c2b3}/node_modules/@vitest/browser/context.js +0 -0
  211. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/ParseError.js +0 -0
  212. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/PhoneNumber.js +0 -0
  213. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/constants.js +0 -0
  214. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/format.js +0 -0
  215. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +0 -0
  216. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -0
  217. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -0
  218. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -0
  219. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -0
  220. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -0
  221. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -0
  222. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -0
  223. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -0
  224. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -0
  225. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -0
  226. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -0
  227. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -0
  228. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -0
  229. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -0
  230. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +0 -0
  231. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -0
  232. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/isObject.js +0 -0
  233. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -0
  234. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -0
  235. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +0 -0
  236. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -0
  237. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/isPossible.js +0 -0
  238. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/isValid.js +0 -0
  239. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/metadata.js +0 -0
  240. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/normalizeArguments.js +0 -0
  241. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parse.js +0 -0
  242. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -0
  243. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +0 -0
  244. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -0
  245. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +0 -0
  246. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/es6/tools/semver-compare.js +0 -0
  247. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +0 -0
  248. /package/dist/node_modules/.pnpm/{libphonenumber-js@1.12.24 → libphonenumber-js@1.12.26}/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +0 -0
  249. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3.2.4_j_d4zn5pd34wsgn4wvyuyhrqqcse → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
  250. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3.2.4_j_d4zn5pd34wsgn4wvyuyhrqqcse → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -0
  251. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3.2.4_j_d4zn5pd34wsgn4wvyuyhrqqcse → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -0
  252. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3.2.4_j_d4zn5pd34wsgn4wvyuyhrqqcse → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.10.0_@vitest_browser@3.2.4_@vitest_ui@3_10880c0a9445bba638204ee93166eaed}/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -0
  253. /package/dist/packages/{web-components/src/tokens/primitive.tokens.scss.js → styles/src/gator/tokens/primitive.tokens.css.js} +0 -0
  254. /package/dist/packages/{web-components/src/tokens/semantic.tokens.scss.js → styles/src/gator/tokens/semantic.tokens.css.js} +0 -0
@@ -1,4 +1 @@
1
- import{Plugin as p,Command as ee}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as ue,findAttributeRange as C,TextWatcher as he,getLastTextLine as me,TwoStepCaretMovement as K,Input as fe,inlineHighlight as ke}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{ClipboardPipeline as ge}from"../../../../../@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{env as we,keyCodes as be,Collection as te,first as ie,toMap as A,ObservableMixin as pe,FocusTracker as x,KeystrokeHandler as S,diff as _e}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ClickObserver as Ve,ModelLivePosition as $,Matcher as ve}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{IconUnlink as Le,IconPencil as Ie,IconSettings as ye,IconLink as se,IconPreviousArrow as B,IconNextArrow as Te}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ContextualBalloon as G,ToolbarView as Pe,CssTransitionDisablerMixin as W,ButtonView as w,SwitchButtonView as Ee,MenuBarMenuListItemButtonView as Ce,clickOutsideHandler as Ae,View as L,ViewCollection as F,FocusCycler as H,ListView as R,ListItemView as D,FormHeaderView as U,IconView as xe,submitHandler as Se,LabeledFieldView as X,createLabeledInputText as j,FormRowView as J}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{isWidget as Be}from"../../../../../@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{upperFirst as Fe}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/upperFirst.js";/**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */class He{_definitions=new Set;get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,s)=>{if(!s.consumable.test(i.item,"attribute:linkHref")||!(i.item.is("selection")||s.schema.isInline(i.item)))return;const n=s.writer,o=n.document.selection;for(const a of this._definitions){const r=n.createAttributeElement("a",a.attributes,{priority:5});a.classes&&n.addClass(a.classes,r);for(const c in a.styles)n.setStyle(c,a.styles[c],r);n.setCustomProperty("link",!0,r),a.callback(i.attributeNewValue)?i.item.is("selection")?n.wrap(o.getFirstRange(),r):n.wrap(s.mapper.toViewRange(i.range),r):n.unwrap(s.mapper.toViewRange(i.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:s,mapper:n})=>{const o=n.toViewElement(i.item),a=Array.from(o.getChildren()).find(r=>r.is("element","a"));if(a)for(const r of this._definitions){const c=A(r.attributes);if(r.callback(i.attributeNewValue)){for(const[u,h]of c)u==="class"?s.addClass(h,a):s.setAttribute(u,h,a);r.classes&&s.addClass(r.classes,a);for(const u in r.styles)s.setStyle(u,r.styles[u],a)}else{for(const[u,h]of c)u==="class"?s.removeClass(h,a):s.removeAttribute(u,a);r.classes&&s.removeClass(r.classes,a);for(const u in r.styles)s.removeStyle(u,a)}}})}}}const Re=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,De="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",Ue=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Oe=/^((\w+:(\/{2,})?)|(\W))/i,Me=["https?","ftps?","mailto"],v="Ctrl+K";function Ne(l){return l.is("attributeElement")&&!!l.getCustomProperty("link")}function Y(l,{writer:e}){const t=e.createAttributeElement("a",{href:l},{priority:5});return e.setCustomProperty("link",!0,t),t}function ne(l,e=Me){const t=String(l),i=e.join("|"),s=new RegExp(`${De.replace("<protocols>",i)}`,"i");return qe(t,s)?t:"#"}function qe(l,e){return!!l.replace(Re,"").match(e)}function ze(l,e){const t={"Open in a new tab":l("Open in a new tab"),Downloadable:l("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function Ke(l){const e=[];if(l)for(const[t,i]of Object.entries(l)){const s=Object.assign({},i,{id:`link${Fe(t)}`});e.push(s)}return e}function P(l,e){return l?e.checkAttribute(l.name,"linkHref"):!1}function $e(l){return Ue.test(l)}function O(l,e){const t=$e(l)?"mailto:":e,i=!!t&&!oe(l);return l&&i?t+l:l}function oe(l){return Oe.test(l)}function Ge(l){window.open(l,"_blank","noopener")}function E(l){let e="";for(const t of l.getItems()){if(!t.is("$text")&&!t.is("$textProxy"))return;e+=t.data}return e}class We extends ee{manualDecorators=new te;automaticDecorators=new He;restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||ie(t.getSelectedBlocks());P(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={},i){const s=this.editor.model,n=s.document.selection,o=[],a=[];for(const r in t)t[r]?o.push(r):a.push(r);s.change(r=>{const c=d=>{r.setAttribute("linkHref",e,d),o.forEach(m=>r.setAttribute(m,!0,d)),a.forEach(m=>r.removeAttribute(m,d))},u=(d,m)=>{const k=E(d);if(!k)return d;let g=i;if(g||(g=m&&m==k?e:k),g!=k){const I=Xe(k,g);let f=0;for(const{offset:V,actual:y,expected:M}of I){const N=V+f,q=r.createRange(d.start.getShiftedBy(N),d.start.getShiftedBy(N+y.length)),ae=je(q,d).getAttributes(),ce=Array.from(ae).filter(([de])=>s.schema.getAttributeProperties(de).isFormatting),z=r.createText(M,ce);c(z),s.insertContent(z,q),f+=M.length}return r.createRange(d.start,d.start.getShiftedBy(g.length))}},h=d=>{const{plugins:m}=this.editor;if(r.setSelection(d.end),m.has("TwoStepCaretMovement"))m.get("TwoStepCaretMovement")._handleForwardMovement();else for(const k of["linkHref",...o,...a])r.removeSelectionAttribute(k)};if(n.isCollapsed){const d=n.getFirstPosition();if(n.hasAttribute("linkHref")){const m=n.getAttribute("linkHref"),k=C(d,"linkHref",m,s),g=u(k,m);c(g||k),g&&h(g)}else if(e!==""){const m=A(n.getAttributes());m.set("linkHref",e),o.forEach(g=>{m.set(g,!0)});const k=s.insertContent(r.createText(i||e,m),d);h(k)}}else{const d=Array.from(n.getRanges()),m=s.schema.getValidRanges(d,"linkHref"),k=[];for(const f of n.getSelectedBlocks())s.schema.checkAttribute(f,"linkHref")&&k.push(r.createRangeOn(f));const g=k.slice();for(const f of m)this._isRangeToUpdate(f,k)&&g.push(f);const I=d.map(f=>({start:$.fromPosition(f.start,"toPrevious"),end:$.fromPosition(f.end,"toNext")}));for(let f of g){const V=(f.start.textNode||f.start.nodeAfter).getAttribute("linkHref");f=u(f,V)||f,c(f)}r.setSelection(I.map(f=>{const V=f.start.toPosition(),y=f.end.toPosition();return f.start.detach(),f.end.detach(),s.createRange(V,y)}))}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return P(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}function Xe(l,e){const t=_e(l,e),i={equal:0,insert:0,delete:0},s=[];let n="",o="";for(const a of[...t,null])a=="insert"?o+=e[i.equal+i.insert]:a=="delete"?n+=l[i.equal+i.delete]:(n.length||o.length)&&(s.push({offset:i.equal,actual:n,expected:o}),n="",o=""),a&&i[a]++;return s}function je(l,e){if(!l.isCollapsed)return ie(l.getItems());const t=l.start;return t.textNode?t.textNode:!t.nodeBefore||t.isEqual(e.start)?t.nodeAfter:t.nodeBefore}class Je extends ee{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();P(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,s=e.commands.get("link");t.change(n=>{const o=i.isCollapsed?[C(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const a of o)if(n.removeAttribute("linkHref",a),s)for(const r of s.manualDecorators)n.removeAttribute(r.id,a)})}}class Ye extends pe(){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:s,styles:n,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=i,this.classes=s,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const Qe="ck-link_selected",Q="automatic",Ze="manual",et=/^(https?:)?\/\//;class _ extends p{_linkOpeners=[];static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[K,fe,ge]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Y}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(n,o)=>Y(ne(n,t),o)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:n=>n.getAttribute("href")}}),e.commands.add("link",new We(e)),e.commands.add("unlink",new Je(e));const i=ze(e.t,Ke(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(n=>n.mode===Q)),this._enableManualDecorators(i.filter(n=>n.mode===Ze)),e.plugins.get(K).registerAttribute("linkHref"),ke(e,"linkHref","a",Qe),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:Q,callback:n=>!!n&&et.test(n),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(n=>{t.model.schema.extend("$text",{allowAttributes:n.id});const o=new Ye(n);s.add(o),t.conversion.for("downcast").attributeToElement({model:o.id,view:(a,{writer:r,schema:c},{item:u})=>{if((u.is("selection")||c.isInline(u))&&a){const h=r.createAttributeElement("a",o.attributes,{priority:5});o.classes&&r.addClass(o.classes,h);for(const d in o.styles)r.setStyle(d,o.styles[d],h);return r.setCustomProperty("link",!0,h),h}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...o._createPattern()},model:{key:o.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document,s=n=>{this._linkOpeners.some(o=>o(n))||Ge(n)};this.listenTo(i,"click",(n,o)=>{if(!(we.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let r=o.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;const c=r.getAttribute("href");c&&(n.stop(),o.preventDefault(),s(c))},{context:"$capture"}),this.listenTo(i,"keydown",(n,o)=>{const r=e.commands.get("link").value;r&&o.keyCode===be.enter&&o.altKey&&(n.stop(),s(r))})}_enableSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(s,{attributeKeys:n})=>{!n.includes("linkHref")||i.hasAttribute("linkHref")||t.change(o=>{tt(o,it(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,n)=>{t.change(o=>{const a=o.createRangeIn(n.content);for(const r of a.getItems())if(r.hasAttribute("linkHref")){const c=O(r.getAttribute("linkHref"),i);o.setAttribute("linkHref",c,r)}})})}}function tt(l,e){l.removeSelectionAttribute("linkHref");for(const t of e)l.removeSelectionAttribute(t)}function it(l){return l.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}class st extends w{constructor(e){super(e);const t=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:t.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to(i=>{if(this.href){const s=()=>i.preventDefault();this.fire("navigate",this.href,s)}})}}),this.template.tag="a"}}class nt extends L{focusTracker=new x;keystrokes=new S;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new F;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView())}),this._focusCycler=new H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Se({view:this}),[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:B,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new w(this.locale);return t.set({label:e("Insert"),tooltip:!1,withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new U(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){const e=new R(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{const i=new D(this.locale);return i.children.add(t),i}),e}_createDisplayedTextInput(){const e=this.locale.t,t=new X(this.locale,j);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){const e=this.locale.t,t=new X(this.locale,j);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new J(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new J(this.locale,{children:[this.urlInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}))}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class ot extends L{focusTracker=new x;keystrokes=new S;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new F;_focusCycler;constructor(e){super(e),this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",!1),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0}),this.on("change:hasItems",(t,i,s)=>{s?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation))}),this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children})}render(){super.render(),[this.listView,this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createListView(){const e=new R(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new D(this.locale);return i.children.add(t),i}),e}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:B,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=new U(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){const e=new L(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class rt extends L{focusTracker=new x;keystrokes=new S;backButtonView;children;listChildren;_focusables=new F;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(t,i)=>{this.fire("back"),i()})}render(){super.render(),[...this.listChildren,this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:B,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){const e=this.locale.t,t=new U(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){const e=new R(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new D(this.locale);return i.children.add(t),i}),e}}class lt extends w{arrowView;constructor(e){super(e),this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new xe;return e.content=Te,e}}const b="link-ui";class re extends p{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new te;static get requires(){return[G,_]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(Ve),this._balloon=e.plugins.get(G),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:b,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:b,view:(i,{writer:s})=>{if(!i.markerRange.isCollapsed)return null;const n=s.createUIElement("span");return s.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:v},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy()}registerLinksListProvider(e){const t=this._linksProviders.filter(i=>(i.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){const e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){const e=this.editor,t=new Pe(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let s=e.config.get("link.toolbar");return i.manualDecorators.length||(s=s.filter(n=>n!=="linkProperties")),t.fillFromConfig(s,e.ui.componentFactory),t.keystrokes.set("Esc",(n,o)=>{this._hideUI(),o()}),t.keystrokes.set(v,(n,o)=>{this._addFormView(),o()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){const e=this.editor,t=e.locale.t,i=e.commands.get("link"),s=e.config.get("link.defaultProtocol"),n=new(W(nt))(e.locale,at(e));return n.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",o=>o!==void 0),n.urlInputView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("label").to(i,"value",o=>t(o?"Update":"Insert")),this.listenTo(n,"submit",()=>{if(n.isValid()){const o=n.urlInputView.fieldView.element.value,a=O(o,s),r=n.displayedTextInputView.fieldView.element.value;e.execute("link",a,this._getDecoratorSwitchesState(),r!==this.selectedLinkableText?r:void 0),this._closeFormView()}}),this.listenTo(n.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(o,a)=>{this._closeFormView(),a()}),n.providersListChildren.bindTo(this._linksProviders).using(o=>this._createLinksListProviderButton(o)),n}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:s})=>{const n=new w;return n.set({label:i,icon:s,tooltip:!1,withText:!0}),n.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),n})}_createLinkProviderItemsView(e){const t=this.editor,i=t.locale.t,s=new ot(t.locale),{emptyListPlaceholder:n,label:o}=e;return s.emptyListPlaceholder=n||i("No links available"),s.title=o,this.listenTo(s,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),s}_createPropertiesView(){const e=this.editor,t=this.editor.commands.get("link"),i=new(W(rt))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),i.listChildren.bindTo(t.manualDecorators).using(s=>{const n=new Ee(e.locale);return n.set({label:s.label,withText:!0}),n.bind("isOn").toMany([s,t],"value",(o,a)=>a===void 0&&o===void 0?!!s.defaultValue:!!o),n.on("execute",()=>{s.set("value",!n.isOn),e.execute("link",t.value,this._getDecoratorSwitchesState())}),n}),i}_getDecoratorSwitchesState(){const e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{const s=e.value===void 0&&i.value===void 0?i.defaultValue:i.value;return{...t,[i.id]:!!s}},{})}_registerEditingOpeners(){this.editor.plugins.get(_)._registerLinkOpener(t=>{const i=this._getLinkProviderLinkByHref(t);if(!i)return!1;const{item:s,provider:n}=i;return n.navigate?n.navigate(s):!1})}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const t=this._createButton(w);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{const t=this._createButton(Ce);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{const i=new st(t),s=e.config.get("link.allowedProtocols"),n=e.commands.get("link"),o=t.t;i.bind("isEnabled").to(n,"value",r=>!!r),i.bind("href").to(n,"value",r=>r&&ne(r,s));const a=r=>{if(!r){i.label=void 0,i.icon=void 0,i.tooltip=o("Open link in new tab");return}const c=this._getLinkProviderLinkByHref(r);if(c){const{label:u,tooltip:h,icon:d}=c.item;i.label=u,i.tooltip=h||!1,i.icon=d}else i.label=r,i.icon=void 0,i.tooltip=o("Open link in new tab")};return a(n.value),this.listenTo(n,"change:value",(r,c,u)=>{a(u)}),this.listenTo(i,"navigate",(r,c,u)=>{const h=this._getLinkProviderLinkByHref(c);if(!h)return;const{provider:d,item:m}=h,{navigate:k}=d;k&&k(m)&&(r.stop(),u())}),i}),e.ui.componentFactory.add("unlink",t=>{const i=e.commands.get("unlink"),s=new w(t),n=t.t;return s.set({label:n("Unlink"),icon:Le,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{e.execute("unlink"),this._hideUI()}),s}),e.ui.componentFactory.add("editLink",t=>{const i=e.commands.get("link"),s=new w(t),n=t.t;return s.set({label:n("Edit link"),icon:Ie,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{this._addFormView()}),s}),e.ui.componentFactory.add("linkProperties",t=>{const i=e.commands.get("link"),s=new w(t),n=t.t;return s.set({label:n("Link properties"),icon:ye,tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(o,a,r)=>o&&!!a&&r.length>0),this.listenTo(s,"execute",()=>{this._addPropertiesView()}),s})}_createLinksListProviderButton(e){const t=this.editor.locale,i=new lt(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e)}),i}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("link"),n=new e(t.locale),o=i.t;return n.set({label:o("Link"),icon:se,keystroke:v,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",a=>!!a),this.listenTo(n,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),n}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(v,(i,s)=>{s(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Ae({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){const e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(e=!0){const t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),s=o();const n=()=>{const a=this._getSelectedLinkElement(),r=o();i&&!a||!i&&r!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=a,s=r};function o(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}get _arePropertiesInPanel(){return!!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return!!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return!!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return!!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return!!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(b)){const s=this.editor.editing.mapper.markerNameToElements(b);if(s){const n=Array.from(s),o=e.createRange(e.createPositionBefore(n[0]),e.createPositionAfter(n[n.length-1]));return{target:e.domConverter.viewRangeToDom(o)}}}return{target:()=>{const s=this._getSelectedLinkElement();return s?e.domConverter.mapViewToDom(s):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&Be(i))return T(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),n=T(s.start),o=T(s.end);return!n||n!=o?null:e.createRangeIn(n).getTrimmed().isEqual(s)?n:null}}_getSelectedLinkableText(){const e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return E(e.document.selection.getFirstRange());const s=t.view.createRangeOn(i),n=t.mapper.toModelRange(s);return E(n)}_getLinkProviderLinkByHref(e){if(!e)return null;for(const t of this._linksProviders){const i=t.getItem?t.getItem(e):t.getListItems().find(s=>s.href===e);if(i)return{provider:t,item:i}}return null}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(b))t.updateMarker(b,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:n})=>!e.schema.isContent(n),{boundaries:i});t.addMarker(b,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(b,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(b)&&e.change(t=>{t.removeMarker(b)})}}function T(l){return l.getAncestors().find(e=>Ne(e))||null}function at(l){const e=l.t,t=l.config.get("link.allowCreatingEmptyLinks");return[i=>{if(!t&&!i.url.length)return e("Link URL must not be empty.")}]}const ct=4,le=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),dt=2;class ut extends p{static get requires(){return[ue,_]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?C(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const s=this.editor.model,n=s.document.selection,o=n.getFirstPosition(),a=n.getLastPosition();let r=t.getJoined(this._expandLinkRange(s,o)||t);r&&(r=r.getJoined(this._expandLinkRange(s,a)||t)),r&&(r.start.isBefore(o)||r.end.isAfter(a))&&e.setSelection(r)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,s=e.plugins.get("ClipboardPipeline"),n=e.commands.get("link");s.on("inputTransformation",(o,a)=>{if(!this.isEnabled||!n.isEnabled||i.isCollapsed||a.method!=="paste"||i.rangeCount>1)return;const r=i.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const u=c.match(le);u&&u[2]===c&&(t.change(h=>{this._selectEntireLinks(h,r),n.execute(c)}),o.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new he(e.model,i=>{let s=i;if(!ht(s))return;s=s.slice(0,-1),"!.:,;?".includes(s[s.length-1])&&(s=s.slice(0,-1));const n=Z(s);if(n)return{url:n,removedTrailingCharacters:i.length-s.length}});t.on("matched:data",(i,s)=>{const{batch:n,range:o,url:a,removedTrailingCharacters:r}=s;if(!n.isTyping)return;const c=o.end.getShiftedBy(-r),u=c.getShiftedBy(-a.length),h=e.model.createRange(u,c);this._applyAutoLink(a,h)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition();let n;s.parent.previousSibling?.is("element")?n=t.createRangeIn(s.parent.previousSibling):n=t.createRange(t.createPositionAt(s.parent,0),s),this._checkAndApplyAutoLinkOnRange(n)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:s}=me(e,t),n=Z(i);if(n){const o=t.createRange(s.end.getShiftedBy(-n.length),s.end);this._applyAutoLink(n,o)}}_applyAutoLink(e,t){const i=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),n=O(e,s);!this.isEnabled||!mt(t,i)||!oe(n)||ft(t)||this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(n=>{n.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function ht(l){return l.length>ct&&l[l.length-1]===" "&&l[l.length-2]!==" "}function Z(l){const e=le.exec(l);return e?e[dt]:null}function mt(l,e){return e.schema.checkAttributeInSelection(e.createSelection(l),"linkHref")}function ft(l){const e=l.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}class xt extends p{static get requires(){return[_,re,ut]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class kt extends p{static get requires(){return["ImageEditing","ImageUtils",_]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(gt(e)),e.conversion.for("downcast").add(wt(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,i=e.commands.get("link").automaticDecorators;i.length&&e.conversion.for("downcast").add(i.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(bt(i)),e.conversion.for("upcast").add(pt(e,i))}}function gt(l){const e=l.plugins.has("ImageInlineEditing"),t=l.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,n,o)=>{const a=n.viewItem,r=t.findViewImgElement(a);if(!r)return;const c=r.findAncestor(m=>t.isBlockImageView(m));if(e&&!c)return;const u={attributes:["href"]};if(!o.consumable.consume(a,u))return;const h=a.getAttribute("href");if(!h)return;let d=n.modelCursor.parent;if(!d.is("element","imageBlock")){const m=o.convertItem(r,n.modelCursor);n.modelRange=m.modelRange,n.modelCursor=m.modelCursor,d=n.modelCursor.nodeBefore}d&&d.is("element","imageBlock")&&o.writer.setAttribute("linkHref",h,d)},{priority:"high"})}}function wt(l){const e=l.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",(i,s,n)=>{if(!n.consumable.consume(s.item,i.name))return;const o=n.mapper.toViewElement(s.item),a=n.writer,r=Array.from(o.getChildren()).find(h=>h.is("element","a")),c=e.findViewImgElement(o),u=c.parent.is("element","picture")?c.parent:c;if(r)s.attributeNewValue?a.setAttribute("href",s.attributeNewValue,r):(a.move(a.createRangeOn(u),a.createPositionAt(o,0)),a.remove(r));else{const h=a.createContainerElement("a",{href:s.attributeNewValue});a.insert(a.createPositionAt(o,0),h),a.move(a.createRangeOn(u),a.createPositionAt(h,0))}},{priority:"high"})}}function bt(l){return e=>{e.on(`attribute:${l.id}:imageBlock`,(t,i,s)=>{const n=s.mapper.toViewElement(i.item),o=Array.from(n.getChildren()).find(a=>a.is("element","a"));if(o){if(l.value===void 0){for(const a in l.attributes)s.writer.removeAttribute(a,o);l.classes&&s.writer.removeClass(l.classes,o);for(const a in l.styles)s.writer.removeStyle(a,o);return}for(const[a,r]of A(l.attributes))s.writer.setAttribute(a,r,o);l.classes&&s.writer.addClass(l.classes,o);for(const a in l.styles)s.writer.setStyle(a,l.styles[a],o)}})}}function pt(l,e){const t=l.plugins.has("ImageInlineEditing"),i=l.plugins.get("ImageUtils");return s=>{s.on("element:a",(n,o,a)=>{const r=o.viewItem,c=i.findViewImgElement(r);if(!c)return;const u=c.findAncestor(k=>i.isBlockImageView(k));if(t&&!u)return;const d=new ve(e._createPattern()).match(r);if(!d||!a.consumable.consume(r,d.match))return;const m=o.modelCursor.nodeBefore||o.modelCursor.parent;a.writer.setAttribute(e.id,!0,m)},{priority:"high"})}}class _t extends p{static get requires(){return[_,re,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,s)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(s.preventDefault(),i.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{const s=new w(i),n=e.plugins.get("LinkUI"),o=e.commands.get("link");return s.set({isEnabled:!0,label:t("Link image"),icon:se,keystroke:v,tooltip:!0,isToggleable:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value",a=>!!a),this.listenTo(s,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?n._addToolbarView():n._showUI(!0)}),s})}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class St extends p{static get requires(){return[kt,_t]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}export{ut as AutoLink,He as AutomaticLinkDecorators,xt as Link,We as LinkCommand,_ as LinkEditing,nt as LinkFormView,St as LinkImage,kt as LinkImageEditing,_t as LinkImageUI,Ye as LinkManualDecorator,rt as LinkPropertiesView,ot as LinkProviderItemsView,re as LinkUI,Je as UnlinkCommand,v as _LINK_KEYSTROKE,lt as _LinkButtonView,st as _LinkPreviewButtonView,Y as _createLinkElement,ne as _ensureSafeLinkUrl,E as _extractTextFromLinkRange,ze as _getLocalizedLinkDecorators,oe as _hasLinkProtocol,$e as _isEmailLink,Ke as _normalizeLinkDecorators,Ge as _openLink,O as addLinkProtocolIfApplicable,ne as ensureSafeUrl,Ne as isLinkElement,P as isLinkableElement};
1
+ import{Plugin as p,Command as ee}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as ue,findAttributeRange as C,TextWatcher as he,getLastTextLine as me,TwoStepCaretMovement as K,Input as fe,inlineHighlight as ke}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{ClipboardPipeline as ge}from"../../../../../@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{env as we,keyCodes as be,Collection as te,first as ie,toMap as A,ObservableMixin as pe,FocusTracker as x,KeystrokeHandler as S,diff as _e}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ClickObserver as Ve,ModelLivePosition as $,Matcher as ve}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{IconUnlink as Le,IconPencil as Ie,IconSettings as ye,IconLink as se,IconPreviousArrow as B,IconNextArrow as Te}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ContextualBalloon as G,ToolbarView as Pe,CssTransitionDisablerMixin as W,ButtonView as w,SwitchButtonView as Ee,MenuBarMenuListItemButtonView as Ce,clickOutsideHandler as Ae,View as L,ViewCollection as F,FocusCycler as H,ListView as R,ListItemView as D,FormHeaderView as U,IconView as xe,submitHandler as Se,LabeledFieldView as X,createLabeledInputText as j,FormRowView as J}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{isWidget as Be}from"../../../../../@ckeditor_ckeditor5-widget@46.1.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{upperFirst as Fe}from"../../../../../es-toolkit@1.39.5/node_modules/es-toolkit/dist/compat/string/upperFirst.js";class He{_definitions=new Set;get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,s)=>{if(!s.consumable.test(i.item,"attribute:linkHref")||!(i.item.is("selection")||s.schema.isInline(i.item)))return;const n=s.writer,o=n.document.selection;for(const a of this._definitions){const r=n.createAttributeElement("a",a.attributes,{priority:5});a.classes&&n.addClass(a.classes,r);for(const c in a.styles)n.setStyle(c,a.styles[c],r);n.setCustomProperty("link",!0,r),a.callback(i.attributeNewValue)?i.item.is("selection")?n.wrap(o.getFirstRange(),r):n.wrap(s.mapper.toViewRange(i.range),r):n.unwrap(s.mapper.toViewRange(i.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:s,mapper:n})=>{const o=n.toViewElement(i.item),a=Array.from(o.getChildren()).find(r=>r.is("element","a"));if(a)for(const r of this._definitions){const c=A(r.attributes);if(r.callback(i.attributeNewValue)){for(const[u,h]of c)u==="class"?s.addClass(h,a):s.setAttribute(u,h,a);r.classes&&s.addClass(r.classes,a);for(const u in r.styles)s.setStyle(u,r.styles[u],a)}else{for(const[u,h]of c)u==="class"?s.removeClass(h,a):s.removeAttribute(u,a);r.classes&&s.removeClass(r.classes,a);for(const u in r.styles)s.removeStyle(u,a)}}})}}}const Re=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,De="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",Ue=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Oe=/^((\w+:(\/{2,})?)|(\W))/i,Me=["https?","ftps?","mailto"],v="Ctrl+K";function Ne(l){return l.is("attributeElement")&&!!l.getCustomProperty("link")}function Y(l,{writer:e}){const t=e.createAttributeElement("a",{href:l},{priority:5});return e.setCustomProperty("link",!0,t),t}function ne(l,e=Me){const t=String(l),i=e.join("|"),s=new RegExp(`${De.replace("<protocols>",i)}`,"i");return qe(t,s)?t:"#"}function qe(l,e){return!!l.replace(Re,"").match(e)}function ze(l,e){const t={"Open in a new tab":l("Open in a new tab"),Downloadable:l("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function Ke(l){const e=[];if(l)for(const[t,i]of Object.entries(l)){const s=Object.assign({},i,{id:`link${Fe(t)}`});e.push(s)}return e}function P(l,e){return l?e.checkAttribute(l.name,"linkHref"):!1}function $e(l){return Ue.test(l)}function O(l,e){const t=$e(l)?"mailto:":e,i=!!t&&!oe(l);return l&&i?t+l:l}function oe(l){return Oe.test(l)}function Ge(l){window.open(l,"_blank","noopener")}function E(l){let e="";for(const t of l.getItems()){if(!t.is("$text")&&!t.is("$textProxy"))return;e+=t.data}return e}class We extends ee{manualDecorators=new te;automaticDecorators=new He;restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||ie(t.getSelectedBlocks());P(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={},i){const s=this.editor.model,n=s.document.selection,o=[],a=[];for(const r in t)t[r]?o.push(r):a.push(r);s.change(r=>{const c=d=>{r.setAttribute("linkHref",e,d),o.forEach(m=>r.setAttribute(m,!0,d)),a.forEach(m=>r.removeAttribute(m,d))},u=(d,m)=>{const k=E(d);if(!k)return d;let g=i;if(g||(g=m&&m==k?e:k),g!=k){const I=Xe(k,g);let f=0;for(const{offset:V,actual:y,expected:M}of I){const N=V+f,q=r.createRange(d.start.getShiftedBy(N),d.start.getShiftedBy(N+y.length)),ae=je(q,d).getAttributes(),ce=Array.from(ae).filter(([de])=>s.schema.getAttributeProperties(de).isFormatting),z=r.createText(M,ce);c(z),s.insertContent(z,q),f+=M.length}return r.createRange(d.start,d.start.getShiftedBy(g.length))}},h=d=>{const{plugins:m}=this.editor;if(r.setSelection(d.end),m.has("TwoStepCaretMovement"))m.get("TwoStepCaretMovement")._handleForwardMovement();else for(const k of["linkHref",...o,...a])r.removeSelectionAttribute(k)};if(n.isCollapsed){const d=n.getFirstPosition();if(n.hasAttribute("linkHref")){const m=n.getAttribute("linkHref"),k=C(d,"linkHref",m,s),g=u(k,m);c(g||k),g&&h(g)}else if(e!==""){const m=A(n.getAttributes());m.set("linkHref",e),o.forEach(g=>{m.set(g,!0)});const k=s.insertContent(r.createText(i||e,m),d);h(k)}}else{const d=Array.from(n.getRanges()),m=s.schema.getValidRanges(d,"linkHref"),k=[];for(const f of n.getSelectedBlocks())s.schema.checkAttribute(f,"linkHref")&&k.push(r.createRangeOn(f));const g=k.slice();for(const f of m)this._isRangeToUpdate(f,k)&&g.push(f);const I=d.map(f=>({start:$.fromPosition(f.start,"toPrevious"),end:$.fromPosition(f.end,"toNext")}));for(let f of g){const V=(f.start.textNode||f.start.nodeAfter).getAttribute("linkHref");f=u(f,V)||f,c(f)}r.setSelection(I.map(f=>{const V=f.start.toPosition(),y=f.end.toPosition();return f.start.detach(),f.end.detach(),s.createRange(V,y)}))}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return P(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}function Xe(l,e){const t=_e(l,e),i={equal:0,insert:0,delete:0},s=[];let n="",o="";for(const a of[...t,null])a=="insert"?o+=e[i.equal+i.insert]:a=="delete"?n+=l[i.equal+i.delete]:(n.length||o.length)&&(s.push({offset:i.equal,actual:n,expected:o}),n="",o=""),a&&i[a]++;return s}function je(l,e){if(!l.isCollapsed)return ie(l.getItems());const t=l.start;return t.textNode?t.textNode:!t.nodeBefore||t.isEqual(e.start)?t.nodeAfter:t.nodeBefore}class Je extends ee{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();P(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,s=e.commands.get("link");t.change(n=>{const o=i.isCollapsed?[C(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const a of o)if(n.removeAttribute("linkHref",a),s)for(const r of s.manualDecorators)n.removeAttribute(r.id,a)})}}class Ye extends pe(){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:s,styles:n,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=i,this.classes=s,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const Qe="ck-link_selected",Q="automatic",Ze="manual",et=/^(https?:)?\/\//;class _ extends p{_linkOpeners=[];static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[K,fe,ge]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Y}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(n,o)=>Y(ne(n,t),o)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:n=>n.getAttribute("href")}}),e.commands.add("link",new We(e)),e.commands.add("unlink",new Je(e));const i=ze(e.t,Ke(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(n=>n.mode===Q)),this._enableManualDecorators(i.filter(n=>n.mode===Ze)),e.plugins.get(K).registerAttribute("linkHref"),ke(e,"linkHref","a",Qe),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:Q,callback:n=>!!n&&et.test(n),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(n=>{t.model.schema.extend("$text",{allowAttributes:n.id});const o=new Ye(n);s.add(o),t.conversion.for("downcast").attributeToElement({model:o.id,view:(a,{writer:r,schema:c},{item:u})=>{if((u.is("selection")||c.isInline(u))&&a){const h=r.createAttributeElement("a",o.attributes,{priority:5});o.classes&&r.addClass(o.classes,h);for(const d in o.styles)r.setStyle(d,o.styles[d],h);return r.setCustomProperty("link",!0,h),h}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...o._createPattern()},model:{key:o.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document,s=n=>{this._linkOpeners.some(o=>o(n))||Ge(n)};this.listenTo(i,"click",(n,o)=>{if(!(we.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let r=o.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;const c=r.getAttribute("href");c&&(n.stop(),o.preventDefault(),s(c))},{context:"$capture"}),this.listenTo(i,"keydown",(n,o)=>{const r=e.commands.get("link").value;r&&o.keyCode===be.enter&&o.altKey&&(n.stop(),s(r))})}_enableSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(s,{attributeKeys:n})=>{!n.includes("linkHref")||i.hasAttribute("linkHref")||t.change(o=>{tt(o,it(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,n)=>{t.change(o=>{const a=o.createRangeIn(n.content);for(const r of a.getItems())if(r.hasAttribute("linkHref")){const c=O(r.getAttribute("linkHref"),i);o.setAttribute("linkHref",c,r)}})})}}function tt(l,e){l.removeSelectionAttribute("linkHref");for(const t of e)l.removeSelectionAttribute(t)}function it(l){return l.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}class st extends w{constructor(e){super(e);const t=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:t.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to(i=>{if(this.href){const s=()=>i.preventDefault();this.fire("navigate",this.href,s)}})}}),this.template.tag="a"}}class nt extends L{focusTracker=new x;keystrokes=new S;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new F;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView())}),this._focusCycler=new H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Se({view:this}),[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:B,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new w(this.locale);return t.set({label:e("Insert"),tooltip:!1,withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new U(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){const e=new R(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{const i=new D(this.locale);return i.children.add(t),i}),e}_createDisplayedTextInput(){const e=this.locale.t,t=new X(this.locale,j);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){const e=this.locale.t,t=new X(this.locale,j);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new J(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new J(this.locale,{children:[this.urlInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}))}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class ot extends L{focusTracker=new x;keystrokes=new S;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new F;_focusCycler;constructor(e){super(e),this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",!1),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0}),this.on("change:hasItems",(t,i,s)=>{s?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation))}),this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children})}render(){super.render(),[this.listView,this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createListView(){const e=new R(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new D(this.locale);return i.children.add(t),i}),e}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:B,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=new U(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){const e=new L(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class rt extends L{focusTracker=new x;keystrokes=new S;backButtonView;children;listChildren;_focusables=new F;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(t,i)=>{this.fire("back"),i()})}render(){super.render(),[...this.listChildren,this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBackButton(){const e=this.locale.t,t=new w(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:B,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){const e=this.locale.t,t=new U(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){const e=new R(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const i=new D(this.locale);return i.children.add(t),i}),e}}class lt extends w{arrowView;constructor(e){super(e),this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new xe;return e.content=Te,e}}const b="link-ui";class re extends p{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new te;static get requires(){return[G,_]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(Ve),this._balloon=e.plugins.get(G),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:b,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:b,view:(i,{writer:s})=>{if(!i.markerRange.isCollapsed)return null;const n=s.createUIElement("span");return s.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:v},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy()}registerLinksListProvider(e){const t=this._linksProviders.filter(i=>(i.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){const e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){const e=this.editor,t=new Pe(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let s=e.config.get("link.toolbar");return i.manualDecorators.length||(s=s.filter(n=>n!=="linkProperties")),t.fillFromConfig(s,e.ui.componentFactory),t.keystrokes.set("Esc",(n,o)=>{this._hideUI(),o()}),t.keystrokes.set(v,(n,o)=>{this._addFormView(),o()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){const e=this.editor,t=e.locale.t,i=e.commands.get("link"),s=e.config.get("link.defaultProtocol"),n=new(W(nt))(e.locale,at(e));return n.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",o=>o!==void 0),n.urlInputView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("label").to(i,"value",o=>t(o?"Update":"Insert")),this.listenTo(n,"submit",()=>{if(n.isValid()){const o=n.urlInputView.fieldView.element.value,a=O(o,s),r=n.displayedTextInputView.fieldView.element.value;e.execute("link",a,this._getDecoratorSwitchesState(),r!==this.selectedLinkableText?r:void 0),this._closeFormView()}}),this.listenTo(n.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(o,a)=>{this._closeFormView(),a()}),n.providersListChildren.bindTo(this._linksProviders).using(o=>this._createLinksListProviderButton(o)),n}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:s})=>{const n=new w;return n.set({label:i,icon:s,tooltip:!1,withText:!0}),n.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),n})}_createLinkProviderItemsView(e){const t=this.editor,i=t.locale.t,s=new ot(t.locale),{emptyListPlaceholder:n,label:o}=e;return s.emptyListPlaceholder=n||i("No links available"),s.title=o,this.listenTo(s,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),s}_createPropertiesView(){const e=this.editor,t=this.editor.commands.get("link"),i=new(W(rt))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),i.listChildren.bindTo(t.manualDecorators).using(s=>{const n=new Ee(e.locale);return n.set({label:s.label,withText:!0}),n.bind("isOn").toMany([s,t],"value",(o,a)=>a===void 0&&o===void 0?!!s.defaultValue:!!o),n.on("execute",()=>{s.set("value",!n.isOn),e.execute("link",t.value,this._getDecoratorSwitchesState())}),n}),i}_getDecoratorSwitchesState(){const e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{const s=e.value===void 0&&i.value===void 0?i.defaultValue:i.value;return{...t,[i.id]:!!s}},{})}_registerEditingOpeners(){this.editor.plugins.get(_)._registerLinkOpener(t=>{const i=this._getLinkProviderLinkByHref(t);if(!i)return!1;const{item:s,provider:n}=i;return n.navigate?n.navigate(s):!1})}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const t=this._createButton(w);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{const t=this._createButton(Ce);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{const i=new st(t),s=e.config.get("link.allowedProtocols"),n=e.commands.get("link"),o=t.t;i.bind("isEnabled").to(n,"value",r=>!!r),i.bind("href").to(n,"value",r=>r&&ne(r,s));const a=r=>{if(!r){i.label=void 0,i.icon=void 0,i.tooltip=o("Open link in new tab");return}const c=this._getLinkProviderLinkByHref(r);if(c){const{label:u,tooltip:h,icon:d}=c.item;i.label=u,i.tooltip=h||!1,i.icon=d}else i.label=r,i.icon=void 0,i.tooltip=o("Open link in new tab")};return a(n.value),this.listenTo(n,"change:value",(r,c,u)=>{a(u)}),this.listenTo(i,"navigate",(r,c,u)=>{const h=this._getLinkProviderLinkByHref(c);if(!h)return;const{provider:d,item:m}=h,{navigate:k}=d;k&&k(m)&&(r.stop(),u())}),i}),e.ui.componentFactory.add("unlink",t=>{const i=e.commands.get("unlink"),s=new w(t),n=t.t;return s.set({label:n("Unlink"),icon:Le,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{e.execute("unlink"),this._hideUI()}),s}),e.ui.componentFactory.add("editLink",t=>{const i=e.commands.get("link"),s=new w(t),n=t.t;return s.set({label:n("Edit link"),icon:Ie,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{this._addFormView()}),s}),e.ui.componentFactory.add("linkProperties",t=>{const i=e.commands.get("link"),s=new w(t),n=t.t;return s.set({label:n("Link properties"),icon:ye,tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(o,a,r)=>o&&!!a&&r.length>0),this.listenTo(s,"execute",()=>{this._addPropertiesView()}),s})}_createLinksListProviderButton(e){const t=this.editor.locale,i=new lt(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e)}),i}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("link"),n=new e(t.locale),o=i.t;return n.set({label:o("Link"),icon:se,keystroke:v,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",a=>!!a),this.listenTo(n,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),n}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(v,(i,s)=>{s(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Ae({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){const e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(e=!0){const t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),s=o();const n=()=>{const a=this._getSelectedLinkElement(),r=o();i&&!a||!i&&r!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=a,s=r};function o(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}get _arePropertiesInPanel(){return!!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return!!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return!!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return!!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return!!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(b)){const s=this.editor.editing.mapper.markerNameToElements(b);if(s){const n=Array.from(s),o=e.createRange(e.createPositionBefore(n[0]),e.createPositionAfter(n[n.length-1]));return{target:e.domConverter.viewRangeToDom(o)}}}return{target:()=>{const s=this._getSelectedLinkElement();return s?e.domConverter.mapViewToDom(s):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&Be(i))return T(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),n=T(s.start),o=T(s.end);return!n||n!=o?null:e.createRangeIn(n).getTrimmed().isEqual(s)?n:null}}_getSelectedLinkableText(){const e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return E(e.document.selection.getFirstRange());const s=t.view.createRangeOn(i),n=t.mapper.toModelRange(s);return E(n)}_getLinkProviderLinkByHref(e){if(!e)return null;for(const t of this._linksProviders){const i=t.getItem?t.getItem(e):t.getListItems().find(s=>s.href===e);if(i)return{provider:t,item:i}}return null}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(b))t.updateMarker(b,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:n})=>!e.schema.isContent(n),{boundaries:i});t.addMarker(b,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(b,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(b)&&e.change(t=>{t.removeMarker(b)})}}function T(l){return l.getAncestors().find(e=>Ne(e))||null}function at(l){const e=l.t,t=l.config.get("link.allowCreatingEmptyLinks");return[i=>{if(!t&&!i.url.length)return e("Link URL must not be empty.")}]}const ct=4,le=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),dt=2;class ut extends p{static get requires(){return[ue,_]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?C(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const s=this.editor.model,n=s.document.selection,o=n.getFirstPosition(),a=n.getLastPosition();let r=t.getJoined(this._expandLinkRange(s,o)||t);r&&(r=r.getJoined(this._expandLinkRange(s,a)||t)),r&&(r.start.isBefore(o)||r.end.isAfter(a))&&e.setSelection(r)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,s=e.plugins.get("ClipboardPipeline"),n=e.commands.get("link");s.on("inputTransformation",(o,a)=>{if(!this.isEnabled||!n.isEnabled||i.isCollapsed||a.method!=="paste"||i.rangeCount>1)return;const r=i.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const u=c.match(le);u&&u[2]===c&&(t.change(h=>{this._selectEntireLinks(h,r),n.execute(c)}),o.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new he(e.model,i=>{let s=i;if(!ht(s))return;s=s.slice(0,-1),"!.:,;?".includes(s[s.length-1])&&(s=s.slice(0,-1));const n=Z(s);if(n)return{url:n,removedTrailingCharacters:i.length-s.length}});t.on("matched:data",(i,s)=>{const{batch:n,range:o,url:a,removedTrailingCharacters:r}=s;if(!n.isTyping)return;const c=o.end.getShiftedBy(-r),u=c.getShiftedBy(-a.length),h=e.model.createRange(u,c);this._applyAutoLink(a,h)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition();let n;s.parent.previousSibling?.is("element")?n=t.createRangeIn(s.parent.previousSibling):n=t.createRange(t.createPositionAt(s.parent,0),s),this._checkAndApplyAutoLinkOnRange(n)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:s}=me(e,t),n=Z(i);if(n){const o=t.createRange(s.end.getShiftedBy(-n.length),s.end);this._applyAutoLink(n,o)}}_applyAutoLink(e,t){const i=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),n=O(e,s);!this.isEnabled||!mt(t,i)||!oe(n)||ft(t)||this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(n=>{n.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function ht(l){return l.length>ct&&l[l.length-1]===" "&&l[l.length-2]!==" "}function Z(l){const e=le.exec(l);return e?e[dt]:null}function mt(l,e){return e.schema.checkAttributeInSelection(e.createSelection(l),"linkHref")}function ft(l){const e=l.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}class xt extends p{static get requires(){return[_,re,ut]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class kt extends p{static get requires(){return["ImageEditing","ImageUtils",_]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(gt(e)),e.conversion.for("downcast").add(wt(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,i=e.commands.get("link").automaticDecorators;i.length&&e.conversion.for("downcast").add(i.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(bt(i)),e.conversion.for("upcast").add(pt(e,i))}}function gt(l){const e=l.plugins.has("ImageInlineEditing"),t=l.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,n,o)=>{const a=n.viewItem,r=t.findViewImgElement(a);if(!r)return;const c=r.findAncestor(m=>t.isBlockImageView(m));if(e&&!c)return;const u={attributes:["href"]};if(!o.consumable.consume(a,u))return;const h=a.getAttribute("href");if(!h)return;let d=n.modelCursor.parent;if(!d.is("element","imageBlock")){const m=o.convertItem(r,n.modelCursor);n.modelRange=m.modelRange,n.modelCursor=m.modelCursor,d=n.modelCursor.nodeBefore}d&&d.is("element","imageBlock")&&o.writer.setAttribute("linkHref",h,d)},{priority:"high"})}}function wt(l){const e=l.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",(i,s,n)=>{if(!n.consumable.consume(s.item,i.name))return;const o=n.mapper.toViewElement(s.item),a=n.writer,r=Array.from(o.getChildren()).find(h=>h.is("element","a")),c=e.findViewImgElement(o),u=c.parent.is("element","picture")?c.parent:c;if(r)s.attributeNewValue?a.setAttribute("href",s.attributeNewValue,r):(a.move(a.createRangeOn(u),a.createPositionAt(o,0)),a.remove(r));else{const h=a.createContainerElement("a",{href:s.attributeNewValue});a.insert(a.createPositionAt(o,0),h),a.move(a.createRangeOn(u),a.createPositionAt(h,0))}},{priority:"high"})}}function bt(l){return e=>{e.on(`attribute:${l.id}:imageBlock`,(t,i,s)=>{const n=s.mapper.toViewElement(i.item),o=Array.from(n.getChildren()).find(a=>a.is("element","a"));if(o){if(l.value===void 0){for(const a in l.attributes)s.writer.removeAttribute(a,o);l.classes&&s.writer.removeClass(l.classes,o);for(const a in l.styles)s.writer.removeStyle(a,o);return}for(const[a,r]of A(l.attributes))s.writer.setAttribute(a,r,o);l.classes&&s.writer.addClass(l.classes,o);for(const a in l.styles)s.writer.setStyle(a,l.styles[a],o)}})}}function pt(l,e){const t=l.plugins.has("ImageInlineEditing"),i=l.plugins.get("ImageUtils");return s=>{s.on("element:a",(n,o,a)=>{const r=o.viewItem,c=i.findViewImgElement(r);if(!c)return;const u=c.findAncestor(k=>i.isBlockImageView(k));if(t&&!u)return;const d=new ve(e._createPattern()).match(r);if(!d||!a.consumable.consume(r,d.match))return;const m=o.modelCursor.nodeBefore||o.modelCursor.parent;a.writer.setAttribute(e.id,!0,m)},{priority:"high"})}}class _t extends p{static get requires(){return[_,re,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,s)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(s.preventDefault(),i.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{const s=new w(i),n=e.plugins.get("LinkUI"),o=e.commands.get("link");return s.set({isEnabled:!0,label:t("Link image"),icon:se,keystroke:v,tooltip:!0,isToggleable:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value",a=>!!a),this.listenTo(s,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?n._addToolbarView():n._showUI(!0)}),s})}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class St extends p{static get requires(){return[kt,_t]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}export{ut as AutoLink,He as AutomaticLinkDecorators,xt as Link,We as LinkCommand,_ as LinkEditing,nt as LinkFormView,St as LinkImage,kt as LinkImageEditing,_t as LinkImageUI,Ye as LinkManualDecorator,rt as LinkPropertiesView,ot as LinkProviderItemsView,re as LinkUI,Je as UnlinkCommand,v as _LINK_KEYSTROKE,lt as _LinkButtonView,st as _LinkPreviewButtonView,Y as _createLinkElement,ne as _ensureSafeLinkUrl,E as _extractTextFromLinkRange,ze as _getLocalizedLinkDecorators,oe as _hasLinkProtocol,$e as _isEmailLink,Ke as _normalizeLinkDecorators,Ge as _openLink,O as addLinkProtocolIfApplicable,ne as ensureSafeUrl,Ne as isLinkElement,P as isLinkableElement};
@@ -1,13 +1 @@
1
- import{Plugin as g,Command as _}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as Rt}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Enter as Mt}from"../../../../../@ckeditor_ckeditor5-enter@46.1.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{CKEditorError as Dt,getCode as zt,toArray as T,first as D,parseKeystroke as $t,getLocalizedArrowKeyCodeDirection as Ut,env as G,uid as jt,FocusTracker as et,KeystrokeHandler as it,global as Wt}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{_normalizeFontSizeOptions as st}from"../../../../../@ckeditor_ckeditor5-font@46.1.1/node_modules/@ckeditor/ckeditor5-font/dist/index.js";import{ClipboardPipeline as qt}from"../../../../../@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{createDropdown as Kt,SplitButtonView as Ht,MenuBarMenuView as Yt,ButtonView as Z,MenuBarMenuListItemButtonView as Gt,focusChildOnDropdownOpen as Zt,View as nt,ViewCollection as Jt,FocusCycler as Qt,addKeyboardHandlingForGrid as Xt,CollapsibleView as te,LabeledFieldView as ee,createLabeledInputNumber as ie,SwitchButtonView as se}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconListStyleDisc as ne,IconListStyleCircle as re,IconListStyleSquare as oe,IconListStyleDecimal as le,IconListStyleDecimalLeadingZero as ae,IconListStyleLowerRoman as ce,IconListStyleUpperRoman as ue,IconListStyleLowerLatin as de,IconListStyleUpperLatin as me,IconBulletedList as J,IconNumberedList as Q,IconTodoList as fe}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{DomEventObserver as pe,Matcher as kt}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */class y{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward=e.direction=="forward",this._includeSelf=!!e.includeSelf,this._sameAttributes=T(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){const s=new this(t,e)[Symbol.iterator]();return D(s)}*[Symbol.iterator](){const t=[];for(const{node:e}of new P(this._getStartNode(),this._isForward?"forward":"backward")){const i=e.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some(s=>e.getAttribute(s)!==this._startElement.getAttribute(s)))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}class P{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(t,e="forward"){this._node=t,this._isForward=e==="forward"}[Symbol.iterator](){return this}next(){if(!p(this._node))return{done:!0,value:void 0};const t=this._node.getAttribute("listIndent");let e=null;if(this._previous){const s=this._previousNodeIndent;t>s?this._previousNodesByIndent[s]=this._previous:t<s?(e=this._previousNodesByIndent[t]||null,this._previousNodesByIndent.length=t):e=this._previous}const i={node:this._node,previous:this._previous,previousNodeInList:e};return this._previous=this._node,this._previousNodeIndent=t,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:i,done:!1}}}class ge{_listHead;constructor(t){this._listHead=t}[Symbol.iterator](){return new P(this._listHead)}}class C{static next(){return jt()}}function p(n){return!!n&&n.is("element")&&n.hasAttribute("listItemId")}function w(n,t={}){return[...S(n,{...t,direction:"backward"}),...S(n,{...t,direction:"forward"})]}function S(n,t={}){const e=t.direction=="forward",i=Array.from(new y(n,{...t,includeSelf:e,sameIndent:!0,sameAttributes:"listItemId"}));return e?i:i.reverse()}function he(n){return Array.from(new y(n,{direction:"forward",higherIndent:!0}))}function At(n,t){const e=new y(n,{sameIndent:!0,sameAttributes:"listType",...t}),i=new y(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(e).reverse(),...i]}function A(n){return!y.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function rt(n){return!y.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function V(n,t={}){n=T(n);const e=t.withNested!==!1,i=new Set;for(const s of n)for(const r of w(s,{higherIndent:e}))i.add(r);return v(i)}function z(n){n=T(n);const t=new Set;for(const e of n)for(const i of At(e))t.add(i);return v(t)}function X(n,t){const e=S(n,{direction:"forward"}),i=C.next();for(const s of e)t.setAttribute("listItemId",i,s);return e}function W(n,t,e){const i={};for(const[r,o]of t.getAttributes())r.startsWith("list")&&(i[r]=o);const s=S(n,{direction:"forward"});for(const r of s)e.setAttributes(i,r);return s}function q(n,t,{expand:e,indentBy:i=1}={}){n=T(n);const s=e?V(n):n;for(const r of s){const o=r.getAttribute("listIndent")+i;o<0?$(r,t):t.setAttribute("listIndent",o,r)}return s}function be(n,t){n=T(n);const e=V(n),i=new Set,s=Math.min(...e.map(o=>o.getAttribute("listIndent"))),r=new Map;for(const o of e)r.set(o,y.first(o,{lowerIndent:!0}));for(const o of e){if(i.has(o))continue;i.add(o);const l=o.getAttribute("listIndent")-1;if(l<0){$(o,t);continue}if(o.getAttribute("listIndent")==s){const a=ye(o,r.get(o),t);for(const c of a)i.add(c);if(a.length)continue}t.setAttribute("listIndent",l,o)}return v(i)}function $(n,t){n=T(n);for(const e of n)e.is("element","listItem")&&t.rename(e,"paragraph");for(const e of n)for(const i of e.getAttributeKeys())i.startsWith("list")&&t.removeAttribute(i,e);return n}function E(n){if(!n.length)return!1;const t=n[0].getAttribute("listItemId");return t?!n.some(e=>e.getAttribute("listItemId")!=t):!1}function Ie(n,t){const e=[];let i=Number.POSITIVE_INFINITY;for(const{node:s}of new P(n.nextSibling)){const r=s.getAttribute("listIndent");if(r==0)break;r<i&&(i=r);const o=r-i;t.setAttribute("listIndent",o,s),e.push(s)}return e}function v(n){return Array.from(n).filter(t=>t.root.rootName!=="$graveyard").sort((t,e)=>t.index-e.index)}function F(n){const t=n.document.selection.getSelectedElement();return t&&n.schema.isObject(t)&&n.schema.isBlock(t)?t:null}function U(n,t){return t.checkChild(n.parent,"listItem")&&t.checkChild(n,"$text")&&!t.isObject(n)}function M(n){return n=="numbered"||n=="customNumbered"}function ye(n,t,e){return S(t,{direction:"forward"}).pop().index>n.index?W(n,t,e):[]}class ot extends _{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=lt(t.document.selection);t.change(i=>{const s=[];E(e)&&!A(e[0])?(this._direction=="forward"&&s.push(...q(e,i)),s.push(...X(e[0],i))):this._direction=="forward"?s.push(...q(e,i,{expand:!0})):s.push(...be(e,i));for(const r of s){if(!r.hasAttribute("listType"))continue;const o=y.first(r,{sameIndent:!0});o&&i.setAttribute("listType",o.getAttribute("listType"),r)}this._fireAfterExecute(s)})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_checkEnabled(){let t=lt(this.editor.model.document.selection),e=t[0];if(!e)return!1;if(this._direction=="backward"||E(t)&&!A(t[0]))return!0;t=V(t),e=t[0];const i=y.first(e,{sameIndent:!0});return i?i.getAttribute("listType")==e.getAttribute("listType"):!1}}function lt(n){const t=Array.from(n.getSelectedBlocks()),e=t.findIndex(i=>!p(i));return e!=-1&&(t.length=e),t}class B extends _{type;_listWalkerOptions;constructor(t,e,i={}){super(t),this.type=e,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,i=e.document,s=F(e),r=Array.from(i.selection.getSelectedBlocks()).filter(l=>e.schema.checkAttribute(l,"listType")||U(l,e.schema)),o=t.forceValue!==void 0?!t.forceValue:this.value;e.change(l=>{if(o){const a=r[r.length-1],c=S(a,{direction:"forward"}),u=[];c.length>1&&u.push(...X(c[1],l)),u.push(...$(r,l)),u.push(...Ie(a,l)),this._fireAfterExecute(u)}else if((s||i.selection.isCollapsed)&&p(r[0])){const a=At(s||r[0],this._listWalkerOptions);for(const c of a)l.setAttributes({...t.additionalAttributes,listType:this.type},c);this._fireAfterExecute(a)}else{const a=[];for(const c of r)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&U(c,e.schema)&&l.rename(c,"listItem"),l.setAttributes({...t.additionalAttributes,listIndent:0,listItemId:C.next(),listType:this.type},c),a.push(c);else for(const u of V(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(l.setAttributes({...t.additionalAttributes,listType:this.type},u),a.push(u));this._fireAfterExecute(a)}})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_getValue(){const t=this.editor.model.document.selection,e=Array.from(t.getSelectedBlocks());if(!e.length)return!1;for(const i of e)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const t=this.editor.model,e=t.schema,i=t.document.selection,s=Array.from(i.getSelectedBlocks());if(!s.length)return!1;if(this.value)return!0;for(const r of s)if(e.checkAttribute(r,"listType")||U(r,e))return!0;return!1}}class at extends _{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:t=!1}={}){const e=this.editor.model,i=e.document.selection,s=[];e.change(r=>{const{firstElement:o,lastElement:l}=this._getMergeSubjectElements(i,t),a=o.getAttribute("listIndent")||0,c=l.getAttribute("listIndent"),u=l.getAttribute("listItemId");if(a!=c){const d=he(l);s.push(...q([l,...d],r,{indentBy:a-c,expand:a<c}))}if(t){let d=i;i.isCollapsed&&(d=r.createSelection(r.createRange(r.createPositionAt(o,"end"),r.createPositionAt(l,0)))),e.deleteContent(d,{doNotResetEntireContent:i.isCollapsed});const m=d.getLastPosition().parent,f=m.nextSibling;s.push(m),f&&f!==l&&f.getAttribute("listItemId")==u&&s.push(...W(f,m,r))}else s.push(...W(l,o,r));this._fireAfterExecute(s)})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_checkEnabled(){const t=this.editor.model,e=t.document.selection,i=F(t);if(e.isCollapsed||i){const s=i||e.getFirstPosition().parent;if(!p(s))return!1;const r=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!r||E([s,r]))return!1}else{const s=e.getLastPosition(),r=e.getFirstPosition();if(s.parent===r.parent||!p(s.parent))return!1}return!0}_getMergeSubjectElements(t,e){const i=this.editor.model,s=F(i);let r,o;if(t.isCollapsed||s){const l=s||t.getFirstPosition().parent,a=A(l);this._direction=="backward"?(o=l,a&&!e?r=y.first(l,{sameIndent:!0,lowerIndent:!0}):r=l.previousSibling):(r=l,o=l.nextSibling)}else r=t.getFirstPosition().parent,o=t.getLastPosition().parent;return{firstElement:r,lastElement:o}}}class ct extends _{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(e=>{const i=X(this._getStartBlock(),e);this._fireAfterExecute(i)})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&p(e)&&!A(e)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?e:e.nextSibling}}class ke extends g{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("bold","listItemBold"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(s,r,o,l){r&&(s.addClass("ck-list-marker-bold",o),G.isSafari&&!(l&&l.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-bold","0",o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemBold"}),e.schema.setAttributeProperties("listItemBold",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemBold"),t.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}))}}class Ae extends g{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("italic","listItemItalic"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(s,r,o,l){r&&(s.addClass("ck-list-marker-italic",o),G.isSafari&&!(l&&l.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-italic","0",o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),e.schema.setAttributeProperties("listItemItalic",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemItalic"),t.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}))}}class Le extends g{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);if(!t.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;const s=st(t.config.get("fontSize.options"));e.registerFormatAttribute("fontSize","listItemFontSize"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(r,o,l,a){if(o){const c=s.find(u=>u.model==o);c&&c.view&&typeof c.view!="string"?c.view.styles?(r.addClass("ck-list-marker-font-size",l),r.setStyle("--ck-content-list-marker-font-size",c.view.styles["font-size"],l)):c.view.classes&&(r.addClass(`ck-list-marker-font-size-${o}`,l),G.isSafari&&!(a&&a.dataPipeline)&&r.setStyle("--ck-content-list-marker-dummy-font-size","0",l)):(r.addClass("ck-list-marker-font-size",l),r.setStyle("--ck-content-list-marker-font-size",o,l))}}})}afterInit(){const t=this.editor,e=t.model;if(!t.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;e.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),e.schema.setAttributeProperties("listItemFontSize",{isFormatting:!0}),e.schema.addAttributeCheck(s=>{if(!s.last.getAttribute("listItemId"))return!1},"listItemFontSize"),t.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s=>s.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});const i=st(t.config.get("fontSize.options"));for(const s of i)s.model&&s.view&&t.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s.model},view:{name:"li",classes:`ck-list-marker-font-size-${s.model}`}})}}class we extends g{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontColor","listItemFontColor"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-color",o),s.setStyle("--ck-content-list-marker-color",r,o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),e.schema.setAttributeProperties("listItemFontColor",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontColor"),t.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:i=>i.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}))}}class Te extends g{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontFamily","listItemFontFamily"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-font-family",o),s.setStyle("--ck-content-list-marker-font-family",r,o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),e.schema.setAttributeProperties("listItemFontFamily",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontFamily"),t.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:i=>i.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}))}}class Se extends g{_loadedFormatting={};static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[ke,Ae,Le,we,Te]}constructor(t){super(t),t.config.define("list.enableListItemMarkerFormatting",!0)}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){const t=this.editor.model;t.document.registerPostFixer(e=>{const i=t.document.differ.getChanges(),s=new Set;let r=!1;for(const o of i)if(o.type==="attribute")(o.attributeKey=="listItemId"||o.attributeKey=="listType"||this._isInlineOrSelectionFormatting(o.attributeKey)||Object.values(this._loadedFormatting).includes(o.attributeKey))&&(p(o.range.start.nodeAfter)?s.add(o.range.start.nodeAfter):p(o.range.start.parent)&&s.add(o.range.start.parent));else if(p(o.position.nodeAfter)&&s.add(o.position.nodeAfter),p(o.position.nodeBefore)&&s.add(o.position.nodeBefore),p(o.position.parent)&&s.add(o.position.parent),o.type=="insert"&&o.name!="$text"){const l=e.createRangeIn(o.position.nodeAfter);for(const a of l.getItems())p(a)&&s.add(a)}for(const o of s){const l=_e(t,o,Object.keys(this._loadedFormatting));for(const[a,c]of Object.entries(l)){const u=this._loadedFormatting[a];(c&&ve(e,o,u,c)||!c&&Ce(e,o,u))&&(r=!0)}}return r})}registerFormatAttribute(t,e){this._loadedFormatting[t]=e}_isInlineOrSelectionFormatting(t){return t.replace(/^selection:/,"")in this._loadedFormatting}}function _e(n,t,e){if(A(t))return ut(n,t,e);const i=w(t);return ut(n,i[0],e)}function ut(n,t,e){if(!xe(t)||n.schema.isLimit(t))return Object.fromEntries(e.map(l=>[l]));if(t.isEmpty)return Object.fromEntries(e.map(l=>[l,t.getAttribute(`selection:${l}`)]));const i=new Set(e),s={},o=n.createRangeIn(t).getWalker({ignoreElementEnd:!0});for(const{item:l}of o){for(const a of i)if(n.schema.checkAttribute(l,a)){const c=l.getAttribute(a);c===void 0?(i.delete(a),s[a]=void 0):s[a]===void 0?s[a]=c:s[a]!==c&&(i.delete(a),s[a]=void 0)}else a in s||(s[a]=void 0);if(!i.size)break;n.schema.isLimit(l)&&o.jumpTo(n.createPositionAfter(l))}return s}function ve(n,t,e,i){const s=w(t);let r=!1;for(const o of s)(!o.hasAttribute(e)||o.getAttribute(e)!==i)&&(n.setAttribute(e,i,o),r=!0);return r}function Ce(n,t,e){const i=w(t);let s=!1;for(const r of i)r.hasAttribute(e)&&(n.removeAttribute(e,r),s=!0);return s}function xe(n){return["numbered","bulleted","customNumbered","customBulleted"].includes(n.getAttribute("listType"))}class Be extends g{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(t){return z(t)}isFirstBlockOfListItem(t){return A(t)}isListItemBlock(t){return p(t)}expandListBlocksToCompleteItems(t,e={}){return V(t,e)}isNumberedListType(t){return M(t)}}/**
5
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
6
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
7
- */function Ee(n){return n.is("element","ol")||n.is("element","ul")}function K(n){return n.is("element","li")}function Fe(n){let t=0,e=n.parent;for(;e;){if(K(e))t++;else{const i=e.previousSibling;i&&K(i)&&t++}e=e.parent}return t}function Pe(n,t,e,i=wt(e,t)){return n.createAttributeElement(Lt(e),null,{priority:2*t/100-100,id:i})}function Ve(n,t,e){return n.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:e})}function Lt(n){return n=="numbered"||n=="customNumbered"?"ol":"ul"}function wt(n,t){return`list-${n}-${t}`}function k(n,t,e){const i=n.nodeBefore;if(p(i)){let s=i;for(const{node:r}of new P(s,"backward"))if(s=r,e.has(s)||(e.add(s),t.has(i)))return;t.add(s)}else{const s=n.nodeAfter;p(s)&&t.add(s)}}function Oe(n,t){let e=0,i=-1,s=null,r=!1;for(const{node:o}of n){const l=o.getAttribute("listIndent");if(l>e){let a;s===null?(s=l-e,a=e):(s>l&&(s=l),a=l-s),a>i+1&&(a=i+1),t.setAttribute("listIndent",a,o),r=!0,i=a}else s=null,e=l+1,i=l}return r}function Ne(n,t,e){const i=new Set;let s=!1;for(const{node:r}of n){if(i.has(r))continue;let o=r.getAttribute("listType"),l=r.getAttribute("listItemId");if(t.has(l)&&(l=C.next()),t.add(l),r.is("element","listItem")){r.getAttribute("listItemId")!=l&&(e.setAttribute("listItemId",l,r),s=!0);continue}for(const a of S(r,{direction:"forward"}))i.add(a),a.getAttribute("listType")!=o&&(l=C.next(),o=a.getAttribute("listType")),a.getAttribute("listItemId")!=l&&(e.setAttribute("listItemId",l,a),s=!0)}return s}function Re(){return(n,t,e)=>{const{writer:i,schema:s}=e;if(!t.modelRange)return;const r=Array.from(t.modelRange.getItems({shallow:!0})).filter(d=>s.checkAttribute(d,"listItemId"));if(!r.length)return;const o=t.viewItem.getAttribute("data-list-item-id")||C.next();e.consumable.consume(t.viewItem,{attributes:"data-list-item-id"});const l=Fe(t.viewItem);let a=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=r[0].getAttribute("listType");c&&(a=c);const u={listItemId:o,listIndent:l,listType:a};for(const d of r)d.hasAttribute("listItemId")||i.setAttributes(u,d);r.length>1&&r[1].getAttribute("listItemId")!=u.listItemId&&e.keepEmptyElement(r[0])}}function Me(n,t,e,i){return()=>{const l=n.document.differ.getChanges(),a=[],c=new Set,u=new Set,d=new Set;for(const m of l)if(m.type=="insert"&&m.name!="$text")k(m.position,c,d),m.attributes.has("listItemId")?u.add(m.position.nodeAfter):k(m.position.getShiftedBy(m.length),c,d);else if(m.type=="remove"&&m.attributes.has("listItemId"))k(m.position,c,d);else if(m.type=="attribute"){const f=m.range.start.nodeAfter;e.includes(m.attributeKey)?(k(m.range.start,c,d),m.attributeNewValue===null?(k(m.range.start.getShiftedBy(1),c,d),r(f)&&a.push(f)):u.add(f)):p(f)&&r(f)&&a.push(f)}for(const m of c.values())a.push(...s(m,u));for(const m of new Set(a))t.reconvertItem(m)};function s(l,a){const c=[],u=new Set,d=[];for(const{node:m,previous:f}of new P(l)){if(u.has(m))continue;const h=m.getAttribute("listIndent");f&&h<f.getAttribute("listIndent")&&(d.length=h+1),d[h]={modelAttributes:Object.fromEntries(Array.from(m.getAttributes()).filter(([I])=>e.includes(I))),modelElement:m};const L=S(m,{direction:"forward"});for(const I of L)u.add(I),(r(I,L)||o(I,d,a))&&c.push(I)}return c}function r(l,a){const c=t.mapper.toViewElement(l);if(!c)return!1;if(i.fire("checkElement",{modelElement:l,viewElement:c}))return!0;if(!l.is("element","paragraph")&&!l.is("element","listItem"))return!1;const d=St(l,e,a);return d&&c.is("element","p")?!0:!!(!d&&c.is("element","span"))}function o(l,a,c){if(c.has(l))return!1;const u=t.mapper.toViewElement(l);let d=a.length-1;for(let m=u.parent;!m.is("editableElement");m=m.parent){const f=K(m),h=Ee(m);if(!h&&!f)continue;const L=`checkAttributes:${f?"item":"list"}`;if(i.fire(L,{viewElement:m,modelAttributes:a[d].modelAttributes,modelReferenceElement:a[d].modelElement}))break;if(h&&(d--,d<0))return!1}return!0}}function dt(n,t,e,{dataPipeline:i}={}){const s=qe(n);return(r,o,l)=>{const{writer:a,mapper:c,consumable:u}=l,d=o.item;if(!n.includes(o.attributeKey)||!s(d,u))return;const m={...l.options,dataPipeline:i},f=ze(d,c,e);Tt(f,a,c),je(f,a);const h=Ue(d,f,t,a,m);We(d,h,t,a,m)}}function De(n){return(t,e,i)=>{const{writer:s,mapper:r}=i,o=t.name.split(":")[1];if(!n.checkAttribute(o,"listItemId"))return;const l=r.toViewPosition(e.position),a=e.position.getShiftedBy(e.length),c=r.toViewPosition(a,{isPhantom:!0}),d=s.createRange(l,c).getTrimmed().end.nodeBefore;/* istanbul ignore next -- @preserve */d&&Tt(d,s,r)}}function mt(n,{dataPipeline:t}={}){return(e,{writer:i})=>{if(!St(e,n))return null;if(!t)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function ze(n,t,e){const i=e.createRangeOn(n);return t.toViewRange(i).getTrimmed().end.nodeBefore}function $e(n,t){return(e,i)=>{if(i.modelPosition.offset>0)return;const s=i.modelPosition.parent;if(!p(s)||!n.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(s)))return;const r=i.mapper.toViewElement(s),o=t.createRangeIn(r),l=o.getWalker();let a=o.start;for(const{item:c}of l){if(c.is("element")&&i.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(a=t.createPositionAfter(c),l.skip(({previousPosition:u})=>!u.isEqual(a)))}i.viewPosition=a}}function Tt(n,t,e){for(;n.parent.is("attributeElement")&&n.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(n),n.parent);const i=[];s(t.createPositionBefore(n).getWalker({direction:"backward"})),s(t.createRangeIn(n).getWalker());for(const r of i)t.remove(r);function s(r){for(const{item:o}of r){if(o.is("element")&&e.toModelElement(o))break;o.is("element")&&o.getCustomProperty("listItemMarker")&&i.push(o)}}}function Ue(n,t,e,i,{dataPipeline:s}){let r=i.createRangeOn(t);if(!A(n))return r;for(const o of e){if(o.scope!="itemMarker")continue;const l=o.createElement(i,n,{dataPipeline:s});if(!l||(i.setCustomProperty("listItemMarker",!0,l),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(n)?i.insert(i.createPositionAt(t,0),l):(i.insert(r.start,l),r=i.createRange(i.createPositionBefore(l),i.createPositionAfter(t))),!o.createWrapperElement||!o.canWrapElement))continue;const a=o.createWrapperElement(i,n,{dataPipeline:s});i.setCustomProperty("listItemWrapper",!0,a),o.canWrapElement(n)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(l),a),r=i.createRange(r.start,i.createPositionAfter(t)))}return r}function je(n,t){let e=n.parent;for(;e.is("attributeElement")&&["ul","ol","li"].includes(e.name);){const i=e.parent;t.unwrap(t.createRangeOn(n),e),e=i}}function We(n,t,e,i,s){if(!n.hasAttribute("listIndent"))return;const r=n.getAttribute("listIndent");let o=n;for(let l=r;l>=0;l--){const a=Ve(i,l,o.getAttribute("listItemId")),c=Pe(i,l,o.getAttribute("listType"));for(const u of e)(u.scope=="list"||u.scope=="item")&&o.hasAttribute(u.attributeName)&&u.setAttributeOnDowncast(i,o.getAttribute(u.attributeName),u.scope=="list"?c:a,s);if(t=i.wrap(t,a),t=i.wrap(t,c),l==0||(o=y.first(o,{lowerIndent:!0}),!o))break}}function qe(n){return(t,e)=>{const i=[];for(const s of n)t.hasAttribute(s)&&i.push(`attribute:${s}`);return i.every(s=>e.test(t,s)!==!1)?(i.forEach(s=>e.consume(t,s)),!0):!1}}function St(n,t,e=w(n)){if(!p(n))return!1;for(const i of n.getAttributeKeys())if(!(i.startsWith("selection:")||i=="htmlEmptyBlock")&&!t.includes(i))return!1;return e.length<2}const R=["listType","listIndent","listItemId"];class b extends g{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Mt,Rt,Be,qt,Se]}constructor(t){super(t),t.config.define("list.multiBlock",!0)}init(){const t=this.editor,e=t.model,i=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new Dt("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:R}),i?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const s of R)e.schema.setAttributeProperties(s,{copyOnReplace:!0});t.commands.add("numberedList",new B(t,"numbered")),t.commands.add("bulletedList",new B(t,"bulleted")),t.commands.add("customNumberedList",new B(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new B(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new ot(t,"forward")),t.commands.add("outdentList",new ot(t,"backward")),t.commands.add("splitListItemBefore",new ct(t,"before")),t.commands.add("splitListItemAfter",new ct(t,"after")),i&&(t.commands.add("mergeListItemBackward",new at(t,"backward")),t.commands.add("mergeListItemForward",new at(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){const e=this.editor.commands,i=e.get("indent"),s=e.get("outdent");i&&i.registerChildCommand(e.get("indentList"),{priority:"high"}),s&&s.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...R,...this._downcastStrategies.map(t=>t.attributeName)]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),i=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",(s,r)=>{const o=t.model.document.selection;F(t.model)||t.model.change(()=>{const l=o.getFirstPosition();if(o.isCollapsed&&r.direction=="backward"){if(!l.isAtStart)return;const a=l.parent;if(!p(a))return;if(!y.first(a,{sameAttributes:"listType",sameIndent:!0})&&a.getAttribute("listIndent")===0)rt(a)||t.execute("splitListItemAfter"),t.execute("outdentList");else{if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:ft(t.model,"backward")})}r.preventDefault(),s.stop()}else{if(o.isCollapsed&&!o.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:ft(t.model,"forward")}),r.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,i=t.commands,s=i.get("enter");this.listenTo(t.editing.view.document,"enter",(r,o)=>{const l=e.document,a=l.selection.getFirstPosition().parent;if(l.selection.isCollapsed&&p(a)&&a.isEmpty&&!o.isSoft){const c=A(a),u=rt(a);c&&u?(t.execute("outdentList"),o.preventDefault(),r.stop()):c&&!u?(t.execute("splitListItemAfter"),o.preventDefault(),r.stop()):u&&(t.execute("splitListItemBefore"),o.preventDefault(),r.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{const r=i.get("splitListItemBefore");if(r.refresh(),!r.isEnabled)return;const l=t.model.document.selection.getLastPosition().parent;w(l).length===2&&r.execute()})}_setupTabIntegration(){const t=this.editor;this.listenTo(t.editing.view.document,"tab",(e,i)=>{const s=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(t.execute(s),i.stopPropagation(),i.preventDefault(),e.stop())},{context:"li"})}_setupConversion(){const t=this.editor,e=t.model,i=this.getListAttributeNames(),s=t.config.get("list.multiBlock"),r=s?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(l,{writer:a})=>a.createElement(r,{listType:""})}).elementToElement({view:"p",model:(l,{writer:a})=>l.parent&&l.parent.is("element","li")?a.createElement(r,{listType:""}):null,converterPriority:"high"}).add(l=>{l.on("element:li",Re())}),s||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:r,view:mt(i),converterPriority:"high"}).add(l=>{l.on("attribute",dt(i,this._downcastStrategies,e)),l.on("remove",De(e.schema))}),t.conversion.for("dataDowncast").elementToElement({model:r,view:mt(i,{dataPipeline:!0}),converterPriority:"high"}).add(l=>{l.on("attribute",dt(i,this._downcastStrategies,e,{dataPipeline:!0}))});const o=$e(this._downcastStrategies,t.editing.view);t.editing.mapper.on("modelToViewPosition",o),t.data.mapper.on("modelToViewPosition",o),this.listenTo(e.document,"change:data",Me(e,t.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(l,{viewElement:a,modelAttributes:c})=>{a.id!=c.listItemId&&(l.return=!0,l.stop())}),this.on("checkAttributes:list",(l,{viewElement:a,modelAttributes:c})=>{(a.name!=Lt(c.listType)||a.id!=wt(c.listType,c.listIndent))&&(l.return=!0,l.stop())})}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer(i=>Ke(t,i,e,this)),this.on("postFixer",(i,{listNodes:s,writer:r})=>{i.return=Oe(s,r)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:r,seenIds:o})=>{i.return=Ne(s,o,r)||i.return},{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",He(t),{priority:"high"}),this.listenTo(e,"outputTransformation",(i,s)=>{t.change(r=>{const o=Array.from(s.content.getChildren()),l=o[o.length-1];if(o.length>1&&l.is("element")&&l.isEmpty&&o.slice(0,-1).every(p)&&r.remove(l),s.method=="copy"||s.method=="cut"){const a=Array.from(s.content.getChildren());E(a)&&$(a,r)}})})}_setupAccessibilityIntegration(){const t=this.editor,e=t.t;t.accessibility.addKeystrokeInfoGroup({id:"list",label:e("Keystrokes that can be used in a list"),keystrokes:[{label:e("Increase list item indent"),keystroke:"Tab"},{label:e("Decrease list item indent"),keystroke:"Shift+Tab"}]})}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(t,e,i,s){s&&(s.skipListItemIds||s.isClipboardPipeline)||t.setAttribute("data-list-item-id",e,i)}})}}function Ke(n,t,e,i){const s=n.document.differ.getChanges(),r=new Set,o=new Set,l=i.editor.config.get("list.multiBlock");let a=!1;for(const u of s){if(u.type=="insert"&&u.name!="$text"){const d=u.position.nodeAfter;if(!n.schema.checkAttribute(d,"listItemId"))for(const m of Array.from(d.getAttributeKeys()))e.includes(m)&&(t.removeAttribute(m,d),a=!0);k(u.position,o,r),u.attributes.has("listItemId")||k(u.position.getShiftedBy(u.length),o,r);for(const{item:m,previousPosition:f}of n.createRangeIn(d))p(m)&&k(f,o,r)}else u.type=="remove"?k(u.position,o,r):u.type=="attribute"&&e.includes(u.attributeKey)&&(k(u.range.start,o,r),u.attributeNewValue===null&&k(u.range.start.getShiftedBy(1),o,r));if(!l&&u.type=="attribute"&&R.includes(u.attributeKey)){const d=u.range.start.nodeAfter;u.attributeNewValue===null&&d&&d.is("element","listItem")?(t.rename(d,"paragraph"),a=!0):u.attributeOldValue===null&&d&&d.is("element")&&d.name!="listItem"&&(t.rename(d,"listItem"),a=!0)}}const c=new Set;for(const u of o.values())a=i.fire("postFixer",{listNodes:new ge(u),listHead:u,writer:t,seenIds:c})||a;return a}function He(n){return(t,[e,i])=>{const s=e.is("documentFragment")?Array.from(e.getChildren()):[e];if(!s.length)return;const o=(i?n.createSelection(i):n.document.selection).getFirstPosition();let l;if(p(o.parent))l=o.parent;else if(p(o.nodeBefore)&&p(o.nodeAfter))l=o.nodeBefore;else return;n.change(a=>{const c=l.getAttribute("listType"),u=l.getAttribute("listIndent"),d=s[0].getAttribute("listIndent")||0,m=Math.max(u-d,0);for(const f of s){const h=p(f);l.is("element","listItem")&&f.is("element","paragraph")&&a.rename(f,"listItem"),a.setAttributes({listIndent:(h?f.getAttribute("listIndent"):0)+m,listItemId:h?f.getAttribute("listItemId"):C.next(),listType:c},f)}})}}function ft(n,t){const e=n.document.selection;if(!e.isCollapsed)return!F(n);if(t==="forward")return!0;const s=e.getFirstPosition().parent,r=s.previousSibling;return n.schema.isObject(r)?!1:r.isEmpty?!0:E([s,r])}function H(n,t,e,i){n.ui.componentFactory.add(t,()=>{const s=pt(Z,n,t,e,i);return s.set({tooltip:!0,isToggleable:!0}),s}),n.ui.componentFactory.add(`menuBar:${t}`,()=>{const s=pt(Gt,n,t,e,i);return s.set({role:"menuitemcheckbox",isToggleable:!0}),s})}function pt(n,t,e,i,s){const r=t.commands.get(e),o=new n(t.locale);return o.set({label:i,icon:s}),o.bind("isOn","isEnabled").to(r,"value","isEnabled"),o.on("execute",()=>{t.execute(e),t.editing.view.focus()}),o}class Ye extends g{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||H(this.editor,"numberedList",t("Numbered List"),Q),this.editor.ui.componentFactory.has("bulletedList")||H(this.editor,"bulletedList",t("Bulleted List"),J)}}class Ti extends g{static get requires(){return[b,Ye]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}class Ge extends _{refresh(){const t=this._getValue();this.value=t,this.isEnabled=t!=null}execute({startIndex:t=1}={}){const e=this.editor.model,i=e.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(r=>p(r)&&M(r.getAttribute("listType")));s=z(s),e.change(r=>{for(const o of s)r.setAttribute("listStart",t>=0?t:1,o)})}_getValue(){const e=this.editor.model.document,i=D(e.selection.getSelectedBlocks());return i&&p(i)&&M(i.getAttribute("listType"))?i.getAttribute("listStart"):null}}/**
8
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
9
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
10
- */const _t={},vt={},Ct={},xt=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:n,typeAttribute:t,listType:e}of xt)_t[n]=e,vt[n]=t,t&&(Ct[t]=n);function Bt(){return xt.map(n=>n.listStyle)}function tt(n){return _t[n]||null}function Et(n){return Ct[n]||null}function Y(n){return vt[n]||null}function Ze(n){switch(n){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return n}}class Je extends _{defaultType;_supportedTypes;constructor(t,e,i){super(t),this.defaultType=e,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,i=e.document;e.change(s=>{this._tryToConvertItemsToList(t);let r=Array.from(i.selection.getSelectedBlocks()).filter(o=>o.hasAttribute("listType"));if(r.length){r=z(r);for(const o of r)s.setAttribute("listStyle",t.type||this.defaultType,o)}})}isStyleTypeSupported(t){return this._supportedTypes?this._supportedTypes.includes(t):!0}_getValue(){const t=D(this.editor.model.document.selection.getSelectedBlocks());return p(t)?t.getAttribute("listStyle"):null}_checkEnabled(){const t=this.editor,e=t.commands.get("numberedList"),i=t.commands.get("bulletedList");return e.isEnabled||i.isEnabled}_tryToConvertItemsToList(t){if(!t.type)return;const e=tt(t.type);if(!e)return;const i=this.editor,s=`${e}List`;i.commands.get(s).value||i.execute(s)}}class Qe extends _{refresh(){const t=this._getValue();this.value=t,this.isEnabled=t!=null}execute(t={}){const e=this.editor.model,i=e.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(r=>p(r)&&r.getAttribute("listType")=="numbered");s=z(s),e.change(r=>{for(const o of s)r.setAttribute("listReversed",!!t.reversed,o)})}_getValue(){const e=this.editor.model.document,i=D(e.selection.getSelectedBlocks());return p(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listReversed"):null}}/**
11
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
12
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
13
- */function gt(n){return(t,e,i)=>{const{writer:s,schema:r,consumable:o}=i;if(o.test(e.viewItem,n.viewConsumables)===!1)return;e.modelRange||Object.assign(e,i.convertChildren(e.viewItem,e.modelCursor));let l=!1;for(const a of e.modelRange.getItems({shallow:!0}))r.checkAttribute(a,n.attributeName)&&n.appliesToListItem(a)&&(a.hasAttribute(n.attributeName)||(s.setAttribute(n.attributeName,n.getAttributeOnUpcast(e.viewItem),a),l=!0));l&&o.consume(e.viewItem,n.viewConsumables)}}class Xe extends g{static get pluginName(){return"ListPropertiesUtils"}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return Bt()}getListTypeFromListStyleType(t){return tt(t)}getListStyleTypeFromTypeAttribute(t){return Et(t)}getTypeAttributeFromListStyleType(t){return Y(t)}}function Ft(n){const{startIndex:t,reversed:e,styles:i}=n;return{styles:ti(i),startIndex:t||!1,reversed:e||!1}}function ti(n){const t={listTypes:["bulleted","numbered"],useAttribute:!1};return n===!0||(n?Array.isArray(n)||typeof n=="string"?t.listTypes=T(n):(t.listTypes=n.listTypes?T(n.listTypes):t.listTypes,t.useAttribute=!!n.useAttribute,n.listStyleTypes&&(t.listStyleTypes=n.listStyleTypes)):t.listTypes=[]),t}const x="default";class ei extends g{static get requires(){return[b,Xe]}static get pluginName(){return"ListPropertiesEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const t=this.editor,e=t.model,i=t.plugins.get(b),s=t.config.get("list.properties"),r=ii(s);for(const o of r)o.addCommand(t),e.schema.extend("$listItem",{allowAttributes:o.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:o.attributeName,setAttributeOnDowncast(l,a,c){o.setAttributeOnDowncast(l,a,c)}});t.conversion.for("upcast").add(o=>{for(const l of r)o.on("element:ol",gt(l)),o.on("element:ul",gt(l))}),i.on("checkAttributes:list",(o,{viewElement:l,modelAttributes:a,modelReferenceElement:c})=>{for(const u of r)u.appliesToListItem(c)&&u.getAttributeOnUpcast(l)!=a[u.attributeName]&&(o.return=!0,o.stop())}),this.listenTo(t.commands.get("indentList"),"afterExecute",(o,l)=>{e.change(a=>{for(const c of l)for(const u of r)u.appliesToListItem(c)&&a.setAttribute(u.attributeName,u.defaultValue,c)})}),i.on("postFixer",(o,{listNodes:l,writer:a})=>{for(const{node:c}of l)for(const u of r)u.hasValidAttribute(c)||(u.appliesToListItem(c)?a.setAttribute(u.attributeName,u.defaultValue,c):a.removeAttribute(u.attributeName,c),o.return=!0)}),i.on("postFixer",(o,{listNodes:l,writer:a})=>{for(const{node:c,previousNodeInList:u}of l)if(u&&u.getAttribute("listType")==c.getAttribute("listType"))for(const d of r){const{attributeName:m}=d;if(!d.appliesToListItem(c))continue;const f=u.getAttribute(m);c.getAttribute(m)!=f&&(a.setAttribute(m,f,c),o.return=!0)}})}}function ii(n){const t=[],e=Ft(n);if(n.styles){const i=e.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:x,viewConsumables:{styles:"list-style-type"},addCommand(s){let r=Bt();i&&(r=r.filter(o=>!!Y(o))),s.commands.add("listStyle",new Je(s,x,r))},appliesToListItem(s){return s.getAttribute("listType")=="numbered"||s.getAttribute("listType")=="bulleted"},hasValidAttribute(s){if(!this.appliesToListItem(s))return!s.hasAttribute("listStyle");if(!s.hasAttribute("listStyle"))return!1;const r=s.getAttribute("listStyle");return r==x?!0:tt(r)==s.getAttribute("listType")},setAttributeOnDowncast(s,r,o){if(r&&r!==x)if(i){const l=Y(r);if(l){s.setAttribute("type",l,o);return}}else{s.setStyle("list-style-type",r,o);return}s.removeStyle("list-style-type",o),s.removeAttribute("type",o)},getAttributeOnUpcast(s){const r=s.getStyle("list-style-type");if(r)return Ze(r);const o=s.getAttribute("type");return o?Et(o):x}})}return n.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(i){i.commands.add("listReversed",new Qe(i))},appliesToListItem(i){return i.getAttribute("listType")=="numbered"},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listReversed")},setAttributeOnDowncast(i,s,r){s?i.setAttribute("reversed","reversed",r):i.removeAttribute("reversed",r)},getAttributeOnUpcast(i){return i.hasAttribute("reversed")}}),n.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(i){i.commands.add("listStart",new Ge(i))},appliesToListItem(i){return M(i.getAttribute("listType"))},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listStart")},setAttributeOnDowncast(i,s,r){s==0||s>1?i.setAttribute("start",s,r):i.removeAttribute("start",r)},getAttributeOnUpcast(i){const s=i.getAttribute("start");return s>=0?s:1}}),t}class Pt extends nt{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new et;keystrokes=new it;focusables=new Jt;focusCycler;constructor(t,{enabledProperties:e,styleButtonViews:i,styleGridAriaLabel:s}){super(t);const r=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Qt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,s),this.children.add(this.stylesView)):r.push("ck-list-properties_without-styles"),(e.startIndex||e.reversed)&&(this._addNumberedListPropertyViews(e),r.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:r},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const t of this.stylesView.children)this.stylesView.focusTracker.add(t.element);Xt({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>Wt.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const t=e=>e.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(t,e){const i=new nt(this.locale);return i.children=i.createCollection(),i.children.addMany(t),i.setTemplate({tag:"div",attributes:{"aria-label":e,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){for(const s of this.children)if(s instanceof Z&&s.isOn){s.focus();return}this.children.first.focus()},i.focusTracker=new et,i.keystrokes=new it,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(t){const e=this.locale.t,i=[];t.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),t.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new te(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:e("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...s)=>s.some(r=>r)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(s,r,o)=>{o||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const t=this.locale.t,e=new ee(this.locale,ie);return e.set({label:t("Start at"),class:"ck-numbered-list-properties__start-index"}),e.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),e.fieldView.on("input",()=>{const i=e.fieldView.element,s=i.valueAsNumber;if(Number.isNaN(s)){e.errorText=t("Invalid start index value.");return}i.checkValidity()?this.fire("listStart",{startIndex:s}):e.errorText=t("Start index must be greater than 0.")}),e}_createReversedSwitchButton(){const t=this.locale.t,e=new se(this.locale);return e.set({withText:!0,label:t("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),e.delegate("execute").to(this,"listReversed"),e}}class si extends g{static get pluginName(){return"ListPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=t.config.get("list.properties"),s=Ft(i),r=s.styles.listTypes;if(r.includes("bulleted")){const o=[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:ne},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:re},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:oe}],l=e("Bulleted List"),a=e("Bulleted list styles toolbar"),c="bulletedList";t.ui.componentFactory.add(c,ht({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:J,styleGridAriaLabel:a,styleDefinitions:o})),t.ui.componentFactory.add(`menuBar:${c}`,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}if(r.includes("numbered")||i.startIndex||i.reversed){const o=[{label:e("Toggle the decimal list style"),tooltip:e("Decimal"),type:"decimal",icon:le},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:ae},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:ce},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:ue},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:de},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:me}],l=e("Numbered List"),a=e("Numbered list styles toolbar"),c="numberedList";t.ui.componentFactory.add(c,ht({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:Q,styleGridAriaLabel:a,styleDefinitions:o})),r.includes("numbered")&&t.ui.componentFactory.add(`menuBar:${c}`,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}}}function ht({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,buttonIcon:s,styleGridAriaLabel:r,styleDefinitions:o}){const l=n.commands.get(e);return a=>{const c=Kt(a,Ht),u=c.buttonView;return c.bind("isEnabled").to(l),c.class="ck-list-styles-dropdown",u.on("execute",()=>{n.execute(e),n.editing.view.focus()}),u.set({label:i,icon:s,tooltip:!0,isToggleable:!0}),u.bind("isOn").to(l,"value",d=>!!d),c.once("change:isOpen",()=>{const d=ni({editor:n,normalizedConfig:t,dropdownView:c,parentCommandName:e,styleGridAriaLabel:r,styleDefinitions:o});c.panelView.children.add(d)}),c.on("execute",()=>{n.editing.view.focus()}),c}}function Vt({editor:n,listStyleCommand:t,parentCommandName:e}){const i=n.locale,s=n.commands.get(e);return({label:r,type:o,icon:l,tooltip:a})=>{const c=new Z(i);return c.set({label:r,icon:l,tooltip:a}),c.bind("isOn").to(t,"value",u=>u===o),c.on("execute",()=>{s.value?t.value===o?n.execute(e):t.value!==o&&n.execute("listStyle",{type:o}):n.model.change(()=>{n.execute("listStyle",{type:o})})}),c}}function ni({editor:n,normalizedConfig:t,dropdownView:e,parentCommandName:i,styleDefinitions:s,styleGridAriaLabel:r}){const o=n.locale,l={...t,...i!="numberedList"?{startIndex:!1,reversed:!1}:null},a=i.replace("List","");let c=null;if(t.styles.listTypes.includes(a)){const d=n.commands.get("listStyle"),m=Vt({editor:n,parentCommandName:i,listStyleCommand:d}),f=t.styles.listStyleTypes;let h=s;if(f){const I=f[a];I&&(h=s.filter(O=>I.includes(O.type)))}const L=Ot(d);c=h.filter(L).map(m)}const u=new Pt(o,{styleGridAriaLabel:r,enabledProperties:l,styleButtonViews:c});if(t.styles.listTypes.includes(a)&&Zt(e,()=>u.stylesView.children.find(d=>d.isOn)),l.startIndex){const d=n.commands.get("listStart");u.startIndexFieldView.bind("isEnabled").to(d),u.startIndexFieldView.fieldView.bind("value").to(d),u.on("listStart",(m,f)=>n.execute("listStart",f))}if(l.reversed){const d=n.commands.get("listReversed");u.reversedSwitchButtonView.bind("isEnabled").to(d),u.reversedSwitchButtonView.bind("isOn").to(d,"value",m=>!!m),u.on("listReversed",()=>{const m=d.value;n.execute("listReversed",{reversed:!m})})}return u.delegate("execute").to(e),u}function bt({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,styleGridAriaLabel:s,styleDefinitions:r}){return o=>{const l=new Yt(o),a=n.commands.get(e),c=n.commands.get("listStyle"),u=Ot(c),d=Vt({editor:n,parentCommandName:e,listStyleCommand:c}),m=t.styles.listStyleTypes;let f=r;if(m){const I=a.type,O=m[I];O&&(f=r.filter(Nt=>O.includes(Nt.type)))}const h=f.filter(u).map(d),L=new Pt(o,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:h});return L.delegate("execute").to(l),l.buttonView.set({label:i,icon:e==="bulletedList"?J:Q}),l.panelView.children.add(L),l.bind("isEnabled").to(a,"isEnabled"),l.on("execute",()=>{n.editing.view.focus()}),l}}function Ot(n){return typeof n.isStyleTypeSupported=="function"?t=>n.isStyleTypeSupported(t.type):()=>!0}class Si extends g{static get requires(){return[ei,si]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}}class ri extends _{constructor(t){super(t),this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){const t=this._getSelectedItems();this.value=this._getValue(t),this.isEnabled=!!t.length}execute(t={}){this.editor.model.change(e=>{const i=this._getSelectedItems(),s=t.forceValue===void 0?!this._getValue(i):t.forceValue;for(const r of i)s?e.setAttribute("todoListChecked",!0,r):e.removeAttribute("todoListChecked",r)})}_getValue(t){return t.every(e=>e.getAttribute("todoListChecked"))}_getSelectedItems(){const t=this.editor.model,e=t.schema,i=t.document.selection.getFirstRange(),s=i.start.parent,r=[];e.checkAttribute(s,"todoListChecked")&&r.push(...w(s));for(const o of i.getItems({shallow:!0}))e.checkAttribute(o,"todoListChecked")&&!r.includes(o)&&r.push(...w(o));return r}}class oi extends pe{domEventType=["change"];onDomEvent(t){if(t.target){const e=this.view.domConverter.mapDomToView(t.target);e&&e.is("element","input")&&e.getAttribute("type")=="checkbox"&&e.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",t)}}}const li=$t("Ctrl+Enter");class ai extends g{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.model,i=t.editing,s=t.plugins.get(b),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new B(t,"todo")),t.commands.add("checkTodoList",new ri(t)),i.view.addObserver(oi),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck(l=>{const a=l.last;if(!a.getAttribute("listItemId")||a.getAttribute("listType")!="todo")return!1},"todoListChecked"),t.conversion.for("upcast").add(l=>{l.on("element:input",ui()),l.on("element:li",ci(),{priority:"low"}),l.on("element:label",j({name:"label",classes:"todo-list__label"})),l.on("element:label",j({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),l.on("element:span",j({name:"span",classes:"todo-list__label__description"})),l.on("element:ul",di({name:"ul",classes:"todo-list"}))}),t.conversion.for("downcast").elementToElement({model:o,view:(l,{writer:a})=>{if(N(l,s.getListAttributeNames()))return a.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),s.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(l,a,c){a=="todo"?l.addClass("todo-list",c):l.removeClass("todo-list",c)}}),s.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(l,a,{dataPipeline:c}){if(a.getAttribute("listType")!="todo")return null;const u=l.createUIElement("input",{type:"checkbox",...a.getAttribute("todoListChecked")?{checked:"checked"}:null,...c?{disabled:"disabled"}:{tabindex:"-1"}});if(c)return u;const d=l.createContainerElement("span",{contenteditable:"false"},u);return d.getFillerOffset=()=>null,d},canWrapElement(l){return N(l,s.getListAttributeNames())},createWrapperElement(l,a,{dataPipeline:c}){const u=["todo-list__label"];return N(a,s.getListAttributeNames())||u.push("todo-list__label_without-description"),l.createAttributeElement(c?"label":"span",{class:u.join(" ")})}}),s.on("checkElement",(l,{modelElement:a,viewElement:c})=>{const u=N(a,s.getListAttributeNames());c.hasClass("todo-list__label__description")!=u&&(l.return=!0,l.stop())}),s.on("checkElement",(l,{modelElement:a,viewElement:c})=>{const u=a.getAttribute("listType")=="todo"&&A(a);let d=!1;const m=t.editing.view.createPositionBefore(c).getWalker({direction:"backward"});for(const{item:f}of m){if(f.is("element")&&t.editing.mapper.toModelElement(f))break;f.is("element","input")&&f.getAttribute("type")=="checkbox"&&(d=!0)}d!=u&&(l.return=!0,l.stop())}),s.on("postFixer",(l,{listNodes:a,writer:c})=>{for(const{node:u,previousNodeInList:d}of a){if(!d||d.getAttribute("listItemId")!=u.getAttribute("listItemId"))continue;const m=d.hasAttribute("todoListChecked"),f=u.hasAttribute("todoListChecked");f&&!m?(c.removeAttribute("todoListChecked",u),l.return=!0):!f&&m&&(c.setAttribute("todoListChecked",!0,u),l.return=!0)}}),e.document.registerPostFixer(l=>{const a=e.document.differ.getChanges();let c=!1;for(const u of a)if(u.type=="attribute"&&u.attributeKey=="listType"){const d=u.range.start.nodeAfter;u.attributeOldValue=="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0)}else if(u.type=="insert"&&u.name!="$text")for(const{item:d}of l.createRangeOn(u.position.nodeAfter))d.is("element")&&d.getAttribute("listType")!="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0);return c}),this.listenTo(i.view.document,"keydown",(l,a)=>{zt(a)===li&&(t.execute("checkTodoList"),l.stop())},{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",(l,a)=>{const c=a.target;if(!c||!c.is("element","input"))return;const u=i.view.createPositionAfter(c),m=i.mapper.toModelPosition(u).parent;m&&p(m)&&m.getAttribute("listType")=="todo"&&this._handleCheckmarkChange(m)}),this.listenTo(i.view.document,"arrowKey",fi(e,t.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",(l,a)=>{const c=a.viewPosition.parent,u=c.is("attributeElement","li")&&a.viewPosition.offset==0,d=It(c)&&a.viewPosition.offset<=1,m=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&It(c.parent);if(!u&&!d&&!m)return;const f=a.modelPosition.nodeAfter;f&&f.getAttribute("listType")=="todo"&&(a.modelPosition=e.createPositionAt(f,0))},{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(t){const e=this.editor,i=e.model,s=Array.from(i.document.selection.getRanges());i.change(r=>{r.setSelection(t,"end"),e.execute("checkTodoList"),r.setSelection(s)})}_initAriaAnnouncements(){const{model:t,ui:e,t:i}=this.editor;let s=null;e&&t.document.selection.on("change:range",()=>{const r=t.document.selection.focus.parent,o=yt(s),l=yt(r);o&&!l?e.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!o&&l&&e.ariaLiveAnnouncer.announce(i("Entering a to-do list")),s=r})}}function ci(){return(n,t,e)=>{const{writer:i,schema:s}=e;if(!t.modelRange)return;const r=Array.from(t.modelRange.getItems({shallow:!0})).filter(o=>o.getAttribute("listType")==="todo"&&s.checkAttribute(o,"listItemId")).reduce((o,l)=>{const a=l.getAttribute("listItemId");return o.has(a)||o.set(a,w(l)),o},new Map);for(const[,o]of r.entries())if(o.some(l=>l.getAttribute("todoListChecked")))for(const l of o)i.setAttribute("todoListChecked",!0,l)}}function ui(){return(n,t,e)=>{const i=t.modelCursor,s=i.parent,r=t.viewItem;if(!e.consumable.test(r,{name:!0})||r.getAttribute("type")!="checkbox"||!i.isAtStart||!s.hasAttribute("listType"))return;e.consumable.consume(r,{name:!0});const o=e.writer;o.setAttribute("listType","todo",s),t.viewItem.hasAttribute("checked")&&o.setAttribute("todoListChecked",!0,s),t.modelRange=o.createRange(i)}}function j(n){const t=new kt(n);return(e,i,s)=>{const r=t.match(i.viewItem);r&&s.consumable.consume(i.viewItem,r.match)&&Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor))}}function di(n){const t=new kt(n);return(e,i,s)=>{const r=t.match(i.viewItem);if(!r)return;const o=r.match;o.name=!1,s.consumable.consume(i.viewItem,o)}}function N(n,t){return(n.is("element","paragraph")||n.is("element","listItem"))&&n.getAttribute("listType")=="todo"&&A(n)&&mi(n,t)}function mi(n,t){for(const e of n.getAttributeKeys())if(!e.startsWith("selection:")&&!t.includes(e))return!1;return!0}function fi(n,t){return(e,i)=>{const s=Ut(i.keyCode,t.contentLanguageDirection),r=n.schema,o=n.document.selection;if(!o.isCollapsed)return;const l=o.getFirstPosition(),a=l.parent;if(s=="right"&&l.isAtEnd){const c=r.getNearestSelectionRange(n.createPositionAfter(a),"forward");if(!c)return;const u=c.start.parent;u&&p(u)&&u.getAttribute("listType")=="todo"&&(n.change(d=>d.setSelection(c)),i.preventDefault(),i.stopPropagation(),e.stop())}else if(s=="left"&&l.isAtStart&&p(a)&&a.getAttribute("listType")=="todo"){const c=r.getNearestSelectionRange(n.createPositionBefore(a),"backward");if(!c)return;n.change(u=>u.setSelection(c)),i.preventDefault(),i.stopPropagation(),e.stop()}}}function It(n){return!!n&&n.is("attributeElement")&&n.hasClass("todo-list__label")}function yt(n){return!n||!n.is("element","paragraph")&&!n.is("element","listItem")?!1:n.getAttribute("listType")=="todo"}class pi extends g{static get pluginName(){return"TodoListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;H(this.editor,"todoList",t("To-do List"),fe)}}class _i extends g{static get requires(){return[ai,pi]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}}export{ri as CheckTodoListCommand,Ti as List,B as ListCommand,b as ListEditing,Se as ListFormatting,ot as ListIndentCommand,ke as ListItemBoldIntegration,we as ListItemFontColorIntegration,Te as ListItemFontFamilyIntegration,Le as ListItemFontSizeIntegration,Ae as ListItemItalicIntegration,at as ListMergeCommand,Si as ListProperties,ei as ListPropertiesEditing,si as ListPropertiesUI,Xe as ListPropertiesUtils,Qe as ListReversedCommand,ct as ListSplitCommand,Ge as ListStartCommand,Je as ListStyleCommand,Ye as ListUI,Be as ListUtils,_i as TodoList,ai as TodoListEditing,pi as TodoListUI,ge as _ListBlocksIterable,Pt as _ListPropertiesView,y as _ListWalker,P as _SiblingListBlocksIterator,oi as _TodoCheckboxChangeObserver,U as _canBecomeSimpleListItem,Pe as _createListElement,Ve as _createListItemElement,H as _createListUIComponents,$e as _createModelToViewListPositionMapper,V as _expandListBlocksToCompleteItems,z as _expandListBlocksToCompleteList,k as _findAndAddListHeadToMap,ze as _findMappedListItemViewElement,Oe as _fixListIndents,Ne as _fixListItemIds,w as _getAllListItemBlocks,Bt as _getAllSupportedListStyleTypes,Fe as _getListIndent,S as _getListItemBlocks,At as _getListItems,Et as _getListStyleTypeFromTypeAttribute,tt as _getListTypeFromListStyleType,he as _getNestedListBlocks,Ft as _getNormalizedListConfig,F as _getSelectedBlockObject,Y as _getTypeAttributeFromListStyleType,wt as _getViewElementIdForListType,Lt as _getViewElementNameForListType,q as _indentListBlocks,A as _isFirstBlockOfListItem,rt as _isLastBlockOfListItem,p as _isListItemBlock,K as _isListItemView,Ee as _isListView,M as _isNumberedListType,E as _isSingleListItem,mt as _listItemBogusParagraphCreator,dt as _listItemDowncastConverter,De as _listItemDowncastRemoveConverter,Re as _listItemUpcastConverter,gt as _listPropertiesUpcastConverter,W as _mergeListItemBefore,Ze as _normalizeListStyle,Ie as _outdentFollowingListItems,be as _outdentListBlocksWithMerge,Me as _reconvertListItemsOnDataChange,$ as _removeListAttributes,v as _sortListBlocks,X as _splitListItemBefore};
1
+ import{Plugin as g,Command as _}from"../../../../../@ckeditor_ckeditor5-core@46.1.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Delete as Rt}from"../../../../../@ckeditor_ckeditor5-typing@46.1.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Enter as Mt}from"../../../../../@ckeditor_ckeditor5-enter@46.1.1/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{CKEditorError as Dt,getCode as zt,toArray as T,first as D,parseKeystroke as $t,getLocalizedArrowKeyCodeDirection as Ut,env as G,uid as jt,FocusTracker as et,KeystrokeHandler as it,global as Wt}from"../../../../../@ckeditor_ckeditor5-utils@46.1.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{_normalizeFontSizeOptions as st}from"../../../../../@ckeditor_ckeditor5-font@46.1.1/node_modules/@ckeditor/ckeditor5-font/dist/index.js";import{ClipboardPipeline as qt}from"../../../../../@ckeditor_ckeditor5-clipboard@46.1.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{createDropdown as Kt,SplitButtonView as Ht,MenuBarMenuView as Yt,ButtonView as Z,MenuBarMenuListItemButtonView as Gt,focusChildOnDropdownOpen as Zt,View as nt,ViewCollection as Jt,FocusCycler as Qt,addKeyboardHandlingForGrid as Xt,CollapsibleView as te,LabeledFieldView as ee,createLabeledInputNumber as ie,SwitchButtonView as se}from"../../../../../@ckeditor_ckeditor5-ui@46.1.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconListStyleDisc as ne,IconListStyleCircle as re,IconListStyleSquare as oe,IconListStyleDecimal as le,IconListStyleDecimalLeadingZero as ae,IconListStyleLowerRoman as ce,IconListStyleUpperRoman as ue,IconListStyleLowerLatin as de,IconListStyleUpperLatin as me,IconBulletedList as J,IconNumberedList as Q,IconTodoList as fe}from"../../../../../@ckeditor_ckeditor5-icons@46.1.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{DomEventObserver as pe,Matcher as kt}from"../../../../../@ckeditor_ckeditor5-engine@46.1.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";class y{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward=e.direction=="forward",this._includeSelf=!!e.includeSelf,this._sameAttributes=T(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){const s=new this(t,e)[Symbol.iterator]();return D(s)}*[Symbol.iterator](){const t=[];for(const{node:e}of new P(this._getStartNode(),this._isForward?"forward":"backward")){const i=e.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some(s=>e.getAttribute(s)!==this._startElement.getAttribute(s)))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}class P{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(t,e="forward"){this._node=t,this._isForward=e==="forward"}[Symbol.iterator](){return this}next(){if(!p(this._node))return{done:!0,value:void 0};const t=this._node.getAttribute("listIndent");let e=null;if(this._previous){const s=this._previousNodeIndent;t>s?this._previousNodesByIndent[s]=this._previous:t<s?(e=this._previousNodesByIndent[t]||null,this._previousNodesByIndent.length=t):e=this._previous}const i={node:this._node,previous:this._previous,previousNodeInList:e};return this._previous=this._node,this._previousNodeIndent=t,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:i,done:!1}}}class ge{_listHead;constructor(t){this._listHead=t}[Symbol.iterator](){return new P(this._listHead)}}class C{static next(){return jt()}}function p(n){return!!n&&n.is("element")&&n.hasAttribute("listItemId")}function w(n,t={}){return[...S(n,{...t,direction:"backward"}),...S(n,{...t,direction:"forward"})]}function S(n,t={}){const e=t.direction=="forward",i=Array.from(new y(n,{...t,includeSelf:e,sameIndent:!0,sameAttributes:"listItemId"}));return e?i:i.reverse()}function he(n){return Array.from(new y(n,{direction:"forward",higherIndent:!0}))}function At(n,t){const e=new y(n,{sameIndent:!0,sameAttributes:"listType",...t}),i=new y(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(e).reverse(),...i]}function A(n){return!y.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function rt(n){return!y.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function V(n,t={}){n=T(n);const e=t.withNested!==!1,i=new Set;for(const s of n)for(const r of w(s,{higherIndent:e}))i.add(r);return v(i)}function z(n){n=T(n);const t=new Set;for(const e of n)for(const i of At(e))t.add(i);return v(t)}function X(n,t){const e=S(n,{direction:"forward"}),i=C.next();for(const s of e)t.setAttribute("listItemId",i,s);return e}function W(n,t,e){const i={};for(const[r,o]of t.getAttributes())r.startsWith("list")&&(i[r]=o);const s=S(n,{direction:"forward"});for(const r of s)e.setAttributes(i,r);return s}function q(n,t,{expand:e,indentBy:i=1}={}){n=T(n);const s=e?V(n):n;for(const r of s){const o=r.getAttribute("listIndent")+i;o<0?$(r,t):t.setAttribute("listIndent",o,r)}return s}function be(n,t){n=T(n);const e=V(n),i=new Set,s=Math.min(...e.map(o=>o.getAttribute("listIndent"))),r=new Map;for(const o of e)r.set(o,y.first(o,{lowerIndent:!0}));for(const o of e){if(i.has(o))continue;i.add(o);const l=o.getAttribute("listIndent")-1;if(l<0){$(o,t);continue}if(o.getAttribute("listIndent")==s){const a=ye(o,r.get(o),t);for(const c of a)i.add(c);if(a.length)continue}t.setAttribute("listIndent",l,o)}return v(i)}function $(n,t){n=T(n);for(const e of n)e.is("element","listItem")&&t.rename(e,"paragraph");for(const e of n)for(const i of e.getAttributeKeys())i.startsWith("list")&&t.removeAttribute(i,e);return n}function E(n){if(!n.length)return!1;const t=n[0].getAttribute("listItemId");return t?!n.some(e=>e.getAttribute("listItemId")!=t):!1}function Ie(n,t){const e=[];let i=Number.POSITIVE_INFINITY;for(const{node:s}of new P(n.nextSibling)){const r=s.getAttribute("listIndent");if(r==0)break;r<i&&(i=r);const o=r-i;t.setAttribute("listIndent",o,s),e.push(s)}return e}function v(n){return Array.from(n).filter(t=>t.root.rootName!=="$graveyard").sort((t,e)=>t.index-e.index)}function F(n){const t=n.document.selection.getSelectedElement();return t&&n.schema.isObject(t)&&n.schema.isBlock(t)?t:null}function U(n,t){return t.checkChild(n.parent,"listItem")&&t.checkChild(n,"$text")&&!t.isObject(n)}function M(n){return n=="numbered"||n=="customNumbered"}function ye(n,t,e){return S(t,{direction:"forward"}).pop().index>n.index?W(n,t,e):[]}class ot extends _{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=lt(t.document.selection);t.change(i=>{const s=[];E(e)&&!A(e[0])?(this._direction=="forward"&&s.push(...q(e,i)),s.push(...X(e[0],i))):this._direction=="forward"?s.push(...q(e,i,{expand:!0})):s.push(...be(e,i));for(const r of s){if(!r.hasAttribute("listType"))continue;const o=y.first(r,{sameIndent:!0});o&&i.setAttribute("listType",o.getAttribute("listType"),r)}this._fireAfterExecute(s)})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_checkEnabled(){let t=lt(this.editor.model.document.selection),e=t[0];if(!e)return!1;if(this._direction=="backward"||E(t)&&!A(t[0]))return!0;t=V(t),e=t[0];const i=y.first(e,{sameIndent:!0});return i?i.getAttribute("listType")==e.getAttribute("listType"):!1}}function lt(n){const t=Array.from(n.getSelectedBlocks()),e=t.findIndex(i=>!p(i));return e!=-1&&(t.length=e),t}class B extends _{type;_listWalkerOptions;constructor(t,e,i={}){super(t),this.type=e,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,i=e.document,s=F(e),r=Array.from(i.selection.getSelectedBlocks()).filter(l=>e.schema.checkAttribute(l,"listType")||U(l,e.schema)),o=t.forceValue!==void 0?!t.forceValue:this.value;e.change(l=>{if(o){const a=r[r.length-1],c=S(a,{direction:"forward"}),u=[];c.length>1&&u.push(...X(c[1],l)),u.push(...$(r,l)),u.push(...Ie(a,l)),this._fireAfterExecute(u)}else if((s||i.selection.isCollapsed)&&p(r[0])){const a=At(s||r[0],this._listWalkerOptions);for(const c of a)l.setAttributes({...t.additionalAttributes,listType:this.type},c);this._fireAfterExecute(a)}else{const a=[];for(const c of r)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&U(c,e.schema)&&l.rename(c,"listItem"),l.setAttributes({...t.additionalAttributes,listIndent:0,listItemId:C.next(),listType:this.type},c),a.push(c);else for(const u of V(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(l.setAttributes({...t.additionalAttributes,listType:this.type},u),a.push(u));this._fireAfterExecute(a)}})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_getValue(){const t=this.editor.model.document.selection,e=Array.from(t.getSelectedBlocks());if(!e.length)return!1;for(const i of e)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const t=this.editor.model,e=t.schema,i=t.document.selection,s=Array.from(i.getSelectedBlocks());if(!s.length)return!1;if(this.value)return!0;for(const r of s)if(e.checkAttribute(r,"listType")||U(r,e))return!0;return!1}}class at extends _{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:t=!1}={}){const e=this.editor.model,i=e.document.selection,s=[];e.change(r=>{const{firstElement:o,lastElement:l}=this._getMergeSubjectElements(i,t),a=o.getAttribute("listIndent")||0,c=l.getAttribute("listIndent"),u=l.getAttribute("listItemId");if(a!=c){const d=he(l);s.push(...q([l,...d],r,{indentBy:a-c,expand:a<c}))}if(t){let d=i;i.isCollapsed&&(d=r.createSelection(r.createRange(r.createPositionAt(o,"end"),r.createPositionAt(l,0)))),e.deleteContent(d,{doNotResetEntireContent:i.isCollapsed});const m=d.getLastPosition().parent,f=m.nextSibling;s.push(m),f&&f!==l&&f.getAttribute("listItemId")==u&&s.push(...W(f,m,r))}else s.push(...W(l,o,r));this._fireAfterExecute(s)})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_checkEnabled(){const t=this.editor.model,e=t.document.selection,i=F(t);if(e.isCollapsed||i){const s=i||e.getFirstPosition().parent;if(!p(s))return!1;const r=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!r||E([s,r]))return!1}else{const s=e.getLastPosition(),r=e.getFirstPosition();if(s.parent===r.parent||!p(s.parent))return!1}return!0}_getMergeSubjectElements(t,e){const i=this.editor.model,s=F(i);let r,o;if(t.isCollapsed||s){const l=s||t.getFirstPosition().parent,a=A(l);this._direction=="backward"?(o=l,a&&!e?r=y.first(l,{sameIndent:!0,lowerIndent:!0}):r=l.previousSibling):(r=l,o=l.nextSibling)}else r=t.getFirstPosition().parent,o=t.getLastPosition().parent;return{firstElement:r,lastElement:o}}}class ct extends _{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(e=>{const i=X(this._getStartBlock(),e);this._fireAfterExecute(i)})}_fireAfterExecute(t){this.fire("afterExecute",v(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&p(e)&&!A(e)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?e:e.nextSibling}}class ke extends g{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("bold","listItemBold"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(s,r,o,l){r&&(s.addClass("ck-list-marker-bold",o),G.isSafari&&!(l&&l.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-bold","0",o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemBold"}),e.schema.setAttributeProperties("listItemBold",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemBold"),t.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}))}}class Ae extends g{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("italic","listItemItalic"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(s,r,o,l){r&&(s.addClass("ck-list-marker-italic",o),G.isSafari&&!(l&&l.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-italic","0",o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),e.schema.setAttributeProperties("listItemItalic",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemItalic"),t.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}))}}class Le extends g{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);if(!t.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;const s=st(t.config.get("fontSize.options"));e.registerFormatAttribute("fontSize","listItemFontSize"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(r,o,l,a){if(o){const c=s.find(u=>u.model==o);c&&c.view&&typeof c.view!="string"?c.view.styles?(r.addClass("ck-list-marker-font-size",l),r.setStyle("--ck-content-list-marker-font-size",c.view.styles["font-size"],l)):c.view.classes&&(r.addClass(`ck-list-marker-font-size-${o}`,l),G.isSafari&&!(a&&a.dataPipeline)&&r.setStyle("--ck-content-list-marker-dummy-font-size","0",l)):(r.addClass("ck-list-marker-font-size",l),r.setStyle("--ck-content-list-marker-font-size",o,l))}}})}afterInit(){const t=this.editor,e=t.model;if(!t.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;e.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),e.schema.setAttributeProperties("listItemFontSize",{isFormatting:!0}),e.schema.addAttributeCheck(s=>{if(!s.last.getAttribute("listItemId"))return!1},"listItemFontSize"),t.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s=>s.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});const i=st(t.config.get("fontSize.options"));for(const s of i)s.model&&s.view&&t.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s.model},view:{name:"li",classes:`ck-list-marker-font-size-${s.model}`}})}}class we extends g{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontColor","listItemFontColor"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-color",o),s.setStyle("--ck-content-list-marker-color",r,o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),e.schema.setAttributeProperties("listItemFontColor",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontColor"),t.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:i=>i.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}))}}class Te extends g{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.plugins.get("ListFormatting"),i=t.plugins.get(b);!t.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontFamily","listItemFontFamily"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-font-family",o),s.setStyle("--ck-content-list-marker-font-family",r,o))}}))}afterInit(){const t=this.editor,e=t.model;!t.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),e.schema.setAttributeProperties("listItemFontFamily",{isFormatting:!0}),e.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontFamily"),t.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:i=>i.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}))}}class Se extends g{_loadedFormatting={};static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[ke,Ae,Le,we,Te]}constructor(t){super(t),t.config.define("list.enableListItemMarkerFormatting",!0)}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){const t=this.editor.model;t.document.registerPostFixer(e=>{const i=t.document.differ.getChanges(),s=new Set;let r=!1;for(const o of i)if(o.type==="attribute")(o.attributeKey=="listItemId"||o.attributeKey=="listType"||this._isInlineOrSelectionFormatting(o.attributeKey)||Object.values(this._loadedFormatting).includes(o.attributeKey))&&(p(o.range.start.nodeAfter)?s.add(o.range.start.nodeAfter):p(o.range.start.parent)&&s.add(o.range.start.parent));else if(p(o.position.nodeAfter)&&s.add(o.position.nodeAfter),p(o.position.nodeBefore)&&s.add(o.position.nodeBefore),p(o.position.parent)&&s.add(o.position.parent),o.type=="insert"&&o.name!="$text"){const l=e.createRangeIn(o.position.nodeAfter);for(const a of l.getItems())p(a)&&s.add(a)}for(const o of s){const l=_e(t,o,Object.keys(this._loadedFormatting));for(const[a,c]of Object.entries(l)){const u=this._loadedFormatting[a];(c&&ve(e,o,u,c)||!c&&Ce(e,o,u))&&(r=!0)}}return r})}registerFormatAttribute(t,e){this._loadedFormatting[t]=e}_isInlineOrSelectionFormatting(t){return t.replace(/^selection:/,"")in this._loadedFormatting}}function _e(n,t,e){if(A(t))return ut(n,t,e);const i=w(t);return ut(n,i[0],e)}function ut(n,t,e){if(!xe(t)||n.schema.isLimit(t))return Object.fromEntries(e.map(l=>[l]));if(t.isEmpty)return Object.fromEntries(e.map(l=>[l,t.getAttribute(`selection:${l}`)]));const i=new Set(e),s={},o=n.createRangeIn(t).getWalker({ignoreElementEnd:!0});for(const{item:l}of o){for(const a of i)if(n.schema.checkAttribute(l,a)){const c=l.getAttribute(a);c===void 0?(i.delete(a),s[a]=void 0):s[a]===void 0?s[a]=c:s[a]!==c&&(i.delete(a),s[a]=void 0)}else a in s||(s[a]=void 0);if(!i.size)break;n.schema.isLimit(l)&&o.jumpTo(n.createPositionAfter(l))}return s}function ve(n,t,e,i){const s=w(t);let r=!1;for(const o of s)(!o.hasAttribute(e)||o.getAttribute(e)!==i)&&(n.setAttribute(e,i,o),r=!0);return r}function Ce(n,t,e){const i=w(t);let s=!1;for(const r of i)r.hasAttribute(e)&&(n.removeAttribute(e,r),s=!0);return s}function xe(n){return["numbered","bulleted","customNumbered","customBulleted"].includes(n.getAttribute("listType"))}class Be extends g{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(t){return z(t)}isFirstBlockOfListItem(t){return A(t)}isListItemBlock(t){return p(t)}expandListBlocksToCompleteItems(t,e={}){return V(t,e)}isNumberedListType(t){return M(t)}}function Ee(n){return n.is("element","ol")||n.is("element","ul")}function K(n){return n.is("element","li")}function Fe(n){let t=0,e=n.parent;for(;e;){if(K(e))t++;else{const i=e.previousSibling;i&&K(i)&&t++}e=e.parent}return t}function Pe(n,t,e,i=wt(e,t)){return n.createAttributeElement(Lt(e),null,{priority:2*t/100-100,id:i})}function Ve(n,t,e){return n.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:e})}function Lt(n){return n=="numbered"||n=="customNumbered"?"ol":"ul"}function wt(n,t){return`list-${n}-${t}`}function k(n,t,e){const i=n.nodeBefore;if(p(i)){let s=i;for(const{node:r}of new P(s,"backward"))if(s=r,e.has(s)||(e.add(s),t.has(i)))return;t.add(s)}else{const s=n.nodeAfter;p(s)&&t.add(s)}}function Oe(n,t){let e=0,i=-1,s=null,r=!1;for(const{node:o}of n){const l=o.getAttribute("listIndent");if(l>e){let a;s===null?(s=l-e,a=e):(s>l&&(s=l),a=l-s),a>i+1&&(a=i+1),t.setAttribute("listIndent",a,o),r=!0,i=a}else s=null,e=l+1,i=l}return r}function Ne(n,t,e){const i=new Set;let s=!1;for(const{node:r}of n){if(i.has(r))continue;let o=r.getAttribute("listType"),l=r.getAttribute("listItemId");if(t.has(l)&&(l=C.next()),t.add(l),r.is("element","listItem")){r.getAttribute("listItemId")!=l&&(e.setAttribute("listItemId",l,r),s=!0);continue}for(const a of S(r,{direction:"forward"}))i.add(a),a.getAttribute("listType")!=o&&(l=C.next(),o=a.getAttribute("listType")),a.getAttribute("listItemId")!=l&&(e.setAttribute("listItemId",l,a),s=!0)}return s}function Re(){return(n,t,e)=>{const{writer:i,schema:s}=e;if(!t.modelRange)return;const r=Array.from(t.modelRange.getItems({shallow:!0})).filter(d=>s.checkAttribute(d,"listItemId"));if(!r.length)return;const o=t.viewItem.getAttribute("data-list-item-id")||C.next();e.consumable.consume(t.viewItem,{attributes:"data-list-item-id"});const l=Fe(t.viewItem);let a=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=r[0].getAttribute("listType");c&&(a=c);const u={listItemId:o,listIndent:l,listType:a};for(const d of r)d.hasAttribute("listItemId")||i.setAttributes(u,d);r.length>1&&r[1].getAttribute("listItemId")!=u.listItemId&&e.keepEmptyElement(r[0])}}function Me(n,t,e,i){return()=>{const l=n.document.differ.getChanges(),a=[],c=new Set,u=new Set,d=new Set;for(const m of l)if(m.type=="insert"&&m.name!="$text")k(m.position,c,d),m.attributes.has("listItemId")?u.add(m.position.nodeAfter):k(m.position.getShiftedBy(m.length),c,d);else if(m.type=="remove"&&m.attributes.has("listItemId"))k(m.position,c,d);else if(m.type=="attribute"){const f=m.range.start.nodeAfter;e.includes(m.attributeKey)?(k(m.range.start,c,d),m.attributeNewValue===null?(k(m.range.start.getShiftedBy(1),c,d),r(f)&&a.push(f)):u.add(f)):p(f)&&r(f)&&a.push(f)}for(const m of c.values())a.push(...s(m,u));for(const m of new Set(a))t.reconvertItem(m)};function s(l,a){const c=[],u=new Set,d=[];for(const{node:m,previous:f}of new P(l)){if(u.has(m))continue;const h=m.getAttribute("listIndent");f&&h<f.getAttribute("listIndent")&&(d.length=h+1),d[h]={modelAttributes:Object.fromEntries(Array.from(m.getAttributes()).filter(([I])=>e.includes(I))),modelElement:m};const L=S(m,{direction:"forward"});for(const I of L)u.add(I),(r(I,L)||o(I,d,a))&&c.push(I)}return c}function r(l,a){const c=t.mapper.toViewElement(l);if(!c)return!1;if(i.fire("checkElement",{modelElement:l,viewElement:c}))return!0;if(!l.is("element","paragraph")&&!l.is("element","listItem"))return!1;const d=St(l,e,a);return d&&c.is("element","p")?!0:!!(!d&&c.is("element","span"))}function o(l,a,c){if(c.has(l))return!1;const u=t.mapper.toViewElement(l);let d=a.length-1;for(let m=u.parent;!m.is("editableElement");m=m.parent){const f=K(m),h=Ee(m);if(!h&&!f)continue;const L=`checkAttributes:${f?"item":"list"}`;if(i.fire(L,{viewElement:m,modelAttributes:a[d].modelAttributes,modelReferenceElement:a[d].modelElement}))break;if(h&&(d--,d<0))return!1}return!0}}function dt(n,t,e,{dataPipeline:i}={}){const s=qe(n);return(r,o,l)=>{const{writer:a,mapper:c,consumable:u}=l,d=o.item;if(!n.includes(o.attributeKey)||!s(d,u))return;const m={...l.options,dataPipeline:i},f=ze(d,c,e);Tt(f,a,c),je(f,a);const h=Ue(d,f,t,a,m);We(d,h,t,a,m)}}function De(n){return(t,e,i)=>{const{writer:s,mapper:r}=i,o=t.name.split(":")[1];if(!n.checkAttribute(o,"listItemId"))return;const l=r.toViewPosition(e.position),a=e.position.getShiftedBy(e.length),c=r.toViewPosition(a,{isPhantom:!0}),d=s.createRange(l,c).getTrimmed().end.nodeBefore;d&&Tt(d,s,r)}}function mt(n,{dataPipeline:t}={}){return(e,{writer:i})=>{if(!St(e,n))return null;if(!t)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function ze(n,t,e){const i=e.createRangeOn(n);return t.toViewRange(i).getTrimmed().end.nodeBefore}function $e(n,t){return(e,i)=>{if(i.modelPosition.offset>0)return;const s=i.modelPosition.parent;if(!p(s)||!n.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(s)))return;const r=i.mapper.toViewElement(s),o=t.createRangeIn(r),l=o.getWalker();let a=o.start;for(const{item:c}of l){if(c.is("element")&&i.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(a=t.createPositionAfter(c),l.skip(({previousPosition:u})=>!u.isEqual(a)))}i.viewPosition=a}}function Tt(n,t,e){for(;n.parent.is("attributeElement")&&n.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(n),n.parent);const i=[];s(t.createPositionBefore(n).getWalker({direction:"backward"})),s(t.createRangeIn(n).getWalker());for(const r of i)t.remove(r);function s(r){for(const{item:o}of r){if(o.is("element")&&e.toModelElement(o))break;o.is("element")&&o.getCustomProperty("listItemMarker")&&i.push(o)}}}function Ue(n,t,e,i,{dataPipeline:s}){let r=i.createRangeOn(t);if(!A(n))return r;for(const o of e){if(o.scope!="itemMarker")continue;const l=o.createElement(i,n,{dataPipeline:s});if(!l||(i.setCustomProperty("listItemMarker",!0,l),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(n)?i.insert(i.createPositionAt(t,0),l):(i.insert(r.start,l),r=i.createRange(i.createPositionBefore(l),i.createPositionAfter(t))),!o.createWrapperElement||!o.canWrapElement))continue;const a=o.createWrapperElement(i,n,{dataPipeline:s});i.setCustomProperty("listItemWrapper",!0,a),o.canWrapElement(n)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(l),a),r=i.createRange(r.start,i.createPositionAfter(t)))}return r}function je(n,t){let e=n.parent;for(;e.is("attributeElement")&&["ul","ol","li"].includes(e.name);){const i=e.parent;t.unwrap(t.createRangeOn(n),e),e=i}}function We(n,t,e,i,s){if(!n.hasAttribute("listIndent"))return;const r=n.getAttribute("listIndent");let o=n;for(let l=r;l>=0;l--){const a=Ve(i,l,o.getAttribute("listItemId")),c=Pe(i,l,o.getAttribute("listType"));for(const u of e)(u.scope=="list"||u.scope=="item")&&o.hasAttribute(u.attributeName)&&u.setAttributeOnDowncast(i,o.getAttribute(u.attributeName),u.scope=="list"?c:a,s);if(t=i.wrap(t,a),t=i.wrap(t,c),l==0||(o=y.first(o,{lowerIndent:!0}),!o))break}}function qe(n){return(t,e)=>{const i=[];for(const s of n)t.hasAttribute(s)&&i.push(`attribute:${s}`);return i.every(s=>e.test(t,s)!==!1)?(i.forEach(s=>e.consume(t,s)),!0):!1}}function St(n,t,e=w(n)){if(!p(n))return!1;for(const i of n.getAttributeKeys())if(!(i.startsWith("selection:")||i=="htmlEmptyBlock")&&!t.includes(i))return!1;return e.length<2}const R=["listType","listIndent","listItemId"];class b extends g{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Mt,Rt,Be,qt,Se]}constructor(t){super(t),t.config.define("list.multiBlock",!0)}init(){const t=this.editor,e=t.model,i=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new Dt("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:R}),i?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const s of R)e.schema.setAttributeProperties(s,{copyOnReplace:!0});t.commands.add("numberedList",new B(t,"numbered")),t.commands.add("bulletedList",new B(t,"bulleted")),t.commands.add("customNumberedList",new B(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new B(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new ot(t,"forward")),t.commands.add("outdentList",new ot(t,"backward")),t.commands.add("splitListItemBefore",new ct(t,"before")),t.commands.add("splitListItemAfter",new ct(t,"after")),i&&(t.commands.add("mergeListItemBackward",new at(t,"backward")),t.commands.add("mergeListItemForward",new at(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){const e=this.editor.commands,i=e.get("indent"),s=e.get("outdent");i&&i.registerChildCommand(e.get("indentList"),{priority:"high"}),s&&s.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...R,...this._downcastStrategies.map(t=>t.attributeName)]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),i=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",(s,r)=>{const o=t.model.document.selection;F(t.model)||t.model.change(()=>{const l=o.getFirstPosition();if(o.isCollapsed&&r.direction=="backward"){if(!l.isAtStart)return;const a=l.parent;if(!p(a))return;if(!y.first(a,{sameAttributes:"listType",sameIndent:!0})&&a.getAttribute("listIndent")===0)rt(a)||t.execute("splitListItemAfter"),t.execute("outdentList");else{if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:ft(t.model,"backward")})}r.preventDefault(),s.stop()}else{if(o.isCollapsed&&!o.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:ft(t.model,"forward")}),r.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,i=t.commands,s=i.get("enter");this.listenTo(t.editing.view.document,"enter",(r,o)=>{const l=e.document,a=l.selection.getFirstPosition().parent;if(l.selection.isCollapsed&&p(a)&&a.isEmpty&&!o.isSoft){const c=A(a),u=rt(a);c&&u?(t.execute("outdentList"),o.preventDefault(),r.stop()):c&&!u?(t.execute("splitListItemAfter"),o.preventDefault(),r.stop()):u&&(t.execute("splitListItemBefore"),o.preventDefault(),r.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{const r=i.get("splitListItemBefore");if(r.refresh(),!r.isEnabled)return;const l=t.model.document.selection.getLastPosition().parent;w(l).length===2&&r.execute()})}_setupTabIntegration(){const t=this.editor;this.listenTo(t.editing.view.document,"tab",(e,i)=>{const s=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(t.execute(s),i.stopPropagation(),i.preventDefault(),e.stop())},{context:"li"})}_setupConversion(){const t=this.editor,e=t.model,i=this.getListAttributeNames(),s=t.config.get("list.multiBlock"),r=s?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(l,{writer:a})=>a.createElement(r,{listType:""})}).elementToElement({view:"p",model:(l,{writer:a})=>l.parent&&l.parent.is("element","li")?a.createElement(r,{listType:""}):null,converterPriority:"high"}).add(l=>{l.on("element:li",Re())}),s||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:r,view:mt(i),converterPriority:"high"}).add(l=>{l.on("attribute",dt(i,this._downcastStrategies,e)),l.on("remove",De(e.schema))}),t.conversion.for("dataDowncast").elementToElement({model:r,view:mt(i,{dataPipeline:!0}),converterPriority:"high"}).add(l=>{l.on("attribute",dt(i,this._downcastStrategies,e,{dataPipeline:!0}))});const o=$e(this._downcastStrategies,t.editing.view);t.editing.mapper.on("modelToViewPosition",o),t.data.mapper.on("modelToViewPosition",o),this.listenTo(e.document,"change:data",Me(e,t.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(l,{viewElement:a,modelAttributes:c})=>{a.id!=c.listItemId&&(l.return=!0,l.stop())}),this.on("checkAttributes:list",(l,{viewElement:a,modelAttributes:c})=>{(a.name!=Lt(c.listType)||a.id!=wt(c.listType,c.listIndent))&&(l.return=!0,l.stop())})}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer(i=>Ke(t,i,e,this)),this.on("postFixer",(i,{listNodes:s,writer:r})=>{i.return=Oe(s,r)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:r,seenIds:o})=>{i.return=Ne(s,o,r)||i.return},{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",He(t),{priority:"high"}),this.listenTo(e,"outputTransformation",(i,s)=>{t.change(r=>{const o=Array.from(s.content.getChildren()),l=o[o.length-1];if(o.length>1&&l.is("element")&&l.isEmpty&&o.slice(0,-1).every(p)&&r.remove(l),s.method=="copy"||s.method=="cut"){const a=Array.from(s.content.getChildren());E(a)&&$(a,r)}})})}_setupAccessibilityIntegration(){const t=this.editor,e=t.t;t.accessibility.addKeystrokeInfoGroup({id:"list",label:e("Keystrokes that can be used in a list"),keystrokes:[{label:e("Increase list item indent"),keystroke:"Tab"},{label:e("Decrease list item indent"),keystroke:"Shift+Tab"}]})}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(t,e,i,s){s&&(s.skipListItemIds||s.isClipboardPipeline)||t.setAttribute("data-list-item-id",e,i)}})}}function Ke(n,t,e,i){const s=n.document.differ.getChanges(),r=new Set,o=new Set,l=i.editor.config.get("list.multiBlock");let a=!1;for(const u of s){if(u.type=="insert"&&u.name!="$text"){const d=u.position.nodeAfter;if(!n.schema.checkAttribute(d,"listItemId"))for(const m of Array.from(d.getAttributeKeys()))e.includes(m)&&(t.removeAttribute(m,d),a=!0);k(u.position,o,r),u.attributes.has("listItemId")||k(u.position.getShiftedBy(u.length),o,r);for(const{item:m,previousPosition:f}of n.createRangeIn(d))p(m)&&k(f,o,r)}else u.type=="remove"?k(u.position,o,r):u.type=="attribute"&&e.includes(u.attributeKey)&&(k(u.range.start,o,r),u.attributeNewValue===null&&k(u.range.start.getShiftedBy(1),o,r));if(!l&&u.type=="attribute"&&R.includes(u.attributeKey)){const d=u.range.start.nodeAfter;u.attributeNewValue===null&&d&&d.is("element","listItem")?(t.rename(d,"paragraph"),a=!0):u.attributeOldValue===null&&d&&d.is("element")&&d.name!="listItem"&&(t.rename(d,"listItem"),a=!0)}}const c=new Set;for(const u of o.values())a=i.fire("postFixer",{listNodes:new ge(u),listHead:u,writer:t,seenIds:c})||a;return a}function He(n){return(t,[e,i])=>{const s=e.is("documentFragment")?Array.from(e.getChildren()):[e];if(!s.length)return;const o=(i?n.createSelection(i):n.document.selection).getFirstPosition();let l;if(p(o.parent))l=o.parent;else if(p(o.nodeBefore)&&p(o.nodeAfter))l=o.nodeBefore;else return;n.change(a=>{const c=l.getAttribute("listType"),u=l.getAttribute("listIndent"),d=s[0].getAttribute("listIndent")||0,m=Math.max(u-d,0);for(const f of s){const h=p(f);l.is("element","listItem")&&f.is("element","paragraph")&&a.rename(f,"listItem"),a.setAttributes({listIndent:(h?f.getAttribute("listIndent"):0)+m,listItemId:h?f.getAttribute("listItemId"):C.next(),listType:c},f)}})}}function ft(n,t){const e=n.document.selection;if(!e.isCollapsed)return!F(n);if(t==="forward")return!0;const s=e.getFirstPosition().parent,r=s.previousSibling;return n.schema.isObject(r)?!1:r.isEmpty?!0:E([s,r])}function H(n,t,e,i){n.ui.componentFactory.add(t,()=>{const s=pt(Z,n,t,e,i);return s.set({tooltip:!0,isToggleable:!0}),s}),n.ui.componentFactory.add(`menuBar:${t}`,()=>{const s=pt(Gt,n,t,e,i);return s.set({role:"menuitemcheckbox",isToggleable:!0}),s})}function pt(n,t,e,i,s){const r=t.commands.get(e),o=new n(t.locale);return o.set({label:i,icon:s}),o.bind("isOn","isEnabled").to(r,"value","isEnabled"),o.on("execute",()=>{t.execute(e),t.editing.view.focus()}),o}class Ye extends g{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||H(this.editor,"numberedList",t("Numbered List"),Q),this.editor.ui.componentFactory.has("bulletedList")||H(this.editor,"bulletedList",t("Bulleted List"),J)}}class Ti extends g{static get requires(){return[b,Ye]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}class Ge extends _{refresh(){const t=this._getValue();this.value=t,this.isEnabled=t!=null}execute({startIndex:t=1}={}){const e=this.editor.model,i=e.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(r=>p(r)&&M(r.getAttribute("listType")));s=z(s),e.change(r=>{for(const o of s)r.setAttribute("listStart",t>=0?t:1,o)})}_getValue(){const e=this.editor.model.document,i=D(e.selection.getSelectedBlocks());return i&&p(i)&&M(i.getAttribute("listType"))?i.getAttribute("listStart"):null}}const _t={},vt={},Ct={},xt=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:n,typeAttribute:t,listType:e}of xt)_t[n]=e,vt[n]=t,t&&(Ct[t]=n);function Bt(){return xt.map(n=>n.listStyle)}function tt(n){return _t[n]||null}function Et(n){return Ct[n]||null}function Y(n){return vt[n]||null}function Ze(n){switch(n){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return n}}class Je extends _{defaultType;_supportedTypes;constructor(t,e,i){super(t),this.defaultType=e,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,i=e.document;e.change(s=>{this._tryToConvertItemsToList(t);let r=Array.from(i.selection.getSelectedBlocks()).filter(o=>o.hasAttribute("listType"));if(r.length){r=z(r);for(const o of r)s.setAttribute("listStyle",t.type||this.defaultType,o)}})}isStyleTypeSupported(t){return this._supportedTypes?this._supportedTypes.includes(t):!0}_getValue(){const t=D(this.editor.model.document.selection.getSelectedBlocks());return p(t)?t.getAttribute("listStyle"):null}_checkEnabled(){const t=this.editor,e=t.commands.get("numberedList"),i=t.commands.get("bulletedList");return e.isEnabled||i.isEnabled}_tryToConvertItemsToList(t){if(!t.type)return;const e=tt(t.type);if(!e)return;const i=this.editor,s=`${e}List`;i.commands.get(s).value||i.execute(s)}}class Qe extends _{refresh(){const t=this._getValue();this.value=t,this.isEnabled=t!=null}execute(t={}){const e=this.editor.model,i=e.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(r=>p(r)&&r.getAttribute("listType")=="numbered");s=z(s),e.change(r=>{for(const o of s)r.setAttribute("listReversed",!!t.reversed,o)})}_getValue(){const e=this.editor.model.document,i=D(e.selection.getSelectedBlocks());return p(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listReversed"):null}}function gt(n){return(t,e,i)=>{const{writer:s,schema:r,consumable:o}=i;if(o.test(e.viewItem,n.viewConsumables)===!1)return;e.modelRange||Object.assign(e,i.convertChildren(e.viewItem,e.modelCursor));let l=!1;for(const a of e.modelRange.getItems({shallow:!0}))r.checkAttribute(a,n.attributeName)&&n.appliesToListItem(a)&&(a.hasAttribute(n.attributeName)||(s.setAttribute(n.attributeName,n.getAttributeOnUpcast(e.viewItem),a),l=!0));l&&o.consume(e.viewItem,n.viewConsumables)}}class Xe extends g{static get pluginName(){return"ListPropertiesUtils"}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return Bt()}getListTypeFromListStyleType(t){return tt(t)}getListStyleTypeFromTypeAttribute(t){return Et(t)}getTypeAttributeFromListStyleType(t){return Y(t)}}function Ft(n){const{startIndex:t,reversed:e,styles:i}=n;return{styles:ti(i),startIndex:t||!1,reversed:e||!1}}function ti(n){const t={listTypes:["bulleted","numbered"],useAttribute:!1};return n===!0||(n?Array.isArray(n)||typeof n=="string"?t.listTypes=T(n):(t.listTypes=n.listTypes?T(n.listTypes):t.listTypes,t.useAttribute=!!n.useAttribute,n.listStyleTypes&&(t.listStyleTypes=n.listStyleTypes)):t.listTypes=[]),t}const x="default";class ei extends g{static get requires(){return[b,Xe]}static get pluginName(){return"ListPropertiesEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const t=this.editor,e=t.model,i=t.plugins.get(b),s=t.config.get("list.properties"),r=ii(s);for(const o of r)o.addCommand(t),e.schema.extend("$listItem",{allowAttributes:o.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:o.attributeName,setAttributeOnDowncast(l,a,c){o.setAttributeOnDowncast(l,a,c)}});t.conversion.for("upcast").add(o=>{for(const l of r)o.on("element:ol",gt(l)),o.on("element:ul",gt(l))}),i.on("checkAttributes:list",(o,{viewElement:l,modelAttributes:a,modelReferenceElement:c})=>{for(const u of r)u.appliesToListItem(c)&&u.getAttributeOnUpcast(l)!=a[u.attributeName]&&(o.return=!0,o.stop())}),this.listenTo(t.commands.get("indentList"),"afterExecute",(o,l)=>{e.change(a=>{for(const c of l)for(const u of r)u.appliesToListItem(c)&&a.setAttribute(u.attributeName,u.defaultValue,c)})}),i.on("postFixer",(o,{listNodes:l,writer:a})=>{for(const{node:c}of l)for(const u of r)u.hasValidAttribute(c)||(u.appliesToListItem(c)?a.setAttribute(u.attributeName,u.defaultValue,c):a.removeAttribute(u.attributeName,c),o.return=!0)}),i.on("postFixer",(o,{listNodes:l,writer:a})=>{for(const{node:c,previousNodeInList:u}of l)if(u&&u.getAttribute("listType")==c.getAttribute("listType"))for(const d of r){const{attributeName:m}=d;if(!d.appliesToListItem(c))continue;const f=u.getAttribute(m);c.getAttribute(m)!=f&&(a.setAttribute(m,f,c),o.return=!0)}})}}function ii(n){const t=[],e=Ft(n);if(n.styles){const i=e.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:x,viewConsumables:{styles:"list-style-type"},addCommand(s){let r=Bt();i&&(r=r.filter(o=>!!Y(o))),s.commands.add("listStyle",new Je(s,x,r))},appliesToListItem(s){return s.getAttribute("listType")=="numbered"||s.getAttribute("listType")=="bulleted"},hasValidAttribute(s){if(!this.appliesToListItem(s))return!s.hasAttribute("listStyle");if(!s.hasAttribute("listStyle"))return!1;const r=s.getAttribute("listStyle");return r==x?!0:tt(r)==s.getAttribute("listType")},setAttributeOnDowncast(s,r,o){if(r&&r!==x)if(i){const l=Y(r);if(l){s.setAttribute("type",l,o);return}}else{s.setStyle("list-style-type",r,o);return}s.removeStyle("list-style-type",o),s.removeAttribute("type",o)},getAttributeOnUpcast(s){const r=s.getStyle("list-style-type");if(r)return Ze(r);const o=s.getAttribute("type");return o?Et(o):x}})}return n.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(i){i.commands.add("listReversed",new Qe(i))},appliesToListItem(i){return i.getAttribute("listType")=="numbered"},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listReversed")},setAttributeOnDowncast(i,s,r){s?i.setAttribute("reversed","reversed",r):i.removeAttribute("reversed",r)},getAttributeOnUpcast(i){return i.hasAttribute("reversed")}}),n.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(i){i.commands.add("listStart",new Ge(i))},appliesToListItem(i){return M(i.getAttribute("listType"))},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listStart")},setAttributeOnDowncast(i,s,r){s==0||s>1?i.setAttribute("start",s,r):i.removeAttribute("start",r)},getAttributeOnUpcast(i){const s=i.getAttribute("start");return s>=0?s:1}}),t}class Pt extends nt{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new et;keystrokes=new it;focusables=new Jt;focusCycler;constructor(t,{enabledProperties:e,styleButtonViews:i,styleGridAriaLabel:s}){super(t);const r=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Qt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,s),this.children.add(this.stylesView)):r.push("ck-list-properties_without-styles"),(e.startIndex||e.reversed)&&(this._addNumberedListPropertyViews(e),r.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:r},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const t of this.stylesView.children)this.stylesView.focusTracker.add(t.element);Xt({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>Wt.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const t=e=>e.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(t,e){const i=new nt(this.locale);return i.children=i.createCollection(),i.children.addMany(t),i.setTemplate({tag:"div",attributes:{"aria-label":e,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){for(const s of this.children)if(s instanceof Z&&s.isOn){s.focus();return}this.children.first.focus()},i.focusTracker=new et,i.keystrokes=new it,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(t){const e=this.locale.t,i=[];t.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),t.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new te(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:e("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...s)=>s.some(r=>r)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(s,r,o)=>{o||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const t=this.locale.t,e=new ee(this.locale,ie);return e.set({label:t("Start at"),class:"ck-numbered-list-properties__start-index"}),e.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),e.fieldView.on("input",()=>{const i=e.fieldView.element,s=i.valueAsNumber;if(Number.isNaN(s)){e.errorText=t("Invalid start index value.");return}i.checkValidity()?this.fire("listStart",{startIndex:s}):e.errorText=t("Start index must be greater than 0.")}),e}_createReversedSwitchButton(){const t=this.locale.t,e=new se(this.locale);return e.set({withText:!0,label:t("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),e.delegate("execute").to(this,"listReversed"),e}}class si extends g{static get pluginName(){return"ListPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=t.config.get("list.properties"),s=Ft(i),r=s.styles.listTypes;if(r.includes("bulleted")){const o=[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:ne},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:re},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:oe}],l=e("Bulleted List"),a=e("Bulleted list styles toolbar"),c="bulletedList";t.ui.componentFactory.add(c,ht({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:J,styleGridAriaLabel:a,styleDefinitions:o})),t.ui.componentFactory.add(`menuBar:${c}`,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}if(r.includes("numbered")||i.startIndex||i.reversed){const o=[{label:e("Toggle the decimal list style"),tooltip:e("Decimal"),type:"decimal",icon:le},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:ae},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:ce},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:ue},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:de},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:me}],l=e("Numbered List"),a=e("Numbered list styles toolbar"),c="numberedList";t.ui.componentFactory.add(c,ht({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,buttonIcon:Q,styleGridAriaLabel:a,styleDefinitions:o})),r.includes("numbered")&&t.ui.componentFactory.add(`menuBar:${c}`,bt({editor:t,normalizedConfig:s,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:o}))}}}function ht({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,buttonIcon:s,styleGridAriaLabel:r,styleDefinitions:o}){const l=n.commands.get(e);return a=>{const c=Kt(a,Ht),u=c.buttonView;return c.bind("isEnabled").to(l),c.class="ck-list-styles-dropdown",u.on("execute",()=>{n.execute(e),n.editing.view.focus()}),u.set({label:i,icon:s,tooltip:!0,isToggleable:!0}),u.bind("isOn").to(l,"value",d=>!!d),c.once("change:isOpen",()=>{const d=ni({editor:n,normalizedConfig:t,dropdownView:c,parentCommandName:e,styleGridAriaLabel:r,styleDefinitions:o});c.panelView.children.add(d)}),c.on("execute",()=>{n.editing.view.focus()}),c}}function Vt({editor:n,listStyleCommand:t,parentCommandName:e}){const i=n.locale,s=n.commands.get(e);return({label:r,type:o,icon:l,tooltip:a})=>{const c=new Z(i);return c.set({label:r,icon:l,tooltip:a}),c.bind("isOn").to(t,"value",u=>u===o),c.on("execute",()=>{s.value?t.value===o?n.execute(e):t.value!==o&&n.execute("listStyle",{type:o}):n.model.change(()=>{n.execute("listStyle",{type:o})})}),c}}function ni({editor:n,normalizedConfig:t,dropdownView:e,parentCommandName:i,styleDefinitions:s,styleGridAriaLabel:r}){const o=n.locale,l={...t,...i!="numberedList"?{startIndex:!1,reversed:!1}:null},a=i.replace("List","");let c=null;if(t.styles.listTypes.includes(a)){const d=n.commands.get("listStyle"),m=Vt({editor:n,parentCommandName:i,listStyleCommand:d}),f=t.styles.listStyleTypes;let h=s;if(f){const I=f[a];I&&(h=s.filter(O=>I.includes(O.type)))}const L=Ot(d);c=h.filter(L).map(m)}const u=new Pt(o,{styleGridAriaLabel:r,enabledProperties:l,styleButtonViews:c});if(t.styles.listTypes.includes(a)&&Zt(e,()=>u.stylesView.children.find(d=>d.isOn)),l.startIndex){const d=n.commands.get("listStart");u.startIndexFieldView.bind("isEnabled").to(d),u.startIndexFieldView.fieldView.bind("value").to(d),u.on("listStart",(m,f)=>n.execute("listStart",f))}if(l.reversed){const d=n.commands.get("listReversed");u.reversedSwitchButtonView.bind("isEnabled").to(d),u.reversedSwitchButtonView.bind("isOn").to(d,"value",m=>!!m),u.on("listReversed",()=>{const m=d.value;n.execute("listReversed",{reversed:!m})})}return u.delegate("execute").to(e),u}function bt({editor:n,normalizedConfig:t,parentCommandName:e,buttonLabel:i,styleGridAriaLabel:s,styleDefinitions:r}){return o=>{const l=new Yt(o),a=n.commands.get(e),c=n.commands.get("listStyle"),u=Ot(c),d=Vt({editor:n,parentCommandName:e,listStyleCommand:c}),m=t.styles.listStyleTypes;let f=r;if(m){const I=a.type,O=m[I];O&&(f=r.filter(Nt=>O.includes(Nt.type)))}const h=f.filter(u).map(d),L=new Pt(o,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:h});return L.delegate("execute").to(l),l.buttonView.set({label:i,icon:e==="bulletedList"?J:Q}),l.panelView.children.add(L),l.bind("isEnabled").to(a,"isEnabled"),l.on("execute",()=>{n.editing.view.focus()}),l}}function Ot(n){return typeof n.isStyleTypeSupported=="function"?t=>n.isStyleTypeSupported(t.type):()=>!0}class Si extends g{static get requires(){return[ei,si]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}}class ri extends _{constructor(t){super(t),this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){const t=this._getSelectedItems();this.value=this._getValue(t),this.isEnabled=!!t.length}execute(t={}){this.editor.model.change(e=>{const i=this._getSelectedItems(),s=t.forceValue===void 0?!this._getValue(i):t.forceValue;for(const r of i)s?e.setAttribute("todoListChecked",!0,r):e.removeAttribute("todoListChecked",r)})}_getValue(t){return t.every(e=>e.getAttribute("todoListChecked"))}_getSelectedItems(){const t=this.editor.model,e=t.schema,i=t.document.selection.getFirstRange(),s=i.start.parent,r=[];e.checkAttribute(s,"todoListChecked")&&r.push(...w(s));for(const o of i.getItems({shallow:!0}))e.checkAttribute(o,"todoListChecked")&&!r.includes(o)&&r.push(...w(o));return r}}class oi extends pe{domEventType=["change"];onDomEvent(t){if(t.target){const e=this.view.domConverter.mapDomToView(t.target);e&&e.is("element","input")&&e.getAttribute("type")=="checkbox"&&e.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",t)}}}const li=$t("Ctrl+Enter");class ai extends g{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[b]}init(){const t=this.editor,e=t.model,i=t.editing,s=t.plugins.get(b),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new B(t,"todo")),t.commands.add("checkTodoList",new ri(t)),i.view.addObserver(oi),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck(l=>{const a=l.last;if(!a.getAttribute("listItemId")||a.getAttribute("listType")!="todo")return!1},"todoListChecked"),t.conversion.for("upcast").add(l=>{l.on("element:input",ui()),l.on("element:li",ci(),{priority:"low"}),l.on("element:label",j({name:"label",classes:"todo-list__label"})),l.on("element:label",j({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),l.on("element:span",j({name:"span",classes:"todo-list__label__description"})),l.on("element:ul",di({name:"ul",classes:"todo-list"}))}),t.conversion.for("downcast").elementToElement({model:o,view:(l,{writer:a})=>{if(N(l,s.getListAttributeNames()))return a.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),s.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(l,a,c){a=="todo"?l.addClass("todo-list",c):l.removeClass("todo-list",c)}}),s.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(l,a,{dataPipeline:c}){if(a.getAttribute("listType")!="todo")return null;const u=l.createUIElement("input",{type:"checkbox",...a.getAttribute("todoListChecked")?{checked:"checked"}:null,...c?{disabled:"disabled"}:{tabindex:"-1"}});if(c)return u;const d=l.createContainerElement("span",{contenteditable:"false"},u);return d.getFillerOffset=()=>null,d},canWrapElement(l){return N(l,s.getListAttributeNames())},createWrapperElement(l,a,{dataPipeline:c}){const u=["todo-list__label"];return N(a,s.getListAttributeNames())||u.push("todo-list__label_without-description"),l.createAttributeElement(c?"label":"span",{class:u.join(" ")})}}),s.on("checkElement",(l,{modelElement:a,viewElement:c})=>{const u=N(a,s.getListAttributeNames());c.hasClass("todo-list__label__description")!=u&&(l.return=!0,l.stop())}),s.on("checkElement",(l,{modelElement:a,viewElement:c})=>{const u=a.getAttribute("listType")=="todo"&&A(a);let d=!1;const m=t.editing.view.createPositionBefore(c).getWalker({direction:"backward"});for(const{item:f}of m){if(f.is("element")&&t.editing.mapper.toModelElement(f))break;f.is("element","input")&&f.getAttribute("type")=="checkbox"&&(d=!0)}d!=u&&(l.return=!0,l.stop())}),s.on("postFixer",(l,{listNodes:a,writer:c})=>{for(const{node:u,previousNodeInList:d}of a){if(!d||d.getAttribute("listItemId")!=u.getAttribute("listItemId"))continue;const m=d.hasAttribute("todoListChecked"),f=u.hasAttribute("todoListChecked");f&&!m?(c.removeAttribute("todoListChecked",u),l.return=!0):!f&&m&&(c.setAttribute("todoListChecked",!0,u),l.return=!0)}}),e.document.registerPostFixer(l=>{const a=e.document.differ.getChanges();let c=!1;for(const u of a)if(u.type=="attribute"&&u.attributeKey=="listType"){const d=u.range.start.nodeAfter;u.attributeOldValue=="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0)}else if(u.type=="insert"&&u.name!="$text")for(const{item:d}of l.createRangeOn(u.position.nodeAfter))d.is("element")&&d.getAttribute("listType")!="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0);return c}),this.listenTo(i.view.document,"keydown",(l,a)=>{zt(a)===li&&(t.execute("checkTodoList"),l.stop())},{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",(l,a)=>{const c=a.target;if(!c||!c.is("element","input"))return;const u=i.view.createPositionAfter(c),m=i.mapper.toModelPosition(u).parent;m&&p(m)&&m.getAttribute("listType")=="todo"&&this._handleCheckmarkChange(m)}),this.listenTo(i.view.document,"arrowKey",fi(e,t.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",(l,a)=>{const c=a.viewPosition.parent,u=c.is("attributeElement","li")&&a.viewPosition.offset==0,d=It(c)&&a.viewPosition.offset<=1,m=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&It(c.parent);if(!u&&!d&&!m)return;const f=a.modelPosition.nodeAfter;f&&f.getAttribute("listType")=="todo"&&(a.modelPosition=e.createPositionAt(f,0))},{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(t){const e=this.editor,i=e.model,s=Array.from(i.document.selection.getRanges());i.change(r=>{r.setSelection(t,"end"),e.execute("checkTodoList"),r.setSelection(s)})}_initAriaAnnouncements(){const{model:t,ui:e,t:i}=this.editor;let s=null;e&&t.document.selection.on("change:range",()=>{const r=t.document.selection.focus.parent,o=yt(s),l=yt(r);o&&!l?e.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!o&&l&&e.ariaLiveAnnouncer.announce(i("Entering a to-do list")),s=r})}}function ci(){return(n,t,e)=>{const{writer:i,schema:s}=e;if(!t.modelRange)return;const r=Array.from(t.modelRange.getItems({shallow:!0})).filter(o=>o.getAttribute("listType")==="todo"&&s.checkAttribute(o,"listItemId")).reduce((o,l)=>{const a=l.getAttribute("listItemId");return o.has(a)||o.set(a,w(l)),o},new Map);for(const[,o]of r.entries())if(o.some(l=>l.getAttribute("todoListChecked")))for(const l of o)i.setAttribute("todoListChecked",!0,l)}}function ui(){return(n,t,e)=>{const i=t.modelCursor,s=i.parent,r=t.viewItem;if(!e.consumable.test(r,{name:!0})||r.getAttribute("type")!="checkbox"||!i.isAtStart||!s.hasAttribute("listType"))return;e.consumable.consume(r,{name:!0});const o=e.writer;o.setAttribute("listType","todo",s),t.viewItem.hasAttribute("checked")&&o.setAttribute("todoListChecked",!0,s),t.modelRange=o.createRange(i)}}function j(n){const t=new kt(n);return(e,i,s)=>{const r=t.match(i.viewItem);r&&s.consumable.consume(i.viewItem,r.match)&&Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor))}}function di(n){const t=new kt(n);return(e,i,s)=>{const r=t.match(i.viewItem);if(!r)return;const o=r.match;o.name=!1,s.consumable.consume(i.viewItem,o)}}function N(n,t){return(n.is("element","paragraph")||n.is("element","listItem"))&&n.getAttribute("listType")=="todo"&&A(n)&&mi(n,t)}function mi(n,t){for(const e of n.getAttributeKeys())if(!e.startsWith("selection:")&&!t.includes(e))return!1;return!0}function fi(n,t){return(e,i)=>{const s=Ut(i.keyCode,t.contentLanguageDirection),r=n.schema,o=n.document.selection;if(!o.isCollapsed)return;const l=o.getFirstPosition(),a=l.parent;if(s=="right"&&l.isAtEnd){const c=r.getNearestSelectionRange(n.createPositionAfter(a),"forward");if(!c)return;const u=c.start.parent;u&&p(u)&&u.getAttribute("listType")=="todo"&&(n.change(d=>d.setSelection(c)),i.preventDefault(),i.stopPropagation(),e.stop())}else if(s=="left"&&l.isAtStart&&p(a)&&a.getAttribute("listType")=="todo"){const c=r.getNearestSelectionRange(n.createPositionBefore(a),"backward");if(!c)return;n.change(u=>u.setSelection(c)),i.preventDefault(),i.stopPropagation(),e.stop()}}}function It(n){return!!n&&n.is("attributeElement")&&n.hasClass("todo-list__label")}function yt(n){return!n||!n.is("element","paragraph")&&!n.is("element","listItem")?!1:n.getAttribute("listType")=="todo"}class pi extends g{static get pluginName(){return"TodoListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;H(this.editor,"todoList",t("To-do List"),fe)}}class _i extends g{static get requires(){return[ai,pi]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}}export{ri as CheckTodoListCommand,Ti as List,B as ListCommand,b as ListEditing,Se as ListFormatting,ot as ListIndentCommand,ke as ListItemBoldIntegration,we as ListItemFontColorIntegration,Te as ListItemFontFamilyIntegration,Le as ListItemFontSizeIntegration,Ae as ListItemItalicIntegration,at as ListMergeCommand,Si as ListProperties,ei as ListPropertiesEditing,si as ListPropertiesUI,Xe as ListPropertiesUtils,Qe as ListReversedCommand,ct as ListSplitCommand,Ge as ListStartCommand,Je as ListStyleCommand,Ye as ListUI,Be as ListUtils,_i as TodoList,ai as TodoListEditing,pi as TodoListUI,ge as _ListBlocksIterable,Pt as _ListPropertiesView,y as _ListWalker,P as _SiblingListBlocksIterator,oi as _TodoCheckboxChangeObserver,U as _canBecomeSimpleListItem,Pe as _createListElement,Ve as _createListItemElement,H as _createListUIComponents,$e as _createModelToViewListPositionMapper,V as _expandListBlocksToCompleteItems,z as _expandListBlocksToCompleteList,k as _findAndAddListHeadToMap,ze as _findMappedListItemViewElement,Oe as _fixListIndents,Ne as _fixListItemIds,w as _getAllListItemBlocks,Bt as _getAllSupportedListStyleTypes,Fe as _getListIndent,S as _getListItemBlocks,At as _getListItems,Et as _getListStyleTypeFromTypeAttribute,tt as _getListTypeFromListStyleType,he as _getNestedListBlocks,Ft as _getNormalizedListConfig,F as _getSelectedBlockObject,Y as _getTypeAttributeFromListStyleType,wt as _getViewElementIdForListType,Lt as _getViewElementNameForListType,q as _indentListBlocks,A as _isFirstBlockOfListItem,rt as _isLastBlockOfListItem,p as _isListItemBlock,K as _isListItemView,Ee as _isListView,M as _isNumberedListType,E as _isSingleListItem,mt as _listItemBogusParagraphCreator,dt as _listItemDowncastConverter,De as _listItemDowncastRemoveConverter,Re as _listItemUpcastConverter,gt as _listPropertiesUpcastConverter,W as _mergeListItemBefore,Ze as _normalizeListStyle,Ie as _outdentFollowingListItems,be as _outdentListBlocksWithMerge,Me as _reconvertListItemsOnDataChange,$ as _removeListAttributes,v as _sortListBlocks,X as _splitListItemBefore};