@ncino/web-components 3.4.0-preview.2 → 3.4.0-preview.3

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 (364) hide show
  1. package/dist/_virtual/index.js +1 -1
  2. package/dist/_virtual/index2.js +1 -1
  3. package/dist/assets/node_modules/.pnpm/ckeditor5@45.0.0/node_modules/ckeditor5/dist/ckeditor5.css +4 -0
  4. package/dist/components/input-rich-text/ckeditor-config.js +1 -1
  5. package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
  6. package/dist/components/panel/gator/panel.storybook-test.js +1 -1
  7. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-alignment@45.0.0/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +4 -0
  8. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@44.3.0 → @ckeditor_ckeditor5-autoformat@45.0.0}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
  9. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@44.3.0 → @ckeditor_ckeditor5-autosave@45.0.0}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
  10. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-basic-styles@45.0.0/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +4 -0
  11. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@44.3.0 → @ckeditor_ckeditor5-block-quote@45.0.0}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +2 -2
  12. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@45.0.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +20 -0
  13. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@44.3.0 → @ckeditor_ckeditor5-cloud-services@45.0.0}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +2 -2
  14. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@44.3.0 → @ckeditor_ckeditor5-code-block@45.0.0}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +5 -5
  15. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@45.0.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js +4 -0
  16. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-editor-classic@45.0.0/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +4 -0
  17. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-engine@44.3.0 → @ckeditor_ckeditor5-engine@45.0.0}/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +3 -3
  18. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@44.3.0 → @ckeditor_ckeditor5-enter@45.0.0}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
  19. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@44.3.0 → @ckeditor_ckeditor5-essentials@45.0.0}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
  20. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-find-and-replace@45.0.0/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +5 -0
  21. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-font@45.0.0/node_modules/@ckeditor/ckeditor5-font/dist/index.js +7 -0
  22. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@44.3.0 → @ckeditor_ckeditor5-heading@45.0.0}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
  23. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-highlight@45.0.0/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +4 -0
  24. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-horizontal-line@45.0.0/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +4 -0
  25. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@45.0.0/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +4 -0
  26. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@45.0.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +12 -0
  27. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-icons@45.0.0/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +6 -0
  28. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@45.0.0/node_modules/@ckeditor/ckeditor5-image/dist/index.js +10 -0
  29. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@45.0.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +10 -0
  30. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@44.3.0 → @ckeditor_ckeditor5-language@45.0.0}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
  31. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@45.0.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +4 -0
  32. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@45.0.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +13 -0
  33. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@44.3.0 → @ckeditor_ckeditor5-markdown-gfm@45.0.0}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
  34. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-media-embed@45.0.0/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +7 -0
  35. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@44.3.0 → @ckeditor_ckeditor5-mention@45.0.0}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
  36. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-page-break@45.0.0/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +4 -0
  37. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@44.3.0 → @ckeditor_ckeditor5-paragraph@45.0.0}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +2 -2
  38. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paste-from-office@44.3.0 → @ckeditor_ckeditor5-paste-from-office@45.0.0}/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -1
  39. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-remove-format@45.0.0/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +4 -0
  40. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-select-all@45.0.0/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +4 -0
  41. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-show-blocks@45.0.0/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +4 -0
  42. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@45.0.0/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +12 -0
  43. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@45.0.0/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +4 -0
  44. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@44.3.0 → @ckeditor_ckeditor5-style@45.0.0}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
  45. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@45.0.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +16 -0
  46. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-typing@44.3.0 → @ckeditor_ckeditor5-typing@45.0.0}/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +3 -3
  47. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@45.0.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +28 -0
  48. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@44.3.0 → @ckeditor_ckeditor5-undo@45.0.0}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +2 -2
  49. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@44.3.0 → @ckeditor_ckeditor5-upload@45.0.0}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
  50. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-utils@44.3.0 → @ckeditor_ckeditor5-utils@45.0.0}/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +9 -9
  51. package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@44.3.0 → @ckeditor_ckeditor5-watchdog@45.0.0}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +1 -1
  52. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@45.0.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +4 -0
  53. package/dist/node_modules/.pnpm/{@storybook_instrumenter@8.6.12_storybook@8.6.12_prettier@3.4.2_ → @storybook_instrumenter@8.6.12_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/instrumenter/dist/index.js +1 -1
  54. package/dist/node_modules/.pnpm/{@storybook_test@8.6.12_storybook@8.6.12_prettier@3.4.2_ → @storybook_test@8.6.12_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/test/dist/index.js +1 -1
  55. package/dist/node_modules/.pnpm/color-parse@1.4.2/node_modules/color-parse/index.js +1 -1
  56. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js +1 -0
  57. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/getTag.js +1 -0
  58. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js +1 -0
  59. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/isIndex.js +1 -0
  60. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +1 -0
  61. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.js +1 -0
  62. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/tags.js +1 -0
  63. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/toKey.js +1 -0
  64. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js +1 -0
  65. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/throttle.js +1 -0
  66. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/assignIn.js +1 -0
  67. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -0
  68. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +1 -0
  69. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/get.js +1 -0
  70. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/keysIn.js +1 -0
  71. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mapValues.js +1 -0
  72. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/merge.js +1 -0
  73. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mergeWith.js +1 -0
  74. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/property.js +1 -0
  75. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/set.js +1 -0
  76. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/unset.js +1 -0
  77. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isArguments.js +1 -0
  78. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js +1 -0
  79. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isElement.js +1 -0
  80. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js +1 -0
  81. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObject.js +1 -0
  82. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js +1 -0
  83. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +1 -0
  84. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isString.js +1 -0
  85. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js +1 -0
  86. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js +1 -0
  87. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js +1 -0
  88. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/startCase.js +1 -0
  89. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/upperFirst.js +1 -0
  90. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/eq.js +1 -0
  91. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/times.js +1 -0
  92. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/toFinite.js +1 -0
  93. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/toInteger.js +1 -0
  94. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/toNumber.js +1 -0
  95. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/toPath.js +1 -0
  96. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/util/toString.js +1 -0
  97. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/after.js +1 -0
  98. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/debounce.js +1 -0
  99. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/identity.js +1 -0
  100. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/noop.js +1 -0
  101. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/clone.js +1 -0
  102. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/cloneDeepWith.js +1 -0
  103. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/mapValues.js +1 -0
  104. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isBuffer.js +1 -0
  105. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js +1 -0
  106. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqualWith.js +1 -0
  107. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isFunction.js +1 -0
  108. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isLength.js +1 -0
  109. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isPlainObject.js +1 -0
  110. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isPrimitive.js +1 -0
  111. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isTypedArray.js +1 -0
  112. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/string/escapeRegExp.js +1 -0
  113. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/string/upperFirst.js +1 -0
  114. package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/string/words.js +1 -0
  115. package/dist/utils/vitest-a11y-utils.js +1 -1
  116. package/package.json +2 -2
  117. package/web-types.json +1 -1
  118. package/dist/assets/node_modules/.pnpm/ckeditor5@44.3.0/node_modules/ckeditor5/dist/ckeditor5.css +0 -4
  119. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-alignment@44.3.0/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +0 -4
  120. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-basic-styles@44.3.0/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +0 -4
  121. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@44.3.0/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +0 -20
  122. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@44.3.0/node_modules/@ckeditor/ckeditor5-core/dist/index.js +0 -6
  123. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-editor-classic@44.3.0/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +0 -4
  124. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-find-and-replace@44.3.0/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +0 -5
  125. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-font@44.3.0/node_modules/@ckeditor/ckeditor5-font/dist/index.js +0 -7
  126. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-highlight@44.3.0/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +0 -4
  127. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-horizontal-line@44.3.0/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +0 -4
  128. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@44.3.0/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +0 -4
  129. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@44.3.0/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +0 -12
  130. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@44.3.0/node_modules/@ckeditor/ckeditor5-image/dist/index.js +0 -10
  131. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@44.3.0/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +0 -10
  132. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@44.3.0/node_modules/@ckeditor/ckeditor5-link/dist/index.js +0 -4
  133. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@44.3.0/node_modules/@ckeditor/ckeditor5-list/dist/index.js +0 -13
  134. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-media-embed@44.3.0/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +0 -7
  135. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-page-break@44.3.0/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +0 -4
  136. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-remove-format@44.3.0/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +0 -4
  137. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-select-all@44.3.0/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +0 -4
  138. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-show-blocks@44.3.0/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +0 -4
  139. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@44.3.0/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +0 -12
  140. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@44.3.0/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +0 -4
  141. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@44.3.0/node_modules/@ckeditor/ckeditor5-table/dist/index.js +0 -19
  142. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@44.3.0/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +0 -29
  143. package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@44.3.0/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +0 -4
  144. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js +0 -1
  145. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js +0 -1
  146. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js +0 -1
  147. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js +0 -1
  148. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js +0 -1
  149. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js +0 -1
  150. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js +0 -1
  151. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js +0 -1
  152. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Stack.js +0 -1
  153. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +0 -1
  154. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js +0 -1
  155. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js +0 -1
  156. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_apply.js +0 -1
  157. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayEach.js +0 -1
  158. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js +0 -1
  159. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js +0 -1
  160. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js +0 -1
  161. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js +0 -1
  162. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayReduce.js +0 -1
  163. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySome.js +0 -1
  164. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiToArray.js +0 -1
  165. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiWords.js +0 -1
  166. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignMergeValue.js +0 -1
  167. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignValue.js +0 -1
  168. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js +0 -1
  169. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAssign.js +0 -1
  170. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAssignIn.js +0 -1
  171. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAssignValue.js +0 -1
  172. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClone.js +0 -1
  173. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseCreate.js +0 -1
  174. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseEach.js +0 -1
  175. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFor.js +0 -1
  176. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseForOwn.js +0 -1
  177. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGet.js +0 -1
  178. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetAllKeys.js +0 -1
  179. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +0 -1
  180. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseHasIn.js +0 -1
  181. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js +0 -1
  182. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqual.js +0 -1
  183. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqualDeep.js +0 -1
  184. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsMap.js +0 -1
  185. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsMatch.js +0 -1
  186. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js +0 -1
  187. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsSet.js +0 -1
  188. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js +0 -1
  189. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIteratee.js +0 -1
  190. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js +0 -1
  191. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeysIn.js +0 -1
  192. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseMap.js +0 -1
  193. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseMatches.js +0 -1
  194. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseMatchesProperty.js +0 -1
  195. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseMerge.js +0 -1
  196. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseMergeDeep.js +0 -1
  197. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseProperty.js +0 -1
  198. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_basePropertyDeep.js +0 -1
  199. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_basePropertyOf.js +0 -1
  200. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRest.js +0 -1
  201. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSet.js +0 -1
  202. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSetToString.js +0 -1
  203. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSlice.js +0 -1
  204. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js +0 -1
  205. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseToString.js +0 -1
  206. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +0 -1
  207. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js +0 -1
  208. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnset.js +0 -1
  209. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js +0 -1
  210. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_castPath.js +0 -1
  211. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_castSlice.js +0 -1
  212. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneArrayBuffer.js +0 -1
  213. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneBuffer.js +0 -1
  214. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneDataView.js +0 -1
  215. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneRegExp.js +0 -1
  216. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneSymbol.js +0 -1
  217. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneTypedArray.js +0 -1
  218. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js +0 -1
  219. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyObject.js +0 -1
  220. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copySymbols.js +0 -1
  221. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copySymbolsIn.js +0 -1
  222. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js +0 -1
  223. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createAssigner.js +0 -1
  224. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createBaseEach.js +0 -1
  225. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createBaseFor.js +0 -1
  226. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createCaseFirst.js +0 -1
  227. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createCompounder.js +0 -1
  228. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_deburrLetter.js +0 -1
  229. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_defineProperty.js +0 -1
  230. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalArrays.js +0 -1
  231. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalByTag.js +0 -1
  232. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalObjects.js +0 -1
  233. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +0 -1
  234. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeys.js +0 -1
  235. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeysIn.js +0 -1
  236. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js +0 -1
  237. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMatchData.js +0 -1
  238. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js +0 -1
  239. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getPrototype.js +0 -1
  240. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +0 -1
  241. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js +0 -1
  242. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbolsIn.js +0 -1
  243. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js +0 -1
  244. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +0 -1
  245. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasPath.js +0 -1
  246. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasUnicode.js +0 -1
  247. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasUnicodeWord.js +0 -1
  248. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js +0 -1
  249. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js +0 -1
  250. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js +0 -1
  251. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js +0 -1
  252. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js +0 -1
  253. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneArray.js +0 -1
  254. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneByTag.js +0 -1
  255. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneObject.js +0 -1
  256. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js +0 -1
  257. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js +0 -1
  258. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKey.js +0 -1
  259. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js +0 -1
  260. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js +0 -1
  261. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js +0 -1
  262. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isStrictComparable.js +0 -1
  263. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js +0 -1
  264. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js +0 -1
  265. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js +0 -1
  266. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js +0 -1
  267. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js +0 -1
  268. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js +0 -1
  269. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js +0 -1
  270. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js +0 -1
  271. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js +0 -1
  272. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js +0 -1
  273. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapToArray.js +0 -1
  274. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_matchesStrictComparable.js +0 -1
  275. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_memoizeCapped.js +0 -1
  276. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js +0 -1
  277. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js +0 -1
  278. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeysIn.js +0 -1
  279. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js +0 -1
  280. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +0 -1
  281. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js +0 -1
  282. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overRest.js +0 -1
  283. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_parent.js +0 -1
  284. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +0 -1
  285. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_safeGet.js +0 -1
  286. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js +0 -1
  287. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js +0 -1
  288. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js +0 -1
  289. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToString.js +0 -1
  290. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shortOut.js +0 -1
  291. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js +0 -1
  292. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackDelete.js +0 -1
  293. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackGet.js +0 -1
  294. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackHas.js +0 -1
  295. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackSet.js +0 -1
  296. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringToArray.js +0 -1
  297. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringToPath.js +0 -1
  298. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toKey.js +0 -1
  299. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js +0 -1
  300. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +0 -1
  301. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_unicodeToArray.js +0 -1
  302. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_unicodeWords.js +0 -1
  303. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/assignIn.js +0 -1
  304. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/clone.js +0 -1
  305. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.js +0 -1
  306. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeepWith.js +0 -1
  307. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/constant.js +0 -1
  308. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +0 -1
  309. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/deburr.js +0 -1
  310. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js +0 -1
  311. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/escapeRegExp.js +0 -1
  312. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.js +0 -1
  313. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/hasIn.js +0 -1
  314. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/identity.js +0 -1
  315. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js +0 -1
  316. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js +0 -1
  317. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js +0 -1
  318. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLikeObject.js +0 -1
  319. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js +0 -1
  320. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isElement.js +0 -1
  321. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqual.js +0 -1
  322. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqualWith.js +0 -1
  323. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js +0 -1
  324. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js +0 -1
  325. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isMap.js +0 -1
  326. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +0 -1
  327. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +0 -1
  328. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isPlainObject.js +0 -1
  329. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSet.js +0 -1
  330. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isString.js +0 -1
  331. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +0 -1
  332. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js +0 -1
  333. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js +0 -1
  334. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keysIn.js +0 -1
  335. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/last.js +0 -1
  336. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/map.js +0 -1
  337. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/mapValues.js +0 -1
  338. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/memoize.js +0 -1
  339. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge.js +0 -1
  340. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/mergeWith.js +0 -1
  341. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +0 -1
  342. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/property.js +0 -1
  343. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.js +0 -1
  344. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/startCase.js +0 -1
  345. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubArray.js +0 -1
  346. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js +0 -1
  347. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/throttle.js +0 -1
  348. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +0 -1
  349. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toPlainObject.js +0 -1
  350. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toString.js +0 -1
  351. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/unset.js +0 -1
  352. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/upperFirst.js +0 -1
  353. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/words.js +0 -1
  354. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.12_prettier@3.4.2_storybook@8.6.12_prettier@3.4.2_ → @storybook_core@8.6.12_prettier@3.5.3_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/core/dist/channels/index.js +0 -0
  355. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.12_prettier@3.4.2_storybook@8.6.12_prettier@3.4.2_ → @storybook_core@8.6.12_prettier@3.5.3_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/core/dist/client-logger/index.js +0 -0
  356. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.12_prettier@3.4.2_storybook@8.6.12_prettier@3.4.2_ → @storybook_core@8.6.12_prettier@3.5.3_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/core/dist/core-events/index.js +0 -0
  357. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.12_prettier@3.4.2_storybook@8.6.12_prettier@3.4.2_ → @storybook_core@8.6.12_prettier@3.5.3_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/core/dist/csf/index.js +0 -0
  358. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.12_prettier@3.4.2_storybook@8.6.12_prettier@3.4.2_ → @storybook_core@8.6.12_prettier@3.5.3_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/core/dist/preview-api/index.js +0 -0
  359. /package/dist/node_modules/.pnpm/{@storybook_core@8.6.12_prettier@3.4.2_storybook@8.6.12_prettier@3.4.2_ → @storybook_core@8.6.12_prettier@3.5.3_storybook@8.6.12_prettier@3.5.3_}/node_modules/@storybook/core/dist/preview-errors.js +0 -0
  360. /package/dist/node_modules/.pnpm/{@vitest_browser@3.1.2_msw@2.7.3_@types_node@22.13.10_typescript@5.8.3__playwright@1.52._d9f437d9be40af4c1087950720317100 → @vitest_browser@3.1.2_msw@2.7.3_@types_node@22.14.1_typescript@5.8.3__playwright@1.52.0_92e0976dd8f8178c7dbbaa4988dfa8c8}/node_modules/@vitest/browser/context.js +0 -0
  361. /package/dist/node_modules/.pnpm/{vitest@3.1.2_@types_debug@4.1.12_@types_node@22.13.10_@vitest_browser@3.1.2_@vitest_ui@_b3e273fb96cdae5dad1113241e94b66d → vitest@3.1.2_@types_debug@4.1.12_@types_node@22.14.1_@vitest_browser@3.1.2_@vitest_ui@3_941980ac824345de547571ef69676a52}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
  362. /package/dist/node_modules/.pnpm/{vitest@3.1.2_@types_debug@4.1.12_@types_node@22.13.10_@vitest_browser@3.1.2_@vitest_ui@_b3e273fb96cdae5dad1113241e94b66d → vitest@3.1.2_@types_debug@4.1.12_@types_node@22.14.1_@vitest_browser@3.1.2_@vitest_ui@3_941980ac824345de547571ef69676a52}/node_modules/vitest/dist/chunks/date.CDOsz-HY.js +0 -0
  363. /package/dist/node_modules/.pnpm/{vitest@3.1.2_@types_debug@4.1.12_@types_node@22.13.10_@vitest_browser@3.1.2_@vitest_ui@_b3e273fb96cdae5dad1113241e94b66d → vitest@3.1.2_@types_debug@4.1.12_@types_node@22.14.1_@vitest_browser@3.1.2_@vitest_ui@3_941980ac824345de547571ef69676a52}/node_modules/vitest/dist/chunks/utils.CgTj3MsC.js +0 -0
  364. /package/dist/node_modules/.pnpm/{vitest@3.1.2_@types_debug@4.1.12_@types_node@22.13.10_@vitest_browser@3.1.2_@vitest_ui@_b3e273fb96cdae5dad1113241e94b66d → vitest@3.1.2_@types_debug@4.1.12_@types_node@22.14.1_@vitest_browser@3.1.2_@vitest_ui@3_941980ac824345de547571ef69676a52}/node_modules/vitest/dist/chunks/vi.ClIskdbk.js +0 -0
@@ -1,10 +1,10 @@
1
- var Vs=Object.defineProperty;var $s=(r,t,e)=>t in r?Vs(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var c=(r,t,e)=>$s(r,typeof t!="symbol"?t+"":t,e);import{global as ie,EmitterMixin as O,CKEditorError as d,compareArrays as F,toMap as we,ObservableMixin as U,count as tn,isIterable as ce,toArray as le,EventInfo as Tt,Collection as qt,uid as Ls,spliceArray as nn,logWarning as W,DomEmitterMixin as Ws,isValidAttributeName as qs,first as zt,isText as R,indexOf as Ve,getAncestors as zs,isComment as We,env as T,scrollViewportToShowTarget as Us,isInsideSurrogatePair as zn,isInsideCombinedSymbol as Un,remove as sn,insertAt as Jn,diff as pt,fastDiff as Js,keyCodes as me,isArrowKeyCode as js,priorities as _t,isInsideEmojiSequence as Gs,isNode as lt,getCode as Hs}from"../../../../../@ckeditor_ckeditor5-utils@44.3.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import jn from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/clone.js";import rn from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/isEqual.js";import ct from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/isObject.js";import Ks from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/unset.js";import ht from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/get.js";import Mt from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/isPlainObject.js";import Xs from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/assignIn.js";import Gn from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/merge.js";import Ys from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/set.js";import he from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.js";import Qs from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/isEqualWith.js";import xt from"../../../../../lodash-es@4.17.21/node_modules/lodash-es/debounce.js";/**
1
+ var Vs=Object.defineProperty;var $s=(r,t,e)=>t in r?Vs(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var c=(r,t,e)=>$s(r,typeof t!="symbol"?t+"":t,e);import{global as ie,EmitterMixin as O,CKEditorError as d,compareArrays as F,toMap as we,ObservableMixin as U,count as tn,isIterable as ce,toArray as le,EventInfo as Tt,Collection as qt,uid as Ls,spliceArray as nn,logWarning as W,DomEmitterMixin as Ws,isValidAttributeName as qs,first as zt,isText as R,indexOf as Ve,getAncestors as zs,isComment as We,env as T,scrollViewportToShowTarget as Us,isInsideSurrogatePair as zn,isInsideCombinedSymbol as Un,remove as sn,insertAt as Jn,diff as pt,fastDiff as Js,keyCodes as me,isArrowKeyCode as js,priorities as _t,isInsideEmojiSequence as Gs,isNode as lt,getCode as Hs}from"../../../../../@ckeditor_ckeditor5-utils@45.0.0/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{clone as jn}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/clone.js";import{isEqual as rn}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{isObject as ct}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObject.js";import{unset as Ks}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/unset.js";import{get as ht}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/get.js";import{isPlainObject as Mt}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{assignIn as Xs}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/assignIn.js";import{merge as Gn}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/merge.js";import{set as Ys}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/set.js";import{cloneDeep as he}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";import{isEqualWith as Qs}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js";import{debounce as xt}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";/**
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */const Ne=new WeakMap;let on=!1;function fl({view:r,element:t,text:e,isDirectHost:n=!0,keepOnFocus:s=!1}){const i=r.document;Ne.has(i)||(Ne.set(i,new Map),i.registerPostFixer(a=>wt(Ne.get(i),a)),i.on("change:isComposing",()=>{r.change(a=>wt(Ne.get(i),a))},{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",(a,l,h)=>o(h)),t.placeholder?o(t.placeholder):e&&o(e),e&&rr();function o(a){const l={text:a,isDirectHost:n,keepOnFocus:s,hostElement:n?t:null};Ne.get(i).set(t,l),r.change(h=>wt([[t,l]],h))}}function Zs(r,t){return t.hasClass("ck-placeholder")?!1:(r.addClass("ck-placeholder",t),!0)}function er(r,t){return t.hasClass("ck-placeholder")?(r.removeClass("ck-placeholder",t),!0):!1}function tr(r,t){if(!r.isAttached()||nr(r))return!1;const e=r.document,s=e.selection.anchor;return e.isComposing&&s&&s.parent===r?!1:t||!e.isFocused?!0:!!s&&s.parent!==r}function nr(r){for(const t of r.getChildren())if(!t.is("uiElement"))return!0;return!1}function wt(r,t){const e=[];let n=!1;for(const[s,i]of r)i.isDirectHost&&(e.push(s),an(t,s,i)&&(n=!0));for(const[s,i]of r){if(i.isDirectHost)continue;const o=sr(s);o&&(e.includes(o)||(i.hostElement=o,an(t,s,i)&&(n=!0)))}return n}function an(r,t,e){const{text:n,isDirectHost:s,hostElement:i}=e;let o=!1;return i.getAttribute("data-placeholder")!==n&&(r.setAttribute("data-placeholder",n,i),o=!0),(s||t.childCount==1)&&tr(i,e.keepOnFocus)?Zs(r,i)&&(o=!0):er(r,i)&&(o=!0),o}function sr(r){if(r.childCount){const t=r.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}function rr(){on||W("enableplaceholder-deprecated-text-option"),on=!0}/**
5
5
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
6
6
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
7
- */let ye=class{is(){throw new Error("is() method is abstract")}},ve=class extends O(ye){constructor(e){super();c(this,"document");c(this,"parent");this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new d("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let n=this;for(;n.parent;)e.unshift(n.index),n=n.parent;return e}getAncestors(e={}){const n=[];let s=e.includeSelf?this:this.parent;for(;s;)n[e.parentFirst?"push":"unshift"](s),s=s.parent;return n}getCommonAncestor(e,n={}){const s=this.getAncestors(n),i=e.getAncestors(n);let o=0;for(;s[o]==i[o]&&s[o];)o++;return o===0?null:s[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const n=this.getPath(),s=e.getPath(),i=F(n,s);switch(i){case"prefix":return!0;case"extension":return!1;default:return n[i]<s[i]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,n,s){this.fire(`change:${e}`,n,s),this.parent&&this.parent._fireChange(e,n,s)}toJSON(){const e=jn(this);return delete e.parent,e}};ve.prototype.is=function(r){return r==="node"||r==="view:node"};let N=class Nt extends ve{constructor(e,n){super(e);c(this,"_textData");this._textData=n}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof Nt?this===e||this.data===e.data:!1}_clone(){return new Nt(this.document,this.data)}};N.prototype.is=function(r){return r==="$text"||r==="view:$text"||r==="text"||r==="view:text"||r==="node"||r==="view:node"};let Z=class extends ye{constructor(e,n,s){super();c(this,"textNode");c(this,"data");c(this,"offsetInText");if(this.textNode=e,n<0||n>e.data.length)throw new d("view-textproxy-wrong-offsetintext",this);if(s<0||n+s>e.data.length)throw new d("view-textproxy-wrong-length",this);this.data=e.data.substring(n,n+s),this.offsetInText=n}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const n=[];let s=e.includeSelf?this.textNode:this.parent;for(;s!==null;)n[e.parentFirst?"push":"unshift"](s),s=s.parent;return n}};Z.prototype.is=function(r){return r==="$textProxy"||r==="view:$textProxy"||r==="textProxy"||r==="view:textProxy"};class ut{constructor(){c(this,"_consumables",new Map)}add(t,e){let n;if(t.is("$text")||t.is("documentFragment")){this._consumables.set(t,!0);return}this._consumables.has(t)?n=this._consumables.get(t):(n=new ir(t),this._consumables.set(t,n)),n.add(e?$e(e):t._getConsumables())}test(t,e){const n=this._consumables.get(t);return n===void 0?null:t.is("$text")||t.is("documentFragment")?n:n.test($e(e))}consume(t,e){if(t.is("$text")||t.is("documentFragment"))return this.test(t,e)?(this._consumables.set(t,!1),!0):!1;const n=this._consumables.get(t);return n===void 0?!1:n.consume($e(e))}revert(t,e){const n=this._consumables.get(t);n!==void 0&&(t.is("$text")||t.is("documentFragment")?this._consumables.set(t,!0):n.revert($e(e)))}static createFrom(t,e){if(e||(e=new ut),t.is("$text"))e.add(t);else if(t.is("element")||t.is("documentFragment")){e.add(t);for(const n of t.getChildren())ut.createFrom(n,e)}return e}}class ir{constructor(t){c(this,"element");c(this,"_canConsumeName",null);c(this,"_attributes",new Map);this.element=t}add(t){t.name&&(this._canConsumeName=!0);for(const[e,n]of t.attributes)if(n){let s=this._attributes.get(e);(!s||typeof s=="boolean")&&(s=new Map,this._attributes.set(e,s)),s.set(n,!0)}else{if(e=="style"||e=="class")throw new d("viewconsumable-invalid-attribute",this);this._attributes.set(e,!0)}}test(t){if(t.name&&!this._canConsumeName)return this._canConsumeName;for(const[e,n]of t.attributes){const s=this._attributes.get(e);if(s===void 0)return null;if(s===!1)return!1;if(s!==!0){if(n){const i=s.get(n);if(i===void 0)return null;if(!i)return!1}else for(const i of s.values())if(!i)return!1}}return!0}consume(t){if(!this.test(t))return!1;t.name&&(this._canConsumeName=!1);for(const[e,n]of t.attributes){const s=this._attributes.get(e);if(typeof s=="boolean")for(const[i]of this.element._getConsumables(e,n).attributes)this._attributes.set(i,!1);else if(n)for(const[,i]of this.element._getConsumables(e,n).attributes)s.set(i,!1);else for(const i of s.keys())s.set(i,!1)}return!0}revert(t){t.name&&(this._canConsumeName=!0);for(const[e,n]of t.attributes){const s=this._attributes.get(e);if(s===!1){this._attributes.set(e,!0);continue}if(!(s===void 0||s===!0))if(n)s.get(n)===!1&&s.set(n,!0);else for(const i of s.keys())s.set(i,!0)}}}function $e(r){const t=[];return"attributes"in r&&r.attributes&&bt(t,r.attributes),"classes"in r&&r.classes&&bt(t,r.classes,"class"),"styles"in r&&r.styles&&bt(t,r.styles,"style"),{name:r.name||!1,attributes:t}}function bt(r,t,e){if(typeof t=="string"){r.push(e?[e,t]:[t]);return}for(const n of t)Array.isArray(n)?r.push(n):r.push(e?[e,n]:[n])}class He{constructor(...t){c(this,"_patterns",[]);this.add(...t)}add(...t){for(let e of t)(typeof e=="string"||e instanceof RegExp)&&(e={name:e}),this._patterns.push(e)}match(...t){for(const e of t)for(const n of this._patterns){const s=this._isElementMatching(e,n);if(s)return{element:e,pattern:n,match:s}}return null}matchAll(...t){const e=[];for(const n of t)for(const s of this._patterns){const i=this._isElementMatching(n,s);i&&e.push({element:n,pattern:s,match:i})}return e.length>0?e:null}getElementName(){if(this._patterns.length!==1)return null;const t=this._patterns[0],e=t.name;return typeof t!="function"&&e&&!(e instanceof RegExp)?e:null}_isElementMatching(t,e){if(typeof e=="function"){const i=e(t);return!i||typeof i!="object"?i:$e(i)}const n={};if(e.name&&(n.name=or(e.name,t.name),!n.name))return null;const s=[];return e.attributes&&!ar(e.attributes,t,s)||e.classes&&!lr(e.classes,t,s)||e.styles&&!cr(e.styles,t,s)?null:(s.length&&(n.attributes=s),n)}}function ft(r,t){return r===!0||r===t||r instanceof RegExp&&!!String(t).match(r)}function or(r,t){return r instanceof RegExp?!!t.match(r):r===t}function Ut(r,t){if(Array.isArray(r))return r.map(n=>typeof n!="object"||n instanceof RegExp?t?[t,n,!0]:[n,!0]:((n.key===void 0||n.value===void 0)&&W("matcher-pattern-missing-key-or-value",n),t?[t,n.key,n.value]:[n.key,n.value]));if(typeof r!="object"||r instanceof RegExp)return[t?[t,r,!0]:[r,!0]];const e=[];for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.push(t?[t,n,r[n]]:[n,r[n]]);return e}function ar(r,t,e){let n;return typeof r=="object"&&!(r instanceof RegExp)&&!Array.isArray(r)?(r.style!==void 0&&W("matcher-pattern-deprecated-attributes-style-key",r),r.class!==void 0&&W("matcher-pattern-deprecated-attributes-class-key",r)):n=["class","style"],t._collectAttributesMatch(Ut(r),e,n)}function lr(r,t,e){return t._collectAttributesMatch(Ut(r,"class"),e)}function cr(r,t,e){return t._collectAttributesMatch(Ut(r,"style"),e)}class qe{constructor(t){c(this,"_styles");c(this,"_cachedStyleNames",null);c(this,"_cachedExpandedStyleNames",null);c(this,"_styleProcessor");this._styles={},this._styleProcessor=t}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(t){this.clear();const e=hr(t);for(const[n,s]of e)this._styleProcessor.toNormalizedForm(n,s,this._styles);return this}has(t){if(this.isEmpty)return!1;const n=this._styleProcessor.getReducedForm(t,this._styles).find(([s])=>s===t);return Array.isArray(n)}set(t,e){if(this._cachedStyleNames=null,this._cachedExpandedStyleNames=null,ct(t))for(const[n,s]of Object.entries(t))this._styleProcessor.toNormalizedForm(n,s,this._styles);else this._styleProcessor.toNormalizedForm(t,e,this._styles)}remove(t){for(const e of le(t)){this._cachedStyleNames=null,this._cachedExpandedStyleNames=null;const n=Ot(e);Ks(this._styles,n),delete this._styles[e],this._cleanEmptyObjectsOnPath(n)}}getNormalized(t){return this._styleProcessor.getNormalized(t,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(t=>t.join(":")).sort().join(";")+";"}getAsString(t){if(this.isEmpty)return;if(this._styles[t]&&!ct(this._styles[t]))return this._styles[t];const n=this._styleProcessor.getReducedForm(t,this._styles).find(([s])=>s===t);if(Array.isArray(n))return n[1]}getStyleNames(t=!1){return this.isEmpty?[]:t?(this._cachedExpandedStyleNames=this._cachedExpandedStyleNames||this._styleProcessor.getStyleNames(this._styles),this._cachedExpandedStyleNames):(this._cachedStyleNames=this._cachedStyleNames||this.getStylesEntries().map(([e])=>e),this._cachedStyleNames)}keys(){return this.getStyleNames()}clear(){this._styles={},this._cachedStyleNames=null,this._cachedExpandedStyleNames=null}isSimilar(t){if(this.size!==t.size)return!1;for(const e of this.getStyleNames())if(!t.has(e)||t.getAsString(e)!==this.getAsString(e))return!1;return!0}getStylesEntries(){const t=[],e=Object.keys(this._styles);for(const n of e)t.push(...this._styleProcessor.getReducedForm(n,this._styles));return t}_clone(){const t=new this.constructor(this._styleProcessor);return t.set(this.getNormalized()),t}_getTokensMatch(t,e){const n=[];for(const s of this.getStyleNames(!0))if(ft(t,s)){if(e===!0){n.push(s);continue}const i=this.getAsString(s);ft(e,i)&&n.push(s)}return n.length?n:void 0}_getConsumables(t){const e=[];if(t){e.push(t);for(const n of this._styleProcessor.getRelatedStyles(t))e.push(n)}else for(const n of this.getStyleNames()){for(const s of this._styleProcessor.getRelatedStyles(n))e.push(s);e.push(n)}return e}_canMergeFrom(t){for(const e of t.getStyleNames())if(this.has(e)&&this.getAsString(e)!==t.getAsString(e))return!1;return!0}_mergeFrom(t){for(const e of t.getStyleNames())this.has(e)||this.set(e,t.getAsString(e))}_isMatching(t){for(const e of t.getStyleNames())if(!this.has(e)||this.getAsString(e)!==t.getAsString(e))return!1;return!0}_cleanEmptyObjectsOnPath(t){const e=t.split(".");if(!(e.length>1))return;const s=e.splice(0,e.length-1).join("."),i=ht(this._styles,s);if(!i)return;!Object.keys(i).length&&this.remove(s)}}class pl{constructor(){c(this,"_normalizers");c(this,"_extractors");c(this,"_reducers");c(this,"_consumables");this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(t,e,n){if(ct(e)){yt(n,Ot(t),e);return}if(this._normalizers.has(t)){const s=this._normalizers.get(t),{path:i,value:o}=s(e);yt(n,i,o)}else yt(n,t,e)}getNormalized(t,e){if(!t)return Gn({},e);if(e[t]!==void 0)return e[t];if(this._extractors.has(t)){const n=this._extractors.get(t);if(typeof n=="string")return ht(e,n);const s=n(t,e);if(s)return s}return ht(e,Ot(t))}getReducedForm(t,e){const n=this.getNormalized(t,e);return n===void 0?[]:this._reducers.has(t)?this._reducers.get(t)(n):[[t,n]]}getStyleNames(t){const e=new Set;for(const n of this._consumables.keys()){const s=this.getNormalized(n,t);s&&(typeof s!="object"||Object.keys(s).length)&&e.add(n)}for(const n of Object.keys(t))e.add(n);return Array.from(e)}getRelatedStyles(t){return this._consumables.get(t)||[]}setNormalizer(t,e){this._normalizers.set(t,e)}setExtractor(t,e){this._extractors.set(t,e)}setReducer(t,e){this._reducers.set(t,e)}setStyleRelation(t,e){this._mapStyleNames(t,e);for(const n of e)this._mapStyleNames(n,[t])}_mapStyleNames(t,e){this._consumables.has(t)||this._consumables.set(t,[]),this._consumables.get(t).push(...e)}}function hr(r){let t=null,e=0,n=0,s=null;const i=new Map;if(r==="")return i;r.charAt(r.length-1)!=";"&&(r=r+";");for(let o=0;o<r.length;o++){const a=r.charAt(o);if(t===null)switch(a){case":":s||(s=r.substr(e,o-e),n=o+1);break;case'"':case"'":t=a;break;case";":{const l=r.substr(n,o-n);s&&i.set(s.trim(),l.trim()),s=null,e=o+1;break}}else a===t&&(t=null)}return i}function Ot(r){return r.replace("-",".")}function yt(r,t,e){let n=e;ct(e)&&(n=Gn({},ht(r,t),e)),Ys(r,t,n)}class vt{constructor(){c(this,"_set",new Set)}get isEmpty(){return this._set.size==0}get size(){return this._set.size}has(t){return this._set.has(t)}keys(){return Array.from(this._set.keys())}setTo(t){this.clear();for(const e of t.split(/\s+/))e&&this._set.add(e);return this}set(t){for(const e of le(t))e&&this._set.add(e)}remove(t){for(const e of le(t))this._set.delete(e)}clear(){this._set.clear()}toString(){return Array.from(this._set).join(" ")}isSimilar(t){if(this.size!==t.size)return!1;for(const e of this.keys())if(!t.has(e))return!1;return!0}_clone(){const t=new this.constructor;return t._set=new Set(this._set),t}_getTokensMatch(t){const e=[];if(t===!0){for(const n of this._set.keys())e.push(n);return e}if(typeof t=="string"){for(const n of t.split(/\s+/))if(this._set.has(n))e.push(n);else return;return e}for(const n of this._set.keys())n.match(t)&&e.push(n);return e.length?e:void 0}_getConsumables(t){return t?[t]:this.keys()}_canMergeFrom(){return!0}_mergeFrom(t){for(const e of t._set.keys())this._set.has(e)||this._set.add(e)}_isMatching(t){for(const e of t._set.keys())if(!this._set.has(e))return!1;return!0}}let ne=class Hn extends ve{constructor(e,n,s,i){super(e);c(this,"name");c(this,"_unsafeAttributesToRender",[]);c(this,"_attrs");c(this,"_children");c(this,"_customProperties",new Map);this.name=n,this._attrs=this._parseAttributes(s),this._children=[],i&&this._insertChild(0,i)}get _classes(){return this._attrs.get("class")}get _styles(){return this._attrs.get("style")}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes&&(yield"class"),this._styles&&(yield"style");for(const e of this._attrs.keys())e!="class"&&e!="style"&&(yield e)}*getAttributes(){for(const[e,n]of this._attrs.entries())yield[e,String(n)]}getAttribute(e){return this._attrs.has(e)?String(this._attrs.get(e)):void 0}hasAttribute(e,n){return this._attrs.has(e)?n!==void 0?ke(this.name,e)||Oe(this.name,e)?this._attrs.get(e).has(n):this._attrs.get(e)===n:!0:!1}isSimilar(e){if(!(e instanceof Hn))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size)return!1;for(const[n,s]of this._attrs){const i=e._attrs.get(n);if(i===void 0)return!1;if(typeof s=="string"||typeof i=="string"){if(i!==s)return!1}else if(!s.isSimilar(i))return!1}return!0}hasClass(...e){for(const n of e)if(!this._classes||!this._classes.has(n))return!1;return!0}getClassNames(){const e=this._classes?this._classes.keys():[],n=e[Symbol.iterator]();return Object.assign(e,{next:n.next.bind(n)})}getStyle(e){return this._styles&&this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles&&this._styles.getNormalized(e)}getStyleNames(e){return this._styles?this._styles.getStyleNames(e):[]}hasStyle(...e){for(const n of e)if(!this._styles||!this._styles.has(n))return!1;return!0}findAncestor(...e){const n=new He(...e);let s=this.parent;for(;s&&!s.is("documentFragment");){if(n.match(s))return s;s=s.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=this._classes?this._classes.keys().sort().join(","):"",n=this._styles&&String(this._styles),s=Array.from(this._attrs).filter(([i])=>i!="style"&&i!="class").map(i=>`${i[0]}="${i[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(n?` style="${n}"`:"")+(s==""?"":` ${s}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const n=[];if(e)for(const i of this.getChildren())n.push(i._clone(e));const s=new this.constructor(this.document,this.name,this._attrs,n);return s._customProperties=new Map(this._customProperties),s.getFillerOffset=this.getFillerOffset,s._unsafeAttributesToRender=this._unsafeAttributesToRender,s}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,n){this._fireChange("children",this,{index:e});let s=0;const i=ur(this.document,n);for(const o of i)o.parent!==null&&o._remove(),o.parent=this,o.document=this.document,this._children.splice(e,0,o),e++,s++;return s}_removeChildren(e,n=1){this._fireChange("children",this,{index:e});for(let s=e;s<e+n;s++)this._children[s].parent=null;return this._children.splice(e,n)}_setAttribute(e,n,s=!0){if(this._fireChange("attributes",this),ke(this.name,e)||Oe(this.name,e)){let i=this._attrs.get(e);i||(i=ke(this.name,e)?new qe(this.document.stylesProcessor):new vt,this._attrs.set(e,i)),s?i.setTo(String(n)):ke(this.name,e)?Array.isArray(n)?i.set(n[0],n[1]):i.set(n):i.set(typeof n=="string"?n.split(/\s+/):n)}else this._attrs.set(e,String(n))}_removeAttribute(e,n){if(this._fireChange("attributes",this),n!==void 0&&(ke(this.name,e)||Oe(this.name,e))){const s=this._attrs.get(e);return s?(Oe(this.name,e)&&typeof n=="string"&&(n=n.split(/\s+/)),s.remove(n),s.isEmpty?this._attrs.delete(e):!1):!1}return this._attrs.delete(e)}_addClass(e){this._setAttribute("class",e,!1)}_removeClass(e){this._removeAttribute("class",e)}_setStyle(e,n){typeof e!="string"?this._setAttribute("style",e,!1):this._setAttribute("style",[e,n],!1)}_removeStyle(e){this._removeAttribute("style",e)}_collectAttributesMatch(e,n,s){for(const[i,o,a]of e){let l=!1,h=!1;for(const[u,m]of this._attrs)if(!(s&&s.includes(u)||!ft(i,u)))if(l=!0,typeof m=="string"){if(ft(o,m))n.push([u]),h=!0;else if(!(i instanceof RegExp))return!1}else{const p=m._getTokensMatch(o,a||!0);if(p){h=!0;for(const w of p)n.push([u,w])}else if(!(i instanceof RegExp))return!1}if(!l||!h)return!1}return!0}_getConsumables(e,n){const s=[];if(e){const i=this._attrs.get(e);if(i!==void 0)if(typeof i=="string")s.push([e]);else for(const o of i._getConsumables(n))s.push([e,o])}else for(const[i,o]of this._attrs)if(typeof o=="string")s.push([i]);else for(const a of o._getConsumables())s.push([i,a]);return{name:!e,attributes:s}}_canMergeAttributesFrom(e){if(this.name!=e.name)return!1;for(const[n,s]of e._attrs){const i=this._attrs.get(n);if(i!==void 0){if(typeof i=="string"||typeof s=="string"){if(i!==s)return!1}else if(!i._canMergeFrom(s))return!1}}return!0}_mergeAttributesFrom(e){this._fireChange("attributes",this);for(const[n,s]of e._attrs){const i=this._attrs.get(n);i===void 0||typeof i=="string"||typeof s=="string"?this._setAttribute(n,s):i._mergeFrom(s)}}_canSubtractAttributesOf(e){if(this.name!=e.name)return!1;for(const[n,s]of e._attrs){const i=this._attrs.get(n);if(i===void 0)return!1;if(typeof i=="string"||typeof s=="string"){if(i!==s)return!1}else if(!i._isMatching(s))return!1}return!0}_subtractAttributesOf(e){this._fireChange("attributes",this);for(const[n,s]of e._attrs){const i=this._attrs.get(n);typeof i=="string"||typeof s=="string"?this._attrs.delete(n):(i.remove(s.keys()),i.isEmpty&&this._attrs.delete(n))}}_setCustomProperty(e,n){this._customProperties.set(e,n)}_removeCustomProperty(e){return this._customProperties.delete(e)}_parseAttributes(e){const n=we(e);for(const[s,i]of n)if(i===null)n.delete(s);else if(ke(this.name,s)){const o=i instanceof qe?i._clone():new qe(this.document.stylesProcessor).setTo(String(i));n.set(s,o)}else if(Oe(this.name,s)){const o=i instanceof vt?i._clone():new vt().setTo(String(i));n.set(s,o)}else typeof i!="string"&&n.set(s,String(i));return n}};ne.prototype.is=function(r,t){return t?t===this.name&&(r==="element"||r==="view:element"):r==="element"||r==="view:element"||r==="node"||r==="view:node"};function ur(r,t){if(typeof t=="string")return[new N(r,t)];ce(t)||(t=[t]);const e=[];for(const n of t)typeof n=="string"?e.push(new N(r,n)):n instanceof Z?e.push(new N(r,n.data)):e.push(n);return e}function Oe(r,t){return t=="class"||r=="a"&&t=="rel"}function ke(r,t){return t=="style"}class Ke extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=fr}}Ke.prototype.is=function(r,t){return t?t===this.name&&(r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"):r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function fr(){const r=[...this.getChildren()],t=r[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const e of r)if(!e.is("uiElement"))return null;return this.childCount}class mt extends U(Ke){constructor(t,e,n,s){super(t,e,n,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(t),this.bind("isFocused").to(t,"isFocused",i=>i&&t.selection.editableElement==this),this.listenTo(t.selection,"change",()=>{this.isFocused=t.isFocused&&t.selection.editableElement==this})}destroy(){this.stopListening()}}mt.prototype.is=function(r,t){return t?t===this.name&&(r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"):r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};const ln=Symbol("rootName");class Kn extends mt{constructor(t,e){super(t,e),this.rootName="main"}get rootName(){return this.getCustomProperty(ln)}set rootName(t){this._setCustomProperty(ln,t)}set _name(t){this.name=t}}Kn.prototype.is=function(r,t){return t?t===this.name&&(r==="rootElement"||r==="view:rootElement"||r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"):r==="rootElement"||r==="view:rootElement"||r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};let ge=class{constructor(t={}){c(this,"direction");c(this,"boundaries");c(this,"singleCharacters");c(this,"shallow");c(this,"ignoreElementEnd");c(this,"_position");c(this,"_boundaryStartParent");c(this,"_boundaryEndParent");if(!t.boundaries&&!t.startPosition)throw new d("view-tree-walker-no-start-position",null);if(t.direction&&t.direction!="forward"&&t.direction!="backward")throw new d("view-tree-walker-unknown-direction",t.startPosition,{direction:t.direction});this.boundaries=t.boundaries||null,t.startPosition?this._position=_._createAt(t.startPosition):this._position=_._createAt(t.boundaries[t.direction=="backward"?"end":"start"]),this.direction=t.direction||"forward",this.singleCharacters=!!t.singleCharacters,this.shallow=!!t.shallow,this.ignoreElementEnd=!!t.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(t){let e,n;do n=this.position,e=this.next();while(!e.done&&t(e.value));e.done||(this._position=n)}jumpTo(t){this._boundaryStartParent&&t.isBefore(this.boundaries.start)?t=this.boundaries.start:this._boundaryEndParent&&t.isAfter(this.boundaries.end)&&(t=this.boundaries.end),this._position=t.clone()}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let t=this.position.clone();const e=this.position,n=t.parent;if(n.parent===null&&t.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;if(n&&n.is("view:$text")){if(t.isAtEnd)return this._position=_._createAfter(n),this._next();s=n.data[t.offset]}else s=n.getChild(t.offset);if(typeof s=="string"){let i;this.singleCharacters?i=1:i=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-t.offset;const o=new Z(n,t.offset,i);return t.offset+=i,this._position=t,this._formatReturnValue("text",o,e,t,i)}if(s&&s.is("view:element")){if(!this.shallow)t=new _(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,this._formatReturnValue("elementStart",s,e,t,1)}if(s&&s.is("view:$text")){if(this.singleCharacters)return t=new _(s,0),this._position=t,this._next();let i=s.data.length,o;return s==this._boundaryEndParent?(i=this.boundaries.end.offset,o=new Z(s,0,i),t=_._createAfter(o)):(o=new Z(s,0,s.data.length),t.offset++),this._position=t,this._formatReturnValue("text",o,e,t,i)}return t=_._createAfter(n),this._position=t,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,e,t)}_previous(){let t=this.position.clone();const e=this.position,n=t.parent;if(n.parent===null&&t.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(n.is("view:$text")){if(t.isAtStart)return this._position=_._createBefore(n),this._previous();s=n.data[t.offset-1]}else s=n.getChild(t.offset-1);if(typeof s=="string"){let i;if(this.singleCharacters)i=1;else{const a=n===this._boundaryStartParent?this.boundaries.start.offset:0;i=t.offset-a}t.offset-=i;const o=new Z(n,t.offset,i);return this._position=t,this._formatReturnValue("text",o,e,t,i)}if(s&&s.is("view:element"))return this.shallow?(t.offset--,this._position=t,this._formatReturnValue("elementStart",s,e,t,1)):(t=new _(s,s.childCount),this._position=t,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,e,t));if(s&&s.is("view:$text")){if(this.singleCharacters)return t=new _(s,s.data.length),this._position=t,this._previous();let i=s.data.length,o;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;o=new Z(s,a,s.data.length-a),i=o.data.length,t=_._createBefore(o)}else o=new Z(s,0,s.data.length),t.offset--;return this._position=t,this._formatReturnValue("text",o,e,t,i)}return t=_._createBefore(n),this._position=t,this._formatReturnValue("elementStart",n,e,t,1)}_formatReturnValue(t,e,n,s,i){return e.is("view:$textProxy")&&(e.offsetInText+e.data.length==e.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=_._createAfter(e.textNode),this._position=s):n=_._createAfter(e.textNode)),e.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=_._createBefore(e.textNode),this._position=s):n=_._createBefore(e.textNode))),{done:!1,value:{type:t,item:e,previousPosition:n,nextPosition:s,length:i}}}},_=class Q extends ye{constructor(e,n){super();c(this,"parent");c(this,"offset");this.parent=e,this.offset=n}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof mt);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const n=Q._createAt(this),s=n.offset+e;return n.offset=s<0?0:s,n}getLastMatchingPosition(e,n={}){n.startPosition=this;const s=new ge(n);return s.skip(e),s.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const n=this.getAncestors(),s=e.getAncestors();let i=0;for(;n[i]==s[i]&&n[i];)i++;return i===0?null:n[i-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const n=this.parent.is("node")?this.parent.getPath():[],s=e.parent.is("node")?e.parent.getPath():[];n.push(this.offset),s.push(e.offset);const i=F(n,s);switch(i){case"prefix":return"before";case"extension":return"after";default:return n[i]<s[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new ge(e)}clone(){return new Q(this.parent,this.offset)}static _createAt(e,n){if(e instanceof Q)return new this(e.parent,e.offset);{const s=e;if(n=="end")n=s.is("$text")?s.data.length:s.childCount;else{if(n=="before")return this._createBefore(s);if(n=="after")return this._createAfter(s);if(n!==0&&!n)throw new d("view-createpositionat-offset-required",s)}return new Q(s,n)}}static _createAfter(e){if(e.is("$textProxy"))return new Q(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new d("view-position-after-root",e,{root:e});return new Q(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new Q(e.textNode,e.offsetInText);if(!e.parent)throw new d("view-position-before-root",e,{root:e});return new Q(e.parent,e.index)}};_.prototype.is=function(r){return r==="position"||r==="view:position"};let b=class re extends ye{constructor(e,n=null){super();c(this,"start");c(this,"end");this.start=e.clone(),this.end=n?n.clone():e.clone()}*[Symbol.iterator](){yield*new ge({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(nt,{direction:"backward"}),n=this.end.getLastMatchingPosition(nt);return e.parent.is("$text")&&e.isAtStart&&(e=_._createBefore(e.parent)),n.parent.is("$text")&&n.isAtEnd&&(n=_._createAfter(n.parent)),new re(e,n)}getTrimmed(){let e=this.start.getLastMatchingPosition(nt);if(e.isAfter(this.end)||e.isEqual(this.end))return new re(e,e);let n=this.end.getLastMatchingPosition(nt,{direction:"backward"});const s=e.nodeAfter,i=n.nodeBefore;return s&&s.is("$text")&&(e=new _(s,0)),i&&i.is("$text")&&(n=new _(i,i.data.length)),new re(e,n)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,n=!1){e.isCollapsed&&(n=!1);const s=this.containsPosition(e.start)||n&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||n&&this.end.isEqual(e.end);return s&&i}getDifference(e){const n=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&n.push(new re(this.start,e.start)),this.containsPosition(e.end)&&n.push(new re(e.end,this.end))):n.push(this.clone()),n}getIntersection(e){if(this.isIntersecting(e)){let n=this.start,s=this.end;return this.containsPosition(e.start)&&(n=e.start),this.containsPosition(e.end)&&(s=e.end),new re(n,s)}return null}getWalker(e={}){return e.boundaries=this,new ge(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,n=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(n=this.end.parent.previousSibling),e&&e.is("element")&&e===n?e:null}clone(){return new re(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const n=new ge(e);for(const s of n)yield s.item}*getPositions(e={}){e.boundaries=this;const n=new ge(e);yield n.position;for(const s of n)yield s.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,n,s,i){return new this(new _(e,n),new _(s,i))}static _createFromPositionAndShift(e,n){const s=e,i=e.getShiftedBy(n);return n>0?new this(s,i):new this(i,s)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const n=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(_._createBefore(e),n)}};b.prototype.is=function(r){return r==="range"||r==="view:range"};function nt(r){return!!(r.item.is("attributeElement")||r.item.is("uiElement"))}let ee=class Xn extends O(ye){constructor(...e){super();c(this,"_ranges");c(this,"_lastRangeBackward");c(this,"_isFake");c(this,"_fakeSelectionLabel");this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const n of this._ranges)(!e||n.start.isBefore(e.start))&&(e=n);return e?e.clone():null}getLastRange(){let e=null;for(const n of this._ranges)(!e||n.end.isAfter(e.end))&&(e=n);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const n of this._ranges){let s=!1;for(const i of e._ranges)if(n.isEqual(i)){s=!0;break}if(!s)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const n=tn(this.getRanges()),s=tn(e.getRanges());if(n!=s)return!1;if(n==0)return!0;for(let i of this.getRanges()){i=i.getTrimmed();let o=!1;for(let a of e.getRanges())if(a=a.getTrimmed(),i.start.isEqual(a.start)&&i.end.isEqual(a.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[n,s,i]=e;if(typeof s=="object"&&(i=s,s=void 0),n===null)this._setRanges([]),this._setFakeOptions(i);else if(n instanceof Xn||n instanceof Jt)this._setRanges(n.getRanges(),n.isBackward),this._setFakeOptions({fake:n.isFake,label:n.fakeSelectionLabel});else if(n instanceof b)this._setRanges([n],i&&i.backward),this._setFakeOptions(i);else if(n instanceof _)this._setRanges([new b(n)]),this._setFakeOptions(i);else if(n instanceof ve){const o=!!i&&!!i.backward;let a;if(s===void 0)throw new d("view-selection-setto-required-second-parameter",this);s=="in"?a=b._createIn(n):s=="on"?a=b._createOn(n):a=new b(_._createAt(n,s)),this._setRanges([a],o),this._setFakeOptions(i)}else if(ce(n))this._setRanges(n,i&&i.backward),this._setFakeOptions(i);else throw new d("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,n){if(this.anchor===null)throw new d("view-selection-setfocus-no-ranges",this);const s=_._createAt(e,n);if(s.compareWith(this.focus)=="same")return;const i=this.anchor;this._ranges.pop(),s.compareWith(i)=="before"?this._addRange(new b(s,i),!0):this._addRange(new b(i,s)),this.fire("change")}_setRanges(e,n=!1){e=Array.from(e),this._ranges=[];for(const s of e)this._addRange(s);this._lastRangeBackward=!!n}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,n=!1){if(!(e instanceof b))throw new d("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!n}_pushRange(e){for(const n of this._ranges)if(e.isIntersecting(n))throw new d("view-selection-range-intersects",this,{addedRange:e,intersectingRange:n});this._ranges.push(new b(e.start,e.end))}};ee.prototype.is=function(r){return r==="selection"||r==="view:selection"};let Jt=class extends O(ye){constructor(...e){super();c(this,"_selection");this._selection=new ee,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,n){this._selection.setFocus(e,n)}};Jt.prototype.is=function(r){return r==="selection"||r=="documentSelection"||r=="view:selection"||r=="view:documentSelection"};class jt extends Tt{constructor(e,n,s){super(e,n);c(this,"startRange");c(this,"_eventPhase");c(this,"_currentTarget");this.startRange=s,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const Pt=Symbol("bubbling contexts");function It(r){class t extends r{fire(n,...s){try{const i=n instanceof Tt?n:new Tt(this,n),o=Ct(this);if(!o.size)return;if(Ie(i,"capturing",this),Ae(o,"$capture",i,...s))return i.return;const a=i.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,h=l?!!Yn(o,l):!1;let u=l||dr(a);if(Ie(i,"atTarget",u),!h){if(Ae(o,"$text",i,...s))return i.return;Ie(i,"bubbling",u)}for(;u;){if(u.is("rootElement")){if(Ae(o,"$root",i,...s))return i.return}else if(u.is("element")&&Ae(o,u.name,i,...s))return i.return;if(Ae(o,u,i,...s))return i.return;u=u.parent,Ie(i,"bubbling",u)}return Ie(i,"bubbling",this),Ae(o,"$document",i,...s),i.return}catch(i){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(i,this)}}_addEventListener(n,s,i){const o=le(i.context||"$document"),a=Ct(this);for(const l of o){let h=a.get(l);h||(h=new(O()),a.set(l,h)),this.listenTo(h,n,s,i)}}_removeEventListener(n,s){const i=Ct(this);for(const o of i.values())this.stopListening(o,n,s)}}return t}{const r=It(Object);["fire","_addEventListener","_removeEventListener"].forEach(t=>{It[t]=r.prototype[t]})}function Ie(r,t,e){r instanceof jt&&(r._eventPhase=t,r._currentTarget=e)}function Ae(r,t,e,...n){const s=typeof t=="string"?r.get(t):Yn(r,t);return s?(s.fire(e,...n),e.stop.called):!1}function Yn(r,t){for(const[e,n]of r)if(typeof e=="function"&&e(t))return n;return null}function Ct(r){return r[Pt]||(r[Pt]=new Map),r[Pt]}function dr(r){if(!r)return null;const t=r.start.parent,e=r.end.parent,n=t.getPath(),s=e.getPath();return n.length>s.length?t:e}let Qn=class extends It(U()){constructor(e){super();c(this,"selection");c(this,"roots");c(this,"stylesProcessor");c(this,"_postFixers",new Set);this.selection=new Jt,this.roots=new qt({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let n=!1;do for(const s of this._postFixers)if(n=s(e),n)break;while(n)}};const cn=10;class pe extends ne{constructor(e,n,s,i){super(e,n,s,i);c(this,"_priority",cn);c(this,"_id",null);c(this,"_clonesGroup",null);this.getFillerOffset=mr}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new d("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const n=super._clone(e);return n._priority=this._priority,n._id=this._id,n}_canMergeAttributesFrom(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canMergeAttributesFrom(e)}_canSubtractAttributesOf(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canSubtractAttributesOf(e)}}c(pe,"DEFAULT_PRIORITY",cn);pe.prototype.is=function(r,t){return t?t===this.name&&(r==="attributeElement"||r==="view:attributeElement"||r==="element"||r==="view:element"):r==="attributeElement"||r==="view:attributeElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function mr(){if(kt(this))return null;let r=this.parent;for(;r&&r.is("attributeElement");){if(kt(r)>1)return null;r=r.parent}return!r||kt(r)>1?null:this.childCount}function kt(r){return Array.from(r.getChildren()).filter(t=>!t.is("uiElement")).length}class Gt extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=gr}_insertChild(t,e){if(e&&(e instanceof ve||Array.from(e).length>0))throw new d("view-emptyelement-cannot-add",[this,e]);return 0}}Gt.prototype.is=function(r,t){return t?t===this.name&&(r==="emptyElement"||r==="view:emptyElement"||r==="element"||r==="view:element"):r==="emptyElement"||r==="view:emptyElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function gr(){return null}class gt extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=_r}_insertChild(t,e){if(e&&(e instanceof ve||Array.from(e).length>0))throw new d("view-uielement-cannot-add",[this,e]);return 0}render(t,e){return this.toDomElement(t)}toDomElement(t){const e=t.createElement(this.name);for(const n of this.getAttributeKeys())e.setAttribute(n,this.getAttribute(n));return e}}gt.prototype.is=function(r,t){return t?t===this.name&&(r==="uiElement"||r==="view:uiElement"||r==="element"||r==="view:element"):r==="uiElement"||r==="view:uiElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function pr(r){r.document.on("arrowKey",(t,e)=>wr(t,e,r.domConverter),{priority:"low"})}function _r(){return null}function wr(r,t,e){if(t.keyCode==me.arrowright){const n=t.domTarget.ownerDocument.defaultView.getSelection(),s=n.rangeCount==1&&n.getRangeAt(0).collapsed;if(s||t.shiftKey){const i=n.focusNode,o=n.focusOffset,a=e.domPositionToView(i,o);if(a===null)return;let l=!1;const h=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){const u=e.viewPositionToDom(h);s?n.collapse(u.parent,u.offset):n.extend(u.parent,u.offset)}}}}class Ht extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=br}_insertChild(t,e){if(e&&(e instanceof ve||Array.from(e).length>0))throw new d("view-rawelement-cannot-add",[this,e]);return 0}render(t,e){}}Ht.prototype.is=function(r,t){return t?t===this.name&&(r==="rawElement"||r==="view:rawElement"||r==="element"||r==="view:element"):r==="rawElement"||r==="view:rawElement"||r===this.name||r==="view:"+this.name||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function br(){return null}let _e=class extends O(ye){constructor(e,n){super();c(this,"document");c(this,"_children",[]);c(this,"_customProperties",new Map);this.document=e,n&&this._insertChild(0,n)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,n){this._fireChange("children",this,{index:e});let s=0;const i=yr(this.document,n);for(const o of i)o.parent!==null&&o._remove(),o.parent=this,this._children.splice(e,0,o),e++,s++;return s}_removeChildren(e,n=1){this._fireChange("children",this,{index:e});for(let s=e;s<e+n;s++)this._children[s].parent=null;return this._children.splice(e,n)}_fireChange(e,n,s){this.fire(`change:${e}`,n,s)}_setCustomProperty(e,n){this._customProperties.set(e,n)}_removeCustomProperty(e){return this._customProperties.delete(e)}};_e.prototype.is=function(r){return r==="documentFragment"||r==="view:documentFragment"};function yr(r,t){return typeof t=="string"?[new N(r,t)]:(ce(t)||(t=[t]),Array.from(t).map(e=>typeof e=="string"?new N(r,e):e instanceof Z?new N(r,e.data):e))}class Zn{constructor(t){c(this,"document");c(this,"_cloneGroups",new Map);c(this,"_slotFactory",null);this.document=t}setSelection(...t){this.document.selection._setTo(...t)}setSelectionFocus(t,e){this.document.selection._setFocus(t,e)}createDocumentFragment(t){return new _e(this.document,t)}createText(t){return new N(this.document,t)}createAttributeElement(t,e,n={}){const s=new pe(this.document,t,e);return typeof n.priority=="number"&&(s._priority=n.priority),n.id&&(s._id=n.id),n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createContainerElement(t,e,n={},s={}){let i=null;Mt(n)?s=n:i=n;const o=new Ke(this.document,t,e,i);return s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}createEditableElement(t,e,n={}){const s=new mt(this.document,t,e);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createEmptyElement(t,e,n={}){const s=new Gt(this.document,t,e);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createUIElement(t,e,n){const s=new gt(this.document,t,e);return n&&(s.render=n),s}createRawElement(t,e,n,s={}){const i=new Ht(this.document,t,e);return n&&(i.render=n),s.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),i}setAttribute(t,e,n,s){s!==void 0?s._setAttribute(t,e,n):n._setAttribute(t,e)}removeAttribute(t,e,n){n!==void 0?n._removeAttribute(t,e):e._removeAttribute(t)}addClass(t,e){e._addClass(t)}removeClass(t,e){e._removeClass(t)}setStyle(t,e,n){Mt(t)&&n===void 0?e._setStyle(t):n._setStyle(t,e)}removeStyle(t,e){e._removeStyle(t)}setCustomProperty(t,e,n){n._setCustomProperty(t,e)}removeCustomProperty(t,e){return e._removeCustomProperty(t)}breakAttributes(t){return t instanceof _?this._breakAttributes(t):this._breakAttributesRange(t)}breakContainer(t){const e=t.parent;if(!e.is("containerElement"))throw new d("view-writer-break-non-container-element",this.document);if(!e.parent)throw new d("view-writer-break-root",this.document);if(t.isAtStart)return _._createBefore(e);if(!t.isAtEnd){const n=e._clone(!1);this.insert(_._createAfter(e),n);const s=new b(t,_._createAt(e,"end")),i=new _(n,0);this.move(s,i)}return _._createAfter(e)}mergeAttributes(t){const e=t.offset,n=t.parent;if(n.is("$text"))return t;if(n.is("attributeElement")&&n.childCount===0){const o=n.parent,a=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new _(o,a))}const s=n.getChild(e-1),i=n.getChild(e);if(!s||!i)return t;if(s.is("$text")&&i.is("$text"))return un(s,i);if(s.is("attributeElement")&&i.is("attributeElement")&&s.isSimilar(i)){const o=s.childCount;return s._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new _(s,o))}return t}mergeContainers(t){const e=t.nodeBefore,n=t.nodeAfter;if(!e||!n||!e.is("containerElement")||!n.is("containerElement"))throw new d("view-writer-merge-containers-invalid-position",this.document);const s=e.getChild(e.childCount-1),i=s instanceof N?_._createAt(s,"end"):_._createAt(e,"end");return this.move(b._createIn(n),_._createAt(e,"end")),this.remove(b._createOn(n)),i}insert(t,e){e=ce(e)?[...e]:[e],es(e,this.document);const n=e.reduce((o,a)=>{const l=o[o.length-1],h=!a.is("uiElement");return!l||l.breakAttributes!=h?o.push({breakAttributes:h,nodes:[a]}):l.nodes.push(a),o},[]);let s=null,i=t;for(const{nodes:o,breakAttributes:a}of n){const l=this._insertNodes(i,o,a);s||(s=l.start),i=l.end}return s?new b(s,i):new b(t)}remove(t){const e=t instanceof b?t:b._createOn(t);if(Fe(e,this.document),e.isCollapsed)return new _e(this.document);const{start:n,end:s}=this._breakAttributesRange(e,!0),i=n.parent,o=s.offset-n.offset,a=i._removeChildren(n.offset,o);for(const h of a)this._removeFromClonedElementsGroup(h);const l=this.mergeAttributes(n);return e.start=l,e.end=l.clone(),new _e(this.document,a)}clear(t,e){Fe(t,this.document);const n=t.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of n){const i=s.item;let o;if(i.is("element")&&e.isSimilar(i))o=b._createOn(i);else if(!s.nextPosition.isAfter(t.start)&&i.is("$textProxy")){const a=i.getAncestors().find(l=>l.is("element")&&e.isSimilar(l));a&&(o=b._createIn(a))}o&&(o.end.isAfter(t.end)&&(o.end=t.end),o.start.isBefore(t.start)&&(o.start=t.start),this.remove(o))}}move(t,e){let n;if(e.isAfter(t.end)){e=this._breakAttributes(e,!0);const s=e.parent,i=s.childCount;t=this._breakAttributesRange(t,!0),n=this.remove(t),e.offset+=s.childCount-i}else n=this.remove(t);return this.insert(e,n)}wrap(t,e){if(!(e instanceof pe))throw new d("view-writer-wrap-invalid-attribute",this.document);if(Fe(t,this.document),t.isCollapsed){let n=t.start;n.parent.is("element")&&!vr(n.parent)&&(n=n.getLastMatchingPosition(i=>i.item.is("uiElement"))),n=this._wrapPosition(n,e);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(t.start)&&this.setSelection(n),new b(n)}else return this._wrapRange(t,e)}unwrap(t,e){if(!(e instanceof pe))throw new d("view-writer-unwrap-invalid-attribute",this.document);if(Fe(t,this.document),t.isCollapsed)return t;const{start:n,end:s}=this._breakAttributesRange(t,!0),i=n.parent,o=this._unwrapChildren(i,n.offset,s.offset,e),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new b(a,l)}rename(t,e){const n=new Ke(this.document,t,e.getAttributes());return this.insert(_._createAfter(e),n),this.move(b._createIn(e),_._createAt(n,0)),this.remove(b._createOn(e)),n}clearClonedElementsGroup(t){this._cloneGroups.delete(t)}createPositionAt(t,e){return _._createAt(t,e)}createPositionAfter(t){return _._createAfter(t)}createPositionBefore(t){return _._createBefore(t)}createRange(t,e){return new b(t,e)}createRangeOn(t){return b._createOn(t)}createRangeIn(t){return b._createIn(t)}createSelection(...t){return new ee(...t)}createSlot(t="children"){if(!this._slotFactory)throw new d("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,t)}_registerSlotFactory(t){this._slotFactory=t}_clearSlotFactory(){this._slotFactory=null}_insertNodes(t,e,n){let s;if(n?s=Ft(t):s=t.parent.is("$text")?t.parent.parent:t.parent,!s)throw new d("view-writer-invalid-position-container",this.document);let i;n?i=this._breakAttributes(t,!0):i=t.parent.is("$text")?At(t):t;const o=s._insertChild(i.offset,e);for(const u of e)this._addToClonedElementsGroup(u);const a=i.getShiftedBy(o),l=this.mergeAttributes(i);l.isEqual(i)||a.offset--;const h=this.mergeAttributes(a);return new b(l,h)}_wrapChildren(t,e,n,s){let i=e;const o=[];for(;i<n;){const l=t.getChild(i),h=l.is("$text"),u=l.is("attributeElement");if(u&&l._canMergeAttributesFrom(s))l._mergeAttributesFrom(s),o.push(new _(t,i));else if(h||!u||Pr(s,l)){const m=s._clone();l._remove(),m._appendChild(l),t._insertChild(i,m),this._addToClonedElementsGroup(m),o.push(new _(t,i))}else this._wrapChildren(l,0,l.childCount,s);i++}let a=0;for(const l of o){if(l.offset-=a,l.offset==e)continue;this.mergeAttributes(l).isEqual(l)||(a++,n--)}return b._createFromParentsAndOffsets(t,e,t,n)}_unwrapChildren(t,e,n,s){let i=e;const o=[];for(;i<n;){const l=t.getChild(i);if(!l.is("attributeElement")){i++;continue}if(l.isSimilar(s)){const h=l.getChildren(),u=l.childCount;l._remove(),t._insertChild(i,h),this._removeFromClonedElementsGroup(l),o.push(new _(t,i),new _(t,i+u)),i+=u,n+=u-1;continue}if(l._canSubtractAttributesOf(s)){l._subtractAttributesOf(s),o.push(new _(t,i),new _(t,i+1)),i++;continue}this._unwrapChildren(l,0,l.childCount,s),i++}let a=0;for(const l of o){if(l.offset-=a,l.offset==e||l.offset==n)continue;this.mergeAttributes(l).isEqual(l)||(a++,n--)}return b._createFromParentsAndOffsets(t,e,t,n)}_wrapRange(t,e){const{start:n,end:s}=this._breakAttributesRange(t,!0),i=n.parent,o=this._wrapChildren(i,n.offset,s.offset,e),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new b(a,l)}_wrapPosition(t,e){if(e.isSimilar(t.parent))return hn(t.clone());t.parent.is("$text")&&(t=At(t));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,t.parent._insertChild(t.offset,n);const s=new b(t,t.getShiftedBy(1));this.wrap(s,e);const i=new _(n.parent,n.index);n._remove();const o=i.nodeBefore,a=i.nodeAfter;return o&&o.is("view:$text")&&a&&a.is("view:$text")?un(o,a):hn(i)}_breakAttributesRange(t,e=!1){const n=t.start,s=t.end;if(Fe(t,this.document),t.isCollapsed){const l=this._breakAttributes(t.start,e);return new b(l,l)}const i=this._breakAttributes(s,e),o=i.parent.childCount,a=this._breakAttributes(n,e);return i.offset+=i.parent.childCount-o,new b(a,i)}_breakAttributes(t,e=!1){const n=t.offset,s=t.parent;if(t.parent.is("emptyElement"))throw new d("view-writer-cannot-break-empty-element",this.document);if(t.parent.is("uiElement"))throw new d("view-writer-cannot-break-ui-element",this.document);if(t.parent.is("rawElement"))throw new d("view-writer-cannot-break-raw-element",this.document);if(!e&&s.is("$text")&&Bt(s.parent)||Bt(s))return t.clone();if(s.is("$text"))return this._breakAttributes(At(t),e);const i=s.childCount;if(n==i){const o=new _(s.parent,s.index+1);return this._breakAttributes(o,e)}else if(n===0){const o=new _(s.parent,s.index);return this._breakAttributes(o,e)}else{const o=s.index+1,a=s._clone();s.parent._insertChild(o,a),this._addToClonedElementsGroup(a);const l=s.childCount-n,h=s._removeChildren(n,l);a._appendChild(h);const u=new _(s.parent,o);return this._breakAttributes(u,e)}}_addToClonedElementsGroup(t){if(!t.root.is("rootElement"))return;if(t.is("element"))for(const s of t.getChildren())this._addToClonedElementsGroup(s);const e=t.id;if(!e)return;let n=this._cloneGroups.get(e);n||(n=new Set,this._cloneGroups.set(e,n)),n.add(t),t._clonesGroup=n}_removeFromClonedElementsGroup(t){if(t.is("element"))for(const s of t.getChildren())this._removeFromClonedElementsGroup(s);const e=t.id;if(!e)return;const n=this._cloneGroups.get(e);n&&n.delete(t)}}function vr(r){return Array.from(r.getChildren()).some(t=>!t.is("uiElement"))}function Ft(r){let t=r.parent;for(;!Bt(t);){if(!t)return;t=t.parent}return t}function Pr(r,t){return r.priority<t.priority?!0:r.priority>t.priority?!1:r.getIdentity()<t.getIdentity()}function hn(r){const t=r.nodeBefore;if(t&&t.is("$text"))return new _(t,t.data.length);const e=r.nodeAfter;return e&&e.is("$text")?new _(e,0):r}function At(r){if(r.offset==r.parent.data.length)return new _(r.parent.parent,r.parent.index+1);if(r.offset===0)return new _(r.parent.parent,r.parent.index);const t=r.parent.data.slice(r.offset);return r.parent._data=r.parent.data.slice(0,r.offset),r.parent.parent._insertChild(r.parent.index+1,new N(r.root.document,t)),new _(r.parent.parent,r.parent.index+1)}function un(r,t){const e=r.data.length;return r._data+=t.data,t._remove(),new _(r,e)}const Cr=[N,pe,Ke,Gt,Ht,gt];function es(r,t){for(const e of r){if(!Cr.some(n=>e instanceof n))throw new d("view-writer-insert-invalid-node-type",t);e.is("$text")||es(e.getChildren(),t)}}function Bt(r){return r&&(r.is("containerElement")||r.is("documentFragment"))}function Fe(r,t){const e=Ft(r.start),n=Ft(r.end);if(!e||!n||e!==n)throw new d("view-writer-invalid-range-container",t)}const ts=r=>r.createTextNode(" "),ns=r=>{const t=r.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},ss=r=>{const t=r.createElement("br");return t.dataset.ckeFiller="true",t},j=7,Xe="⁠".repeat(j);function $(r){return typeof r=="string"?r.substr(0,j)===Xe:R(r)&&r.data.substr(0,j)===Xe}function Te(r){return r.data.length==j&&$(r)}function fn(r){const t=typeof r=="string"?r:r.data;return $(r)?t.slice(j):t}function kr(r){r.document.on("arrowKey",Ar,{priority:"low"})}function Ar(r,t){if(t.keyCode==me.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(e.rangeCount==1&&e.getRangeAt(0).collapsed){const n=e.getRangeAt(0).startContainer,s=e.getRangeAt(0).startOffset;$(n)&&s<=j&&e.collapse(n,0)}}}class Sr extends U(){constructor(e,n){super();c(this,"domDocuments",new Set);c(this,"domConverter");c(this,"markedAttributes",new Set);c(this,"markedChildren",new Set);c(this,"markedTexts",new Set);c(this,"selection");c(this,"_inlineFiller",null);c(this,"_fakeSelectionContainer",null);this.domConverter=e,this.selection=n,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),T.isBlink&&!T.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()})}markToSync(e,n){if(e==="text")this.domConverter.mapViewToDom(n.parent)&&this.markedTexts.add(n);else{if(!this.domConverter.mapViewToDom(n))return;if(e==="attributes")this.markedAttributes.add(n);else if(e==="children")this.markedChildren.add(n);else throw new d("view-renderer-unknown-type",this)}}render(){if(this.isComposing&&!T.isAndroid)return;let e=null;const n=T.isBlink&&!T.isAndroid?!this.isSelecting:!0;for(const s of this.markedChildren)this._updateChildrenMappings(s);n?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=_._createBefore(e.parent)));for(const s of this.markedAttributes)this._updateAttrs(s);for(const s of this.markedChildren)this._updateChildren(s,{inlineFillerPosition:e});for(const s of this.markedTexts)!this.markedChildren.has(s.parent)&&this.domConverter.mapViewToDom(s.parent)&&this._updateText(s,{inlineFillerPosition:e});if(n)if(e){const s=this.domConverter.viewPositionToDom(e),i=s.parent.ownerDocument;$(s.parent)?this._inlineFiller=s.parent:this._inlineFiller=dn(i,s.parent,s.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const n=this.domConverter.mapViewToDom(e);if(!n)return;const s=Array.from(n.childNodes),i=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),o=this._diffNodeLists(s,i),a=this._findUpdateActions(o,s,i,Rr);if(a.indexOf("update")!==-1){const l={equal:0,insert:0,delete:0};for(const h of a)if(h==="update"){const u=l.equal+l.insert,m=l.equal+l.delete,p=e.getChild(u);p&&!p.is("uiElement")&&!p.is("rawElement")&&this._updateElementMappings(p,s[m]),sn(i[u]),l.equal++}else l[h]++}}_updateElementMappings(e,n){this.domConverter.unbindDomElement(n),this.domConverter.bindElements(n,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?_._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),n=this.domConverter.viewPositionToDom(e);return!!(n&&R(n.parent)&&$(n.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!$(e))throw new d("view-renderer-filler-was-lost",this);Te(e)?e.remove():e.data=e.data.substr(j),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),n=e.parent,s=e.offset;if(!this.domConverter.mapViewToDom(n.root)||!n.is("element")||!Er(n))return!1;const i=e.nodeBefore,o=e.nodeAfter;return!(i instanceof N||o instanceof N||s===n.getFillerOffset()&&(!i||!i.is("element","br"))||T.isAndroid&&(i||o))}_updateText(e,n){const s=this.domConverter.findCorrespondingDomText(e);let o=this.domConverter.viewToDom(e).data;const a=n.inlineFillerPosition;a&&a.parent==e.parent&&a.offset==e.index&&(o=Xe+o),this._updateTextNode(s,o)}_updateAttrs(e){const n=this.domConverter.mapViewToDom(e);if(n){for(const s of Array.from(n.attributes)){const i=s.name;e.hasAttribute(i)||this.domConverter.removeDomElementAttribute(n,i)}for(const s of e.getAttributeKeys())this.domConverter.setDomElementAttribute(n,s,e.getAttribute(s),e)}}_updateChildren(e,n){const s=this.domConverter.mapViewToDom(e);if(!s)return;if(T.isAndroid){let p=null;for(const w of Array.from(s.childNodes)){if(p&&R(p)&&R(w)){s.normalize();break}p=w}}const i=n.inlineFillerPosition,o=s.childNodes,a=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));i&&i.parent===e&&dn(s.ownerDocument,a,i.offset);const l=this._diffNodeLists(o,a),h=this._findUpdateActions(l,o,a,Tr);let u=0;const m=new Set;for(const p of h)p==="delete"?(m.add(o[u]),sn(o[u])):(p==="equal"||p==="update")&&u++;u=0;for(const p of h)p==="insert"?(Jn(s,u,a[u]),u++):p==="update"?(this._updateTextNode(o[u],a[u].data),u++):p==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(a[u])),u++);for(const p of m)p.parentNode||this.domConverter.unbindDomElement(p)}_diffNodeLists(e,n){return e=Nr(e,this._fakeSelectionContainer),pt(e,n,Mr.bind(null,this.domConverter))}_findUpdateActions(e,n,s,i){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let o=[],a=[],l=[];const h={equal:0,insert:0,delete:0};for(const u of e)u==="insert"?l.push(s[h.equal+h.insert]):u==="delete"?a.push(n[h.equal+h.delete]):(o=o.concat(pt(a,l,i).map(m=>m==="equal"?"update":m)),o.push("equal"),a=[],l=[]),h[u]++;return o.concat(pt(a,l,i).map(u=>u==="equal"?"update":u))}_updateTextNode(e,n){const s=e.data;s!=n&&(T.isAndroid&&this.isComposing&&s.replace(/\u00A0/g," ")==n.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,n))}_updateTextNodeInternal(e,n){const s=Js(e.data,n);for(const i of s)i.type==="insert"?e.insertData(i.index,i.values.join("")):e.deleteData(i.index,i.howMany)}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const n of e.getChildren())this._markDescendantTextToSync(n)}}_updateSelection(){if(T.isBlink&&!T.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}const e=this.domConverter.mapViewToDom(this.selection.editableElement);!this.isFocused||!e||(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&T.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const n=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=Or(n));const s=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(s,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!s.parentElement||s.parentElement!=e)&&e.appendChild(s),s.textContent=this.selection.fakeSelectionLabel||" ";const i=n.getSelection(),o=n.createRange();i.removeAllRanges(),o.selectNodeContents(s),i.addRange(o)}_updateDomSelection(e){const n=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(n))return;const s=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);n.setBaseAndExtent(s.parent,s.offset,i.parent,i.offset),T.isGecko&&xr(i,n)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const n=e&&this.domConverter.domSelectionToView(e);return!(n&&this.selection.isEqual(n)||!this.selection.isCollapsed&&this.selection.isSimilar(n))}_fakeSelectionNeedsUpdate(e){const n=this._fakeSelectionContainer,s=e.ownerDocument.getSelection();return!n||n.parentElement!==e||s.anchorNode!==n&&!n.contains(s.anchorNode)?!0:n.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const n=e.getSelection();if(n.rangeCount){const s=e.activeElement,i=this.domConverter.mapDomToView(s);s&&i&&n.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Er(r){if(r.getAttribute("contenteditable")=="false")return!1;const t=r.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||t.getAttribute("contenteditable")=="true"}function dn(r,t,e){const n=t instanceof Array?t:t.childNodes,s=n[e];if(R(s))return s.data=Xe+s.data,s;{const i=r.createTextNode(Xe);return Array.isArray(t)?n.splice(e,0,i):Jn(t,e,i),i}}function Rr(r,t){return lt(r)&&lt(t)&&!R(r)&&!R(t)&&!We(r)&&!We(t)&&r.tagName.toLowerCase()===t.tagName.toLowerCase()}function Tr(r,t){return lt(r)&&lt(t)&&R(r)&&R(t)}function Mr(r,t,e){return t===e?!0:R(t)&&R(e)?t.data===e.data:!!(r.isBlockFiller(t)&&r.isBlockFiller(e))}function xr(r,t){let e=r.parent,n=r.offset;if(R(e)&&Te(e)&&(n=Ve(e)+1,e=e.parentNode),e.nodeType!=Node.ELEMENT_NODE||n!=e.childNodes.length-1)return;const s=e.childNodes[n];s&&s.tagName=="BR"&&t.addRange(t.getRangeAt(0))}function Nr(r,t){const e=Array.from(r);return e.length==0||!t||e[e.length-1]==t&&e.pop(),e}function Or(r){const t=r.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}const Ir=ss(ie.document),Fr=ts(ie.document),Br=ns(ie.document),st="data-ck-unsafe-attribute-",mn="data-ck-unsafe-element";class rs{constructor(t,{blockFillerMode:e,renderingMode:n="editing"}={}){c(this,"document");c(this,"renderingMode");c(this,"blockFillerMode");c(this,"preElements");c(this,"blockElements");c(this,"inlineObjectElements");c(this,"unsafeElements");c(this,"_domDocument");c(this,"_domToViewMapping",new WeakMap);c(this,"_viewToDomMapping",new WeakMap);c(this,"_fakeSelectionMapping",new WeakMap);c(this,"_rawContentElementMatcher",new He);c(this,"_inlineObjectElementMatcher",new He);c(this,"_elementsWithTemporaryCustomProperties",new Set);this.document=t,this.renderingMode=n,this.blockFillerMode=e||(n==="editing"?"br":"nbsp"),this.preElements=["pre","textarea"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?ie.document:ie.document.implementation.createHTMLDocument("")}bindFakeSelection(t,e){this._fakeSelectionMapping.set(t,new ee(e))}fakeSelectionToView(t){return this._fakeSelectionMapping.get(t)}bindElements(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}unbindDomElement(t){const e=this._domToViewMapping.get(t);if(e){this._domToViewMapping.delete(t),this._viewToDomMapping.delete(e);for(const n of t.children)this.unbindDomElement(n)}}bindDocumentFragments(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}shouldRenderAttribute(t,e,n){return this.renderingMode==="data"?!0:(t=t.toLowerCase(),t.startsWith("on")||t==="srcdoc"&&e.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:n==="img"&&(t==="src"||t==="srcset")||n==="source"&&t==="srcset"?!0:!e.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(t,e){if(this.renderingMode==="data"){t.innerHTML=e;return}const n=new DOMParser().parseFromString(e,"text/html"),s=n.createDocumentFragment(),i=n.body.childNodes;for(;i.length>0;)s.appendChild(i[0]);const o=n.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=o.nextNode();)a.push(l);for(const h of a){for(const m of h.getAttributeNames())this.setDomElementAttribute(h,m,h.getAttribute(m));const u=h.tagName.toLowerCase();this._shouldRenameElement(u)&&(wn(u),h.replaceWith(this._createReplacementDomElement(u,h)))}for(;t.firstChild;)t.firstChild.remove();t.append(s)}viewToDom(t,e={}){if(t.is("$text")){const n=this._processDataFromViewText(t);return this._domDocument.createTextNode(n)}else{const n=t;if(this.mapViewToDom(n))if(n.getCustomProperty("editingPipeline:doNotReuseOnce"))this._elementsWithTemporaryCustomProperties.add(n);else return this.mapViewToDom(n);let s;if(n.is("documentFragment"))s=this._domDocument.createDocumentFragment(),e.bind&&this.bindDocumentFragments(s,n);else{if(n.is("uiElement"))return n.name==="$comment"?s=this._domDocument.createComment(n.getCustomProperty("$rawContent")):s=n.render(this._domDocument,this),e.bind&&this.bindElements(s,n),s;this._shouldRenameElement(n.name)?(wn(n.name),s=this._createReplacementDomElement(n.name)):n.hasAttribute("xmlns")?s=this._domDocument.createElementNS(n.getAttribute("xmlns"),n.name):s=this._domDocument.createElement(n.name),n.is("rawElement")&&n.render(s,this),e.bind&&this.bindElements(s,n);for(const i of n.getAttributeKeys())this.setDomElementAttribute(s,i,n.getAttribute(i),n)}if(e.withChildren!==!1)for(const i of this.viewChildrenToDom(n,e))s instanceof HTMLTemplateElement?s.content.appendChild(i):s.appendChild(i);return s}}setDomElementAttribute(t,e,n,s){const i=this.shouldRenderAttribute(e,n,t.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(e);if(i||W("domconverter-unsafe-attribute-detected",{domElement:t,key:e,value:n}),!qs(e)){W("domconverter-invalid-attribute-detected",{domElement:t,key:e,value:n});return}t.hasAttribute(e)&&!i?t.removeAttribute(e):t.hasAttribute(st+e)&&i&&t.removeAttribute(st+e),t.setAttribute(i?e:st+e,n)}removeDomElementAttribute(t,e){e!=mn&&(t.removeAttribute(e),t.removeAttribute(st+e))}*viewChildrenToDom(t,e={}){const n=t.getFillerOffset&&t.getFillerOffset();let s=0;for(const i of t.getChildren()){n===s&&(yield this._getBlockFiller());const o=i.is("element")&&!!i.getCustomProperty("dataPipeline:transparentRendering")&&!zt(i.getAttributes());if(o&&this.renderingMode=="data")if(i.is("rawElement")){const a=this._domDocument.createElement(i.name);i.render(a,this),yield*[...a.childNodes]}else yield*this.viewChildrenToDom(i,e);else o&&W("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:i}),yield this.viewToDom(i,e);s++}n===s&&(yield this._getBlockFiller())}viewRangeToDom(t){const e=this.viewPositionToDom(t.start),n=this.viewPositionToDom(t.end),s=this._domDocument.createRange();return s.setStart(e.parent,e.offset),s.setEnd(n.parent,n.offset),s}viewPositionToDom(t){const e=t.parent;if(e.is("$text")){const n=this.findCorrespondingDomText(e);if(!n)return null;let s=t.offset;return $(n)&&(s+=j),{parent:n,offset:s}}else{let n,s,i;if(t.offset===0){if(n=this.mapViewToDom(e),!n)return null;i=n.childNodes[0]}else{const a=t.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;n=s.parentNode,i=s.nextSibling}if(R(i)&&$(i))return{parent:i,offset:j};const o=s?Ve(s)+1:0;return{parent:n,offset:o}}}domToView(t,e={}){const n=[],s=this._domToView(t,e,n),i=s.next().value;return!i||(s.next(),this._processDomInlineNodes(null,n,e),this.blockFillerMode=="br"&&pn(i))||i.is("$text")&&i.data.length==0?null:i}*domChildrenToView(t,e={},n=[]){let s=[];t instanceof HTMLTemplateElement?s=[...t.content.childNodes]:s=[...t.childNodes];for(let i=0;i<s.length;i++){const o=s[i],a=this._domToView(o,e,n),l=a.next().value;l!==null&&(this._isBlockViewElement(l)&&this._processDomInlineNodes(t,n,e),this.blockFillerMode=="br"&&pn(l)||(yield l),a.next())}this._processDomInlineNodes(t,n,e)}domSelectionToView(t){if(Wr(t))return new ee([]);if(t.rangeCount===1){let s=t.getRangeAt(0).startContainer;R(s)&&(s=s.parentNode);const i=this.fakeSelectionToView(s);if(i)return i}const e=this.isDomSelectionBackward(t),n=[];for(let s=0;s<t.rangeCount;s++){const i=t.getRangeAt(s),o=this.domRangeToView(i);o&&n.push(o)}return new ee(n,{backward:e})}domRangeToView(t){const e=this.domPositionToView(t.startContainer,t.startOffset),n=this.domPositionToView(t.endContainer,t.endOffset);return e&&n?new b(e,n):null}domPositionToView(t,e=0){if(this.isBlockFiller(t))return this.domPositionToView(t.parentNode,Ve(t));const n=this.mapDomToView(t);if(n&&(n.is("uiElement")||n.is("rawElement")))return _._createBefore(n);if(R(t)){if(Te(t))return this.domPositionToView(t.parentNode,Ve(t));const s=this.findCorrespondingViewText(t);let i=e;return s?($(t)&&(i-=j,i=i<0?0:i),new _(s,i)):null}else{if(e===0){const s=this.mapDomToView(t);if(s)return new _(s,0)}else{const s=t.childNodes[e-1];if(R(s)&&Te(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,Ve(s));const i=R(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(i&&i.parent)return new _(i.parent,i.index+1)}return null}}mapDomToView(t){return this.getHostViewElement(t)||this._domToViewMapping.get(t)}findCorrespondingViewText(t){if(Te(t))return null;const e=this.getHostViewElement(t);if(e)return e;const n=t.previousSibling;if(n){if(!this.isElement(n))return null;const s=this.mapDomToView(n);if(s){const i=s.nextSibling;return i instanceof N?i:null}}else{const s=this.mapDomToView(t.parentNode);if(s){const i=s.getChild(0);return i instanceof N?i:null}}return null}mapViewToDom(t){return this._viewToDomMapping.get(t)}findCorrespondingDomText(t){const e=t.previousSibling;return e&&this.mapViewToDom(e)?this.mapViewToDom(e).nextSibling:!e&&t.parent&&this.mapViewToDom(t.parent)?this.mapViewToDom(t.parent).childNodes[0]:null}focus(t){const e=this.mapViewToDom(t);if(e&&e.ownerDocument.activeElement!==e){const{scrollX:n,scrollY:s}=ie.window,i=[];gn(e,o=>{const{scrollLeft:a,scrollTop:l}=o;i.push([a,l])}),e.focus(),gn(e,o=>{const[a,l]=i.shift();o.scrollLeft=a,o.scrollTop=l}),ie.window.scrollTo(n,s)}}_clearDomSelection(){const t=this.mapViewToDom(this.document.selection.editableElement);if(!t)return;const e=t.ownerDocument.defaultView.getSelection(),n=this.domSelectionToView(e);n&&n.rangeCount>0&&e.removeAllRanges()}isElement(t){return t&&t.nodeType==Node.ELEMENT_NODE}isDocumentFragment(t){return t&&t.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(t){return this.blockFillerMode=="br"?t.isEqualNode(Ir):_n(t,this.blockElements)?!0:t.isEqualNode(Br)||Vr(t,this.blockElements)}isDomSelectionBackward(t){if(t.isCollapsed)return!1;const e=this._domDocument.createRange();try{e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset)}catch{return!1}const n=e.collapsed;return e.detach(),n}getHostViewElement(t){const e=zs(t);for(e.pop();e.length;){const n=e.pop(),s=this._domToViewMapping.get(n);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(t){return this._isDomSelectionPositionCorrect(t.anchorNode,t.anchorOffset)&&this._isDomSelectionPositionCorrect(t.focusNode,t.focusOffset)}registerRawContentMatcher(t){this._rawContentElementMatcher.add(t)}registerInlineObjectMatcher(t){this._inlineObjectElementMatcher.add(t)}_clearTemporaryCustomProperties(){for(const t of this._elementsWithTemporaryCustomProperties)t._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return ts(this._domDocument);case"markedNbsp":return ns(this._domDocument);case"br":return ss(this._domDocument)}}_isDomSelectionPositionCorrect(t,e){if(R(t)&&$(t)&&e<j||this.isElement(t)&&$(t.childNodes[e]))return!1;const n=this.mapDomToView(t);return!(n&&(n.is("uiElement")||n.is("rawElement")))}*_domToView(t,e,n){if(this.blockFillerMode!="br"&&_n(t,this.blockElements))return null;const s=this.getHostViewElement(t);if(s)return s;if(We(t)&&e.skipComments)return null;if(R(t)){if(Te(t))return null;{const i=t.data;if(i==="")return null;const o=new N(this.document,i);return n.push(o),o}}else{let i=this.mapDomToView(t);if(i)return this._isInlineObjectElement(i)&&n.push(i),i;if(this.isDocumentFragment(t))i=new _e(this.document),e.bind&&this.bindDocumentFragments(t,i);else{i=this._createViewElement(t,e),e.bind&&this.bindElements(t,i);const a=t.attributes;if(a)for(let l=a.length,h=0;h<l;h++)i._setAttribute(a[h].name,a[h].value);if(this._isViewElementWithRawContent(i,e))return i._setCustomProperty("$rawContent",t.innerHTML),this._isBlockViewElement(i)||n.push(i),i;if(We(t))return i._setCustomProperty("$rawContent",t.data),i}yield i;const o=[];if(e.withChildren!==!1)for(const a of this.domChildrenToView(t,e,o))i._appendChild(a);if(this._isInlineObjectElement(i))n.push(i),this._processDomInlineNodes(null,o,e);else for(const a of o)n.push(a)}}_processDomInlineNodes(t,e,n){if(!e.length||t&&!this.isDocumentFragment(t)&&!this._isBlockDomElement(t))return;let s=!1;for(let i=0;i<e.length;i++){const o=e[i];if(!o.is("$text")){s=!1;continue}let a,l=!1;if(this._isPreFormatted(o))a=fn(o.data);else{a=o.data.replace(/[ \n\t\r]{1,}/g," "),l=/[^\S\u00A0]/.test(a.charAt(a.length-1));const h=i>0?e[i-1]:null,u=i+1<e.length?e[i+1]:null,m=!h||h.is("element")&&h.name=="br"||s,p=u?!1:!$(o.data);n.withChildren!==!1&&(m&&(a=a.replace(/^ /,"")),p&&(a=a.replace(/ $/,""))),a=fn(a),this.blockFillerMode!="br"&&o.parent&&(Lr(o.parent,a)?(a="",o.parent.parent&&(o.parent.parent._setCustomProperty("$hasBlockFiller",!0),o.parent._remove())):$r(o.parent,a,this.blockElements)&&(a="",o.parent._setCustomProperty("$hasBlockFiller",!0))),a=a.replace(/ \u00A0/g," ");const w=u&&u.is("element")&&u.name!="br",v=u&&u.is("$text")&&u.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(a)||!u||w||v)&&(a=a.replace(/\u00A0$/," ")),(m||h&&h.is("element")&&h.name!="br")&&(a=a.replace(/^\u00A0/," "))}a.length==0&&o.parent?(o._remove(),e.splice(i,1),i--):(o._data=a,s=l)}e.length=0}_processDataFromViewText(t){let e=t.data;if(this._isPreFormatted(t))return e;if(e.charAt(0)==" "){const n=this._getTouchingInlineViewNode(t,!1);(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n)||!n)&&(e=" "+e.substr(1))}if(e.charAt(e.length-1)==" "){const n=this._getTouchingInlineViewNode(t,!0),s=n&&n.is("$textProxy")&&n.data.charAt(0)==" ";(e.charAt(e.length-2)==" "||!n||s)&&(e=e.substr(0,e.length-1)+" ")}return e.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(t){if(this._isPreFormatted(t))return!1;const e=this._processDataFromViewText(t);return e.charAt(e.length-1)==" "}_isPreFormatted(t){if(Dr(t,this.preElements))return!0;for(const e of t.getAncestors({parentFirst:!0}))if(!(!e.is("element")||!e.hasStyle("white-space")||e.getStyle("white-space")==="inherit"))return["pre","pre-wrap","break-spaces"].includes(e.getStyle("white-space"));return!1}_getTouchingInlineViewNode(t,e){const n=new ge({startPosition:e?_._createAfter(t):_._createBefore(t),direction:e?"forward":"backward"});for(const{item:s}of n){if(s.is("$textProxy"))return s;if(s.is("element")&&s.getCustomProperty("dataPipeline:transparentRendering"))continue;if(s.is("element","br"))return null;if(this._isInlineObjectElement(s))return s;if(s.is("containerElement"))return null}return null}_isBlockDomElement(t){return this.isElement(t)&&this.blockElements.includes(t.tagName.toLowerCase())}_isBlockViewElement(t){return t.is("element")&&this.blockElements.includes(t.name)}_isInlineObjectElement(t){return t.is("element")?t.name=="br"||this.inlineObjectElements.includes(t.name)||!!this._inlineObjectElementMatcher.match(t):!1}_createViewElement(t,e){if(We(t))return new gt(this.document,"$comment");const n=e.keepOriginalCase?t.tagName:t.tagName.toLowerCase();return new ne(this.document,n)}_isViewElementWithRawContent(t,e){return e.withChildren!==!1&&t.is("element")&&!!this._rawContentElementMatcher.match(t)}_shouldRenameElement(t){const e=t.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(e)}_createReplacementDomElement(t,e){const n=this._domDocument.createElement("span");if(n.setAttribute(mn,t),e){for(;e.firstChild;)n.appendChild(e.firstChild);for(const s of e.getAttributeNames())n.setAttribute(s,e.getAttribute(s))}return n}}function Dr(r,t){return r.getAncestors().some(e=>e.is("element")&&t.includes(e.name))}function gn(r,t){let e=r;for(;e;)t(e),e=e.parentElement}function Vr(r,t){return r.isEqualNode(Fr)&&is(r,t)&&r.parentNode.childNodes.length===1}function is(r,t){const e=r.parentNode;return!!e&&!!e.tagName&&t.includes(e.tagName.toLowerCase())}function $r(r,t,e){return t==" "&&r&&r.is("element")&&r.childCount==1&&e.includes(r.name)}function Lr(r,t){return t==" "&&r&&r.is("element","span")&&r.childCount==1&&r.hasAttribute("data-cke-filler")}function pn(r){return r.is("element","br")&&r.hasAttribute("data-cke-filler")}function _n(r,t){return r.tagName==="BR"&&is(r,t)&&r.parentNode.childNodes.length===1}function wn(r){r==="script"&&W("domconverter-unsafe-script-element-detected"),r==="style"&&W("domconverter-unsafe-style-element-detected")}function Wr(r){if(!T.isGecko||!r.rangeCount)return!1;const t=r.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch{return!0}return!1}class xe extends Ws(){constructor(e){super();c(this,"view");c(this,"document");c(this,"_isEnabled",!1);this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}class qr{constructor(t,e,n){c(this,"view");c(this,"document");c(this,"domEvent");c(this,"domTarget");this.view=t,this.document=t.document,this.domEvent=e,this.domTarget=e.target,Xs(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Pe extends xe{constructor(){super(...arguments);c(this,"useCapture",!1);c(this,"usePassive",!1)}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(s=>{this.listenTo(e,s,(i,o)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(o.target)&&this.onDomEvent(o)},{useCapture:this.useCapture,usePassive:this.usePassive})})}stopObserving(e){this.stopListening(e)}fire(e,n,s){this.isEnabled&&this.document.fire(e,new qr(this.view,n,s))}}class zr extends Pe{constructor(){super(...arguments);c(this,"domEventType",["keydown","keyup"])}onDomEvent(e){const n={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Hs(this)}};this.fire(e.type,e,n)}}class Ur extends xe{constructor(e){super(e);c(this,"_fireSelectionChangeDoneDebounced");this._fireSelectionChangeDoneDebounced=xt(n=>{this.document.fire("selectionChangeDone",n)},200)}observe(){const e=this.document;e.on("arrowKey",(n,s)=>{e.selection.isFake&&this.isEnabled&&s.preventDefault()},{context:"$capture"}),e.on("arrowKey",(n,s)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(s.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const n=this.document.selection,s=new ee(n.getRanges(),{backward:n.isBackward,fake:!1});(e==me.arrowleft||e==me.arrowup)&&s.setTo(s.getFirstPosition()),(e==me.arrowright||e==me.arrowdown)&&s.setTo(s.getLastPosition());const i={oldSelection:n,newSelection:s,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}class os extends xe{constructor(e){super(e);c(this,"domConverter");c(this,"_config");c(this,"_domElements");c(this,"_mutationObserver");this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const n of this._domElements)this._mutationObserver.observe(n,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const n=this.domConverter,s=new Set,i=new Set;for(const a of e){const l=n.mapDomToView(a.target);l&&(l.is("uiElement")||l.is("rawElement")||a.type==="childList"&&!this._isBogusBrMutation(a)&&i.add(l))}for(const a of e){const l=n.mapDomToView(a.target);if(!(l&&(l.is("uiElement")||l.is("rawElement")))&&a.type==="characterData"){const h=n.findCorrespondingViewText(a.target);h&&!i.has(h.parent)?s.add(h):!h&&$(a.target)&&i.add(n.mapDomToView(a.target.parentNode))}}const o=[];for(const a of s)o.push({type:"text",node:a});for(const a of i){const l=n.mapViewToDom(a),h=Array.from(a.getChildren()),u=Array.from(n.domChildrenToView(l,{withChildren:!1}));Qs(h,u,Jr)||o.push({type:"children",node:a})}o.length&&this.document.fire("mutations",{mutations:o})}_isBogusBrMutation(e){let n=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(n=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),n&&n.is("element","br")}}function Jr(r,t){if(!Array.isArray(r))return r===t?!0:r.is("$text")&&t.is("$text")?r.data===t.data:!1}class Dt extends Pe{constructor(e){super(e);c(this,"_renderTimeoutId",null);c(this,"_isFocusChanging",!1);c(this,"domEventType",["focus","blur"]);this.useCapture=!0;const n=this.document;n.on("focus",()=>this._handleFocus()),n.on("blur",(s,i)=>this._handleBlur(i)),n.on("beforeinput",()=>{n.isFocused||this._handleFocus()},{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this._renderTimeoutId=null,this.flush(),this.view.change(()=>{})},50)}_handleBlur(e){const n=this.document.selection.editableElement;(n===null||n===e.target)&&(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change(()=>{}))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class jr extends xe{constructor(e){super(e);c(this,"mutationObserver");c(this,"focusObserver");c(this,"selection");c(this,"domConverter");c(this,"_documents");c(this,"_fireSelectionChangeDoneDebounced");c(this,"_clearInfiniteLoopInterval");c(this,"_documentIsSelectingInactivityTimeoutDebounced");c(this,"_loopbackCounter");this.mutationObserver=e.getObserver(os),this.focusObserver=e.getObserver(Dt),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=xt(n=>{this.document.fire("selectionChangeDone",n)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=xt(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const n=e.ownerDocument,s=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},i=()=>{this.document.isSelecting&&(this._handleSelectionChange(n),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",s,{priority:"highest"}),this.listenTo(e,"keydown",i,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",i,{priority:"highest",useCapture:!0}),!this._documents.has(n)&&(this.listenTo(n,"mouseup",i,{priority:"highest",useCapture:!0}),this.listenTo(n,"selectionchange",()=>{this.document.isComposing&&!T.isAndroid||(this._handleSelectionChange(n),this._documentIsSelectingInactivityTimeoutDebounced())}),this.listenTo(this.view.document,"compositionstart",()=>{this._handleSelectionChange(n)},{priority:"lowest"}),this._documents.add(n))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const n=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(n.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(n);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(n))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(this.selection.isSimilar(s))this.view.forceRender();else{const i={oldSelection:this.selection,newSelection:s,domSelection:n};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}class Gr extends Pe{constructor(e){super(e);c(this,"domEventType",["compositionstart","compositionupdate","compositionend"]);const n=this.document;n.on("compositionstart",()=>{n.isComposing=!0},{priority:"low"}),n.on("compositionend",()=>{n.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
7
+ */let ye=class{is(){throw new Error("is() method is abstract")}},ve=class extends O(ye){constructor(e){super();c(this,"document");c(this,"parent");this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new d("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let n=this;for(;n.parent;)e.unshift(n.index),n=n.parent;return e}getAncestors(e={}){const n=[];let s=e.includeSelf?this:this.parent;for(;s;)n[e.parentFirst?"push":"unshift"](s),s=s.parent;return n}getCommonAncestor(e,n={}){const s=this.getAncestors(n),i=e.getAncestors(n);let o=0;for(;s[o]==i[o]&&s[o];)o++;return o===0?null:s[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const n=this.getPath(),s=e.getPath(),i=F(n,s);switch(i){case"prefix":return!0;case"extension":return!1;default:return n[i]<s[i]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,n,s){this.fire(`change:${e}`,n,s),this.parent&&this.parent._fireChange(e,n,s)}toJSON(){const e=jn(this);return delete e.parent,e}};ve.prototype.is=function(r){return r==="node"||r==="view:node"};let N=class Nt extends ve{constructor(e,n){super(e);c(this,"_textData");this._textData=n}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof Nt?this===e||this.data===e.data:!1}_clone(){return new Nt(this.document,this.data)}};N.prototype.is=function(r){return r==="$text"||r==="view:$text"||r==="text"||r==="view:text"||r==="node"||r==="view:node"};let Z=class extends ye{constructor(e,n,s){super();c(this,"textNode");c(this,"data");c(this,"offsetInText");if(this.textNode=e,n<0||n>e.data.length)throw new d("view-textproxy-wrong-offsetintext",this);if(s<0||n+s>e.data.length)throw new d("view-textproxy-wrong-length",this);this.data=e.data.substring(n,n+s),this.offsetInText=n}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const n=[];let s=e.includeSelf?this.textNode:this.parent;for(;s!==null;)n[e.parentFirst?"push":"unshift"](s),s=s.parent;return n}};Z.prototype.is=function(r){return r==="$textProxy"||r==="view:$textProxy"||r==="textProxy"||r==="view:textProxy"};class ut{constructor(){c(this,"_consumables",new Map)}add(t,e){let n;if(t.is("$text")||t.is("documentFragment")){this._consumables.set(t,!0);return}this._consumables.has(t)?n=this._consumables.get(t):(n=new ir(t),this._consumables.set(t,n)),n.add(e?$e(e):t._getConsumables())}test(t,e){const n=this._consumables.get(t);return n===void 0?null:t.is("$text")||t.is("documentFragment")?n:n.test($e(e))}consume(t,e){if(t.is("$text")||t.is("documentFragment"))return this.test(t,e)?(this._consumables.set(t,!1),!0):!1;const n=this._consumables.get(t);return n===void 0?!1:n.consume($e(e))}revert(t,e){const n=this._consumables.get(t);n!==void 0&&(t.is("$text")||t.is("documentFragment")?this._consumables.set(t,!0):n.revert($e(e)))}static createFrom(t,e){if(e||(e=new ut),t.is("$text"))e.add(t);else if(t.is("element")||t.is("documentFragment")){e.add(t);for(const n of t.getChildren())ut.createFrom(n,e)}return e}}class ir{constructor(t){c(this,"element");c(this,"_canConsumeName",null);c(this,"_attributes",new Map);this.element=t}add(t){t.name&&(this._canConsumeName=!0);for(const[e,n]of t.attributes)if(n){let s=this._attributes.get(e);(!s||typeof s=="boolean")&&(s=new Map,this._attributes.set(e,s)),s.set(n,!0)}else{if(e=="style"||e=="class")throw new d("viewconsumable-invalid-attribute",this);this._attributes.set(e,!0)}}test(t){if(t.name&&!this._canConsumeName)return this._canConsumeName;for(const[e,n]of t.attributes){const s=this._attributes.get(e);if(s===void 0)return null;if(s===!1)return!1;if(s!==!0){if(n){const i=s.get(n);if(i===void 0)return null;if(!i)return!1}else for(const i of s.values())if(!i)return!1}}return!0}consume(t){if(!this.test(t))return!1;t.name&&(this._canConsumeName=!1);for(const[e,n]of t.attributes){const s=this._attributes.get(e);if(typeof s=="boolean")for(const[i]of this.element._getConsumables(e,n).attributes)this._attributes.set(i,!1);else if(n)for(const[,i]of this.element._getConsumables(e,n).attributes)s.set(i,!1);else for(const i of s.keys())s.set(i,!1)}return!0}revert(t){t.name&&(this._canConsumeName=!0);for(const[e,n]of t.attributes){const s=this._attributes.get(e);if(s===!1){this._attributes.set(e,!0);continue}if(!(s===void 0||s===!0))if(n)s.get(n)===!1&&s.set(n,!0);else for(const i of s.keys())s.set(i,!0)}}}function $e(r){const t=[];return"attributes"in r&&r.attributes&&bt(t,r.attributes),"classes"in r&&r.classes&&bt(t,r.classes,"class"),"styles"in r&&r.styles&&bt(t,r.styles,"style"),{name:r.name||!1,attributes:t}}function bt(r,t,e){if(typeof t=="string"){r.push(e?[e,t]:[t]);return}for(const n of t)Array.isArray(n)?r.push(n):r.push(e?[e,n]:[n])}class He{constructor(...t){c(this,"_patterns",[]);this.add(...t)}add(...t){for(let e of t)(typeof e=="string"||e instanceof RegExp)&&(e={name:e}),this._patterns.push(e)}match(...t){for(const e of t)for(const n of this._patterns){const s=this._isElementMatching(e,n);if(s)return{element:e,pattern:n,match:s}}return null}matchAll(...t){const e=[];for(const n of t)for(const s of this._patterns){const i=this._isElementMatching(n,s);i&&e.push({element:n,pattern:s,match:i})}return e.length>0?e:null}getElementName(){if(this._patterns.length!==1)return null;const t=this._patterns[0],e=t.name;return typeof t!="function"&&e&&!(e instanceof RegExp)?e:null}_isElementMatching(t,e){if(typeof e=="function"){const i=e(t);return!i||typeof i!="object"?i:$e(i)}const n={};if(e.name&&(n.name=or(e.name,t.name),!n.name))return null;const s=[];return e.attributes&&!ar(e.attributes,t,s)||e.classes&&!lr(e.classes,t,s)||e.styles&&!cr(e.styles,t,s)?null:(s.length&&(n.attributes=s),n)}}function ft(r,t){return r===!0||r===t||r instanceof RegExp&&!!String(t).match(r)}function or(r,t){return r instanceof RegExp?!!t.match(r):r===t}function Ut(r,t){if(Array.isArray(r))return r.map(n=>typeof n!="object"||n instanceof RegExp?t?[t,n,!0]:[n,!0]:((n.key===void 0||n.value===void 0)&&W("matcher-pattern-missing-key-or-value",n),t?[t,n.key,n.value]:[n.key,n.value]));if(typeof r!="object"||r instanceof RegExp)return[t?[t,r,!0]:[r,!0]];const e=[];for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.push(t?[t,n,r[n]]:[n,r[n]]);return e}function ar(r,t,e){let n;return typeof r=="object"&&!(r instanceof RegExp)&&!Array.isArray(r)?(r.style!==void 0&&W("matcher-pattern-deprecated-attributes-style-key",r),r.class!==void 0&&W("matcher-pattern-deprecated-attributes-class-key",r)):n=["class","style"],t._collectAttributesMatch(Ut(r),e,n)}function lr(r,t,e){return t._collectAttributesMatch(Ut(r,"class"),e)}function cr(r,t,e){return t._collectAttributesMatch(Ut(r,"style"),e)}class qe{constructor(t){c(this,"_styles");c(this,"_cachedStyleNames",null);c(this,"_cachedExpandedStyleNames",null);c(this,"_styleProcessor");this._styles={},this._styleProcessor=t}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(t){this.clear();const e=hr(t);for(const[n,s]of e)this._styleProcessor.toNormalizedForm(n,s,this._styles);return this}has(t){if(this.isEmpty)return!1;const n=this._styleProcessor.getReducedForm(t,this._styles).find(([s])=>s===t);return Array.isArray(n)}set(t,e){if(this._cachedStyleNames=null,this._cachedExpandedStyleNames=null,ct(t))for(const[n,s]of Object.entries(t))this._styleProcessor.toNormalizedForm(n,s,this._styles);else this._styleProcessor.toNormalizedForm(t,e,this._styles)}remove(t){for(const e of le(t)){this._cachedStyleNames=null,this._cachedExpandedStyleNames=null;const n=Ot(e);Ks(this._styles,n),delete this._styles[e],this._cleanEmptyObjectsOnPath(n)}}getNormalized(t){return this._styleProcessor.getNormalized(t,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(t=>t.join(":")).sort().join(";")+";"}getAsString(t){if(this.isEmpty)return;if(this._styles[t]&&!ct(this._styles[t]))return this._styles[t];const n=this._styleProcessor.getReducedForm(t,this._styles).find(([s])=>s===t);if(Array.isArray(n))return n[1]}getStyleNames(t=!1){return this.isEmpty?[]:t?(this._cachedExpandedStyleNames||(this._cachedExpandedStyleNames=this._styleProcessor.getStyleNames(this._styles)),this._cachedExpandedStyleNames):(this._cachedStyleNames||(this._cachedStyleNames=this.getStylesEntries().map(([e])=>e)),this._cachedStyleNames)}keys(){return this.getStyleNames()}clear(){this._styles={},this._cachedStyleNames=null,this._cachedExpandedStyleNames=null}isSimilar(t){if(this.size!==t.size)return!1;for(const e of this.getStyleNames())if(!t.has(e)||t.getAsString(e)!==this.getAsString(e))return!1;return!0}getStylesEntries(){const t=[],e=Object.keys(this._styles);for(const n of e)t.push(...this._styleProcessor.getReducedForm(n,this._styles));return t}_clone(){const t=new this.constructor(this._styleProcessor);return t.set(this.getNormalized()),t}_getTokensMatch(t,e){const n=[];for(const s of this.getStyleNames(!0))if(ft(t,s)){if(e===!0){n.push(s);continue}const i=this.getAsString(s);ft(e,i)&&n.push(s)}return n.length?n:void 0}_getConsumables(t){const e=[];if(t){e.push(t);for(const n of this._styleProcessor.getRelatedStyles(t))e.push(n)}else for(const n of this.getStyleNames()){for(const s of this._styleProcessor.getRelatedStyles(n))e.push(s);e.push(n)}return e}_canMergeFrom(t){for(const e of t.getStyleNames())if(this.has(e)&&this.getAsString(e)!==t.getAsString(e))return!1;return!0}_mergeFrom(t){for(const e of t.getStyleNames())this.has(e)||this.set(e,t.getAsString(e))}_isMatching(t){for(const e of t.getStyleNames())if(!this.has(e)||this.getAsString(e)!==t.getAsString(e))return!1;return!0}_cleanEmptyObjectsOnPath(t){const e=t.split(".");if(!(e.length>1))return;const s=e.splice(0,e.length-1).join("."),i=ht(this._styles,s);if(!i)return;!Object.keys(i).length&&this.remove(s)}}class pl{constructor(){c(this,"_normalizers");c(this,"_extractors");c(this,"_reducers");c(this,"_consumables");this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(t,e,n){if(ct(e)){yt(n,Ot(t),e);return}if(this._normalizers.has(t)){const s=this._normalizers.get(t),{path:i,value:o}=s(e);yt(n,i,o)}else yt(n,t,e)}getNormalized(t,e){if(!t)return Gn({},e);if(e[t]!==void 0)return e[t];if(this._extractors.has(t)){const n=this._extractors.get(t);if(typeof n=="string")return ht(e,n);const s=n(t,e);if(s)return s}return ht(e,Ot(t))}getReducedForm(t,e){const n=this.getNormalized(t,e);return n===void 0?[]:this._reducers.has(t)?this._reducers.get(t)(n):[[t,n]]}getStyleNames(t){const e=new Set;for(const n of this._consumables.keys()){const s=this.getNormalized(n,t);s&&(typeof s!="object"||Object.keys(s).length)&&e.add(n)}for(const n of Object.keys(t))e.add(n);return Array.from(e)}getRelatedStyles(t){return this._consumables.get(t)||[]}setNormalizer(t,e){this._normalizers.set(t,e)}setExtractor(t,e){this._extractors.set(t,e)}setReducer(t,e){this._reducers.set(t,e)}setStyleRelation(t,e){this._mapStyleNames(t,e);for(const n of e)this._mapStyleNames(n,[t])}_mapStyleNames(t,e){this._consumables.has(t)||this._consumables.set(t,[]),this._consumables.get(t).push(...e)}}function hr(r){let t=null,e=0,n=0,s=null;const i=new Map;if(r==="")return i;r.charAt(r.length-1)!=";"&&(r=r+";");for(let o=0;o<r.length;o++){const a=r.charAt(o);if(t===null)switch(a){case":":s||(s=r.substr(e,o-e),n=o+1);break;case'"':case"'":t=a;break;case";":{const l=r.substr(n,o-n);s&&i.set(s.trim(),l.trim()),s=null,e=o+1;break}}else a===t&&(t=null)}return i}function Ot(r){return r.replace("-",".")}function yt(r,t,e){let n=e;ct(e)&&(n=Gn({},ht(r,t),e)),Ys(r,t,n)}class vt{constructor(){c(this,"_set",new Set)}get isEmpty(){return this._set.size==0}get size(){return this._set.size}has(t){return this._set.has(t)}keys(){return Array.from(this._set.keys())}setTo(t){this.clear();for(const e of t.split(/\s+/))e&&this._set.add(e);return this}set(t){for(const e of le(t))e&&this._set.add(e)}remove(t){for(const e of le(t))this._set.delete(e)}clear(){this._set.clear()}toString(){return Array.from(this._set).join(" ")}isSimilar(t){if(this.size!==t.size)return!1;for(const e of this.keys())if(!t.has(e))return!1;return!0}_clone(){const t=new this.constructor;return t._set=new Set(this._set),t}_getTokensMatch(t){const e=[];if(t===!0){for(const n of this._set.keys())e.push(n);return e}if(typeof t=="string"){for(const n of t.split(/\s+/))if(this._set.has(n))e.push(n);else return;return e}for(const n of this._set.keys())n.match(t)&&e.push(n);return e.length?e:void 0}_getConsumables(t){return t?[t]:this.keys()}_canMergeFrom(){return!0}_mergeFrom(t){for(const e of t._set.keys())this._set.has(e)||this._set.add(e)}_isMatching(t){for(const e of t._set.keys())if(!this._set.has(e))return!1;return!0}}let ne=class Hn extends ve{constructor(e,n,s,i){super(e);c(this,"name");c(this,"_unsafeAttributesToRender",[]);c(this,"_attrs");c(this,"_children");c(this,"_customProperties",new Map);this.name=n,this._attrs=this._parseAttributes(s),this._children=[],i&&this._insertChild(0,i)}get _classes(){return this._attrs.get("class")}get _styles(){return this._attrs.get("style")}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes&&(yield"class"),this._styles&&(yield"style");for(const e of this._attrs.keys())e!="class"&&e!="style"&&(yield e)}*getAttributes(){for(const[e,n]of this._attrs.entries())yield[e,String(n)]}getAttribute(e){return this._attrs.has(e)?String(this._attrs.get(e)):void 0}hasAttribute(e,n){return this._attrs.has(e)?n!==void 0?ke(this.name,e)||Oe(this.name,e)?this._attrs.get(e).has(n):this._attrs.get(e)===n:!0:!1}isSimilar(e){if(!(e instanceof Hn))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size)return!1;for(const[n,s]of this._attrs){const i=e._attrs.get(n);if(i===void 0)return!1;if(typeof s=="string"||typeof i=="string"){if(i!==s)return!1}else if(!s.isSimilar(i))return!1}return!0}hasClass(...e){for(const n of e)if(!this._classes||!this._classes.has(n))return!1;return!0}getClassNames(){const e=this._classes?this._classes.keys():[],n=e[Symbol.iterator]();return Object.assign(e,{next:n.next.bind(n)})}getStyle(e){return this._styles&&this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles&&this._styles.getNormalized(e)}getStyleNames(e){return this._styles?this._styles.getStyleNames(e):[]}hasStyle(...e){for(const n of e)if(!this._styles||!this._styles.has(n))return!1;return!0}findAncestor(...e){const n=new He(...e);let s=this.parent;for(;s&&!s.is("documentFragment");){if(n.match(s))return s;s=s.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=this._classes?this._classes.keys().sort().join(","):"",n=this._styles&&String(this._styles),s=Array.from(this._attrs).filter(([i])=>i!="style"&&i!="class").map(i=>`${i[0]}="${i[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(n?` style="${n}"`:"")+(s==""?"":` ${s}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const n=[];if(e)for(const i of this.getChildren())n.push(i._clone(e));const s=new this.constructor(this.document,this.name,this._attrs,n);return s._customProperties=new Map(this._customProperties),s.getFillerOffset=this.getFillerOffset,s._unsafeAttributesToRender=this._unsafeAttributesToRender,s}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,n){this._fireChange("children",this,{index:e});let s=0;const i=ur(this.document,n);for(const o of i)o.parent!==null&&o._remove(),o.parent=this,o.document=this.document,this._children.splice(e,0,o),e++,s++;return s}_removeChildren(e,n=1){this._fireChange("children",this,{index:e});for(let s=e;s<e+n;s++)this._children[s].parent=null;return this._children.splice(e,n)}_setAttribute(e,n,s=!0){if(this._fireChange("attributes",this),ke(this.name,e)||Oe(this.name,e)){let i=this._attrs.get(e);i||(i=ke(this.name,e)?new qe(this.document.stylesProcessor):new vt,this._attrs.set(e,i)),s?i.setTo(String(n)):ke(this.name,e)?Array.isArray(n)?i.set(n[0],n[1]):i.set(n):i.set(typeof n=="string"?n.split(/\s+/):n)}else this._attrs.set(e,String(n))}_removeAttribute(e,n){if(this._fireChange("attributes",this),n!==void 0&&(ke(this.name,e)||Oe(this.name,e))){const s=this._attrs.get(e);return s?(Oe(this.name,e)&&typeof n=="string"&&(n=n.split(/\s+/)),s.remove(n),s.isEmpty?this._attrs.delete(e):!1):!1}return this._attrs.delete(e)}_addClass(e){this._setAttribute("class",e,!1)}_removeClass(e){this._removeAttribute("class",e)}_setStyle(e,n){typeof e!="string"?this._setAttribute("style",e,!1):this._setAttribute("style",[e,n],!1)}_removeStyle(e){this._removeAttribute("style",e)}_collectAttributesMatch(e,n,s){for(const[i,o,a]of e){let l=!1,h=!1;for(const[u,m]of this._attrs)if(!(s&&s.includes(u)||!ft(i,u)))if(l=!0,typeof m=="string"){if(ft(o,m))n.push([u]),h=!0;else if(!(i instanceof RegExp))return!1}else{const p=m._getTokensMatch(o,a||!0);if(p){h=!0;for(const w of p)n.push([u,w])}else if(!(i instanceof RegExp))return!1}if(!l||!h)return!1}return!0}_getConsumables(e,n){const s=[];if(e){const i=this._attrs.get(e);if(i!==void 0)if(typeof i=="string")s.push([e]);else for(const o of i._getConsumables(n))s.push([e,o])}else for(const[i,o]of this._attrs)if(typeof o=="string")s.push([i]);else for(const a of o._getConsumables())s.push([i,a]);return{name:!e,attributes:s}}_canMergeAttributesFrom(e){if(this.name!=e.name)return!1;for(const[n,s]of e._attrs){const i=this._attrs.get(n);if(i!==void 0){if(typeof i=="string"||typeof s=="string"){if(i!==s)return!1}else if(!i._canMergeFrom(s))return!1}}return!0}_mergeAttributesFrom(e){this._fireChange("attributes",this);for(const[n,s]of e._attrs){const i=this._attrs.get(n);i===void 0||typeof i=="string"||typeof s=="string"?this._setAttribute(n,s):i._mergeFrom(s)}}_canSubtractAttributesOf(e){if(this.name!=e.name)return!1;for(const[n,s]of e._attrs){const i=this._attrs.get(n);if(i===void 0)return!1;if(typeof i=="string"||typeof s=="string"){if(i!==s)return!1}else if(!i._isMatching(s))return!1}return!0}_subtractAttributesOf(e){this._fireChange("attributes",this);for(const[n,s]of e._attrs){const i=this._attrs.get(n);typeof i=="string"||typeof s=="string"?this._attrs.delete(n):(i.remove(s.keys()),i.isEmpty&&this._attrs.delete(n))}}_setCustomProperty(e,n){this._customProperties.set(e,n)}_removeCustomProperty(e){return this._customProperties.delete(e)}_parseAttributes(e){const n=we(e);for(const[s,i]of n)if(i===null)n.delete(s);else if(ke(this.name,s)){const o=i instanceof qe?i._clone():new qe(this.document.stylesProcessor).setTo(String(i));n.set(s,o)}else if(Oe(this.name,s)){const o=i instanceof vt?i._clone():new vt().setTo(String(i));n.set(s,o)}else typeof i!="string"&&n.set(s,String(i));return n}};ne.prototype.is=function(r,t){return t?t===this.name&&(r==="element"||r==="view:element"):r==="element"||r==="view:element"||r==="node"||r==="view:node"};function ur(r,t){if(typeof t=="string")return[new N(r,t)];ce(t)||(t=[t]);const e=[];for(const n of t)typeof n=="string"?e.push(new N(r,n)):n instanceof Z?e.push(new N(r,n.data)):e.push(n);return e}function Oe(r,t){return t=="class"||r=="a"&&t=="rel"}function ke(r,t){return t=="style"}class Ke extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=fr}}Ke.prototype.is=function(r,t){return t?t===this.name&&(r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"):r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function fr(){const r=[...this.getChildren()],t=r[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const e of r)if(!e.is("uiElement"))return null;return this.childCount}class mt extends U(Ke){constructor(t,e,n,s){super(t,e,n,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(t),this.bind("isFocused").to(t,"isFocused",i=>i&&t.selection.editableElement==this),this.listenTo(t.selection,"change",()=>{this.isFocused=t.isFocused&&t.selection.editableElement==this})}destroy(){this.stopListening()}}mt.prototype.is=function(r,t){return t?t===this.name&&(r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"):r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};const ln=Symbol("rootName");class Kn extends mt{constructor(t,e){super(t,e),this.rootName="main"}get rootName(){return this.getCustomProperty(ln)}set rootName(t){this._setCustomProperty(ln,t)}set _name(t){this.name=t}}Kn.prototype.is=function(r,t){return t?t===this.name&&(r==="rootElement"||r==="view:rootElement"||r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"):r==="rootElement"||r==="view:rootElement"||r==="editableElement"||r==="view:editableElement"||r==="containerElement"||r==="view:containerElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};let ge=class{constructor(t={}){c(this,"direction");c(this,"boundaries");c(this,"singleCharacters");c(this,"shallow");c(this,"ignoreElementEnd");c(this,"_position");c(this,"_boundaryStartParent");c(this,"_boundaryEndParent");if(!t.boundaries&&!t.startPosition)throw new d("view-tree-walker-no-start-position",null);if(t.direction&&t.direction!="forward"&&t.direction!="backward")throw new d("view-tree-walker-unknown-direction",t.startPosition,{direction:t.direction});this.boundaries=t.boundaries||null,t.startPosition?this._position=_._createAt(t.startPosition):this._position=_._createAt(t.boundaries[t.direction=="backward"?"end":"start"]),this.direction=t.direction||"forward",this.singleCharacters=!!t.singleCharacters,this.shallow=!!t.shallow,this.ignoreElementEnd=!!t.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(t){let e,n;do n=this.position,e=this.next();while(!e.done&&t(e.value));e.done||(this._position=n)}jumpTo(t){this._boundaryStartParent&&t.isBefore(this.boundaries.start)?t=this.boundaries.start:this._boundaryEndParent&&t.isAfter(this.boundaries.end)&&(t=this.boundaries.end),this._position=t.clone()}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let t=this.position.clone();const e=this.position,n=t.parent;if(n.parent===null&&t.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;if(n&&n.is("view:$text")){if(t.isAtEnd)return this._position=_._createAfter(n),this._next();s=n.data[t.offset]}else s=n.getChild(t.offset);if(typeof s=="string"){let i;this.singleCharacters?i=1:i=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-t.offset;const o=new Z(n,t.offset,i);return t.offset+=i,this._position=t,this._formatReturnValue("text",o,e,t,i)}if(s&&s.is("view:element")){if(!this.shallow)t=new _(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,this._formatReturnValue("elementStart",s,e,t,1)}if(s&&s.is("view:$text")){if(this.singleCharacters)return t=new _(s,0),this._position=t,this._next();let i=s.data.length,o;return s==this._boundaryEndParent?(i=this.boundaries.end.offset,o=new Z(s,0,i),t=_._createAfter(o)):(o=new Z(s,0,s.data.length),t.offset++),this._position=t,this._formatReturnValue("text",o,e,t,i)}return t=_._createAfter(n),this._position=t,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,e,t)}_previous(){let t=this.position.clone();const e=this.position,n=t.parent;if(n.parent===null&&t.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(n.is("view:$text")){if(t.isAtStart)return this._position=_._createBefore(n),this._previous();s=n.data[t.offset-1]}else s=n.getChild(t.offset-1);if(typeof s=="string"){let i;if(this.singleCharacters)i=1;else{const a=n===this._boundaryStartParent?this.boundaries.start.offset:0;i=t.offset-a}t.offset-=i;const o=new Z(n,t.offset,i);return this._position=t,this._formatReturnValue("text",o,e,t,i)}if(s&&s.is("view:element"))return this.shallow?(t.offset--,this._position=t,this._formatReturnValue("elementStart",s,e,t,1)):(t=new _(s,s.childCount),this._position=t,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,e,t));if(s&&s.is("view:$text")){if(this.singleCharacters)return t=new _(s,s.data.length),this._position=t,this._previous();let i=s.data.length,o;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;o=new Z(s,a,s.data.length-a),i=o.data.length,t=_._createBefore(o)}else o=new Z(s,0,s.data.length),t.offset--;return this._position=t,this._formatReturnValue("text",o,e,t,i)}return t=_._createBefore(n),this._position=t,this._formatReturnValue("elementStart",n,e,t,1)}_formatReturnValue(t,e,n,s,i){return e.is("view:$textProxy")&&(e.offsetInText+e.data.length==e.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=_._createAfter(e.textNode),this._position=s):n=_._createAfter(e.textNode)),e.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=_._createBefore(e.textNode),this._position=s):n=_._createBefore(e.textNode))),{done:!1,value:{type:t,item:e,previousPosition:n,nextPosition:s,length:i}}}},_=class Q extends ye{constructor(e,n){super();c(this,"parent");c(this,"offset");this.parent=e,this.offset=n}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof mt);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const n=Q._createAt(this),s=n.offset+e;return n.offset=s<0?0:s,n}getLastMatchingPosition(e,n={}){n.startPosition=this;const s=new ge(n);return s.skip(e),s.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const n=this.getAncestors(),s=e.getAncestors();let i=0;for(;n[i]==s[i]&&n[i];)i++;return i===0?null:n[i-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const n=this.parent.is("node")?this.parent.getPath():[],s=e.parent.is("node")?e.parent.getPath():[];n.push(this.offset),s.push(e.offset);const i=F(n,s);switch(i){case"prefix":return"before";case"extension":return"after";default:return n[i]<s[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new ge(e)}clone(){return new Q(this.parent,this.offset)}static _createAt(e,n){if(e instanceof Q)return new this(e.parent,e.offset);{const s=e;if(n=="end")n=s.is("$text")?s.data.length:s.childCount;else{if(n=="before")return this._createBefore(s);if(n=="after")return this._createAfter(s);if(n!==0&&!n)throw new d("view-createpositionat-offset-required",s)}return new Q(s,n)}}static _createAfter(e){if(e.is("$textProxy"))return new Q(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new d("view-position-after-root",e,{root:e});return new Q(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new Q(e.textNode,e.offsetInText);if(!e.parent)throw new d("view-position-before-root",e,{root:e});return new Q(e.parent,e.index)}};_.prototype.is=function(r){return r==="position"||r==="view:position"};let b=class re extends ye{constructor(e,n=null){super();c(this,"start");c(this,"end");this.start=e.clone(),this.end=n?n.clone():e.clone()}*[Symbol.iterator](){yield*new ge({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(nt,{direction:"backward"}),n=this.end.getLastMatchingPosition(nt);return e.parent.is("$text")&&e.isAtStart&&(e=_._createBefore(e.parent)),n.parent.is("$text")&&n.isAtEnd&&(n=_._createAfter(n.parent)),new re(e,n)}getTrimmed(){let e=this.start.getLastMatchingPosition(nt);if(e.isAfter(this.end)||e.isEqual(this.end))return new re(e,e);let n=this.end.getLastMatchingPosition(nt,{direction:"backward"});const s=e.nodeAfter,i=n.nodeBefore;return s&&s.is("$text")&&(e=new _(s,0)),i&&i.is("$text")&&(n=new _(i,i.data.length)),new re(e,n)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,n=!1){e.isCollapsed&&(n=!1);const s=this.containsPosition(e.start)||n&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||n&&this.end.isEqual(e.end);return s&&i}getDifference(e){const n=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&n.push(new re(this.start,e.start)),this.containsPosition(e.end)&&n.push(new re(e.end,this.end))):n.push(this.clone()),n}getIntersection(e){if(this.isIntersecting(e)){let n=this.start,s=this.end;return this.containsPosition(e.start)&&(n=e.start),this.containsPosition(e.end)&&(s=e.end),new re(n,s)}return null}getWalker(e={}){return e.boundaries=this,new ge(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,n=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(n=this.end.parent.previousSibling),e&&e.is("element")&&e===n?e:null}clone(){return new re(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const n=new ge(e);for(const s of n)yield s.item}*getPositions(e={}){e.boundaries=this;const n=new ge(e);yield n.position;for(const s of n)yield s.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,n,s,i){return new this(new _(e,n),new _(s,i))}static _createFromPositionAndShift(e,n){const s=e,i=e.getShiftedBy(n);return n>0?new this(s,i):new this(i,s)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const n=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(_._createBefore(e),n)}};b.prototype.is=function(r){return r==="range"||r==="view:range"};function nt(r){return!!(r.item.is("attributeElement")||r.item.is("uiElement"))}let ee=class Xn extends O(ye){constructor(...e){super();c(this,"_ranges");c(this,"_lastRangeBackward");c(this,"_isFake");c(this,"_fakeSelectionLabel");this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const n of this._ranges)(!e||n.start.isBefore(e.start))&&(e=n);return e?e.clone():null}getLastRange(){let e=null;for(const n of this._ranges)(!e||n.end.isAfter(e.end))&&(e=n);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const n of this._ranges){let s=!1;for(const i of e._ranges)if(n.isEqual(i)){s=!0;break}if(!s)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const n=tn(this.getRanges()),s=tn(e.getRanges());if(n!=s)return!1;if(n==0)return!0;for(let i of this.getRanges()){i=i.getTrimmed();let o=!1;for(let a of e.getRanges())if(a=a.getTrimmed(),i.start.isEqual(a.start)&&i.end.isEqual(a.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[n,s,i]=e;if(typeof s=="object"&&(i=s,s=void 0),n===null)this._setRanges([]),this._setFakeOptions(i);else if(n instanceof Xn||n instanceof Jt)this._setRanges(n.getRanges(),n.isBackward),this._setFakeOptions({fake:n.isFake,label:n.fakeSelectionLabel});else if(n instanceof b)this._setRanges([n],i&&i.backward),this._setFakeOptions(i);else if(n instanceof _)this._setRanges([new b(n)]),this._setFakeOptions(i);else if(n instanceof ve){const o=!!i&&!!i.backward;let a;if(s===void 0)throw new d("view-selection-setto-required-second-parameter",this);s=="in"?a=b._createIn(n):s=="on"?a=b._createOn(n):a=new b(_._createAt(n,s)),this._setRanges([a],o),this._setFakeOptions(i)}else if(ce(n))this._setRanges(n,i&&i.backward),this._setFakeOptions(i);else throw new d("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,n){if(this.anchor===null)throw new d("view-selection-setfocus-no-ranges",this);const s=_._createAt(e,n);if(s.compareWith(this.focus)=="same")return;const i=this.anchor;this._ranges.pop(),s.compareWith(i)=="before"?this._addRange(new b(s,i),!0):this._addRange(new b(i,s)),this.fire("change")}_setRanges(e,n=!1){e=Array.from(e),this._ranges=[];for(const s of e)this._addRange(s);this._lastRangeBackward=!!n}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,n=!1){if(!(e instanceof b))throw new d("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!n}_pushRange(e){for(const n of this._ranges)if(e.isIntersecting(n))throw new d("view-selection-range-intersects",this,{addedRange:e,intersectingRange:n});this._ranges.push(new b(e.start,e.end))}};ee.prototype.is=function(r){return r==="selection"||r==="view:selection"};let Jt=class extends O(ye){constructor(...e){super();c(this,"_selection");this._selection=new ee,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,n){this._selection.setFocus(e,n)}};Jt.prototype.is=function(r){return r==="selection"||r=="documentSelection"||r=="view:selection"||r=="view:documentSelection"};class jt extends Tt{constructor(e,n,s){super(e,n);c(this,"startRange");c(this,"_eventPhase");c(this,"_currentTarget");this.startRange=s,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const Pt=Symbol("bubbling contexts");function It(r){class t extends r{fire(n,...s){try{const i=n instanceof Tt?n:new Tt(this,n),o=Ct(this);if(!o.size)return;if(Ie(i,"capturing",this),Ae(o,"$capture",i,...s))return i.return;const a=i.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,h=l?!!Yn(o,l):!1;let u=l||dr(a);if(Ie(i,"atTarget",u),!h){if(Ae(o,"$text",i,...s))return i.return;Ie(i,"bubbling",u)}for(;u;){if(u.is("rootElement")){if(Ae(o,"$root",i,...s))return i.return}else if(u.is("element")&&Ae(o,u.name,i,...s))return i.return;if(Ae(o,u,i,...s))return i.return;u=u.parent,Ie(i,"bubbling",u)}return Ie(i,"bubbling",this),Ae(o,"$document",i,...s),i.return}catch(i){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(i,this)}}_addEventListener(n,s,i){const o=le(i.context||"$document"),a=Ct(this);for(const l of o){let h=a.get(l);h||(h=new(O()),a.set(l,h)),this.listenTo(h,n,s,i)}}_removeEventListener(n,s){const i=Ct(this);for(const o of i.values())this.stopListening(o,n,s)}}return t}{const r=It(Object);["fire","_addEventListener","_removeEventListener"].forEach(t=>{It[t]=r.prototype[t]})}function Ie(r,t,e){r instanceof jt&&(r._eventPhase=t,r._currentTarget=e)}function Ae(r,t,e,...n){const s=typeof t=="string"?r.get(t):Yn(r,t);return s?(s.fire(e,...n),e.stop.called):!1}function Yn(r,t){for(const[e,n]of r)if(typeof e=="function"&&e(t))return n;return null}function Ct(r){return r[Pt]||(r[Pt]=new Map),r[Pt]}function dr(r){if(!r)return null;const t=r.start.parent,e=r.end.parent,n=t.getPath(),s=e.getPath();return n.length>s.length?t:e}let Qn=class extends It(U()){constructor(e){super();c(this,"selection");c(this,"roots");c(this,"stylesProcessor");c(this,"_postFixers",new Set);this.selection=new Jt,this.roots=new qt({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let n=!1;do for(const s of this._postFixers)if(n=s(e),n)break;while(n)}};const cn=10;class pe extends ne{constructor(e,n,s,i){super(e,n,s,i);c(this,"_priority",cn);c(this,"_id",null);c(this,"_clonesGroup",null);this.getFillerOffset=mr}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new d("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const n=super._clone(e);return n._priority=this._priority,n._id=this._id,n}_canMergeAttributesFrom(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canMergeAttributesFrom(e)}_canSubtractAttributesOf(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canSubtractAttributesOf(e)}}c(pe,"DEFAULT_PRIORITY",cn);pe.prototype.is=function(r,t){return t?t===this.name&&(r==="attributeElement"||r==="view:attributeElement"||r==="element"||r==="view:element"):r==="attributeElement"||r==="view:attributeElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function mr(){if(kt(this))return null;let r=this.parent;for(;r&&r.is("attributeElement");){if(kt(r)>1)return null;r=r.parent}return!r||kt(r)>1?null:this.childCount}function kt(r){return Array.from(r.getChildren()).filter(t=>!t.is("uiElement")).length}class Gt extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=gr}_insertChild(t,e){if(e&&(e instanceof ve||Array.from(e).length>0))throw new d("view-emptyelement-cannot-add",[this,e]);return 0}}Gt.prototype.is=function(r,t){return t?t===this.name&&(r==="emptyElement"||r==="view:emptyElement"||r==="element"||r==="view:element"):r==="emptyElement"||r==="view:emptyElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function gr(){return null}class gt extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=_r}_insertChild(t,e){if(e&&(e instanceof ve||Array.from(e).length>0))throw new d("view-uielement-cannot-add",[this,e]);return 0}render(t,e){return this.toDomElement(t)}toDomElement(t){const e=t.createElement(this.name);for(const n of this.getAttributeKeys())e.setAttribute(n,this.getAttribute(n));return e}}gt.prototype.is=function(r,t){return t?t===this.name&&(r==="uiElement"||r==="view:uiElement"||r==="element"||r==="view:element"):r==="uiElement"||r==="view:uiElement"||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function pr(r){r.document.on("arrowKey",(t,e)=>wr(t,e,r.domConverter),{priority:"low"})}function _r(){return null}function wr(r,t,e){if(t.keyCode==me.arrowright){const n=t.domTarget.ownerDocument.defaultView.getSelection(),s=n.rangeCount==1&&n.getRangeAt(0).collapsed;if(s||t.shiftKey){const i=n.focusNode,o=n.focusOffset,a=e.domPositionToView(i,o);if(a===null)return;let l=!1;const h=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){const u=e.viewPositionToDom(h);s?n.collapse(u.parent,u.offset):n.extend(u.parent,u.offset)}}}}class Ht extends ne{constructor(t,e,n,s){super(t,e,n,s),this.getFillerOffset=br}_insertChild(t,e){if(e&&(e instanceof ve||Array.from(e).length>0))throw new d("view-rawelement-cannot-add",[this,e]);return 0}render(t,e){}}Ht.prototype.is=function(r,t){return t?t===this.name&&(r==="rawElement"||r==="view:rawElement"||r==="element"||r==="view:element"):r==="rawElement"||r==="view:rawElement"||r===this.name||r==="view:"+this.name||r==="element"||r==="view:element"||r==="node"||r==="view:node"};function br(){return null}let _e=class extends O(ye){constructor(e,n){super();c(this,"document");c(this,"_children",[]);c(this,"_customProperties",new Map);this.document=e,n&&this._insertChild(0,n)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,n){this._fireChange("children",this,{index:e});let s=0;const i=yr(this.document,n);for(const o of i)o.parent!==null&&o._remove(),o.parent=this,this._children.splice(e,0,o),e++,s++;return s}_removeChildren(e,n=1){this._fireChange("children",this,{index:e});for(let s=e;s<e+n;s++)this._children[s].parent=null;return this._children.splice(e,n)}_fireChange(e,n,s){this.fire(`change:${e}`,n,s)}_setCustomProperty(e,n){this._customProperties.set(e,n)}_removeCustomProperty(e){return this._customProperties.delete(e)}};_e.prototype.is=function(r){return r==="documentFragment"||r==="view:documentFragment"};function yr(r,t){return typeof t=="string"?[new N(r,t)]:(ce(t)||(t=[t]),Array.from(t).map(e=>typeof e=="string"?new N(r,e):e instanceof Z?new N(r,e.data):e))}class Zn{constructor(t){c(this,"document");c(this,"_cloneGroups",new Map);c(this,"_slotFactory",null);this.document=t}setSelection(...t){this.document.selection._setTo(...t)}setSelectionFocus(t,e){this.document.selection._setFocus(t,e)}createDocumentFragment(t){return new _e(this.document,t)}createText(t){return new N(this.document,t)}createAttributeElement(t,e,n={}){const s=new pe(this.document,t,e);return typeof n.priority=="number"&&(s._priority=n.priority),n.id&&(s._id=n.id),n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createContainerElement(t,e,n={},s={}){let i=null;Mt(n)?s=n:i=n;const o=new Ke(this.document,t,e,i);return s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}createEditableElement(t,e,n={}){const s=new mt(this.document,t,e);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createEmptyElement(t,e,n={}){const s=new Gt(this.document,t,e);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createUIElement(t,e,n){const s=new gt(this.document,t,e);return n&&(s.render=n),s}createRawElement(t,e,n,s={}){const i=new Ht(this.document,t,e);return n&&(i.render=n),s.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),i}setAttribute(t,e,n,s){s!==void 0?s._setAttribute(t,e,n):n._setAttribute(t,e)}removeAttribute(t,e,n){n!==void 0?n._removeAttribute(t,e):e._removeAttribute(t)}addClass(t,e){e._addClass(t)}removeClass(t,e){e._removeClass(t)}setStyle(t,e,n){Mt(t)&&n===void 0?e._setStyle(t):n._setStyle(t,e)}removeStyle(t,e){e._removeStyle(t)}setCustomProperty(t,e,n){n._setCustomProperty(t,e)}removeCustomProperty(t,e){return e._removeCustomProperty(t)}breakAttributes(t){return t instanceof _?this._breakAttributes(t):this._breakAttributesRange(t)}breakContainer(t){const e=t.parent;if(!e.is("containerElement"))throw new d("view-writer-break-non-container-element",this.document);if(!e.parent)throw new d("view-writer-break-root",this.document);if(t.isAtStart)return _._createBefore(e);if(!t.isAtEnd){const n=e._clone(!1);this.insert(_._createAfter(e),n);const s=new b(t,_._createAt(e,"end")),i=new _(n,0);this.move(s,i)}return _._createAfter(e)}mergeAttributes(t){const e=t.offset,n=t.parent;if(n.is("$text"))return t;if(n.is("attributeElement")&&n.childCount===0){const o=n.parent,a=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new _(o,a))}const s=n.getChild(e-1),i=n.getChild(e);if(!s||!i)return t;if(s.is("$text")&&i.is("$text"))return un(s,i);if(s.is("attributeElement")&&i.is("attributeElement")&&s.isSimilar(i)){const o=s.childCount;return s._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new _(s,o))}return t}mergeContainers(t){const e=t.nodeBefore,n=t.nodeAfter;if(!e||!n||!e.is("containerElement")||!n.is("containerElement"))throw new d("view-writer-merge-containers-invalid-position",this.document);const s=e.getChild(e.childCount-1),i=s instanceof N?_._createAt(s,"end"):_._createAt(e,"end");return this.move(b._createIn(n),_._createAt(e,"end")),this.remove(b._createOn(n)),i}insert(t,e){e=ce(e)?[...e]:[e],es(e,this.document);const n=e.reduce((o,a)=>{const l=o[o.length-1],h=!a.is("uiElement");return!l||l.breakAttributes!=h?o.push({breakAttributes:h,nodes:[a]}):l.nodes.push(a),o},[]);let s=null,i=t;for(const{nodes:o,breakAttributes:a}of n){const l=this._insertNodes(i,o,a);s||(s=l.start),i=l.end}return s?new b(s,i):new b(t)}remove(t){const e=t instanceof b?t:b._createOn(t);if(Fe(e,this.document),e.isCollapsed)return new _e(this.document);const{start:n,end:s}=this._breakAttributesRange(e,!0),i=n.parent,o=s.offset-n.offset,a=i._removeChildren(n.offset,o);for(const h of a)this._removeFromClonedElementsGroup(h);const l=this.mergeAttributes(n);return e.start=l,e.end=l.clone(),new _e(this.document,a)}clear(t,e){Fe(t,this.document);const n=t.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of n){const i=s.item;let o;if(i.is("element")&&e.isSimilar(i))o=b._createOn(i);else if(!s.nextPosition.isAfter(t.start)&&i.is("$textProxy")){const a=i.getAncestors().find(l=>l.is("element")&&e.isSimilar(l));a&&(o=b._createIn(a))}o&&(o.end.isAfter(t.end)&&(o.end=t.end),o.start.isBefore(t.start)&&(o.start=t.start),this.remove(o))}}move(t,e){let n;if(e.isAfter(t.end)){e=this._breakAttributes(e,!0);const s=e.parent,i=s.childCount;t=this._breakAttributesRange(t,!0),n=this.remove(t),e.offset+=s.childCount-i}else n=this.remove(t);return this.insert(e,n)}wrap(t,e){if(!(e instanceof pe))throw new d("view-writer-wrap-invalid-attribute",this.document);if(Fe(t,this.document),t.isCollapsed){let n=t.start;n.parent.is("element")&&!vr(n.parent)&&(n=n.getLastMatchingPosition(i=>i.item.is("uiElement"))),n=this._wrapPosition(n,e);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(t.start)&&this.setSelection(n),new b(n)}else return this._wrapRange(t,e)}unwrap(t,e){if(!(e instanceof pe))throw new d("view-writer-unwrap-invalid-attribute",this.document);if(Fe(t,this.document),t.isCollapsed)return t;const{start:n,end:s}=this._breakAttributesRange(t,!0),i=n.parent,o=this._unwrapChildren(i,n.offset,s.offset,e),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new b(a,l)}rename(t,e){const n=new Ke(this.document,t,e.getAttributes());return this.insert(_._createAfter(e),n),this.move(b._createIn(e),_._createAt(n,0)),this.remove(b._createOn(e)),n}clearClonedElementsGroup(t){this._cloneGroups.delete(t)}createPositionAt(t,e){return _._createAt(t,e)}createPositionAfter(t){return _._createAfter(t)}createPositionBefore(t){return _._createBefore(t)}createRange(t,e){return new b(t,e)}createRangeOn(t){return b._createOn(t)}createRangeIn(t){return b._createIn(t)}createSelection(...t){return new ee(...t)}createSlot(t="children"){if(!this._slotFactory)throw new d("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,t)}_registerSlotFactory(t){this._slotFactory=t}_clearSlotFactory(){this._slotFactory=null}_insertNodes(t,e,n){let s;if(n?s=Ft(t):s=t.parent.is("$text")?t.parent.parent:t.parent,!s)throw new d("view-writer-invalid-position-container",this.document);let i;n?i=this._breakAttributes(t,!0):i=t.parent.is("$text")?At(t):t;const o=s._insertChild(i.offset,e);for(const u of e)this._addToClonedElementsGroup(u);const a=i.getShiftedBy(o),l=this.mergeAttributes(i);l.isEqual(i)||a.offset--;const h=this.mergeAttributes(a);return new b(l,h)}_wrapChildren(t,e,n,s){let i=e;const o=[];for(;i<n;){const l=t.getChild(i),h=l.is("$text"),u=l.is("attributeElement");if(u&&l._canMergeAttributesFrom(s))l._mergeAttributesFrom(s),o.push(new _(t,i));else if(h||!u||Pr(s,l)){const m=s._clone();l._remove(),m._appendChild(l),t._insertChild(i,m),this._addToClonedElementsGroup(m),o.push(new _(t,i))}else this._wrapChildren(l,0,l.childCount,s);i++}let a=0;for(const l of o){if(l.offset-=a,l.offset==e)continue;this.mergeAttributes(l).isEqual(l)||(a++,n--)}return b._createFromParentsAndOffsets(t,e,t,n)}_unwrapChildren(t,e,n,s){let i=e;const o=[];for(;i<n;){const l=t.getChild(i);if(!l.is("attributeElement")){i++;continue}if(l.isSimilar(s)){const h=l.getChildren(),u=l.childCount;l._remove(),t._insertChild(i,h),this._removeFromClonedElementsGroup(l),o.push(new _(t,i),new _(t,i+u)),i+=u,n+=u-1;continue}if(l._canSubtractAttributesOf(s)){l._subtractAttributesOf(s),o.push(new _(t,i),new _(t,i+1)),i++;continue}this._unwrapChildren(l,0,l.childCount,s),i++}let a=0;for(const l of o){if(l.offset-=a,l.offset==e||l.offset==n)continue;this.mergeAttributes(l).isEqual(l)||(a++,n--)}return b._createFromParentsAndOffsets(t,e,t,n)}_wrapRange(t,e){const{start:n,end:s}=this._breakAttributesRange(t,!0),i=n.parent,o=this._wrapChildren(i,n.offset,s.offset,e),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new b(a,l)}_wrapPosition(t,e){if(e.isSimilar(t.parent))return hn(t.clone());t.parent.is("$text")&&(t=At(t));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,t.parent._insertChild(t.offset,n);const s=new b(t,t.getShiftedBy(1));this.wrap(s,e);const i=new _(n.parent,n.index);n._remove();const o=i.nodeBefore,a=i.nodeAfter;return o&&o.is("view:$text")&&a&&a.is("view:$text")?un(o,a):hn(i)}_breakAttributesRange(t,e=!1){const n=t.start,s=t.end;if(Fe(t,this.document),t.isCollapsed){const l=this._breakAttributes(t.start,e);return new b(l,l)}const i=this._breakAttributes(s,e),o=i.parent.childCount,a=this._breakAttributes(n,e);return i.offset+=i.parent.childCount-o,new b(a,i)}_breakAttributes(t,e=!1){const n=t.offset,s=t.parent;if(t.parent.is("emptyElement"))throw new d("view-writer-cannot-break-empty-element",this.document);if(t.parent.is("uiElement"))throw new d("view-writer-cannot-break-ui-element",this.document);if(t.parent.is("rawElement"))throw new d("view-writer-cannot-break-raw-element",this.document);if(!e&&s.is("$text")&&Bt(s.parent)||Bt(s))return t.clone();if(s.is("$text"))return this._breakAttributes(At(t),e);const i=s.childCount;if(n==i){const o=new _(s.parent,s.index+1);return this._breakAttributes(o,e)}else if(n===0){const o=new _(s.parent,s.index);return this._breakAttributes(o,e)}else{const o=s.index+1,a=s._clone();s.parent._insertChild(o,a),this._addToClonedElementsGroup(a);const l=s.childCount-n,h=s._removeChildren(n,l);a._appendChild(h);const u=new _(s.parent,o);return this._breakAttributes(u,e)}}_addToClonedElementsGroup(t){if(!t.root.is("rootElement"))return;if(t.is("element"))for(const s of t.getChildren())this._addToClonedElementsGroup(s);const e=t.id;if(!e)return;let n=this._cloneGroups.get(e);n||(n=new Set,this._cloneGroups.set(e,n)),n.add(t),t._clonesGroup=n}_removeFromClonedElementsGroup(t){if(t.is("element"))for(const s of t.getChildren())this._removeFromClonedElementsGroup(s);const e=t.id;if(!e)return;const n=this._cloneGroups.get(e);n&&n.delete(t)}}function vr(r){return Array.from(r.getChildren()).some(t=>!t.is("uiElement"))}function Ft(r){let t=r.parent;for(;!Bt(t);){if(!t)return;t=t.parent}return t}function Pr(r,t){return r.priority<t.priority?!0:r.priority>t.priority?!1:r.getIdentity()<t.getIdentity()}function hn(r){const t=r.nodeBefore;if(t&&t.is("$text"))return new _(t,t.data.length);const e=r.nodeAfter;return e&&e.is("$text")?new _(e,0):r}function At(r){if(r.offset==r.parent.data.length)return new _(r.parent.parent,r.parent.index+1);if(r.offset===0)return new _(r.parent.parent,r.parent.index);const t=r.parent.data.slice(r.offset);return r.parent._data=r.parent.data.slice(0,r.offset),r.parent.parent._insertChild(r.parent.index+1,new N(r.root.document,t)),new _(r.parent.parent,r.parent.index+1)}function un(r,t){const e=r.data.length;return r._data+=t.data,t._remove(),new _(r,e)}const Cr=[N,pe,Ke,Gt,Ht,gt];function es(r,t){for(const e of r){if(!Cr.some(n=>e instanceof n))throw new d("view-writer-insert-invalid-node-type",t);e.is("$text")||es(e.getChildren(),t)}}function Bt(r){return r&&(r.is("containerElement")||r.is("documentFragment"))}function Fe(r,t){const e=Ft(r.start),n=Ft(r.end);if(!e||!n||e!==n)throw new d("view-writer-invalid-range-container",t)}const ts=r=>r.createTextNode(" "),ns=r=>{const t=r.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},ss=r=>{const t=r.createElement("br");return t.dataset.ckeFiller="true",t},j=7,Xe="⁠".repeat(j);function $(r){return typeof r=="string"?r.substr(0,j)===Xe:R(r)&&r.data.substr(0,j)===Xe}function Te(r){return r.data.length==j&&$(r)}function fn(r){const t=typeof r=="string"?r:r.data;return $(r)?t.slice(j):t}function kr(r){r.document.on("arrowKey",Ar,{priority:"low"})}function Ar(r,t){if(t.keyCode==me.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(e.rangeCount==1&&e.getRangeAt(0).collapsed){const n=e.getRangeAt(0).startContainer,s=e.getRangeAt(0).startOffset;$(n)&&s<=j&&e.collapse(n,0)}}}class Sr extends U(){constructor(e,n){super();c(this,"domDocuments",new Set);c(this,"domConverter");c(this,"markedAttributes",new Set);c(this,"markedChildren",new Set);c(this,"markedTexts",new Set);c(this,"selection");c(this,"_inlineFiller",null);c(this,"_fakeSelectionContainer",null);this.domConverter=e,this.selection=n,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),T.isBlink&&!T.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()})}markToSync(e,n){if(e==="text")this.domConverter.mapViewToDom(n.parent)&&this.markedTexts.add(n);else{if(!this.domConverter.mapViewToDom(n))return;if(e==="attributes")this.markedAttributes.add(n);else if(e==="children")this.markedChildren.add(n);else throw new d("view-renderer-unknown-type",this)}}render(){if(this.isComposing&&!T.isAndroid)return;let e=null;const n=T.isBlink&&!T.isAndroid?!this.isSelecting:!0;for(const s of this.markedChildren)this._updateChildrenMappings(s);n?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=_._createBefore(e.parent)));for(const s of this.markedAttributes)this._updateAttrs(s);for(const s of this.markedChildren)this._updateChildren(s,{inlineFillerPosition:e});for(const s of this.markedTexts)!this.markedChildren.has(s.parent)&&this.domConverter.mapViewToDom(s.parent)&&this._updateText(s,{inlineFillerPosition:e});if(n)if(e){const s=this.domConverter.viewPositionToDom(e),i=s.parent.ownerDocument;$(s.parent)?this._inlineFiller=s.parent:this._inlineFiller=dn(i,s.parent,s.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const n=this.domConverter.mapViewToDom(e);if(!n)return;const s=Array.from(n.childNodes),i=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),o=this._diffNodeLists(s,i),a=this._findUpdateActions(o,s,i,Rr);if(a.indexOf("update")!==-1){const l={equal:0,insert:0,delete:0};for(const h of a)if(h==="update"){const u=l.equal+l.insert,m=l.equal+l.delete,p=e.getChild(u);p&&!p.is("uiElement")&&!p.is("rawElement")&&this._updateElementMappings(p,s[m]),sn(i[u]),l.equal++}else l[h]++}}_updateElementMappings(e,n){this.domConverter.unbindDomElement(n),this.domConverter.bindElements(n,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?_._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),n=this.domConverter.viewPositionToDom(e);return!!(n&&R(n.parent)&&$(n.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!$(e))throw new d("view-renderer-filler-was-lost",this);Te(e)?e.remove():e.data=e.data.substr(j),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),n=e.parent,s=e.offset;if(!this.domConverter.mapViewToDom(n.root)||!n.is("element")||!Er(n))return!1;const i=e.nodeBefore,o=e.nodeAfter;return!(i instanceof N||o instanceof N||s===n.getFillerOffset()&&(!i||!i.is("element","br"))||T.isAndroid&&(i||o))}_updateText(e,n){const s=this.domConverter.findCorrespondingDomText(e);let o=this.domConverter.viewToDom(e).data;const a=n.inlineFillerPosition;a&&a.parent==e.parent&&a.offset==e.index&&(o=Xe+o),this._updateTextNode(s,o)}_updateAttrs(e){const n=this.domConverter.mapViewToDom(e);if(n){for(const s of Array.from(n.attributes)){const i=s.name;e.hasAttribute(i)||this.domConverter.removeDomElementAttribute(n,i)}for(const s of e.getAttributeKeys())this.domConverter.setDomElementAttribute(n,s,e.getAttribute(s),e)}}_updateChildren(e,n){const s=this.domConverter.mapViewToDom(e);if(!s)return;if(T.isAndroid){let p=null;for(const w of Array.from(s.childNodes)){if(p&&R(p)&&R(w)){s.normalize();break}p=w}}const i=n.inlineFillerPosition,o=s.childNodes,a=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));i&&i.parent===e&&dn(s.ownerDocument,a,i.offset);const l=this._diffNodeLists(o,a),h=this._findUpdateActions(l,o,a,Tr);let u=0;const m=new Set;for(const p of h)p==="delete"?(m.add(o[u]),sn(o[u])):(p==="equal"||p==="update")&&u++;u=0;for(const p of h)p==="insert"?(Jn(s,u,a[u]),u++):p==="update"?(this._updateTextNode(o[u],a[u].data),u++):p==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(a[u])),u++);for(const p of m)p.parentNode||this.domConverter.unbindDomElement(p)}_diffNodeLists(e,n){return e=Nr(e,this._fakeSelectionContainer),pt(e,n,Mr.bind(null,this.domConverter))}_findUpdateActions(e,n,s,i){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let o=[],a=[],l=[];const h={equal:0,insert:0,delete:0};for(const u of e)u==="insert"?l.push(s[h.equal+h.insert]):u==="delete"?a.push(n[h.equal+h.delete]):(o=o.concat(pt(a,l,i).map(m=>m==="equal"?"update":m)),o.push("equal"),a=[],l=[]),h[u]++;return o.concat(pt(a,l,i).map(u=>u==="equal"?"update":u))}_updateTextNode(e,n){const s=e.data;s!=n&&(T.isAndroid&&this.isComposing&&s.replace(/\u00A0/g," ")==n.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,n))}_updateTextNodeInternal(e,n){const s=Js(e.data,n);for(const i of s)i.type==="insert"?e.insertData(i.index,i.values.join("")):e.deleteData(i.index,i.howMany)}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const n of e.getChildren())this._markDescendantTextToSync(n)}}_updateSelection(){if(T.isBlink&&!T.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}const e=this.domConverter.mapViewToDom(this.selection.editableElement);!this.isFocused||!e||(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&T.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const n=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=Or(n));const s=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(s,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!s.parentElement||s.parentElement!=e)&&e.appendChild(s),s.textContent=this.selection.fakeSelectionLabel||" ";const i=n.getSelection(),o=n.createRange();i.removeAllRanges(),o.selectNodeContents(s),i.addRange(o)}_updateDomSelection(e){const n=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(n))return;const s=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);n.setBaseAndExtent(s.parent,s.offset,i.parent,i.offset),T.isGecko&&xr(i,n)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const n=e&&this.domConverter.domSelectionToView(e);return!(n&&this.selection.isEqual(n)||!this.selection.isCollapsed&&this.selection.isSimilar(n))}_fakeSelectionNeedsUpdate(e){const n=this._fakeSelectionContainer,s=e.ownerDocument.getSelection();return!n||n.parentElement!==e||s.anchorNode!==n&&!n.contains(s.anchorNode)?!0:n.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const n=e.getSelection();if(n.rangeCount){const s=e.activeElement,i=this.domConverter.mapDomToView(s);s&&i&&n.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Er(r){if(r.getAttribute("contenteditable")=="false")return!1;const t=r.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||t.getAttribute("contenteditable")=="true"}function dn(r,t,e){const n=t instanceof Array?t:t.childNodes,s=n[e];if(R(s))return s.data=Xe+s.data,s;{const i=r.createTextNode(Xe);return Array.isArray(t)?n.splice(e,0,i):Jn(t,e,i),i}}function Rr(r,t){return lt(r)&&lt(t)&&!R(r)&&!R(t)&&!We(r)&&!We(t)&&r.tagName.toLowerCase()===t.tagName.toLowerCase()}function Tr(r,t){return lt(r)&&lt(t)&&R(r)&&R(t)}function Mr(r,t,e){return t===e?!0:R(t)&&R(e)?t.data===e.data:!!(r.isBlockFiller(t)&&r.isBlockFiller(e))}function xr(r,t){let e=r.parent,n=r.offset;if(R(e)&&Te(e)&&(n=Ve(e)+1,e=e.parentNode),e.nodeType!=Node.ELEMENT_NODE||n!=e.childNodes.length-1)return;const s=e.childNodes[n];s&&s.tagName=="BR"&&t.addRange(t.getRangeAt(0))}function Nr(r,t){const e=Array.from(r);return e.length==0||!t||e[e.length-1]==t&&e.pop(),e}function Or(r){const t=r.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}const Ir=ss(ie.document),Fr=ts(ie.document),Br=ns(ie.document),st="data-ck-unsafe-attribute-",mn="data-ck-unsafe-element";class rs{constructor(t,{blockFillerMode:e,renderingMode:n="editing"}={}){c(this,"document");c(this,"renderingMode");c(this,"blockFillerMode");c(this,"preElements");c(this,"blockElements");c(this,"inlineObjectElements");c(this,"unsafeElements");c(this,"_domDocument");c(this,"_domToViewMapping",new WeakMap);c(this,"_viewToDomMapping",new WeakMap);c(this,"_fakeSelectionMapping",new WeakMap);c(this,"_rawContentElementMatcher",new He);c(this,"_inlineObjectElementMatcher",new He);c(this,"_elementsWithTemporaryCustomProperties",new Set);this.document=t,this.renderingMode=n,this.blockFillerMode=e||(n==="editing"?"br":"nbsp"),this.preElements=["pre","textarea"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?ie.document:ie.document.implementation.createHTMLDocument("")}get domDocument(){return this._domDocument}bindFakeSelection(t,e){this._fakeSelectionMapping.set(t,new ee(e))}fakeSelectionToView(t){return this._fakeSelectionMapping.get(t)}bindElements(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}unbindDomElement(t){const e=this._domToViewMapping.get(t);if(e){this._domToViewMapping.delete(t),this._viewToDomMapping.delete(e);for(const n of t.children)this.unbindDomElement(n)}}bindDocumentFragments(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}shouldRenderAttribute(t,e,n){return this.renderingMode==="data"?!0:(t=t.toLowerCase(),t.startsWith("on")||t==="srcdoc"&&e.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:n==="img"&&(t==="src"||t==="srcset")||n==="source"&&t==="srcset"?!0:!e.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(t,e){if(this.renderingMode==="data"){t.innerHTML=e;return}const n=new DOMParser().parseFromString(e,"text/html"),s=n.createDocumentFragment(),i=n.body.childNodes;for(;i.length>0;)s.appendChild(i[0]);const o=n.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=o.nextNode();)a.push(l);for(const h of a){for(const m of h.getAttributeNames())this.setDomElementAttribute(h,m,h.getAttribute(m));const u=h.tagName.toLowerCase();this._shouldRenameElement(u)&&(wn(u),h.replaceWith(this._createReplacementDomElement(u,h)))}for(;t.firstChild;)t.firstChild.remove();t.append(s)}viewToDom(t,e={}){if(t.is("$text")){const n=this._processDataFromViewText(t);return this._domDocument.createTextNode(n)}else{const n=t;if(this.mapViewToDom(n))if(n.getCustomProperty("editingPipeline:doNotReuseOnce"))this._elementsWithTemporaryCustomProperties.add(n);else return this.mapViewToDom(n);let s;if(n.is("documentFragment"))s=this._domDocument.createDocumentFragment(),e.bind&&this.bindDocumentFragments(s,n);else{if(n.is("uiElement"))return n.name==="$comment"?s=this._domDocument.createComment(n.getCustomProperty("$rawContent")):s=n.render(this._domDocument,this),e.bind&&this.bindElements(s,n),s;this._shouldRenameElement(n.name)?(wn(n.name),s=this._createReplacementDomElement(n.name)):n.hasAttribute("xmlns")?s=this._domDocument.createElementNS(n.getAttribute("xmlns"),n.name):s=this._domDocument.createElement(n.name),n.is("rawElement")&&n.render(s,this),e.bind&&this.bindElements(s,n);for(const i of n.getAttributeKeys())this.setDomElementAttribute(s,i,n.getAttribute(i),n)}if(e.withChildren!==!1)for(const i of this.viewChildrenToDom(n,e))s instanceof HTMLTemplateElement?s.content.appendChild(i):s.appendChild(i);return s}}setDomElementAttribute(t,e,n,s){const i=this.shouldRenderAttribute(e,n,t.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(e);if(i||W("domconverter-unsafe-attribute-detected",{domElement:t,key:e,value:n}),!qs(e)){W("domconverter-invalid-attribute-detected",{domElement:t,key:e,value:n});return}t.hasAttribute(e)&&!i?t.removeAttribute(e):t.hasAttribute(st+e)&&i&&t.removeAttribute(st+e),t.setAttribute(i?e:st+e,n)}removeDomElementAttribute(t,e){e!=mn&&(t.removeAttribute(e),t.removeAttribute(st+e))}*viewChildrenToDom(t,e={}){const n=t.getFillerOffset&&t.getFillerOffset();let s=0;for(const i of t.getChildren()){n===s&&(yield this._getBlockFiller());const o=i.is("element")&&!!i.getCustomProperty("dataPipeline:transparentRendering")&&!zt(i.getAttributes());if(o&&this.renderingMode=="data")if(i.is("rawElement")){const a=this._domDocument.createElement(i.name);i.render(a,this),yield*[...a.childNodes]}else yield*this.viewChildrenToDom(i,e);else o&&W("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:i}),yield this.viewToDom(i,e);s++}n===s&&(yield this._getBlockFiller())}viewRangeToDom(t){const e=this.viewPositionToDom(t.start),n=this.viewPositionToDom(t.end),s=this._domDocument.createRange();return s.setStart(e.parent,e.offset),s.setEnd(n.parent,n.offset),s}viewPositionToDom(t){const e=t.parent;if(e.is("$text")){const n=this.findCorrespondingDomText(e);if(!n)return null;let s=t.offset;return $(n)&&(s+=j),{parent:n,offset:s}}else{let n,s,i;if(t.offset===0){if(n=this.mapViewToDom(e),!n)return null;i=n.childNodes[0]}else{const a=t.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;n=s.parentNode,i=s.nextSibling}if(R(i)&&$(i))return{parent:i,offset:j};const o=s?Ve(s)+1:0;return{parent:n,offset:o}}}domToView(t,e={}){const n=[],s=this._domToView(t,e,n),i=s.next().value;return!i||(s.next(),this._processDomInlineNodes(null,n,e),this.blockFillerMode=="br"&&pn(i))||i.is("$text")&&i.data.length==0?null:i}*domChildrenToView(t,e={},n=[]){let s=[];t instanceof HTMLTemplateElement?s=[...t.content.childNodes]:s=[...t.childNodes];for(let i=0;i<s.length;i++){const o=s[i],a=this._domToView(o,e,n),l=a.next().value;l!==null&&(this._isBlockViewElement(l)&&this._processDomInlineNodes(t,n,e),this.blockFillerMode=="br"&&pn(l)||(yield l),a.next())}this._processDomInlineNodes(t,n,e)}domSelectionToView(t){if(Wr(t))return new ee([]);if(t.rangeCount===1){let s=t.getRangeAt(0).startContainer;R(s)&&(s=s.parentNode);const i=this.fakeSelectionToView(s);if(i)return i}const e=this.isDomSelectionBackward(t),n=[];for(let s=0;s<t.rangeCount;s++){const i=t.getRangeAt(s),o=this.domRangeToView(i);o&&n.push(o)}return new ee(n,{backward:e})}domRangeToView(t){const e=this.domPositionToView(t.startContainer,t.startOffset),n=this.domPositionToView(t.endContainer,t.endOffset);return e&&n?new b(e,n):null}domPositionToView(t,e=0){if(this.isBlockFiller(t))return this.domPositionToView(t.parentNode,Ve(t));const n=this.mapDomToView(t);if(n&&(n.is("uiElement")||n.is("rawElement")))return _._createBefore(n);if(R(t)){if(Te(t))return this.domPositionToView(t.parentNode,Ve(t));const s=this.findCorrespondingViewText(t);let i=e;return s?($(t)&&(i-=j,i=i<0?0:i),new _(s,i)):null}else{if(e===0){const s=this.mapDomToView(t);if(s)return new _(s,0)}else{const s=t.childNodes[e-1];if(R(s)&&Te(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,Ve(s));const i=R(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(i&&i.parent)return new _(i.parent,i.index+1)}return null}}mapDomToView(t){return this.getHostViewElement(t)||this._domToViewMapping.get(t)}findCorrespondingViewText(t){if(Te(t))return null;const e=this.getHostViewElement(t);if(e)return e;const n=t.previousSibling;if(n){if(!this.isElement(n))return null;const s=this.mapDomToView(n);if(s){const i=s.nextSibling;return i instanceof N?i:null}}else{const s=this.mapDomToView(t.parentNode);if(s){const i=s.getChild(0);return i instanceof N?i:null}}return null}mapViewToDom(t){return this._viewToDomMapping.get(t)}findCorrespondingDomText(t){const e=t.previousSibling;return e&&this.mapViewToDom(e)?this.mapViewToDom(e).nextSibling:!e&&t.parent&&this.mapViewToDom(t.parent)?this.mapViewToDom(t.parent).childNodes[0]:null}focus(t){const e=this.mapViewToDom(t);if(!e||e.ownerDocument.activeElement===e)return;const{scrollX:n,scrollY:s}=ie.window,i=[];gn(e,o=>{const{scrollLeft:a,scrollTop:l}=o;i.push([a,l])}),e.focus(),gn(e,o=>{const[a,l]=i.shift();o.scrollLeft=a,o.scrollTop=l}),ie.window.scrollTo(n,s)}_clearDomSelection(){const t=this.mapViewToDom(this.document.selection.editableElement);if(!t)return;const e=t.ownerDocument.defaultView.getSelection(),n=this.domSelectionToView(e);n&&n.rangeCount>0&&e.removeAllRanges()}isElement(t){return t&&t.nodeType==Node.ELEMENT_NODE}isDocumentFragment(t){return t&&t.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(t){return this.blockFillerMode=="br"?t.isEqualNode(Ir):_n(t,this.blockElements)?!0:t.isEqualNode(Br)||Vr(t,this.blockElements)}isDomSelectionBackward(t){if(t.isCollapsed)return!1;const e=this._domDocument.createRange();try{e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset)}catch{return!1}const n=e.collapsed;return e.detach(),n}getHostViewElement(t){const e=zs(t);for(e.pop();e.length;){const n=e.pop(),s=this._domToViewMapping.get(n);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(t){return this._isDomSelectionPositionCorrect(t.anchorNode,t.anchorOffset)&&this._isDomSelectionPositionCorrect(t.focusNode,t.focusOffset)}registerRawContentMatcher(t){this._rawContentElementMatcher.add(t)}registerInlineObjectMatcher(t){this._inlineObjectElementMatcher.add(t)}_clearTemporaryCustomProperties(){for(const t of this._elementsWithTemporaryCustomProperties)t._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return ts(this._domDocument);case"markedNbsp":return ns(this._domDocument);case"br":return ss(this._domDocument)}}_isDomSelectionPositionCorrect(t,e){if(R(t)&&$(t)&&e<j||this.isElement(t)&&$(t.childNodes[e]))return!1;const n=this.mapDomToView(t);return!(n&&(n.is("uiElement")||n.is("rawElement")))}*_domToView(t,e,n){if(this.blockFillerMode!="br"&&_n(t,this.blockElements))return null;const s=this.getHostViewElement(t);if(s)return s;if(We(t)&&e.skipComments)return null;if(R(t)){if(Te(t))return null;{const i=t.data;if(i==="")return null;const o=new N(this.document,i);return n.push(o),o}}else{let i=this.mapDomToView(t);if(i)return this._isInlineObjectElement(i)&&n.push(i),i;if(this.isDocumentFragment(t))i=new _e(this.document),e.bind&&this.bindDocumentFragments(t,i);else{i=this._createViewElement(t,e),e.bind&&this.bindElements(t,i);const a=t.attributes;if(a)for(let l=a.length,h=0;h<l;h++)i._setAttribute(a[h].name,a[h].value);if(this._isViewElementWithRawContent(i,e))return i._setCustomProperty("$rawContent",t.innerHTML),this._isBlockViewElement(i)||n.push(i),i;if(We(t))return i._setCustomProperty("$rawContent",t.data),i}yield i;const o=[];if(e.withChildren!==!1)for(const a of this.domChildrenToView(t,e,o))i._appendChild(a);if(this._isInlineObjectElement(i))n.push(i),this._processDomInlineNodes(null,o,e);else for(const a of o)n.push(a)}}_processDomInlineNodes(t,e,n){if(!e.length||t&&!this.isDocumentFragment(t)&&!this._isBlockDomElement(t))return;let s=!1;for(let i=0;i<e.length;i++){const o=e[i];if(!o.is("$text")){s=!1;continue}let a,l=!1;if(this._isPreFormatted(o))a=fn(o.data);else{a=o.data.replace(/[ \n\t\r]{1,}/g," "),l=/[^\S\u00A0]/.test(a.charAt(a.length-1));const h=i>0?e[i-1]:null,u=i+1<e.length?e[i+1]:null,m=!h||h.is("element")&&h.name=="br"||s,p=u?!1:!$(o.data);n.withChildren!==!1&&(m&&(a=a.replace(/^ /,"")),p&&(a=a.replace(/ $/,""))),a=fn(a),this.blockFillerMode!="br"&&o.parent&&(Lr(o.parent,a)?(a="",o.parent.parent&&(o.parent.parent._setCustomProperty("$hasBlockFiller",!0),o.parent._remove())):$r(o.parent,a,this.blockElements)&&(a="",o.parent._setCustomProperty("$hasBlockFiller",!0))),a=a.replace(/ \u00A0/g," ");const w=u&&u.is("element")&&u.name!="br",v=u&&u.is("$text")&&u.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(a)||!u||w||v)&&(a=a.replace(/\u00A0$/," ")),(m||h&&h.is("element")&&h.name!="br")&&(a=a.replace(/^\u00A0/," "))}a.length==0&&o.parent?(o._remove(),e.splice(i,1),i--):(o._data=a,s=l)}e.length=0}_processDataFromViewText(t){let e=t.data;if(this._isPreFormatted(t))return e;if(e.charAt(0)==" "){const n=this._getTouchingInlineViewNode(t,!1);(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n)||!n)&&(e=" "+e.substr(1))}if(e.charAt(e.length-1)==" "){const n=this._getTouchingInlineViewNode(t,!0),s=n&&n.is("$textProxy")&&n.data.charAt(0)==" ";(e.charAt(e.length-2)==" "||!n||s)&&(e=e.substr(0,e.length-1)+" ")}return e.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(t){if(this._isPreFormatted(t))return!1;const e=this._processDataFromViewText(t);return e.charAt(e.length-1)==" "}_isPreFormatted(t){if(Dr(t,this.preElements))return!0;for(const e of t.getAncestors({parentFirst:!0}))if(!(!e.is("element")||!e.hasStyle("white-space")||e.getStyle("white-space")==="inherit"))return["pre","pre-wrap","break-spaces"].includes(e.getStyle("white-space"));return!1}_getTouchingInlineViewNode(t,e){const n=new ge({startPosition:e?_._createAfter(t):_._createBefore(t),direction:e?"forward":"backward"});for(const{item:s}of n){if(s.is("$textProxy"))return s;if(s.is("element")&&s.getCustomProperty("dataPipeline:transparentRendering"))continue;if(s.is("element","br"))return null;if(this._isInlineObjectElement(s))return s;if(s.is("containerElement"))return null}return null}_isBlockDomElement(t){return this.isElement(t)&&this.blockElements.includes(t.tagName.toLowerCase())}_isBlockViewElement(t){return t.is("element")&&this.blockElements.includes(t.name)}_isInlineObjectElement(t){return t.is("element")?t.name=="br"||this.inlineObjectElements.includes(t.name)||!!this._inlineObjectElementMatcher.match(t):!1}_createViewElement(t,e){if(We(t))return new gt(this.document,"$comment");const n=e.keepOriginalCase?t.tagName:t.tagName.toLowerCase();return new ne(this.document,n)}_isViewElementWithRawContent(t,e){return e.withChildren!==!1&&t.is("element")&&!!this._rawContentElementMatcher.match(t)}_shouldRenameElement(t){const e=t.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(e)}_createReplacementDomElement(t,e){const n=this._domDocument.createElement("span");if(n.setAttribute(mn,t),e){for(;e.firstChild;)n.appendChild(e.firstChild);for(const s of e.getAttributeNames())n.setAttribute(s,e.getAttribute(s))}return n}}function Dr(r,t){return r.getAncestors().some(e=>e.is("element")&&t.includes(e.name))}function gn(r,t){let e=r;for(;e;)t(e),e=e.parentElement}function Vr(r,t){return r.isEqualNode(Fr)&&is(r,t)&&r.parentNode.childNodes.length===1}function is(r,t){const e=r.parentNode;return!!e&&!!e.tagName&&t.includes(e.tagName.toLowerCase())}function $r(r,t,e){return t==" "&&r&&r.is("element")&&r.childCount==1&&e.includes(r.name)}function Lr(r,t){return t==" "&&r&&r.is("element","span")&&r.childCount==1&&r.hasAttribute("data-cke-filler")}function pn(r){return r.is("element","br")&&r.hasAttribute("data-cke-filler")}function _n(r,t){return r.tagName==="BR"&&is(r,t)&&r.parentNode.childNodes.length===1}function wn(r){r==="script"&&W("domconverter-unsafe-script-element-detected"),r==="style"&&W("domconverter-unsafe-style-element-detected")}function Wr(r){if(!T.isGecko||!r.rangeCount)return!1;const t=r.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch{return!0}return!1}class xe extends Ws(){constructor(e){super();c(this,"view");c(this,"document");c(this,"_isEnabled",!1);this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}class qr{constructor(t,e,n){c(this,"view");c(this,"document");c(this,"domEvent");c(this,"domTarget");this.view=t,this.document=t.document,this.domEvent=e,this.domTarget=e.target,Xs(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Pe extends xe{constructor(){super(...arguments);c(this,"useCapture",!1);c(this,"usePassive",!1)}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(s=>{this.listenTo(e,s,(i,o)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(o.target)&&this.onDomEvent(o)},{useCapture:this.useCapture,usePassive:this.usePassive})})}stopObserving(e){this.stopListening(e)}fire(e,n,s){this.isEnabled&&this.document.fire(e,new qr(this.view,n,s))}}class zr extends Pe{constructor(){super(...arguments);c(this,"domEventType",["keydown","keyup"])}onDomEvent(e){const n={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Hs(this)}};this.fire(e.type,e,n)}}class Ur extends xe{constructor(e){super(e);c(this,"_fireSelectionChangeDoneDebounced");this._fireSelectionChangeDoneDebounced=xt(n=>{this.document.fire("selectionChangeDone",n)},200)}observe(){const e=this.document;e.on("arrowKey",(n,s)=>{e.selection.isFake&&this.isEnabled&&s.preventDefault()},{context:"$capture"}),e.on("arrowKey",(n,s)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(s.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const n=this.document.selection,s=new ee(n.getRanges(),{backward:n.isBackward,fake:!1});(e==me.arrowleft||e==me.arrowup)&&s.setTo(s.getFirstPosition()),(e==me.arrowright||e==me.arrowdown)&&s.setTo(s.getLastPosition());const i={oldSelection:n,newSelection:s,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}class os extends xe{constructor(e){super(e);c(this,"domConverter");c(this,"_config");c(this,"_domElements");c(this,"_mutationObserver");this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const n of this._domElements)this._mutationObserver.observe(n,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const n=this.domConverter,s=new Set,i=new Set;for(const a of e){const l=n.mapDomToView(a.target);l&&(l.is("uiElement")||l.is("rawElement")||a.type==="childList"&&!this._isBogusBrMutation(a)&&i.add(l))}for(const a of e){const l=n.mapDomToView(a.target);if(!(l&&(l.is("uiElement")||l.is("rawElement")))&&a.type==="characterData"){const h=n.findCorrespondingViewText(a.target);h&&!i.has(h.parent)?s.add(h):!h&&$(a.target)&&i.add(n.mapDomToView(a.target.parentNode))}}const o=[];for(const a of s)o.push({type:"text",node:a});for(const a of i){const l=n.mapViewToDom(a),h=Array.from(a.getChildren()),u=Array.from(n.domChildrenToView(l,{withChildren:!1}));Qs(h,u,Jr)||o.push({type:"children",node:a})}o.length&&this.document.fire("mutations",{mutations:o})}_isBogusBrMutation(e){let n=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(n=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),n&&n.is("element","br")}}function Jr(r,t){if(!Array.isArray(r))return r===t?!0:r.is("$text")&&t.is("$text")?r.data===t.data:!1}class Dt extends Pe{constructor(e){super(e);c(this,"_renderTimeoutId",null);c(this,"_isFocusChanging",!1);c(this,"domEventType",["focus","blur"]);this.useCapture=!0;const n=this.document;n.on("focus",()=>this._handleFocus()),n.on("blur",(s,i)=>this._handleBlur(i)),n.on("beforeinput",()=>{n.isFocused||this._handleFocus()},{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this._renderTimeoutId=null,this.flush(),this.view.change(()=>{})},50)}_handleBlur(e){const n=this.document.selection.editableElement;(n===null||n===e.target)&&(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change(()=>{}))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class jr extends xe{constructor(e){super(e);c(this,"mutationObserver");c(this,"focusObserver");c(this,"selection");c(this,"domConverter");c(this,"_documents",new WeakSet);c(this,"_fireSelectionChangeDoneDebounced");c(this,"_clearInfiniteLoopInterval");c(this,"_documentIsSelectingInactivityTimeoutDebounced");c(this,"_loopbackCounter",0);c(this,"_pendingSelectionChange",new Set);this.mutationObserver=e.getObserver(os),this.focusObserver=e.getObserver(Dt),this.selection=this.document.selection,this.domConverter=e.domConverter,this._fireSelectionChangeDoneDebounced=xt(n=>{this.document.fire("selectionChangeDone",n)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=xt(()=>this.document.isSelecting=!1,5e3),this.view.document.on("change:isFocused",(n,s,i)=>{if(i&&this._pendingSelectionChange.size){for(const o of Array.from(this._pendingSelectionChange))this._handleSelectionChange(o);this._pendingSelectionChange.clear()}})}observe(e){const n=e.ownerDocument,s=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},i=()=>{this.document.isSelecting&&(this._handleSelectionChange(n),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",s,{priority:"highest"}),this.listenTo(e,"keydown",i,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",i,{priority:"highest",useCapture:!0}),!this._documents.has(n)&&(this.listenTo(n,"mouseup",i,{priority:"highest",useCapture:!0}),this.listenTo(n,"selectionchange",()=>{this.document.isComposing&&!T.isAndroid||(this._handleSelectionChange(n),this._documentIsSelectingInactivityTimeoutDebounced())}),this.listenTo(this.view.document,"compositionstart",()=>{this._handleSelectionChange(n)},{priority:"lowest"}),this._documents.add(n))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const n=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(n.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(n);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.view.document.isFocused){this._pendingSelectionChange.add(e);return}if(this._pendingSelectionChange.delete(e),!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(n))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(this.selection.isSimilar(s))this.view.forceRender();else{const i={oldSelection:this.selection,newSelection:s,domSelection:n};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}class Gr extends Pe{constructor(e){super(e);c(this,"domEventType",["compositionstart","compositionupdate","compositionend"]);const n=this.document;n.on("compositionstart",()=>{n.isComposing=!0},{priority:"low"}),n.on("compositionend",()=>{n.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
8
8
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
9
9
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
10
10
  */class Hr{constructor(t,e={}){c(this,"_files");c(this,"_native");this._files=e.cacheFiles?bn(t):null,this._native=t}get files(){return this._files||(this._files=bn(this._native)),this._files}get types(){return this._native.types}getData(t){return this._native.getData(t)}setData(t,e){this._native.setData(t,e)}set effectAllowed(t){this._native.effectAllowed=t}get effectAllowed(){return this._native.effectAllowed}set dropEffect(t){this._native.dropEffect=t}get dropEffect(){return this._native.dropEffect}setDragImage(t,e,n){this._native.setDragImage(t,e,n)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function bn(r){const t=Array.from(r.files||[]),e=Array.from(r.items||[]);return t.length?t:e.filter(n=>n.kind==="file").map(n=>n.getAsFile())}class Kr extends Pe{constructor(){super(...arguments);c(this,"domEventType","beforeinput")}onDomEvent(e){const n=e.getTargetRanges(),s=this.view,i=s.document;let o=null,a=null,l=[];if(e.dataTransfer&&(o=new Hr(e.dataTransfer)),e.data!==null?a=e.data:o&&(a=o.getData("text/plain")),i.selection.isFake)l=Array.from(i.selection.getRanges());else if(n.length)l=n.map(h=>{const u=s.domConverter.domPositionToView(h.startContainer,h.startOffset),m=s.domConverter.domPositionToView(h.endContainer,h.endOffset);if(u)return s.createRange(u,m);if(m)return s.createRange(m)}).filter(h=>!!h);else if(T.isAndroid){const h=e.target.ownerDocument.defaultView.getSelection();l=Array.from(s.domConverter.domSelectionToView(h).getRanges())}if(T.isAndroid&&e.inputType=="insertCompositionText"&&a&&a.endsWith(`
@@ -18,7 +18,7 @@ var Vs=Object.defineProperty;var $s=(r,t,e)=>t in r?Vs(r,t,{enumerable:!0,config
18
18
  */class fs{constructor(t){c(this,"_dispatchers");this._dispatchers=t}add(t){for(const e of this._dispatchers)t(e);return this}}class pi extends fs{elementToElement(t){return this.add(Ii(t))}elementToStructure(t){return this.add(Fi(t))}attributeToElement(t){return this.add(Bi(t))}attributeToAttribute(t){return this.add(Di(t))}markerToElement(t){return this.add(Vi(t))}markerToHighlight(t){return this.add(Li(t))}markerToData(t){return this.add($i(t))}}function ds(){return(r,t,e)=>{if(!e.consumable.consume(t.item,r.name))return;const n=e.writer,s=e.mapper.toViewPosition(t.range.start),i=n.createText(t.item.data);n.insert(s,i)}}function ms(){return(r,t,e)=>{e.convertAttributes(t.item),!t.reconversion&&t.item.is("element")&&!t.item.isEmpty&&e.convertChildren(t.item)}}function _i(){return(r,t,e)=>{const n=e.mapper.toViewPosition(t.position),s=t.position.getShiftedBy(t.length),i=e.mapper.toViewPosition(s,{isPhantom:!0}),o=e.writer.createRange(n,i),a=e.writer.remove(o.getTrimmed());for(const l of e.writer.createRangeIn(a).getItems())e.mapper.unbindViewElement(l,{defer:!0})}}function gs(r,t){const e=r.createAttributeElement("span",t.attributes);return t.classes&&e._addClass(t.classes),typeof t.priority=="number"&&(e._priority=t.priority),e._id=t.id,e}function wi(){return(r,t,e)=>{const n=t.selection;if(n.isCollapsed||!e.consumable.consume(n,"selection"))return;const s=[];for(const i of n.getRanges())s.push(e.mapper.toViewRange(i));e.writer.setSelection(s,{backward:n.isBackward})}}function bi(){return(r,t,e)=>{const n=t.selection;if(!n.isCollapsed||!e.consumable.consume(n,"selection"))return;const s=e.writer,i=n.getFirstPosition(),o=e.mapper.toViewPosition(i),a=s.breakAttributes(o);s.setSelection(a)}}function yi(){return(r,t,e)=>{const n=e.writer,s=n.document.selection;for(const i of s.getRanges())i.isCollapsed&&i.end.parent.isAttached()&&e.writer.mergeAttributes(i.start);n.setSelection(null)}}function vi(r){return(t,e,n)=>{if(!n.consumable.test(e.item,t.name))return;const s=r(e.attributeOldValue,n,e),i=r(e.attributeNewValue,n,e);if(!s&&!i)return;n.consumable.consume(e.item,t.name);const o=n.writer,a=o.document.selection;if(e.item instanceof L||e.item instanceof H)o.wrap(a.getFirstRange(),i);else{let l=n.mapper.toViewRange(e.range);e.attributeOldValue!==null&&s&&(l=o.unwrap(l,s)),e.attributeNewValue!==null&&i&&o.wrap(l,i)}}}function Pi(r,t=Gi){return(e,n,s)=>{if(!t(n.item,s.consumable,{preflight:!0}))return;const i=r(n.item,s,n);if(!i)return;t(n.item,s.consumable);const o=s.mapper.toViewPosition(n.range.start);s.mapper.bindElements(n.item,i),s.writer.insert(o,i),s.convertAttributes(n.item),ys(i,n.item.getChildren(),s,{reconversion:n.reconversion})}}function Ci(r,t){return(e,n,s)=>{if(!t(n.item,s.consumable,{preflight:!0}))return;const i=new Map;s.writer._registerSlotFactory(zi(n.item,i,s));const o=r(n.item,s,n);if(s.writer._clearSlotFactory(),!o)return;Ui(n.item,i,s),t(n.item,s.consumable);const a=s.mapper.toViewPosition(n.range.start);s.mapper.bindElements(n.item,o),s.writer.insert(a,o),s.convertAttributes(n.item),Ji(o,i,s,{reconversion:n.reconversion})}}function ki(r){return(t,e,n)=>{e.isOpening=!0;const s=r(e,n);e.isOpening=!1;const i=r(e,n);if(!s||!i)return;const o=e.markerRange;if(o.isCollapsed&&!n.consumable.consume(o,t.name))return;for(const h of o)if(!n.consumable.consume(h.item,t.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(o.start),s),n.mapper.bindElementToMarker(s,e.markerName),o.isCollapsed||(l.insert(a.toViewPosition(o.end),i),n.mapper.bindElementToMarker(i,e.markerName)),t.stop()}}function Ai(){return(r,t,e)=>{const n=e.mapper.markerNameToElements(t.markerName);if(n){for(const s of n)e.mapper.unbindElementFromMarkerName(s,t.markerName),e.writer.clear(e.writer.createRangeOn(s),s);e.writer.clearClonedElementsGroup(t.markerName),r.stop()}}}function Si(r){return(t,e,n)=>{const s=r(e.markerName,n);if(!s)return;const i=e.markerRange;n.consumable.consume(i,t.name)&&(Cn(i,!1,n,e,s),Cn(i,!0,n,e,s),t.stop())}}function Cn(r,t,e,n,s){const i=t?r.start:r.end,o=i.nodeAfter&&i.nodeAfter.is("element")?i.nodeAfter:null,a=i.nodeBefore&&i.nodeBefore.is("element")?i.nodeBefore:null;if(o||a){let h,u;t&&o||!t&&!a?(h=o,u=!0):(h=a,u=!1);const m=e.mapper.toViewElement(h);if(m){Ei(m,t,u,e,n,s);return}}const l=e.mapper.toViewPosition(i);Ri(l,t,e,n,s)}function Ei(r,t,e,n,s,i){const o=`data-${i.group}-${t?"start":"end"}-${e?"before":"after"}`,a=r.hasAttribute(o)?r.getAttribute(o).split(","):[];a.unshift(i.name),n.writer.setAttribute(o,a.join(","),r),n.mapper.bindElementToMarker(r,s.markerName)}function Ri(r,t,e,n,s){const i=`${s.group}-${t?"start":"end"}`,o=s.name?{name:s.name}:null,a=e.writer.createUIElement(i,o);e.writer.insert(r,a),e.mapper.bindElementToMarker(a,n.markerName)}function Ti(r){return(t,e,n)=>{const s=r(e.markerName,n);if(!s)return;const i=n.mapper.markerNameToElements(e.markerName);if(!i)return;for(const a of i)n.mapper.unbindElementFromMarkerName(a,e.markerName),a.is("containerElement")?(o(`data-${s.group}-start-before`,a),o(`data-${s.group}-start-after`,a),o(`data-${s.group}-end-before`,a),o(`data-${s.group}-end-after`,a)):n.writer.clear(n.writer.createRangeOn(a),a);n.writer.clearClonedElementsGroup(e.markerName),t.stop();function o(a,l){if(l.hasAttribute(a)){const h=new Set(l.getAttribute(a).split(","));h.delete(s.name),h.size==0?n.writer.removeAttribute(a,l):n.writer.setAttribute(a,Array.from(h).join(","),l)}}}}function Mi(r){return(t,e,n)=>{if(!n.consumable.test(e.item,t.name))return;const s=r(e.attributeOldValue,n,e),i=r(e.attributeNewValue,n,e);if(!s&&!i)return;n.consumable.consume(e.item,t.name);const o=n.mapper.toViewElement(e.item),a=n.writer;if(!o)throw new d("conversion-attribute-to-attribute-on-text",n.dispatcher,e);if(e.attributeOldValue!==null&&s){let l=s.value;s.key=="style"&&(typeof s.value=="string"?l=new qe(a.document.stylesProcessor).setTo(s.value).getStylesEntries().map(([h])=>h):l=Object.keys(s.value)),a.removeAttribute(s.key,l,o)}if(e.attributeNewValue!==null&&i){let l=i.value;i.key=="style"&&typeof i.value=="string"&&(l=Object.fromEntries(new qe(a.document.stylesProcessor).setTo(i.value).getStylesEntries())),a.setAttribute(i.key,l,!1,o)}}}function xi(r){return(t,e,n)=>{if(!e.item||!(e.item instanceof L||e.item instanceof H)&&!e.item.is("$textProxy"))return;const s=Xt(r,e,n);if(!s||!n.consumable.consume(e.item,t.name))return;const i=n.writer,o=gs(i,s),a=i.document.selection;if(e.item instanceof L||e.item instanceof H)i.wrap(a.getFirstRange(),o);else{const l=n.mapper.toViewRange(e.range),h=i.wrap(l,o);for(const u of h.getItems())if(u.is("attributeElement")&&u.isSimilar(o)){n.mapper.bindElementToMarker(u,e.markerName);break}}}}function Ni(r){return(t,e,n)=>{if(!e.item||!(e.item instanceof k))return;const s=Xt(r,e,n);if(!s||!n.consumable.test(e.item,t.name))return;const i=n.mapper.toViewElement(e.item);if(i&&i.getCustomProperty("addHighlight")){n.consumable.consume(e.item,t.name);for(const a of f._createIn(e.item))n.consumable.consume(a.item,t.name);i.getCustomProperty("addHighlight")(i,s,n.writer),n.mapper.bindElementToMarker(i,e.markerName)}}}function Oi(r){return(t,e,n)=>{if(e.markerRange.isCollapsed)return;const s=Xt(r,e,n);if(!s)return;const i=gs(n.writer,s),o=n.mapper.markerNameToElements(e.markerName);if(o){for(const a of o)n.mapper.unbindElementFromMarkerName(a,e.markerName),a.is("attributeElement")?n.writer.unwrap(n.writer.createRangeOn(a),i):a.getCustomProperty("removeHighlight")(a,s.id,n.writer);n.writer.clearClonedElementsGroup(e.markerName),t.stop()}}}function Ii(r){const t=ps(r.model),e=Qe(r.view,"container");return t.attributes.length&&(t.children=!0),n=>{n.on(`insert:${t.name}`,Pi(e,bs(t)),{priority:r.converterPriority||"normal"}),(t.children||t.attributes.length)&&n.on("reduceChanges",ws(t),{priority:"low"})}}function Fi(r){const t=ps(r.model),e=Qe(r.view,"container");return t.children=!0,n=>{if(n._conversionApi.schema.checkChild(t.name,"$text"))throw new d("conversion-element-to-structure-disallowed-text",n,{elementName:t.name});n.on(`insert:${t.name}`,Ci(e,bs(t)),{priority:r.converterPriority||"normal"}),n.on("reduceChanges",ws(t),{priority:"low"})}}function Bi(r){r=he(r);let t=r.model;typeof t=="string"&&(t={key:t});let e=`attribute:${t.key}`;if(t.name&&(e+=":"+t.name),t.values)for(const s of t.values)r.view[s]=Qe(r.view[s],"attribute");else r.view=Qe(r.view,"attribute");const n=_s(r);return s=>{s.on(e,vi(n),{priority:r.converterPriority||"normal"})}}function Di(r){r=he(r);let t=r.model;typeof t=="string"&&(t={key:t});let e=`attribute:${t.key}`;if(t.name&&(e+=":"+t.name),t.values)for(const s of t.values)r.view[s]=kn(r.view[s]);else r.view=kn(r.view);const n=_s(r);return s=>{s.on(e,Mi(n),{priority:r.converterPriority||"normal"})}}function Vi(r){const t=Qe(r.view,"ui");return e=>{e.on(`addMarker:${r.model}`,ki(t),{priority:r.converterPriority||"normal"}),e.on(`removeMarker:${r.model}`,Ai(),{priority:r.converterPriority||"normal"})}}function $i(r){r=he(r);const t=r.model;let e=r.view;return e||(e=n=>({group:t,name:n.substr(r.model.length+1)})),n=>{n.on(`addMarker:${t}`,Si(e),{priority:r.converterPriority||"normal"}),n.on(`removeMarker:${t}`,Ti(e),{priority:r.converterPriority||"normal"})}}function Li(r){return t=>{t.on(`addMarker:${r.model}`,xi(r.view),{priority:r.converterPriority||"normal"}),t.on(`addMarker:${r.model}`,Ni(r.view),{priority:r.converterPriority||"normal"}),t.on(`removeMarker:${r.model}`,Oi(r.view),{priority:r.converterPriority||"normal"})}}function ps(r){return typeof r=="string"&&(r={name:r}),{name:r.name,attributes:r.attributes?le(r.attributes):[],children:!!r.children}}function Qe(r,t){return typeof r=="function"?r:(e,n)=>Wi(r,n,t)}function Wi(r,t,e){typeof r=="string"&&(r={name:r});let n;const s=t.writer,i=Object.assign({},r.attributes);if(e=="container")n=s.createContainerElement(r.name,i);else if(e=="attribute"){const o={priority:r.priority||pe.DEFAULT_PRIORITY};n=s.createAttributeElement(r.name,i,o)}else n=s.createUIElement(r.name,i);if(r.styles){const o=Object.keys(r.styles);for(const a of o)s.setStyle(a,r.styles[a],n)}if(r.classes){const o=r.classes;if(typeof o=="string")s.addClass(o,n);else for(const a of o)s.addClass(a,n)}return n}function _s(r){return r.model.values?(t,e,n)=>{const s=r.view[t];return s?s(t,e,n):null}:r.view}function kn(r){return typeof r=="string"?t=>({key:r,value:t}):typeof r=="object"?r.value?()=>r:t=>({key:r.key,value:t}):r}function Xt(r,t,e){const n=typeof r=="function"?r(t,e):r;return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function qi(r){return(t,e)=>{if(!t.is("element",r.name))return!1;if(e.type=="attribute"){if(r.attributes.includes(e.attributeKey))return!0}else{/* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */if(r.children)return!0}return!1}}function ws(r){const t=qi(r);return(e,n)=>{const s=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const i of n.changes){const o=i.type=="attribute"?i.range.start.nodeAfter:i.position.parent;if(!o||!t(o,i)){s.push(i);continue}if(!n.reconvertedElements.has(o)){n.reconvertedElements.add(o);const a=g._createBefore(o);let l=s.length;for(let h=s.length-1;h>=0;h--){const u=s[h],p=(u.type=="attribute"?u.range.start:u.position).compareWith(a);if(p=="before"||u.type=="remove"&&p=="same")break;l=h}s.splice(l,0,{type:"remove",name:o.name,position:a,length:1},{type:"reinsert",name:o.name,position:a,length:1})}}n.changes=s}}function bs(r){return(t,e,n={})=>{const s=["insert"];for(const i of r.attributes)t.hasAttribute(i)&&s.push(`attribute:${i}`);return s.every(i=>e.test(t,i))?(n.preflight||s.forEach(i=>e.consume(t,i)),!0):!1}}function zi(r,t,e){return(n,s)=>{const i=n.createContainerElement("$slot");let o=null;if(s==="children")o=Array.from(r.getChildren());else if(typeof s=="function")o=Array.from(r.getChildren()).filter(a=>s(a));else throw new d("conversion-slot-mode-unknown",e.dispatcher,{modeOrFilter:s});return t.set(i,o),i}}function Ui(r,t,e){const n=Array.from(t.values()).flat(),s=new Set(n);if(s.size!=n.length)throw new d("conversion-slot-filter-overlap",e.dispatcher,{element:r});if(s.size!=r.childCount)throw new d("conversion-slot-filter-incomplete",e.dispatcher,{element:r})}function Ji(r,t,e,n){e.mapper.on("modelToViewPosition",o,{priority:"highest"});let s=null,i=null;for([s,i]of t)ys(r,i,e,n),e.writer.move(e.writer.createRangeIn(s),e.writer.createPositionBefore(s)),e.writer.remove(s);e.mapper.off("modelToViewPosition",o);function o(a,l){const h=l.modelPosition.nodeAfter,u=i.indexOf(h);u<0||(l.viewPosition=l.mapper.findPositionIn(s,u))}}function ys(r,t,e,n){for(const s of t)ji(r.root,s,e,n)||e.convertItem(s)}function ji(r,t,e,n){const{writer:s,mapper:i}=e;if(!n.reconversion)return!1;const o=i.toViewElement(t);return!o||o.root==r||!e.canReuseView(o)?!1:(s.move(s.createRangeOn(o),i.toViewPosition(g._createBefore(t))),!0)}function Gi(r,t,{preflight:e}={}){return e?t.test(r,"insert"):t.consume(r,"insert")}/**
19
19
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
20
20
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
21
- */function vs(r){const{schema:t,document:e}=r.model;for(const n of e.getRoots())if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return r.insertElement("paragraph",n),!0;return!1}function Ps(r,t,e){const n=e.createContext(r);return!(!e.checkChild(n,"paragraph")||!e.checkChild(n.push("paragraph"),t))}function Cs(r,t){const e=t.createElement("paragraph");return t.insert(e,r),t.createPositionAt(e,0)}class Hi extends fs{elementToElement(t){return this.add(ks(t))}elementToAttribute(t){return this.add(Yi(t))}attributeToAttribute(t){return this.add(Qi(t))}elementToMarker(t){return this.add(Zi(t))}dataToMarker(t){return this.add(eo(t))}}function An(){return(r,t,e)=>{if(!t.modelRange&&e.consumable.consume(t.viewItem,{name:!0})){const{modelRange:n,modelCursor:s}=e.convertChildren(t.viewItem,t.modelCursor);t.modelRange=n,t.modelCursor=s}}}function Ki(){return(r,t,{schema:e,consumable:n,writer:s})=>{let i=t.modelCursor;if(!n.test(t.viewItem))return;if(!e.checkChild(i,"$text")){if(!Ps(i,"$text",e)||t.viewItem.data.trim().length==0)return;i=Cs(i,s)}n.consume(t.viewItem);const o=s.createText(t.viewItem.data);s.insert(o,i),t.modelRange=s.createRange(i,i.getShiftedBy(o.offsetSize)),t.modelCursor=t.modelRange.end}}function Xi(r,t){return(e,n)=>{const s=n.newSelection,i=[];for(const a of s.getRanges())i.push(t.toModelRange(a));const o=r.createSelection(i,{backward:s.isBackward});o.isEqual(r.document.selection)||r.change(a=>{a.setSelection(o)})}}function ks(r){r=he(r);const t=$t(r),e=Yt(r.view),n=e?`element:${e}`:"element";return s=>{s.on(n,t,{priority:r.converterPriority||"normal"})}}function Yi(r){r=he(r),As(r);const t=Ss(r,!1),e=Yt(r.view),n=e?`element:${e}`:"element";return s=>{s.on(n,t,{priority:r.converterPriority||"low"})}}function Qi(r){r=he(r);let t=null;(typeof r.view=="string"||r.view.key)&&(t=so(r)),As(r,t);const e=Ss(r,!0);return n=>{n.on("element",e,{priority:r.converterPriority||"low"})}}function Zi(r){const t=oo(r.model);return ks({...r,model:t})}function eo(r){r=he(r),r.model||(r.model=s=>s?r.view+":"+s:r.view);const t={view:r.view,model:r.model},e=$t(Sn(t,"start")),n=$t(Sn(t,"end"));return s=>{s.on(`element:${r.view}-start`,e,{priority:r.converterPriority||"normal"}),s.on(`element:${r.view}-end`,n,{priority:r.converterPriority||"normal"});const i=_t.low,o=_t.highest,a=_t.get(r.converterPriority)/o;s.on("element",to(t),{priority:i+a})}}function to(r){return(t,e,n)=>{const s=`data-${r.view}`;if(!n.consumable.test(e.viewItem,{attributes:s+"-end-after"})&&!n.consumable.test(e.viewItem,{attributes:s+"-start-after"})&&!n.consumable.test(e.viewItem,{attributes:s+"-end-before"})&&!n.consumable.test(e.viewItem,{attributes:s+"-start-before"}))return;e.modelRange||Object.assign(e,n.convertChildren(e.viewItem,e.modelCursor)),n.consumable.consume(e.viewItem,{attributes:s+"-end-after"})&&i(e.modelRange.end,e.viewItem.getAttribute(s+"-end-after").split(",")),n.consumable.consume(e.viewItem,{attributes:s+"-start-after"})&&i(e.modelRange.end,e.viewItem.getAttribute(s+"-start-after").split(",")),n.consumable.consume(e.viewItem,{attributes:s+"-end-before"})&&i(e.modelRange.start,e.viewItem.getAttribute(s+"-end-before").split(",")),n.consumable.consume(e.viewItem,{attributes:s+"-start-before"})&&i(e.modelRange.start,e.viewItem.getAttribute(s+"-start-before").split(","));function i(o,a){for(const l of a){const h=r.model(l,n),u=n.writer.createElement("$marker",{"data-name":h});n.writer.insert(u,o),e.modelCursor.isEqual(o)?e.modelCursor=e.modelCursor.getShiftedBy(1):e.modelCursor=e.modelCursor._getTransformedByInsertion(o,1),e.modelRange=e.modelRange._getTransformedByInsertion(o,1)[0]}}}}function Yt(r){return typeof r=="string"?r:typeof r=="object"&&typeof r.name=="string"?r.name:null}function $t(r){const t=new He(r.view);return(e,n,s)=>{const i=t.match(n.viewItem);if(!i)return;const o=i.match;if(o.name=!0,!s.consumable.test(n.viewItem,o))return;const a=no(r.model,n.viewItem,s);a&&s.safeInsert(a,n.modelCursor)&&(s.consumable.consume(n.viewItem,o),s.convertChildren(n.viewItem,a),s.updateConversionResult(a,n))}}function no(r,t,e){return r instanceof Function?r(t,e):e.writer.createElement(r)}function so(r){typeof r.view=="string"&&(r.view={key:r.view});const t=r.view.key,e=typeof r.view.value>"u"?/[\s\S]*/:r.view.value;let n;return t=="class"||t=="style"?n={[t=="class"?"classes":"styles"]:e}:n={attributes:{[t]:e}},r.view.name&&(n.name=r.view.name),r.view=n,t}function As(r,t=null){const e=t===null?!0:i=>i.getAttribute(t),n=typeof r.model!="object"?r.model:r.model.key,s=typeof r.model!="object"||typeof r.model.value>"u"?e:r.model.value;r.model={key:n,value:s}}function Ss(r,t){const e=new He(r.view);return(n,s,i)=>{if(!s.modelRange&&t)return;const o=e.match(s.viewItem);if(!o||(ro(r.view,s.viewItem)?o.match.name=!0:delete o.match.name,!i.consumable.test(s.viewItem,o.match)))return;const a=r.model.key,l=typeof r.model.value=="function"?r.model.value(s.viewItem,i):r.model.value;if(l===null)return;s.modelRange||Object.assign(s,i.convertChildren(s.viewItem,s.modelCursor)),io(s.modelRange,{key:a,value:l},t,i)&&(i.consumable.test(s.viewItem,{name:!0})&&(o.match.name=!0),i.consumable.consume(s.viewItem,o.match))}}function ro(r,t){const e=typeof r=="function"?r(t):r;return typeof e=="object"&&!Yt(e)?!1:!e.classes&&!e.attributes&&!e.styles}function io(r,t,e,n){let s=!1;for(const i of Array.from(r.getItems({shallow:e})))n.schema.checkAttribute(i,t.key)&&(s=!0,!i.hasAttribute(t.key)&&n.writer.setAttribute(t.key,t.value,i));return s}function oo(r){return(t,e)=>{const n=typeof r=="string"?r:r(t,e);return e.writer.createElement("$marker",{"data-name":n})}}function Sn(r,t){const e=(n,s)=>{const i=n.getAttribute("name"),o=r.model(i,s);return s.writer.createElement("$marker",{"data-name":o})};return{view:`${r.view}-${t}`,model:e}}function ao(r){r.document.registerPostFixer(t=>lo(t,r))}function lo(r,t){const e=t.document.selection,n=t.schema,s=[];let i=!1;for(const o of e.getRanges()){const a=Es(o,n);a&&!a.isEqual(o)?(s.push(a),i=!0):s.push(o)}return i&&r.setSelection(fo(s),{backward:e.isBackward}),!1}function Es(r,t){return r.isCollapsed?co(r,t):ho(r,t)}function co(r,t){const e=r.start,n=t.getNearestSelectionRange(e);if(!n){const i=e.getAncestors().reverse().find(o=>t.isObject(o));return i?f._createOn(i):null}if(!n.isCollapsed)return n;const s=n.start;return e.isEqual(s)?null:new f(s)}function ho(r,t){const{start:e,end:n}=r,s=t.checkChild(e,"$text"),i=t.checkChild(n,"$text"),o=t.getLimitElement(e),a=t.getLimitElement(n);if(o===a){if(s&&i)return null;if(uo(e,n,t)){const m=e.nodeAfter&&t.isSelectable(e.nodeAfter)?null:t.getNearestSelectionRange(e,"forward"),w=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),v=m?m.start:e,I=w?w.end:n;return new f(v,I)}}const l=o&&!o.is("rootElement"),h=a&&!a.is("rootElement");if(l||h){const u=e.nodeAfter&&n.nodeBefore&&e.nodeAfter.parent===n.nodeBefore.parent,m=l&&(!u||!Rn(e.nodeAfter,t)),p=h&&(!u||!Rn(n.nodeBefore,t));let w=e,v=n;return m&&(w=g._createBefore(En(o,t))),p&&(v=g._createAfter(En(a,t))),new f(w,v)}return null}function En(r,t){let e=r,n=e;for(;t.isLimit(n)&&n.parent;)e=n,n=n.parent;return e}function uo(r,t,e){const n=r.nodeAfter&&!e.isLimit(r.nodeAfter)||e.checkChild(r,"$text"),s=t.nodeBefore&&!e.isLimit(t.nodeBefore)||e.checkChild(t,"$text");return n||s}function fo(r){const t=[...r],e=new Set;let n=1;for(;n<t.length;){const i=t[n],o=t.slice(0,n);for(const[a,l]of o.entries())if(!e.has(a)){if(i.isEqual(l))e.add(a);else if(i.isIntersecting(l)){e.add(a),e.add(n);const h=i.getJoined(l);t.push(h)}}n++}return t.filter((i,o)=>!e.has(o))}function Rn(r,t){return r&&t.isSelectable(r)}class Pl extends U(){constructor(e,n){super();c(this,"model");c(this,"view");c(this,"mapper");c(this,"downcastDispatcher");this.model=e,this.view=new Qr(n),this.mapper=new cs,this.downcastDispatcher=new hs({mapper:this.mapper,schema:e.schema});const s=this.model.document,i=s.selection,o=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(s,"change",()=>{this.view.change(a=>{this.downcastDispatcher.convertChanges(s.differ,o,a),this.downcastDispatcher.convertSelection(i,o,a)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",Xi(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",mo(this.mapper,this.model.schema,this.view),{priority:"high"}),this.downcastDispatcher.on("insert:$text",ds(),{priority:"lowest"}),this.downcastDispatcher.on("insert",ms(),{priority:"lowest"}),this.downcastDispatcher.on("remove",_i(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",yi()),this.downcastDispatcher.on("selection",wi(),{priority:"low"}),this.downcastDispatcher.on("selection",bi(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(a=>{if(a.rootName=="$graveyard")return null;const l=new Kn(this.view.document,a.name);return l.rootName=a.rootName,this.mapper.bindElements(a,l),l})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const n=typeof e=="string"?e:e.name,s=this.model.markers.get(n);if(!s)throw new d("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:n});this.model.change(()=>{this.model.markers._refresh(s)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}function mo(r,t,e){return(n,s)=>{if(!(e.document.isComposing&&!T.isAndroid))for(let i=0;i<s.targetRanges.length;i++){const o=s.targetRanges[i],a=r.toModelRange(o),l=Es(a,t);!l||l.isEqual(a)||(s.targetRanges[i]=r.toViewRange(l))}}}class go extends U(){constructor(){super();c(this,"_sourceDefinitions",{});c(this,"_attributeProperties",Object.create(null));c(this,"_customChildChecks",new Map);c(this,"_customAttributeChecks",new Map);c(this,"_genericCheckSymbol",Symbol("$generic"));c(this,"_compiledDefinitions");this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,n)=>{n[0]=new ae(n[0])},{priority:"highest"}),this.on("checkChild",(e,n)=>{n[0]=new ae(n[0]),n[1]=this.getDefinition(n[1])},{priority:"highest"})}register(e,n){if(this._sourceDefinitions[e])throw new d("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},n)],this._clearCache()}extend(e,n){if(!this._sourceDefinitions[e])throw new d("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},n)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let n;return typeof e=="string"?n=e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?n="$text":n=e.name,this.getDefinitions()[n]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const n=this.getDefinition(e);return!!(n&&n.isBlock)}isLimit(e){const n=this.getDefinition(e);return n?!!(n.isLimit||n.isObject):!1}isObject(e){const n=this.getDefinition(e);return n?!!(n.isObject||n.isLimit&&n.isSelectable&&n.isContent):!1}isInline(e){const n=this.getDefinition(e);return!!(n&&n.isInline)}isSelectable(e){const n=this.getDefinition(e);return n?!!(n.isSelectable||n.isObject):!1}isContent(e){const n=this.getDefinition(e);return n?!!(n.isContent||n.isObject):!1}checkChild(e,n){return n?this._checkContextMatch(e,n):!1}checkAttribute(e,n){const s=this.getDefinition(e.last);if(!s)return!1;const i=this._evaluateAttributeChecks(e,n);return i!==void 0?i:s.allowAttributes.includes(n)}checkMerge(e,n){if(e instanceof g){const s=e.nodeBefore,i=e.nodeAfter;if(!(s instanceof k))throw new d("schema-check-merge-no-element-before",this);if(!(i instanceof k))throw new d("schema-check-merge-no-element-after",this);return this.checkMerge(s,i)}if(this.isLimit(e)||this.isLimit(n))return!1;for(const s of n.getChildren())if(!this.checkChild(e,s))return!1;return!0}addChildCheck(e,n){const s=n!==void 0?n:this._genericCheckSymbol,i=this._customChildChecks.get(s)||[];i.push(e),this._customChildChecks.set(s,i)}addAttributeCheck(e,n){const s=n!==void 0?n:this._genericCheckSymbol,i=this._customAttributeChecks.get(s)||[];i.push(e),this._customAttributeChecks.set(s,i)}setAttributeProperties(e,n){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),n)}getAttributeProperties(e){return this._attributeProperties[e]||Object.create(null)}getLimitElement(e){let n;for(e instanceof g?n=e.parent:n=(e instanceof f?[e]:Array.from(e.getRanges())).reduce((i,o)=>{const a=o.getCommonAncestor();return i?i.getCommonAncestor(a,{includeSelf:!0}):a},null);!this.isLimit(n)&&n.parent;)n=n.parent;return n}checkAttributeInSelection(e,n){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new A("",e.getAttributes())];return this.checkAttribute(i,n)}else{const s=e.getRanges();for(const i of s)for(const o of i)if(this.checkAttribute(o.item,n))return!0}return!1}*getValidRanges(e,n){e=xo(e);for(const s of e)yield*this._getValidRangesForRange(s,n)}getNearestSelectionRange(e,n="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new f(e);let s,i;const o=e.getAncestors().reverse().find(a=>this.isLimit(a))||e.root;(n=="both"||n=="backward")&&(s=new oe({boundaries:f._createIn(o),startPosition:e,direction:"backward"})),(n=="both"||n=="forward")&&(i=new oe({boundaries:f._createIn(o),startPosition:e}));for(const a of Mo(s,i)){const l=a.walker==s?"elementEnd":"elementStart",h=a.value;if(h.type==l&&this.isObject(h.item))return f._createOn(h.item);if(this.checkChild(h.nextPosition,"$text"))return new f(h.nextPosition)}return null}findAllowedParent(e,n){let s=e.parent;for(;s;){if(this.checkChild(s,n))return s;if(this.isLimit(s))return null;s=s.parent}return null}setAllowedAttributes(e,n,s){const i=s.model;for(const[o,a]of Object.entries(n))i.schema.checkAttribute(e,o)&&s.setAttribute(o,a,e)}removeDisallowedAttributes(e,n){for(const s of e)if(s.is("$text"))Tn(this,s,n);else{const o=f._createIn(s).getPositions();for(const a of o){const l=a.nodeBefore||a.parent;Tn(this,l,n)}}}getAttributesWithProperty(e,n,s){const i={};for(const[o,a]of e.getAttributes()){const l=this.getAttributeProperties(o);l[n]!==void 0&&(s===void 0||s===l[n])&&(i[o]=a)}return i}createContext(e){return new ae(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},n=this._sourceDefinitions,s=Object.keys(n);for(const o of s)e[o]=po(n[o],o);const i=Object.values(e);for(const o of i)_o(e,o),wo(e,o),bo(e,o),yo(e,o);for(const o of i)vo(e,o);for(const o of i)Po(e,o);for(const o of i)Co(e,o);for(const o of i)Ao(e,o);for(const o of i)So(e,o);this._compiledDefinitions=ko(e)}_checkContextMatch(e,n){const s=e.last;let i=this._evaluateChildChecks(e,n);if(i=i!==void 0?i:n.allowIn.includes(s.name),!i)return!1;const o=this.getDefinition(s),a=e.trimLast();return o?a.length==0?!0:this._checkContextMatch(a,o):!1}_evaluateChildChecks(e,n){const s=this._customChildChecks.get(this._genericCheckSymbol)||[],i=this._customChildChecks.get(n.name)||[];for(const o of[...s,...i]){const a=o(e,n);if(a!==void 0)return a}}_evaluateAttributeChecks(e,n){const s=this._customAttributeChecks.get(this._genericCheckSymbol)||[],i=this._customAttributeChecks.get(n)||[];for(const o of[...s,...i]){const a=o(e,n);if(a!==void 0)return a}}*_getValidRangesForRange(e,n){let s=e.start,i=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(f._createIn(o),n)),this.checkAttribute(o,n)||(s.isEqual(i)||(yield new f(s,i)),s=g._createAfter(o)),i=g._createAfter(o);s.isEqual(i)||(yield new f(s,i))}findOptimalInsertionRange(e,n){const s=e.getSelectedElement();if(s&&this.isObject(s)&&!this.isInline(s))return n=="before"||n=="after"?new f(g._createAt(s,n)):f._createOn(s);const i=zt(e.getSelectedBlocks());if(!i)return new f(e.focus);if(i.isEmpty)return new f(g._createAt(i,0));const o=g._createAfter(i);return e.focus.isTouching(o)?new f(o):new f(g._createBefore(i))}}class ae{constructor(t){c(this,"_items");if(t instanceof ae)return t;let e;typeof t=="string"?e=[t]:Array.isArray(t)?e=t:e=t.getAncestors({includeSelf:!0}),this._items=e.map(To)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(t){const e=new ae([t]);return e._items=[...this._items,...e._items],e}trimLast(){const t=new ae([]);return t._items=this._items.slice(0,-1),t}getItem(t){return this._items[t]}*getNames(){yield*this._items.map(t=>t.name)}endsWith(t){return Array.from(this.getNames()).join(" ").endsWith(t)}startsWith(t){return Array.from(this.getNames()).join(" ").startsWith(t)}}function po(r,t){const e={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return Eo(r,e),K(r,e,"allowIn"),K(r,e,"allowChildren"),K(r,e,"disallowIn"),K(r,e,"disallowChildren"),K(r,e,"allowContentOf"),K(r,e,"allowWhere"),K(r,e,"allowAttributes"),K(r,e,"disallowAttributes"),K(r,e,"allowAttributesOf"),K(r,e,"inheritTypesFrom"),Ro(r,e),e}function _o(r,t){for(const e of t.allowIn){const n=r[e];n?n.allowChildren.add(t.name):t.allowIn.delete(e)}}function wo(r,t){for(const e of t.allowChildren){const n=r[e];n?n.allowIn.add(t.name):t.allowChildren.delete(e)}}function bo(r,t){for(const e of t.disallowIn){const n=r[e];n?n.disallowChildren.add(t.name):t.disallowIn.delete(e)}}function yo(r,t){for(const e of t.disallowChildren){const n=r[e];n?n.disallowIn.add(t.name):t.disallowChildren.delete(e)}}function vo(r,t){for(const e of t.disallowChildren)t.allowChildren.delete(e);for(const e of t.disallowIn)t.allowIn.delete(e);for(const e of t.disallowAttributes)t.allowAttributes.delete(e)}function Po(r,t){for(const e of t.allowContentOf){const n=r[e];n&&(n.disallowChildren.forEach(s=>{t.allowChildren.has(s)||(t.disallowChildren.add(s),r[s].disallowIn.add(t.name))}),n.allowChildren.forEach(s=>{t.disallowChildren.has(s)||(t.allowChildren.add(s),r[s].allowIn.add(t.name))}))}}function Co(r,t){for(const e of t.allowWhere){const n=r[e];n&&(n.disallowIn.forEach(s=>{t.allowIn.has(s)||(t.disallowIn.add(s),r[s].disallowChildren.add(t.name))}),n.allowIn.forEach(s=>{t.disallowIn.has(s)||(t.allowIn.add(s),r[s].allowChildren.add(t.name))}))}}function ko(r){const t={};for(const e of Object.values(r))t[e.name]={name:e.name,isBlock:!!e.isBlock,isContent:!!e.isContent,isInline:!!e.isInline,isLimit:!!e.isLimit,isObject:!!e.isObject,isSelectable:!!e.isSelectable,allowIn:Array.from(e.allowIn).filter(n=>!!r[n]),allowChildren:Array.from(e.allowChildren).filter(n=>!!r[n]),allowAttributes:Array.from(e.allowAttributes)};return t}function Ao(r,t){for(const e of t.allowAttributesOf){const n=r[e];if(!n)return;n.allowAttributes.forEach(s=>{t.disallowAttributes.has(s)||t.allowAttributes.add(s)})}}function So(r,t){for(const e of t.inheritTypesFrom){const n=r[e];if(n){const s=Object.keys(n).filter(i=>i.startsWith("is"));for(const i of s)i in t||(t[i]=n[i])}}}function Eo(r,t){for(const e of r){const n=Object.keys(e).filter(s=>s.startsWith("is"));for(const s of n)t[s]=!!e[s]}}function K(r,t,e){for(const n of r){let s=n[e];typeof s=="string"&&(s=[s]),Array.isArray(s)&&s.forEach(i=>t[e].add(i))}}function Ro(r,t){for(const e of r){const n=e.inheritAllFrom;n&&(t.allowContentOf.add(n),t.allowWhere.add(n),t.allowAttributesOf.add(n),t.inheritTypesFrom.add(n))}}function To(r){return typeof r=="string"||r.is("documentFragment")?{name:typeof r=="string"?r:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:r.is("element")?r.name:"$text",*getAttributeKeys(){yield*r.getAttributeKeys()},getAttribute(t){return r.getAttribute(t)}}}function*Mo(r,t){let e=!1;for(;!e;){if(e=!0,r){const n=r.next();n.done||(e=!1,yield{walker:r,value:n.value})}if(t){const n=t.next();n.done||(e=!1,yield{walker:t,value:n.value})}}}function*xo(r){for(const t of r)yield*t.getMinimalFlatRanges()}function Tn(r,t,e){for(const n of t.getAttributeKeys())r.checkAttribute(t,n)||e.removeAttribute(n,t)}class No extends O(){constructor(e){super();c(this,"conversionApi");c(this,"_splitParts",new Map);c(this,"_cursorParents",new Map);c(this,"_modelCursor",null);c(this,"_emptyElementsToKeep",new Set);this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(n,s)=>this._convertItem(n,s),convertChildren:(n,s)=>this._convertChildren(n,s),safeInsert:(n,s)=>this._safeInsert(n,s),updateConversionResult:(n,s)=>this._updateConversionResult(n,s),splitToAllowedParent:(n,s)=>this._splitToAllowedParent(n,s),getSplitParts:n=>this._getSplitParts(n),keepEmptyElement:n=>this._keepEmptyElement(n)}}convert(e,n,s=["$root"]){this.fire("viewCleanup",e),this._modelCursor=Io(s,n),this.conversionApi.writer=n,this.conversionApi.consumable=ut.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),o=n.createDocumentFragment();if(i){this._removeEmptyElements();const a=this._modelCursor.parent,l=a._removeChildren(0,a.childCount);o._insertChild(0,l),o.markers=Oo(o,n)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,n){const s={viewItem:e,modelCursor:n,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,s,this.conversionApi):e.is("$text")?this.fire("text",s,this.conversionApi):this.fire("documentFragment",s,this.conversionApi),s.modelRange&&!(s.modelRange instanceof f))throw new d("view-conversion-dispatcher-incorrect-result",this);return{modelRange:s.modelRange,modelCursor:s.modelCursor}}_convertChildren(e,n){let s=n.is("position")?n:g._createAt(n,0);const i=new f(s);for(const o of Array.from(e.getChildren())){const a=this._convertItem(o,s);a.modelRange instanceof f&&(i.end=a.modelRange.end,s=a.modelCursor)}return{modelRange:i,modelCursor:s}}_safeInsert(e,n){const s=this._splitToAllowedParent(e,n);return s?(this.conversionApi.writer.insert(e,s.position),!0):!1}_updateConversionResult(e,n){const s=this._getSplitParts(e),i=this.conversionApi.writer;n.modelRange||(n.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(s[s.length-1])));const o=this._cursorParents.get(e);o?n.modelCursor=i.createPositionAt(o,0):n.modelCursor=n.modelRange.end}_splitToAllowedParent(e,n){const{schema:s,writer:i}=this.conversionApi;let o=s.findAllowedParent(n,e);if(o){if(o===n.parent)return{position:n};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return Ps(n,e,s)?{position:Cs(n,i)}:null;const a=this.conversionApi.writer.split(n,o),l=[];for(const u of a.range.getWalker())if(u.type=="elementEnd")l.push(u.item);else{const m=l.pop(),p=u.item;this._registerSplitPair(m,p)}const h=a.range.end.parent;return this._cursorParents.set(e,h),{position:a.position,cursorParent:h}}_registerSplitPair(e,n){this._splitParts.has(e)||this._splitParts.set(e,[e]);const s=this._splitParts.get(e);this._splitParts.set(n,s),s.push(n)}_getSplitParts(e){let n;return this._splitParts.has(e)?n=this._splitParts.get(e):n=[e],n}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){const e=new Map;for(const n of this._splitParts.keys())if(n.isEmpty&&!this._emptyElementsToKeep.has(n)){const s=e.get(n.parent)||[];s.push(n),this._splitParts.delete(n),e.set(n.parent,s)}for(const[n,s]of e)n._removeChildrenArray(s);e.size&&this._removeEmptyElements()}}function Oo(r,t){const e=new Set,n=new Map,s=f._createIn(r).getItems();for(const i of s)i.is("element","$marker")&&e.add(i);for(const i of e){const o=i.getAttribute("data-name"),a=t.createPositionBefore(i);n.has(o)?n.get(o).end=a.clone():n.set(o,new f(a.clone())),t.remove(i)}return n}function Io(r,t){let e;for(const n of new ae(r)){const s={};for(const o of n.getAttributeKeys())s[o]=n.getAttribute(o);const i=t.createElement(n.name,s);e&&t.insert(i,e),e=g._createAt(i,0)}return e}class Fo{getHtml(t){const n=ie.document.implementation.createHTMLDocument("").createElement("div");return n.appendChild(t),n.innerHTML}}class Bo{constructor(t){c(this,"domParser");c(this,"domConverter");c(this,"htmlWriter");c(this,"skipComments",!0);this.domParser=new DOMParser,this.domConverter=new rs(t,{renderingMode:"data"}),this.htmlWriter=new Fo}toData(t){const e=this.domConverter.viewToDom(t);return this.htmlWriter.getHtml(e)}toView(t){const e=this._toDom(t);return this.domConverter.domToView(e,{skipComments:this.skipComments})}registerRawContentMatcher(t){this.domConverter.registerRawContentMatcher(t)}useFillerType(t){this.domConverter.blockFillerMode=t=="marked"?"markedNbsp":"nbsp"}_toDom(t){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(t.trim().slice(0,1e4))||(t=`<body>${t}</body>`);const e=this.domParser.parseFromString(t,"text/html"),n=e.createDocumentFragment(),s=e.body.childNodes;for(;s.length>0;)n.appendChild(s[0]);return n}}class Cl extends O(){constructor(e,n){super();c(this,"model");c(this,"mapper");c(this,"downcastDispatcher");c(this,"upcastDispatcher");c(this,"viewDocument");c(this,"stylesProcessor");c(this,"htmlProcessor");c(this,"processor");c(this,"_viewWriter");this.model=e,this.mapper=new cs,this.downcastDispatcher=new hs({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",ds(),{priority:"lowest"}),this.downcastDispatcher.on("insert",ms(),{priority:"lowest"}),this.upcastDispatcher=new No({schema:e.schema}),this.viewDocument=new Qn(n),this.stylesProcessor=n,this.htmlProcessor=new Bo(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Zn(this.viewDocument),this.upcastDispatcher.on("text",Ki(),{priority:"lowest"}),this.upcastDispatcher.on("element",An(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",An(),{priority:"lowest"}),U().prototype.decorate.call(this,"init"),U().prototype.decorate.call(this,"set"),U().prototype.decorate.call(this,"get"),U().prototype.decorate.call(this,"toView"),U().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},vs)},{priority:"lowest"})}get(e={}){const{rootName:n="main",trim:s="empty"}=e;if(!this._checkIfRootsExists([n]))throw new d("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(n);return i.isAttached()||W("datacontroller-get-detached-root",this),s==="empty"&&!this.model.hasContent(i,{ignoreWhitespaces:!0})?"":this.stringify(i,e)}stringify(e,n={}){const s=this.toView(e,n);return this.processor.toData(s)}toView(e,n={}){const s=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const o=f._createIn(e),a=new _e(s);this.mapper.bindElements(e,a);const l=e.is("documentFragment")?e.markers:Do(e);return this.downcastDispatcher.convert(o,l,i,n),a}init(e){if(this.model.document.version)throw new d("datacontroller-init-document-not-empty",this);let n={};if(typeof e=="string"?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new d("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},s=>{for(const i of Object.keys(n)){const o=this.model.document.getRoot(i);s.insert(this.parse(n[i],o),o,0)}}),Promise.resolve()}set(e,n={}){let s={};if(typeof e=="string"?s.main=e:s=e,!this._checkIfRootsExists(Object.keys(s)))throw new d("datacontroller-set-non-existent-root",this);this.model.enqueueChange(n.batchType||{},i=>{i.setSelection(null),i.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(s)){const a=this.model.document.getRoot(o);i.remove(i.createRangeIn(a)),i.insert(this.parse(s[o],a),a,0)}})}parse(e,n="$root"){const s=this.processor.toView(e);return this.toModel(s,n)}toModel(e,n="$root"){return this.model.change(s=>this.upcastDispatcher.convert(e,s,n))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const n of e)if(!this.model.document.getRoot(n))return!1;return!0}}function Do(r){const t=[],e=r.root.document;if(!e)return new Map;const n=f._createIn(r);for(const s of e.model.markers){const i=s.getRange(),o=i.isCollapsed,a=i.start.isEqual(n.start)||i.end.isEqual(n.end);if(o&&a)t.push([s.name,i]);else{const l=n.getIntersection(i);l&&t.push([s.name,l])}}return t.sort(([s,i],[o,a])=>{if(i.end.compareWith(a.start)!=="after")return 1;if(i.start.compareWith(a.end)!=="before")return-1;switch(i.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(i.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return o.localeCompare(s)}}}),new Map(t)}class kl{constructor(t,e){c(this,"_helpers",new Map);c(this,"_downcast");c(this,"_upcast");this._downcast=le(t),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=le(e),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(t,e){const n=this._downcast.includes(e);if(!this._upcast.includes(e)&&!n)throw new d("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:t,dispatchers:[e],isDowncast:n})}for(t){if(!this._helpers.has(t))throw new d("conversion-for-unknown-group",this);return this._helpers.get(t)}elementToElement(t){this.for("downcast").elementToElement(t);for(const{model:e,view:n}of St(t))this.for("upcast").elementToElement({model:e,view:n,converterPriority:t.converterPriority})}attributeToElement(t){this.for("downcast").attributeToElement(t);for(const{model:e,view:n}of St(t))this.for("upcast").elementToAttribute({view:n,model:e,converterPriority:t.converterPriority})}attributeToAttribute(t){this.for("downcast").attributeToAttribute(t);for(const{model:e,view:n}of St(t))this.for("upcast").attributeToAttribute({view:n,model:e})}_createConversionHelpers({name:t,dispatchers:e,isDowncast:n}){if(this._helpers.has(t))throw new d("conversion-group-exists",this);const s=n?new pi(e):new Hi(e);this._helpers.set(t,s)}}function*St(r){if(r.model.values)for(const t of r.model.values){const e={key:r.model.key,value:t},n=r.view[t],s=r.upcastAlso?r.upcastAlso[t]:void 0;yield*Mn(e,n,s)}else yield*Mn(r.model,r.view,r.upcastAlso)}function*Mn(r,t,e){if(yield{model:r,view:t},e)for(const n of le(e))yield{model:r,view:n}}/**
21
+ */function vs(r){const{schema:t,document:e}=r.model;for(const n of e.getRoots())if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return r.insertElement("paragraph",n),!0;return!1}function Ps(r,t,e){const n=e.createContext(r);return!(!e.checkChild(n,"paragraph")||!e.checkChild(n.push("paragraph"),t))}function Cs(r,t){const e=t.createElement("paragraph");return t.insert(e,r),t.createPositionAt(e,0)}class Hi extends fs{elementToElement(t){return this.add(ks(t))}elementToAttribute(t){return this.add(Yi(t))}attributeToAttribute(t){return this.add(Qi(t))}elementToMarker(t){return this.add(Zi(t))}dataToMarker(t){return this.add(eo(t))}}function An(){return(r,t,e)=>{if(!t.modelRange&&e.consumable.consume(t.viewItem,{name:!0})){const{modelRange:n,modelCursor:s}=e.convertChildren(t.viewItem,t.modelCursor);t.modelRange=n,t.modelCursor=s}}}function Ki(){return(r,t,{schema:e,consumable:n,writer:s})=>{let i=t.modelCursor;if(!n.test(t.viewItem))return;if(!e.checkChild(i,"$text")){if(!Ps(i,"$text",e)||t.viewItem.data.trim().length==0)return;i=Cs(i,s)}n.consume(t.viewItem);const o=s.createText(t.viewItem.data);s.insert(o,i),t.modelRange=s.createRange(i,i.getShiftedBy(o.offsetSize)),t.modelCursor=t.modelRange.end}}function Xi(r,t){return(e,n)=>{const s=n.newSelection,i=[];for(const a of s.getRanges())i.push(t.toModelRange(a));const o=r.createSelection(i,{backward:s.isBackward});o.isEqual(r.document.selection)||r.change(a=>{a.setSelection(o)})}}function ks(r){r=he(r);const t=$t(r),e=Yt(r.view),n=e?`element:${e}`:"element";return s=>{s.on(n,t,{priority:r.converterPriority||"normal"})}}function Yi(r){r=he(r),As(r);const t=Ss(r,!1),e=Yt(r.view),n=e?`element:${e}`:"element";return s=>{s.on(n,t,{priority:r.converterPriority||"low"})}}function Qi(r){r=he(r);let t=null;(typeof r.view=="string"||r.view.key)&&(t=so(r)),As(r,t);const e=Ss(r,!0);return n=>{n.on("element",e,{priority:r.converterPriority||"low"})}}function Zi(r){const t=oo(r.model);return ks({...r,model:t})}function eo(r){r=he(r),r.model||(r.model=s=>s?r.view+":"+s:r.view);const t={view:r.view,model:r.model},e=$t(Sn(t,"start")),n=$t(Sn(t,"end"));return s=>{s.on(`element:${r.view}-start`,e,{priority:r.converterPriority||"normal"}),s.on(`element:${r.view}-end`,n,{priority:r.converterPriority||"normal"});const i=_t.low,o=_t.highest,a=_t.get(r.converterPriority)/o;s.on("element",to(t),{priority:i+a})}}function to(r){return(t,e,n)=>{const s=`data-${r.view}`;if(!n.consumable.test(e.viewItem,{attributes:s+"-end-after"})&&!n.consumable.test(e.viewItem,{attributes:s+"-start-after"})&&!n.consumable.test(e.viewItem,{attributes:s+"-end-before"})&&!n.consumable.test(e.viewItem,{attributes:s+"-start-before"}))return;e.modelRange||Object.assign(e,n.convertChildren(e.viewItem,e.modelCursor)),n.consumable.consume(e.viewItem,{attributes:s+"-end-after"})&&i(e.modelRange.end,e.viewItem.getAttribute(s+"-end-after").split(",")),n.consumable.consume(e.viewItem,{attributes:s+"-start-after"})&&i(e.modelRange.end,e.viewItem.getAttribute(s+"-start-after").split(",")),n.consumable.consume(e.viewItem,{attributes:s+"-end-before"})&&i(e.modelRange.start,e.viewItem.getAttribute(s+"-end-before").split(",")),n.consumable.consume(e.viewItem,{attributes:s+"-start-before"})&&i(e.modelRange.start,e.viewItem.getAttribute(s+"-start-before").split(","));function i(o,a){for(const l of a){const h=r.model(l,n),u=n.writer.createElement("$marker",{"data-name":h});n.writer.insert(u,o),e.modelCursor.isEqual(o)?e.modelCursor=e.modelCursor.getShiftedBy(1):e.modelCursor=e.modelCursor._getTransformedByInsertion(o,1),e.modelRange=e.modelRange._getTransformedByInsertion(o,1)[0]}}}}function Yt(r){return typeof r=="string"?r:typeof r=="object"&&typeof r.name=="string"?r.name:null}function $t(r){const t=new He(r.view);return(e,n,s)=>{const i=t.match(n.viewItem);if(!i)return;const o=i.match;if(o.name=!0,!s.consumable.test(n.viewItem,o))return;const a=no(r.model,n.viewItem,s);a&&s.safeInsert(a,n.modelCursor)&&(s.consumable.consume(n.viewItem,o),s.convertChildren(n.viewItem,a),s.updateConversionResult(a,n))}}function no(r,t,e){return r instanceof Function?r(t,e):e.writer.createElement(r)}function so(r){typeof r.view=="string"&&(r.view={key:r.view});const t=r.view.key,e=typeof r.view.value>"u"?/[\s\S]*/:r.view.value;let n;return t=="class"||t=="style"?n={[t=="class"?"classes":"styles"]:e}:n={attributes:{[t]:e}},r.view.name&&(n.name=r.view.name),r.view=n,t}function As(r,t=null){const e=t===null?!0:i=>i.getAttribute(t),n=typeof r.model!="object"?r.model:r.model.key,s=typeof r.model!="object"||typeof r.model.value>"u"?e:r.model.value;r.model={key:n,value:s}}function Ss(r,t){const e=new He(r.view);return(n,s,i)=>{if(!s.modelRange&&t)return;const o=e.match(s.viewItem);if(!o||(ro(r.view,s.viewItem)?o.match.name=!0:delete o.match.name,!i.consumable.test(s.viewItem,o.match)))return;const a=r.model.key,l=typeof r.model.value=="function"?r.model.value(s.viewItem,i,s):r.model.value;if(l===null)return;s.modelRange||Object.assign(s,i.convertChildren(s.viewItem,s.modelCursor)),io(s.modelRange,{key:a,value:l},t,i)&&(i.consumable.test(s.viewItem,{name:!0})&&(o.match.name=!0),i.consumable.consume(s.viewItem,o.match))}}function ro(r,t){const e=typeof r=="function"?r(t):r;return typeof e=="object"&&!Yt(e)?!1:!e.classes&&!e.attributes&&!e.styles}function io(r,t,e,n){let s=!1;for(const i of Array.from(r.getItems({shallow:e})))n.schema.checkAttribute(i,t.key)&&(s=!0,!i.hasAttribute(t.key)&&n.writer.setAttribute(t.key,t.value,i));return s}function oo(r){return(t,e)=>{const n=typeof r=="string"?r:r(t,e);return e.writer.createElement("$marker",{"data-name":n})}}function Sn(r,t){const e=(n,s)=>{const i=n.getAttribute("name"),o=r.model(i,s);return s.writer.createElement("$marker",{"data-name":o})};return{view:`${r.view}-${t}`,model:e}}function ao(r){r.document.registerPostFixer(t=>lo(t,r))}function lo(r,t){const e=t.document.selection,n=t.schema,s=[];let i=!1;for(const o of e.getRanges()){const a=Es(o,n);a&&!a.isEqual(o)?(s.push(a),i=!0):s.push(o)}return i&&r.setSelection(fo(s),{backward:e.isBackward}),!1}function Es(r,t){return r.isCollapsed?co(r,t):ho(r,t)}function co(r,t){const e=r.start,n=t.getNearestSelectionRange(e);if(!n){const i=e.getAncestors().reverse().find(o=>t.isObject(o));return i?f._createOn(i):null}if(!n.isCollapsed)return n;const s=n.start;return e.isEqual(s)?null:new f(s)}function ho(r,t){const{start:e,end:n}=r,s=t.checkChild(e,"$text"),i=t.checkChild(n,"$text"),o=t.getLimitElement(e),a=t.getLimitElement(n);if(o===a){if(s&&i)return null;if(uo(e,n,t)){const m=e.nodeAfter&&t.isSelectable(e.nodeAfter)?null:t.getNearestSelectionRange(e,"forward"),w=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),v=m?m.start:e,I=w?w.end:n;return new f(v,I)}}const l=o&&!o.is("rootElement"),h=a&&!a.is("rootElement");if(l||h){const u=e.nodeAfter&&n.nodeBefore&&e.nodeAfter.parent===n.nodeBefore.parent,m=l&&(!u||!Rn(e.nodeAfter,t)),p=h&&(!u||!Rn(n.nodeBefore,t));let w=e,v=n;return m&&(w=g._createBefore(En(o,t))),p&&(v=g._createAfter(En(a,t))),new f(w,v)}return null}function En(r,t){let e=r,n=e;for(;t.isLimit(n)&&n.parent;)e=n,n=n.parent;return e}function uo(r,t,e){const n=r.nodeAfter&&!e.isLimit(r.nodeAfter)||e.checkChild(r,"$text"),s=t.nodeBefore&&!e.isLimit(t.nodeBefore)||e.checkChild(t,"$text");return n||s}function fo(r){const t=[...r],e=new Set;let n=1;for(;n<t.length;){const i=t[n],o=t.slice(0,n);for(const[a,l]of o.entries())if(!e.has(a)){if(i.isEqual(l))e.add(a);else if(i.isIntersecting(l)){e.add(a),e.add(n);const h=i.getJoined(l);t.push(h)}}n++}return t.filter((i,o)=>!e.has(o))}function Rn(r,t){return r&&t.isSelectable(r)}class Pl extends U(){constructor(e,n){super();c(this,"model");c(this,"view");c(this,"mapper");c(this,"downcastDispatcher");this.model=e,this.view=new Qr(n),this.mapper=new cs,this.downcastDispatcher=new hs({mapper:this.mapper,schema:e.schema});const s=this.model.document,i=s.selection,o=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(s,"change",()=>{this.view.change(a=>{this.downcastDispatcher.convertChanges(s.differ,o,a),this.downcastDispatcher.convertSelection(i,o,a)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",Xi(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",mo(this.mapper,this.model.schema,this.view),{priority:"high"}),this.downcastDispatcher.on("insert:$text",ds(),{priority:"lowest"}),this.downcastDispatcher.on("insert",ms(),{priority:"lowest"}),this.downcastDispatcher.on("remove",_i(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",yi()),this.downcastDispatcher.on("selection",wi(),{priority:"low"}),this.downcastDispatcher.on("selection",bi(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(a=>{if(a.rootName=="$graveyard")return null;const l=new Kn(this.view.document,a.name);return l.rootName=a.rootName,this.mapper.bindElements(a,l),l})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const n=typeof e=="string"?e:e.name,s=this.model.markers.get(n);if(!s)throw new d("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:n});this.model.change(()=>{this.model.markers._refresh(s)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}function mo(r,t,e){return(n,s)=>{if(!(e.document.isComposing&&!T.isAndroid))for(let i=0;i<s.targetRanges.length;i++){const o=s.targetRanges[i],a=r.toModelRange(o),l=Es(a,t);!l||l.isEqual(a)||(s.targetRanges[i]=r.toViewRange(l))}}}class go extends U(){constructor(){super();c(this,"_sourceDefinitions",{});c(this,"_attributeProperties",Object.create(null));c(this,"_customChildChecks",new Map);c(this,"_customAttributeChecks",new Map);c(this,"_genericCheckSymbol",Symbol("$generic"));c(this,"_compiledDefinitions");this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,n)=>{n[0]=new ae(n[0])},{priority:"highest"}),this.on("checkChild",(e,n)=>{n[0]=new ae(n[0]),n[1]=this.getDefinition(n[1])},{priority:"highest"})}register(e,n){if(this._sourceDefinitions[e])throw new d("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},n)],this._clearCache()}extend(e,n){if(!this._sourceDefinitions[e])throw new d("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},n)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let n;return typeof e=="string"?n=e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?n="$text":n=e.name,this.getDefinitions()[n]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const n=this.getDefinition(e);return!!(n&&n.isBlock)}isLimit(e){const n=this.getDefinition(e);return n?!!(n.isLimit||n.isObject):!1}isObject(e){const n=this.getDefinition(e);return n?!!(n.isObject||n.isLimit&&n.isSelectable&&n.isContent):!1}isInline(e){const n=this.getDefinition(e);return!!(n&&n.isInline)}isSelectable(e){const n=this.getDefinition(e);return n?!!(n.isSelectable||n.isObject):!1}isContent(e){const n=this.getDefinition(e);return n?!!(n.isContent||n.isObject):!1}checkChild(e,n){return n?this._checkContextMatch(e,n):!1}checkAttribute(e,n){const s=this.getDefinition(e.last);if(!s)return!1;const i=this._evaluateAttributeChecks(e,n);return i!==void 0?i:s.allowAttributes.includes(n)}checkMerge(e,n){if(e instanceof g){const s=e.nodeBefore,i=e.nodeAfter;if(!(s instanceof k))throw new d("schema-check-merge-no-element-before",this);if(!(i instanceof k))throw new d("schema-check-merge-no-element-after",this);return this.checkMerge(s,i)}if(this.isLimit(e)||this.isLimit(n))return!1;for(const s of n.getChildren())if(!this.checkChild(e,s))return!1;return!0}addChildCheck(e,n){const s=n!==void 0?n:this._genericCheckSymbol,i=this._customChildChecks.get(s)||[];i.push(e),this._customChildChecks.set(s,i)}addAttributeCheck(e,n){const s=n!==void 0?n:this._genericCheckSymbol,i=this._customAttributeChecks.get(s)||[];i.push(e),this._customAttributeChecks.set(s,i)}setAttributeProperties(e,n){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),n)}getAttributeProperties(e){return this._attributeProperties[e]||Object.create(null)}getLimitElement(e){let n;for(e instanceof g?n=e.parent:n=(e instanceof f?[e]:Array.from(e.getRanges())).reduce((i,o)=>{const a=o.getCommonAncestor();return i?i.getCommonAncestor(a,{includeSelf:!0}):a},null);!this.isLimit(n)&&n.parent;)n=n.parent;return n}checkAttributeInSelection(e,n){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new A("",e.getAttributes())];return this.checkAttribute(i,n)}else{const s=e.getRanges();for(const i of s)for(const o of i)if(this.checkAttribute(o.item,n))return!0}return!1}*getValidRanges(e,n){e=xo(e);for(const s of e)yield*this._getValidRangesForRange(s,n)}getNearestSelectionRange(e,n="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new f(e);let s,i;const o=e.getAncestors().reverse().find(a=>this.isLimit(a))||e.root;(n=="both"||n=="backward")&&(s=new oe({boundaries:f._createIn(o),startPosition:e,direction:"backward"})),(n=="both"||n=="forward")&&(i=new oe({boundaries:f._createIn(o),startPosition:e}));for(const a of Mo(s,i)){const l=a.walker==s?"elementEnd":"elementStart",h=a.value;if(h.type==l&&this.isObject(h.item))return f._createOn(h.item);if(this.checkChild(h.nextPosition,"$text"))return new f(h.nextPosition)}return null}findAllowedParent(e,n){let s=e.parent;for(;s;){if(this.checkChild(s,n))return s;if(this.isLimit(s))return null;s=s.parent}return null}setAllowedAttributes(e,n,s){const i=s.model;for(const[o,a]of Object.entries(n))i.schema.checkAttribute(e,o)&&s.setAttribute(o,a,e)}removeDisallowedAttributes(e,n){for(const s of e)if(s.is("$text"))Tn(this,s,n);else{const o=f._createIn(s).getPositions();for(const a of o){const l=a.nodeBefore||a.parent;Tn(this,l,n)}}}getAttributesWithProperty(e,n,s){const i={};for(const[o,a]of e.getAttributes()){const l=this.getAttributeProperties(o);l[n]!==void 0&&(s===void 0||s===l[n])&&(i[o]=a)}return i}createContext(e){return new ae(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},n=this._sourceDefinitions,s=Object.keys(n);for(const o of s)e[o]=po(n[o],o);const i=Object.values(e);for(const o of i)_o(e,o),wo(e,o),bo(e,o),yo(e,o);for(const o of i)vo(e,o);for(const o of i)Po(e,o);for(const o of i)Co(e,o);for(const o of i)Ao(e,o);for(const o of i)So(e,o);this._compiledDefinitions=ko(e)}_checkContextMatch(e,n){const s=e.last;let i=this._evaluateChildChecks(e,n);if(i=i!==void 0?i:n.allowIn.includes(s.name),!i)return!1;const o=this.getDefinition(s),a=e.trimLast();return o?a.length==0?!0:this._checkContextMatch(a,o):!1}_evaluateChildChecks(e,n){const s=this._customChildChecks.get(this._genericCheckSymbol)||[],i=this._customChildChecks.get(n.name)||[];for(const o of[...s,...i]){const a=o(e,n);if(a!==void 0)return a}}_evaluateAttributeChecks(e,n){const s=this._customAttributeChecks.get(this._genericCheckSymbol)||[],i=this._customAttributeChecks.get(n)||[];for(const o of[...s,...i]){const a=o(e,n);if(a!==void 0)return a}}*_getValidRangesForRange(e,n){let s=e.start,i=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(f._createIn(o),n)),this.checkAttribute(o,n)||(s.isEqual(i)||(yield new f(s,i)),s=g._createAfter(o)),i=g._createAfter(o);s.isEqual(i)||(yield new f(s,i))}findOptimalInsertionRange(e,n){const s=e.getSelectedElement();if(s&&this.isObject(s)&&!this.isInline(s))return n=="before"||n=="after"?new f(g._createAt(s,n)):f._createOn(s);const i=zt(e.getSelectedBlocks());if(!i)return new f(e.focus);if(i.isEmpty)return new f(g._createAt(i,0));const o=g._createAfter(i);return e.focus.isTouching(o)?new f(o):new f(g._createBefore(i))}}class ae{constructor(t){c(this,"_items");if(t instanceof ae)return t;let e;typeof t=="string"?e=[t]:Array.isArray(t)?e=t:e=t.getAncestors({includeSelf:!0}),this._items=e.map(To)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(t){const e=new ae([t]);return e._items=[...this._items,...e._items],e}trimLast(){const t=new ae([]);return t._items=this._items.slice(0,-1),t}getItem(t){return this._items[t]}*getNames(){yield*this._items.map(t=>t.name)}endsWith(t){return Array.from(this.getNames()).join(" ").endsWith(t)}startsWith(t){return Array.from(this.getNames()).join(" ").startsWith(t)}}function po(r,t){const e={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return Eo(r,e),K(r,e,"allowIn"),K(r,e,"allowChildren"),K(r,e,"disallowIn"),K(r,e,"disallowChildren"),K(r,e,"allowContentOf"),K(r,e,"allowWhere"),K(r,e,"allowAttributes"),K(r,e,"disallowAttributes"),K(r,e,"allowAttributesOf"),K(r,e,"inheritTypesFrom"),Ro(r,e),e}function _o(r,t){for(const e of t.allowIn){const n=r[e];n?n.allowChildren.add(t.name):t.allowIn.delete(e)}}function wo(r,t){for(const e of t.allowChildren){const n=r[e];n?n.allowIn.add(t.name):t.allowChildren.delete(e)}}function bo(r,t){for(const e of t.disallowIn){const n=r[e];n?n.disallowChildren.add(t.name):t.disallowIn.delete(e)}}function yo(r,t){for(const e of t.disallowChildren){const n=r[e];n?n.disallowIn.add(t.name):t.disallowChildren.delete(e)}}function vo(r,t){for(const e of t.disallowChildren)t.allowChildren.delete(e);for(const e of t.disallowIn)t.allowIn.delete(e);for(const e of t.disallowAttributes)t.allowAttributes.delete(e)}function Po(r,t){for(const e of t.allowContentOf){const n=r[e];n&&(n.disallowChildren.forEach(s=>{t.allowChildren.has(s)||(t.disallowChildren.add(s),r[s].disallowIn.add(t.name))}),n.allowChildren.forEach(s=>{t.disallowChildren.has(s)||(t.allowChildren.add(s),r[s].allowIn.add(t.name))}))}}function Co(r,t){for(const e of t.allowWhere){const n=r[e];n&&(n.disallowIn.forEach(s=>{t.allowIn.has(s)||(t.disallowIn.add(s),r[s].disallowChildren.add(t.name))}),n.allowIn.forEach(s=>{t.disallowIn.has(s)||(t.allowIn.add(s),r[s].allowChildren.add(t.name))}))}}function ko(r){const t={};for(const e of Object.values(r))t[e.name]={name:e.name,isBlock:!!e.isBlock,isContent:!!e.isContent,isInline:!!e.isInline,isLimit:!!e.isLimit,isObject:!!e.isObject,isSelectable:!!e.isSelectable,allowIn:Array.from(e.allowIn).filter(n=>!!r[n]),allowChildren:Array.from(e.allowChildren).filter(n=>!!r[n]),allowAttributes:Array.from(e.allowAttributes)};return t}function Ao(r,t){for(const e of t.allowAttributesOf){const n=r[e];if(!n)return;n.allowAttributes.forEach(s=>{t.disallowAttributes.has(s)||t.allowAttributes.add(s)})}}function So(r,t){for(const e of t.inheritTypesFrom){const n=r[e];if(n){const s=Object.keys(n).filter(i=>i.startsWith("is"));for(const i of s)i in t||(t[i]=n[i])}}}function Eo(r,t){for(const e of r){const n=Object.keys(e).filter(s=>s.startsWith("is"));for(const s of n)t[s]=!!e[s]}}function K(r,t,e){for(const n of r){let s=n[e];typeof s=="string"&&(s=[s]),Array.isArray(s)&&s.forEach(i=>t[e].add(i))}}function Ro(r,t){for(const e of r){const n=e.inheritAllFrom;n&&(t.allowContentOf.add(n),t.allowWhere.add(n),t.allowAttributesOf.add(n),t.inheritTypesFrom.add(n))}}function To(r){return typeof r=="string"||r.is("documentFragment")?{name:typeof r=="string"?r:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:r.is("element")?r.name:"$text",*getAttributeKeys(){yield*r.getAttributeKeys()},getAttribute(t){return r.getAttribute(t)}}}function*Mo(r,t){let e=!1;for(;!e;){if(e=!0,r){const n=r.next();n.done||(e=!1,yield{walker:r,value:n.value})}if(t){const n=t.next();n.done||(e=!1,yield{walker:t,value:n.value})}}}function*xo(r){for(const t of r)yield*t.getMinimalFlatRanges()}function Tn(r,t,e){for(const n of t.getAttributeKeys())r.checkAttribute(t,n)||e.removeAttribute(n,t)}class No extends O(){constructor(e){super();c(this,"conversionApi");c(this,"_splitParts",new Map);c(this,"_cursorParents",new Map);c(this,"_modelCursor",null);c(this,"_emptyElementsToKeep",new Set);this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(n,s)=>this._convertItem(n,s),convertChildren:(n,s)=>this._convertChildren(n,s),safeInsert:(n,s)=>this._safeInsert(n,s),updateConversionResult:(n,s)=>this._updateConversionResult(n,s),splitToAllowedParent:(n,s)=>this._splitToAllowedParent(n,s),getSplitParts:n=>this._getSplitParts(n),keepEmptyElement:n=>this._keepEmptyElement(n)}}convert(e,n,s=["$root"]){this.fire("viewCleanup",e),this._modelCursor=Io(s,n),this.conversionApi.writer=n,this.conversionApi.consumable=ut.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),o=n.createDocumentFragment();if(i){this._removeEmptyElements();const a=this._modelCursor.parent,l=a._removeChildren(0,a.childCount);o._insertChild(0,l),o.markers=Oo(o,n)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,n){const s={viewItem:e,modelCursor:n,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,s,this.conversionApi):e.is("$text")?this.fire("text",s,this.conversionApi):this.fire("documentFragment",s,this.conversionApi),s.modelRange&&!(s.modelRange instanceof f))throw new d("view-conversion-dispatcher-incorrect-result",this);return{modelRange:s.modelRange,modelCursor:s.modelCursor}}_convertChildren(e,n){let s=n.is("position")?n:g._createAt(n,0);const i=new f(s);for(const o of Array.from(e.getChildren())){const a=this._convertItem(o,s);a.modelRange instanceof f&&(i.end=a.modelRange.end,s=a.modelCursor)}return{modelRange:i,modelCursor:s}}_safeInsert(e,n){const s=this._splitToAllowedParent(e,n);return s?(this.conversionApi.writer.insert(e,s.position),!0):!1}_updateConversionResult(e,n){const s=this._getSplitParts(e),i=this.conversionApi.writer;n.modelRange||(n.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(s[s.length-1])));const o=this._cursorParents.get(e);o?n.modelCursor=i.createPositionAt(o,0):n.modelCursor=n.modelRange.end}_splitToAllowedParent(e,n){const{schema:s,writer:i}=this.conversionApi;let o=s.findAllowedParent(n,e);if(o){if(o===n.parent)return{position:n};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return Ps(n,e,s)?{position:Cs(n,i)}:null;const a=this.conversionApi.writer.split(n,o),l=[];for(const u of a.range.getWalker())if(u.type=="elementEnd")l.push(u.item);else{const m=l.pop(),p=u.item;this._registerSplitPair(m,p)}const h=a.range.end.parent;return this._cursorParents.set(e,h),{position:a.position,cursorParent:h}}_registerSplitPair(e,n){this._splitParts.has(e)||this._splitParts.set(e,[e]);const s=this._splitParts.get(e);this._splitParts.set(n,s),s.push(n)}_getSplitParts(e){let n;return this._splitParts.has(e)?n=this._splitParts.get(e):n=[e],n}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){const e=new Map;for(const n of this._splitParts.keys())if(n.isEmpty&&!this._emptyElementsToKeep.has(n)){const s=e.get(n.parent)||[];s.push(n),this._splitParts.delete(n),e.set(n.parent,s)}for(const[n,s]of e)n._removeChildrenArray(s);e.size&&this._removeEmptyElements()}}function Oo(r,t){const e=new Set,n=new Map,s=f._createIn(r).getItems();for(const i of s)i.is("element","$marker")&&e.add(i);for(const i of e){const o=i.getAttribute("data-name"),a=t.createPositionBefore(i);n.has(o)?n.get(o).end=a.clone():n.set(o,new f(a.clone())),t.remove(i)}return n}function Io(r,t){let e;for(const n of new ae(r)){const s={};for(const o of n.getAttributeKeys())s[o]=n.getAttribute(o);const i=t.createElement(n.name,s);e&&t.insert(i,e),e=g._createAt(i,0)}return e}class Fo{getHtml(t){const n=ie.document.implementation.createHTMLDocument("").createElement("div");return n.appendChild(t),n.innerHTML}}class Bo{constructor(t){c(this,"domParser");c(this,"domConverter");c(this,"htmlWriter");c(this,"skipComments",!0);this.domParser=new DOMParser,this.domConverter=new rs(t,{renderingMode:"data"}),this.htmlWriter=new Fo}toData(t){const e=this.domConverter.viewToDom(t);return this.htmlWriter.getHtml(e)}toView(t){const e=this._toDom(t);return this.domConverter.domToView(e,{skipComments:this.skipComments})}registerRawContentMatcher(t){this.domConverter.registerRawContentMatcher(t)}useFillerType(t){this.domConverter.blockFillerMode=t=="marked"?"markedNbsp":"nbsp"}_toDom(t){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(t.trim().slice(0,1e4))||(t=`<body>${t}</body>`);const e=this.domParser.parseFromString(t,"text/html"),n=e.createDocumentFragment(),s=e.body.childNodes;for(;s.length>0;)n.appendChild(s[0]);return n}}class Cl extends O(){constructor(e,n){super();c(this,"model");c(this,"mapper");c(this,"downcastDispatcher");c(this,"upcastDispatcher");c(this,"viewDocument");c(this,"stylesProcessor");c(this,"htmlProcessor");c(this,"processor");c(this,"_viewWriter");this.model=e,this.mapper=new cs,this.downcastDispatcher=new hs({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",ds(),{priority:"lowest"}),this.downcastDispatcher.on("insert",ms(),{priority:"lowest"}),this.upcastDispatcher=new No({schema:e.schema}),this.viewDocument=new Qn(n),this.stylesProcessor=n,this.htmlProcessor=new Bo(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Zn(this.viewDocument),this.upcastDispatcher.on("text",Ki(),{priority:"lowest"}),this.upcastDispatcher.on("element",An(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",An(),{priority:"lowest"}),U().prototype.decorate.call(this,"init"),U().prototype.decorate.call(this,"set"),U().prototype.decorate.call(this,"get"),U().prototype.decorate.call(this,"toView"),U().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},vs)},{priority:"lowest"})}get(e={}){const{rootName:n="main",trim:s="empty"}=e;if(!this._checkIfRootsExists([n]))throw new d("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(n);return i.isAttached()||W("datacontroller-get-detached-root",this),s==="empty"&&!this.model.hasContent(i,{ignoreWhitespaces:!0})?"":this.stringify(i,e)}stringify(e,n={}){const s=this.toView(e,n);return this.processor.toData(s)}toView(e,n={}){const s=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const o=f._createIn(e),a=new _e(s);this.mapper.bindElements(e,a);const l=e.is("documentFragment")?e.markers:Do(e);return this.downcastDispatcher.convert(o,l,i,n),a}init(e){if(this.model.document.version)throw new d("datacontroller-init-document-not-empty",this);let n={};if(typeof e=="string"?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new d("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},s=>{for(const i of Object.keys(n)){const o=this.model.document.getRoot(i);s.insert(this.parse(n[i],o),o,0)}}),Promise.resolve()}set(e,n={}){let s={};if(typeof e=="string"?s.main=e:s=e,!this._checkIfRootsExists(Object.keys(s)))throw new d("datacontroller-set-non-existent-root",this);this.model.enqueueChange(n.batchType||{},i=>{i.setSelection(null),i.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(s)){const a=this.model.document.getRoot(o);i.remove(i.createRangeIn(a)),i.insert(this.parse(s[o],a),a,0)}})}parse(e,n="$root"){const s=this.processor.toView(e);return this.toModel(s,n)}toModel(e,n="$root"){return this.model.change(s=>this.upcastDispatcher.convert(e,s,n))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const n of e)if(!this.model.document.getRoot(n))return!1;return!0}}function Do(r){const t=[],e=r.root.document;if(!e)return new Map;const n=f._createIn(r);for(const s of e.model.markers){const i=s.getRange(),o=i.isCollapsed,a=i.start.isEqual(n.start)||i.end.isEqual(n.end);if(o&&a)t.push([s.name,i]);else{const l=n.getIntersection(i);l&&t.push([s.name,l])}}return t.sort(([s,i],[o,a])=>{if(i.end.compareWith(a.start)!=="after")return 1;if(i.start.compareWith(a.end)!=="before")return-1;switch(i.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(i.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return o.localeCompare(s)}}}),new Map(t)}class kl{constructor(t,e){c(this,"_helpers",new Map);c(this,"_downcast");c(this,"_upcast");this._downcast=le(t),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=le(e),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(t,e){const n=this._downcast.includes(e);if(!this._upcast.includes(e)&&!n)throw new d("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:t,dispatchers:[e],isDowncast:n})}for(t){if(!this._helpers.has(t))throw new d("conversion-for-unknown-group",this);return this._helpers.get(t)}elementToElement(t){this.for("downcast").elementToElement(t);for(const{model:e,view:n}of St(t))this.for("upcast").elementToElement({model:e,view:n,converterPriority:t.converterPriority})}attributeToElement(t){this.for("downcast").attributeToElement(t);for(const{model:e,view:n}of St(t))this.for("upcast").elementToAttribute({view:n,model:e,converterPriority:t.converterPriority})}attributeToAttribute(t){this.for("downcast").attributeToAttribute(t);for(const{model:e,view:n}of St(t))this.for("upcast").attributeToAttribute({view:n,model:e})}_createConversionHelpers({name:t,dispatchers:e,isDowncast:n}){if(this._helpers.has(t))throw new d("conversion-group-exists",this);const s=n?new pi(e):new Hi(e);this._helpers.set(t,s)}}function*St(r){if(r.model.values)for(const t of r.model.values){const e={key:r.model.key,value:t},n=r.view[t],s=r.upcastAlso?r.upcastAlso[t]:void 0;yield*Mn(e,n,s)}else yield*Mn(r.model,r.view,r.upcastAlso)}function*Mn(r,t,e){if(yield{model:r,view:t},e)for(const n of le(e))yield{model:r,view:n}}/**
22
22
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
23
23
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
24
24
  */class q{constructor(t){c(this,"baseVersion");c(this,"isDocumentOperation");c(this,"batch");this.baseVersion=t,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const t=Object.assign({},this);return t.__className=this.constructor.className,delete t.batch,delete t.isDocumentOperation,t}static get className(){return"Operation"}static fromJSON(t,e){return new this(t.baseVersion)}}function Qt(r,t){const e=Ts(t),n=e.reduce((o,a)=>o+a.offsetSize,0),s=r.parent;tt(r);const i=r.index;return s._insertChild(i,e),et(s,i+e.length),et(s,i),new f(r,r.getShiftedBy(n))}function Rs(r){if(!r.isFlat)throw new d("operation-utils-remove-range-not-flat",this);const t=r.start.parent;tt(r.start),tt(r.end);const e=t._removeChildren(r.start.index,r.end.index-r.start.index);return et(t,r.start.index),e}function Ze(r,t){if(!r.isFlat)throw new d("operation-utils-move-range-not-flat",this);const e=Rs(r);return t=t._getTransformedByDeletion(r.start,r.end.offset-r.start.offset),Qt(t,e)}function Vo(r,t,e){tt(r.start),tt(r.end);for(const n of r.getItems({shallow:!0})){const s=n.is("$textProxy")?n.textNode:n;e!==null?s._setAttribute(t,e):s._removeAttribute(t),et(s.parent,s.index)}et(r.end.parent,r.end.index)}function Ts(r){const t=[];function e(n){if(typeof n=="string")t.push(new A(n));else if(n instanceof G)t.push(new A(n.data,n.getAttributes()));else if(n instanceof Ce)t.push(n);else if(ce(n))for(const s of n)e(s)}e(r);for(let n=1;n<t.length;n++){const s=t[n],i=t[n-1];s instanceof A&&i instanceof A&&Ms(s,i)&&(t.splice(n-1,2,new A(i.data+s.data,i.getAttributes())),n--)}return t}function et(r,t){const e=r.getChild(t-1),n=r.getChild(t);if(e&&n&&e.is("$text")&&n.is("$text")&&Ms(e,n)){const s=new A(e.data+n.data,e.getAttributes());r._removeChildren(t-1,2),r._insertChild(t-1,s)}}function tt(r){const t=r.textNode,e=r.parent;if(t){const n=r.offset-t.startOffset,s=t.index;e._removeChildren(s,1);const i=new A(t.data.substr(0,n),t.getAttributes()),o=new A(t.data.substr(n),t.getAttributes());e._insertChild(s,[i,o])}}function Ms(r,t){const e=r.getAttributes(),n=t.getAttributes();for(const s of e){if(s[1]!==t.getAttribute(s[0]))return!1;n.next()}return n.next().done}class P extends q{constructor(e,n,s,i){super(i);c(this,"sourcePosition");c(this,"howMany");c(this,"targetPosition");this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=n,this.targetPosition=s.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[f._createFromPositionAndShift(this.sourcePosition,this.howMany),f._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new P(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new P(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,n=this.targetPosition.parent,s=this.sourcePosition.offset,i=this.targetPosition.offset;if(s+this.howMany>e.maxOffset)throw new d("move-operation-nodes-do-not-exist",this);if(e===n&&s<i&&i<s+this.howMany)throw new d("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&F(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const o=this.sourcePosition.path.length-1;if(this.targetPosition.path[o]>=s&&this.targetPosition.path[o]<s+this.howMany)throw new d("move-operation-node-into-itself",this)}}_execute(){Ze(f._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,n){const s=g.fromJSON(e.sourcePosition,n),i=g.fromJSON(e.targetPosition,n);return new this(s,e.howMany,i,e.baseVersion)}}class x extends q{constructor(e,n,s){super(s);c(this,"position");c(this,"nodes");c(this,"shouldReceiveAttributes");this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Ue(Ts(n)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new Ue([...this.nodes].map(s=>s._clone(!0))),n=new x(this.position,e,this.baseVersion);return n.shouldReceiveAttributes=this.shouldReceiveAttributes,n}getReversed(){const e=this.position.root.document.graveyard,n=new g(e,[0]);return new P(this.position,this.nodes.maxOffset,n,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new d("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Ue([...e].map(n=>n._clone(!0))),Qt(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,n){const s=[];for(const o of e.nodes)o.name?s.push(k.fromJSON(o)):s.push(A.fromJSON(o));const i=new x(g.fromJSON(e.position,n),s,e.baseVersion);return i.shouldReceiveAttributes=e.shouldReceiveAttributes,i}}class C extends q{constructor(e,n,s,i,o){super(o);c(this,"splitPosition");c(this,"howMany");c(this,"insertionPosition");c(this,"graveyardPosition");this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=n,this.insertionPosition=s,this.graveyardPosition=i?i.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new g(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new f(this.splitPosition,e)}get affectedSelectable(){const e=[f._createFromPositionAndShift(this.splitPosition,0),f._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(f._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new C(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,n=new g(e,[0]);return new S(this.moveTargetPosition,this.howMany,this.splitPosition,n,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,n=this.splitPosition.offset;if(!e||e.maxOffset<n)throw new d("split-operation-position-invalid",this);if(e.parent){if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new d("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new d("split-operation-graveyard-position-invalid",this)}else throw new d("split-operation-split-in-root",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Ze(f._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const s=e._clone();Qt(this.insertionPosition,s)}const n=new f(g._createAt(e,this.splitPosition.offset),g._createAt(e,e.maxOffset));Ze(n,this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const n=e.path.slice(0,-1);return n[n.length-1]++,new g(e.root,n,"toPrevious")}static fromJSON(e,n){const s=g.fromJSON(e.splitPosition,n),i=g.fromJSON(e.insertionPosition,n),o=e.graveyardPosition?g.fromJSON(e.graveyardPosition,n):null;return new this(s,e.howMany,i,o,e.baseVersion)}}class S extends q{constructor(e,n,s,i,o){super(o);c(this,"sourcePosition");c(this,"howMany");c(this,"targetPosition");c(this,"graveyardPosition");this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=n,this.targetPosition=s.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=i.clone()}get type(){return"merge"}get deletionPosition(){return new g(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new f(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[f._createOn(e),f._createFromPositionAndShift(this.targetPosition,0),f._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new S(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),n=this.sourcePosition.path.slice(0,-1),s=new g(this.sourcePosition.root,n)._getTransformedByMergeOperation(this);return new C(e,this.howMany,s,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,n=this.targetPosition.parent;if(e.parent)if(n.parent){if(this.howMany!=e.maxOffset)throw new d("merge-operation-how-many-invalid",this)}else throw new d("merge-operation-target-position-invalid",this);else throw new d("merge-operation-source-position-invalid",this)}_execute(){const e=this.sourcePosition.parent,n=f._createIn(e);Ze(n,this.targetPosition),Ze(f._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,n){const s=g.fromJSON(e.sourcePosition,n),i=g.fromJSON(e.targetPosition,n),o=g.fromJSON(e.graveyardPosition,n);return new this(s,e.howMany,i,o,e.baseVersion)}}class B extends q{constructor(e,n,s,i,o,a){super(a);c(this,"name");c(this,"oldRange");c(this,"newRange");c(this,"affectsData");c(this,"_markers");this.name=e,this.oldRange=n?n.clone():null,this.newRange=s?s.clone():null,this.affectsData=o,this._markers=i}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new B(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new B(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,n){return new B(e.name,e.oldRange?f.fromJSON(e.oldRange,n):null,e.newRange?f.fromJSON(e.newRange,n):null,n.model.markers,e.affectsData,e.baseVersion)}}class E extends q{constructor(e,n,s,i,o){super(o);c(this,"range");c(this,"key");c(this,"oldValue");c(this,"newValue");this.range=e.clone(),this.key=n,this.oldValue=s===void 0?null:s,this.newValue=i===void 0?null:i}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new E(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new E(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new d("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!rn(e.getAttribute(this.key),this.oldValue))throw new d("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new d("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){rn(this.oldValue,this.newValue)||Vo(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,n){return new E(f.fromJSON(e.range,n),e.key,e.oldValue,e.newValue,e.baseVersion)}}class M extends q{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new M(this.baseVersion)}getReversed(){return new M(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class V extends q{constructor(e,n,s,i){super(i);c(this,"position");c(this,"oldName");c(this,"newName");this.position=e,this.position.stickiness="toNext",this.oldName=n,this.newName=s}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new V(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new V(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(e instanceof k){if(e.name!==this.oldName)throw new d("rename-operation-wrong-name",this)}else throw new d("rename-operation-wrong-position",this)}_execute(){const e=this.position.nodeAfter;e.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,n){return new V(g.fromJSON(e.position,n),e.oldName,e.newName,e.baseVersion)}}class te extends q{constructor(e,n,s,i,o){super(o);c(this,"root");c(this,"key");c(this,"oldValue");c(this,"newValue");this.root=e,this.key=n,this.oldValue=s===void 0?null:s,this.newValue=i===void 0?null:i}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new te(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new te(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new d("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new d("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new d("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,n){if(!n.getRoot(e.root))throw new d("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new te(n.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Y extends q{constructor(e,n,s,i,o){super(o);c(this,"rootName");c(this,"elementName");c(this,"isAdd");c(this,"_document");if(this.rootName=e,this.elementName=n,this.isAdd=s,this._document=i,!this._document.getRoot(this.rootName)){const a=this._document.createRoot(this.elementName,this.rootName);a._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new Y(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new Y(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,n){return new Y(e.rootName,e.elementName,e.isAdd,n,e.baseVersion)}}const J={};J[E.className]=E;J[x.className]=x;J[B.className]=B;J[P.className]=P;J[M.className]=M;J[q.className]=q;J[V.className]=V;J[te.className]=te;J[Y.className]=Y;J[C.className]=C;J[S.className]=S;class $o{static fromJSON(t,e){return J[t.__className].fromJSON(t,e)}}const Lt=new Map;function y(r,t,e){let n=Lt.get(r);n||(n=new Map,Lt.set(r,n)),n.set(t,e)}function Lo(r,t){const e=Lt.get(r);return e&&e.has(t)?e.get(t):Wo}function Wo(r){return[r]}function xn(r,t,e={}){const n=Lo(r.constructor,t.constructor);try{return r=r.clone(),n(r,t,e)}catch(s){throw s}}function Al(r,t,e){r=r.slice(),t=t.slice();const n=new qo(e.document,e.useRelations,e.forceWeakRemove);n.setOriginalOperations(r),n.setOriginalOperations(t);const s=n.originalOperations;if(r.length==0||t.length==0)return{operationsA:r,operationsB:t,originalOperations:s};const i=new WeakMap;for(const l of r)i.set(l,0);const o={nextBaseVersionA:r[r.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:r.length,originalOperationsBCount:t.length};let a=0;for(;a<r.length;){const l=r[a],h=i.get(l);if(h==t.length){a++;continue}const u=t[h],m=xn(l,u,n.getContext(l,u,!0)),p=xn(u,l,n.getContext(u,l,!1));n.updateRelation(l,u),n.setOriginalOperations(m,l),n.setOriginalOperations(p,u);for(const w of m)i.set(w,h+p.length);r.splice(a,1,...m),t.splice(h,1,...p)}return On(r),On(t),Nn(r,o.nextBaseVersionB),Nn(t,o.nextBaseVersionA),{operationsA:r,operationsB:t,originalOperations:s}}class qo{constructor(t,e,n=!1){c(this,"originalOperations");c(this,"_history");c(this,"_useRelations");c(this,"_forceWeakRemove");c(this,"_relations");this.originalOperations=new Map,this._history=t.history,this._useRelations=e,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(t,e=null){const n=e?this.originalOperations.get(e):null;for(const s of t)this.originalOperations.set(s,n||s)}updateRelation(t,e){if(t instanceof P)e instanceof S?t.targetPosition.isEqual(e.sourcePosition)||e.movedRange.containsPosition(t.targetPosition)?this._setRelation(t,e,"insertAtSource"):t.targetPosition.isEqual(e.deletionPosition)?this._setRelation(t,e,"insertBetween"):t.targetPosition.isAfter(e.sourcePosition)&&this._setRelation(t,e,"moveTargetAfter"):e instanceof P&&(t.targetPosition.isEqual(e.sourcePosition)||t.targetPosition.isBefore(e.sourcePosition)?this._setRelation(t,e,"insertBefore"):this._setRelation(t,e,"insertAfter"));else if(t instanceof C){if(e instanceof S)t.splitPosition.isBefore(e.sourcePosition)&&this._setRelation(t,e,"splitBefore");else if(e instanceof P)if(t.splitPosition.isEqual(e.sourcePosition)||t.splitPosition.isBefore(e.sourcePosition))this._setRelation(t,e,"splitBefore");else{const n=f._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.splitPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(t.splitPosition)){const s=n.end.offset-t.splitPosition.offset,i=t.splitPosition.offset-n.start.offset;this._setRelation(t,e,{howMany:s,offset:i})}}}else if(t instanceof S)e instanceof S?(t.targetPosition.isEqual(e.sourcePosition)||this._setRelation(t,e,"mergeTargetNotMoved"),t.sourcePosition.isEqual(e.targetPosition)&&this._setRelation(t,e,"mergeSourceNotMoved"),t.sourcePosition.isEqual(e.sourcePosition)&&this._setRelation(t,e,"mergeSameElement")):e instanceof C?t.sourcePosition.isEqual(e.splitPosition)&&this._setRelation(t,e,"splitAtSource"):e instanceof P&&e.howMany>0&&(t.sourcePosition.isEqual(e.sourcePosition.getShiftedBy(e.howMany))&&this._setRelation(t,e,"mergeSourceAffected"),t.targetPosition.isEqual(e.sourcePosition)&&this._setRelation(t,e,"mergeTargetWasBefore"));else if(t instanceof B){const n=t.newRange;if(!n)return;if(e instanceof S){const s=n.start.isEqual(e.targetPosition),i=n.start.isEqual(e.deletionPosition),o=n.end.isEqual(e.deletionPosition),a=n.end.isEqual(e.sourcePosition);(s||i||o||a)&&this._setRelation(t,e,{wasInLeftElement:s,wasStartBeforeMergedElement:i,wasEndBeforeMergedElement:o,wasInRightElement:a})}}}getContext(t,e,n){return{aIsStrong:n,aWasUndone:this._wasUndone(t),bWasUndone:this._wasUndone(e),abRelation:this._useRelations?this._getRelation(t,e):null,baRelation:this._useRelations?this._getRelation(e,t):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(t){const e=this.originalOperations.get(t);return e.wasUndone||this._history.isUndoneOperation(e)}_getRelation(t,e){const n=this.originalOperations.get(e),s=this._history.getUndoneOperation(n);if(!s)return null;const i=this.originalOperations.get(t),o=this._relations.get(i);return o&&o.get(s)||null}_setRelation(t,e,n){const s=this.originalOperations.get(t),i=this.originalOperations.get(e);let o=this._relations.get(s);o||(o=new Map,this._relations.set(s,o)),o.set(i,n)}}function Nn(r,t){for(const e of r)e.baseVersion=t++}function On(r){const t=new Map;for(let e=0;e<r.length;e++){const n=r[e];n instanceof B&&(n.baseVersion!==-1?t.set(n.name,{op:n,ranges:n.newRange?[n.newRange]:[]}):(n.newRange&&t.get(n.name).ranges.push(n.newRange),r.splice(e,1),e--))}for(const{op:e,ranges:n}of t.values())n.length?e.newRange=f._createFromRanges(n):e.newRange=null}y(E,E,(r,t,e)=>{if(r.key===t.key&&r.range.start.hasSameParentAs(t.range.start)){const n=r.range.getDifference(t.range).map(i=>new E(i,r.key,r.oldValue,r.newValue,0)),s=r.range.getIntersection(t.range);return s&&e.aIsStrong&&n.push(new E(s,t.key,t.newValue,r.newValue,0)),n.length==0?[new M(0)]:n}else return[r]});y(E,x,(r,t)=>{if(r.range.start.hasSameParentAs(t.position)&&r.range.containsPosition(t.position)){const n=r.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(s=>new E(s,r.key,r.oldValue,r.newValue,r.baseVersion));if(t.shouldReceiveAttributes){const s=xs(t,r.key,r.oldValue);s&&n.unshift(s)}return n}return r.range=r.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[r]});function xs(r,t,e){const s=r.nodes.getNode(0).getAttribute(t);if(s==e)return null;const i=new f(r.position,r.position.getShiftedBy(r.howMany));return new E(i,t,s,e,0)}y(E,S,(r,t)=>{const e=[];r.range.start.hasSameParentAs(t.deletionPosition)&&(r.range.containsPosition(t.deletionPosition)||r.range.start.isEqual(t.deletionPosition))&&e.push(f._createFromPositionAndShift(t.graveyardPosition,1));const n=r.range._getTransformedByMergeOperation(t);return n.isCollapsed||e.push(n),e.map(s=>new E(s,r.key,r.oldValue,r.newValue,r.baseVersion))});y(E,P,(r,t)=>zo(r.range,t).map(n=>new E(n,r.key,r.oldValue,r.newValue,r.baseVersion)));function zo(r,t){const e=f._createFromPositionAndShift(t.sourcePosition,t.howMany);let n=null,s=[];e.containsRange(r,!0)?n=r:r.start.hasSameParentAs(e.start)?(s=r.getDifference(e),n=r.getIntersection(e)):s=[r];const i=[];for(let o of s){o=o._getTransformedByDeletion(t.sourcePosition,t.howMany);const a=t.getMovedRangeStart(),l=o.start.hasSameParentAs(a),h=o._getTransformedByInsertion(a,t.howMany,l);i.push(...h)}return n&&i.push(n._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]),i}y(E,C,(r,t)=>{if(r.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||r.range.end.offset++,[r];if(r.range.start.hasSameParentAs(t.splitPosition)&&r.range.containsPosition(t.splitPosition)){const e=r.clone();return e.range=new f(t.moveTargetPosition.clone(),r.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),r.range.end=t.splitPosition.clone(),r.range.end.stickiness="toPrevious",[r,e]}return r.range=r.range._getTransformedBySplitOperation(t),[r]});y(x,E,(r,t)=>{const e=[r];if(r.shouldReceiveAttributes&&r.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(r.position)){const n=xs(r,t.key,t.newValue);n&&e.push(n)}return e});y(x,x,(r,t,e)=>r.position.isEqual(t.position)&&e.aIsStrong?[r]:(r.position=r.position._getTransformedByInsertOperation(t),[r]));y(x,P,(r,t)=>(r.position=r.position._getTransformedByMoveOperation(t),[r]));y(x,C,(r,t)=>(r.position=r.position._getTransformedBySplitOperation(t),[r]));y(x,S,(r,t)=>(r.position=r.position._getTransformedByMergeOperation(t),[r]));y(B,x,(r,t)=>(r.oldRange&&(r.oldRange=r.oldRange._getTransformedByInsertOperation(t)[0]),r.newRange&&(r.newRange=r.newRange._getTransformedByInsertOperation(t)[0]),[r]));y(B,B,(r,t,e)=>{if(r.name==t.name)if(e.aIsStrong)r.oldRange=t.newRange?t.newRange.clone():null;else return[new M(0)];return[r]});y(B,S,(r,t)=>(r.oldRange&&(r.oldRange=r.oldRange._getTransformedByMergeOperation(t)),r.newRange&&(r.newRange=r.newRange._getTransformedByMergeOperation(t)),[r]));y(B,P,(r,t)=>{const e=[r];if(r.oldRange&&(r.oldRange=f._createFromRanges(r.oldRange._getTransformedByMoveOperation(t))),r.newRange){const n=r.newRange._getTransformedByMoveOperation(t);r.newRange=n[0];for(let s=1;s<n.length;s++){const i=r.clone();i.oldRange=null,i.newRange=n[s],i.baseVersion=-1,e.push(i)}}return e});y(B,C,(r,t,e)=>{if(r.oldRange&&(r.oldRange=r.oldRange._getTransformedBySplitOperation(t)),r.newRange){if(e.abRelation){const n=r.newRange._getTransformedBySplitOperation(t);return r.newRange.start.isEqual(t.splitPosition)&&e.abRelation.wasStartBeforeMergedElement?r.newRange.start=g._createAt(t.insertionPosition):r.newRange.start.isEqual(t.splitPosition)&&!e.abRelation.wasInLeftElement?r.newRange.start=g._createAt(t.moveTargetPosition):r.newRange.start=n.start,r.newRange.end.isEqual(t.splitPosition)&&e.abRelation.wasInRightElement?r.newRange.end=g._createAt(t.moveTargetPosition):r.newRange.end.isEqual(t.splitPosition)&&e.abRelation.wasEndBeforeMergedElement?r.newRange.end=g._createAt(t.insertionPosition):r.newRange.end=n.end,[r]}r.newRange=r.newRange._getTransformedBySplitOperation(t)}return[r]});y(S,x,(r,t)=>(r.sourcePosition.hasSameParentAs(t.position)&&(r.howMany+=t.howMany),r.sourcePosition=r.sourcePosition._getTransformedByInsertOperation(t),r.targetPosition=r.targetPosition._getTransformedByInsertOperation(t),[r]));y(S,S,(r,t,e)=>{if(r.sourcePosition.isEqual(t.sourcePosition)&&r.targetPosition.isEqual(t.targetPosition))if(e.bWasUndone){const n=t.graveyardPosition.path.slice();return n.push(0),r.sourcePosition=new g(t.graveyardPosition.root,n),r.howMany=0,[r]}else return[new M(0)];if(r.sourcePosition.isEqual(t.sourcePosition)&&!r.targetPosition.isEqual(t.targetPosition)&&!e.bWasUndone&&e.abRelation!="splitAtSource"){const n=r.targetPosition.root.rootName=="$graveyard",s=t.targetPosition.root.rootName=="$graveyard";if(s&&!n||!(n&&!s)&&e.aIsStrong){const l=t.targetPosition._getTransformedByMergeOperation(t),h=r.targetPosition._getTransformedByMergeOperation(t);return[new P(l,r.howMany,h,0)]}else return[new M(0)]}return r.sourcePosition.hasSameParentAs(t.targetPosition)&&(r.howMany+=t.howMany),r.sourcePosition=r.sourcePosition._getTransformedByMergeOperation(t),r.targetPosition=r.targetPosition._getTransformedByMergeOperation(t),(!r.graveyardPosition.isEqual(t.graveyardPosition)||!e.aIsStrong)&&(r.graveyardPosition=r.graveyardPosition._getTransformedByMergeOperation(t)),[r]});y(S,P,(r,t,e)=>{const n=f._createFromPositionAndShift(t.sourcePosition,t.howMany);return t.type=="remove"&&!e.bWasUndone&&r.deletionPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(r.sourcePosition)?[new M(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(r.sourcePosition)?r.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(r.sourcePosition)&&e.abRelation=="mergeSourceAffected"?r.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(r.targetPosition)?(r.targetPosition.stickiness="toNone",r.howMany-=t.howMany):t.targetPosition.isEqual(r.targetPosition)&&e.abRelation=="mergeTargetWasBefore"?(r.targetPosition.stickiness="toPrevious",r.howMany+=t.howMany):(r.sourcePosition.hasSameParentAs(t.targetPosition)&&(r.howMany+=t.howMany),r.sourcePosition.hasSameParentAs(t.sourcePosition)&&(r.howMany-=t.howMany)),r.sourcePosition=r.sourcePosition._getTransformedByMoveOperation(t),r.targetPosition=r.targetPosition._getTransformedByMoveOperation(t),r.sourcePosition.stickiness="toPrevious",r.targetPosition.stickiness="toNext",r.graveyardPosition.isEqual(t.targetPosition)||(r.graveyardPosition=r.graveyardPosition._getTransformedByMoveOperation(t)),[r])});y(S,C,(r,t,e)=>{if(t.graveyardPosition&&(r.graveyardPosition=r.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),r.deletionPosition.isEqual(t.graveyardPosition)&&(r.howMany=t.howMany)),r.targetPosition.isEqual(t.splitPosition)&&(t.graveyardPosition&&r.deletionPosition.isEqual(t.graveyardPosition)||e.abRelation=="mergeTargetNotMoved"))return r.sourcePosition=r.sourcePosition._getTransformedBySplitOperation(t),[r];if(r.sourcePosition.isEqual(t.splitPosition)){if(e.abRelation=="mergeSourceNotMoved")return r.howMany=0,r.targetPosition=r.targetPosition._getTransformedBySplitOperation(t),[r];if(e.abRelation=="mergeSameElement"||r.sourcePosition.offset>0)return r.sourcePosition=t.moveTargetPosition.clone(),r.targetPosition=r.targetPosition._getTransformedBySplitOperation(t),[r]}return r.sourcePosition.hasSameParentAs(t.splitPosition)&&(r.howMany=t.splitPosition.offset),r.sourcePosition=r.sourcePosition._getTransformedBySplitOperation(t),r.targetPosition=r.targetPosition._getTransformedBySplitOperation(t),[r]});y(P,x,(r,t)=>{const n=f._createFromPositionAndShift(r.sourcePosition,r.howMany)._getTransformedByInsertOperation(t,!1)[0];return r.sourcePosition=n.start,r.howMany=n.end.offset-n.start.offset,r.targetPosition.isEqual(t.position)||(r.targetPosition=r.targetPosition._getTransformedByInsertOperation(t)),[r]});y(P,P,(r,t,e)=>{const n=f._createFromPositionAndShift(r.sourcePosition,r.howMany),s=f._createFromPositionAndShift(t.sourcePosition,t.howMany);let i=e.aIsStrong,o=!e.aIsStrong;e.abRelation=="insertBefore"||e.baRelation=="insertAfter"?o=!0:(e.abRelation=="insertAfter"||e.baRelation=="insertBefore")&&(o=!1);let a;if(r.targetPosition.isEqual(t.targetPosition)&&o?a=r.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):a=r.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),In(r,t)&&In(t,r))return[t.getReversed()];if(n.containsPosition(t.targetPosition)&&n.containsRange(s,!0))return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Me([n],a);if(s.containsPosition(r.targetPosition)&&s.containsRange(n,!0))return n.start=n.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),n.end=n.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Me([n],a);const u=F(r.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if(u=="prefix"||u=="extension")return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Me([n],a);r.type=="remove"&&t.type!="remove"&&!e.aWasUndone&&!e.forceWeakRemove?i=!0:r.type!="remove"&&t.type=="remove"&&!e.bWasUndone&&!e.forceWeakRemove&&(i=!1);const m=[],p=n.getDifference(s);for(const v of p){v.start=v.start._getTransformedByDeletion(t.sourcePosition,t.howMany),v.end=v.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const I=F(v.start.getParentPath(),t.getMovedRangeStart().getParentPath())=="same",fe=v._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,I);m.push(...fe)}const w=n.getIntersection(s);return w!==null&&i&&(w.start=w.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),w.end=w.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),m.length===0?m.push(w):m.length==1?s.start.isBefore(n.start)||s.start.isEqual(n.start)?m.unshift(w):m.push(w):m.splice(1,0,w)),m.length===0?[new M(r.baseVersion)]:Me(m,a)});y(P,C,(r,t,e)=>{let n=r.targetPosition.clone();(!r.targetPosition.isEqual(t.insertionPosition)||!t.graveyardPosition||e.abRelation=="moveTargetAfter")&&(n=r.targetPosition._getTransformedBySplitOperation(t));const s=f._createFromPositionAndShift(r.sourcePosition,r.howMany);if(s.end.isEqual(t.insertionPosition))return t.graveyardPosition||r.howMany++,r.targetPosition=n,[r];if(s.start.hasSameParentAs(t.splitPosition)&&s.containsPosition(t.splitPosition)){let a=new f(t.splitPosition,s.end);a=a._getTransformedBySplitOperation(t);const l=[new f(s.start,t.splitPosition),a];return Me(l,n)}r.targetPosition.isEqual(t.splitPosition)&&e.abRelation=="insertAtSource"&&(n=t.moveTargetPosition),r.targetPosition.isEqual(t.insertionPosition)&&e.abRelation=="insertBetween"&&(n=r.targetPosition);const o=[s._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const a=s.start.isEqual(t.graveyardPosition)||s.containsPosition(t.graveyardPosition);r.howMany>1&&a&&!e.aWasUndone&&o.push(f._createFromPositionAndShift(t.insertionPosition,1))}return Me(o,n)});y(P,S,(r,t,e)=>{const n=f._createFromPositionAndShift(r.sourcePosition,r.howMany);if(t.deletionPosition.hasSameParentAs(r.sourcePosition)&&n.containsPosition(t.sourcePosition)){if(r.type=="remove"&&!e.forceWeakRemove){if(!e.aWasUndone){const o=[];let a=t.graveyardPosition.clone(),l=t.targetPosition._getTransformedByMergeOperation(t);const h=r.targetPosition.getTransformedByOperation(t);r.howMany>1&&(o.push(new P(r.sourcePosition,r.howMany-1,h,0)),a=a._getTransformedByMove(r.sourcePosition,h,r.howMany-1),l=l._getTransformedByMove(r.sourcePosition,h,r.howMany-1));const u=t.deletionPosition._getCombined(r.sourcePosition,h),m=new P(a,1,u,0),p=m.getMovedRangeStart().path.slice();p.push(0);const w=new g(m.targetPosition.root,p);l=l._getTransformedByMove(a,u,1);const v=new P(l,t.howMany,w,0);return o.push(m),o.push(v),o}}else if(r.howMany==1)return e.bWasUndone?(r.sourcePosition=t.graveyardPosition.clone(),r.targetPosition=r.targetPosition._getTransformedByMergeOperation(t),[r]):[new M(0)]}const i=f._createFromPositionAndShift(r.sourcePosition,r.howMany)._getTransformedByMergeOperation(t);return r.sourcePosition=i.start,r.howMany=i.end.offset-i.start.offset,r.targetPosition=r.targetPosition._getTransformedByMergeOperation(t),[r]});y(V,x,(r,t)=>(r.position=r.position._getTransformedByInsertOperation(t),[r]));y(V,S,(r,t)=>r.position.isEqual(t.deletionPosition)?(r.position=t.graveyardPosition.clone(),r.position.stickiness="toNext",[r]):(r.position=r.position._getTransformedByMergeOperation(t),[r]));y(V,P,(r,t)=>(r.position=r.position._getTransformedByMoveOperation(t),[r]));y(V,V,(r,t,e)=>{if(r.position.isEqual(t.position))if(e.aIsStrong)r.oldName=t.newName;else return[new M(0)];return[r]});y(V,C,(r,t)=>{const e=r.position.path,n=t.splitPosition.getParentPath();if(F(e,n)=="same"&&!t.graveyardPosition){const s=new V(r.position.getShiftedBy(1),r.oldName,r.newName,0);return[r,s]}return r.position=r.position._getTransformedBySplitOperation(t),[r]});y(te,te,(r,t,e)=>{if(r.root===t.root&&r.key===t.key){if(!e.aIsStrong||r.newValue===t.newValue)return[new M(0)];r.oldValue=t.newValue}return[r]});y(Y,Y,(r,t)=>r.rootName===t.rootName&&r.isAdd===t.isAdd?[new M(0)]:[r]);y(C,x,(r,t)=>(r.splitPosition.hasSameParentAs(t.position)&&r.splitPosition.offset<t.position.offset&&(r.howMany+=t.howMany),r.splitPosition=r.splitPosition._getTransformedByInsertOperation(t),r.insertionPosition=r.insertionPosition._getTransformedByInsertOperation(t),[r]));y(C,S,(r,t,e)=>{if(!r.graveyardPosition&&!e.bWasUndone&&r.splitPosition.hasSameParentAs(t.sourcePosition)){const n=t.graveyardPosition.path.slice();n.push(0);const s=new g(t.graveyardPosition.root,n),i=C.getInsertionPosition(new g(t.graveyardPosition.root,n)),o=new C(s,0,i,null,0);return r.splitPosition=r.splitPosition._getTransformedByMergeOperation(t),r.insertionPosition=C.getInsertionPosition(r.splitPosition),r.graveyardPosition=o.insertionPosition.clone(),r.graveyardPosition.stickiness="toNext",[o,r]}return r.splitPosition.hasSameParentAs(t.deletionPosition)&&!r.splitPosition.isAfter(t.deletionPosition)&&r.howMany--,r.splitPosition.hasSameParentAs(t.targetPosition)&&(r.howMany+=t.howMany),r.splitPosition=r.splitPosition._getTransformedByMergeOperation(t),r.insertionPosition=C.getInsertionPosition(r.splitPosition),r.graveyardPosition&&(r.graveyardPosition=r.graveyardPosition._getTransformedByMergeOperation(t)),[r]});y(C,P,(r,t,e)=>{const n=f._createFromPositionAndShift(t.sourcePosition,t.howMany);if(r.graveyardPosition){const i=n.start.isEqual(r.graveyardPosition)||n.containsPosition(r.graveyardPosition);if(!e.bWasUndone&&i){const o=r.splitPosition._getTransformedByMoveOperation(t),a=r.graveyardPosition._getTransformedByMoveOperation(t),l=a.path.slice();l.push(0);const h=new g(a.root,l);return[new P(o,r.howMany,h,0)]}r.graveyardPosition=r.graveyardPosition._getTransformedByMoveOperation(t)}const s=r.splitPosition.isEqual(t.targetPosition);if(s&&(e.baRelation=="insertAtSource"||e.abRelation=="splitBefore"))return r.howMany+=t.howMany,r.splitPosition=r.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),r.insertionPosition=C.getInsertionPosition(r.splitPosition),[r];if(s&&e.abRelation&&e.abRelation.howMany){const{howMany:i,offset:o}=e.abRelation;return r.howMany+=i,r.splitPosition=r.splitPosition.getShiftedBy(o),[r]}if(r.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(r.splitPosition)){const i=t.howMany-(r.splitPosition.offset-t.sourcePosition.offset);return r.howMany-=i,r.splitPosition.hasSameParentAs(t.targetPosition)&&r.splitPosition.offset<t.targetPosition.offset&&(r.howMany+=t.howMany),r.splitPosition=t.sourcePosition.clone(),r.insertionPosition=C.getInsertionPosition(r.splitPosition),[r]}return t.sourcePosition.isEqual(t.targetPosition)||(r.splitPosition.hasSameParentAs(t.sourcePosition)&&r.splitPosition.offset<=t.sourcePosition.offset&&(r.howMany-=t.howMany),r.splitPosition.hasSameParentAs(t.targetPosition)&&r.splitPosition.offset<t.targetPosition.offset&&(r.howMany+=t.howMany)),r.splitPosition.stickiness="toNone",r.splitPosition=r.splitPosition._getTransformedByMoveOperation(t),r.splitPosition.stickiness="toNext",r.graveyardPosition?r.insertionPosition=r.insertionPosition._getTransformedByMoveOperation(t):r.insertionPosition=C.getInsertionPosition(r.splitPosition),[r]});y(C,C,(r,t,e)=>{if(r.splitPosition.isEqual(t.splitPosition)){if(!r.graveyardPosition&&!t.graveyardPosition)return[new M(0)];if(r.graveyardPosition&&t.graveyardPosition&&r.graveyardPosition.isEqual(t.graveyardPosition))return[new M(0)];if(e.abRelation=="splitBefore")return r.howMany=0,r.graveyardPosition=r.graveyardPosition._getTransformedBySplitOperation(t),[r]}if(r.graveyardPosition&&t.graveyardPosition&&r.graveyardPosition.isEqual(t.graveyardPosition)){const n=r.splitPosition.root.rootName=="$graveyard",s=t.splitPosition.root.rootName=="$graveyard";if(s&&!n||!(n&&!s)&&e.aIsStrong){const l=[];return t.howMany&&l.push(new P(t.moveTargetPosition,t.howMany,t.splitPosition,0)),r.howMany&&l.push(new P(r.splitPosition,r.howMany,r.moveTargetPosition,0)),l}else return[new M(0)]}if(r.graveyardPosition&&(r.graveyardPosition=r.graveyardPosition._getTransformedBySplitOperation(t)),r.splitPosition.isEqual(t.insertionPosition)&&e.abRelation=="splitBefore")return r.howMany++,[r];if(t.splitPosition.isEqual(r.insertionPosition)&&e.baRelation=="splitBefore"){const n=t.insertionPosition.path.slice();n.push(0);const s=new g(t.insertionPosition.root,n),i=new P(r.insertionPosition,1,s,0);return[r,i]}return r.splitPosition.hasSameParentAs(t.splitPosition)&&r.splitPosition.offset<t.splitPosition.offset&&(r.howMany-=t.howMany),r.splitPosition=r.splitPosition._getTransformedBySplitOperation(t),r.insertionPosition=C.getInsertionPosition(r.splitPosition),[r]});function In(r,t){return r.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)===null}function Me(r,t){const e=[];for(let n=0;n<r.length;n++){const s=r[n],i=new P(s.start,s.end.offset-s.start.offset,t,0);e.push(i);for(let o=n+1;o<r.length;o++)r[o]=r[o]._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany)[0];t=t._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany)}return e}class D extends O(g){constructor(t,e,n="toNone"){if(super(t,e,n),!this.root.is("rootElement"))throw new d("model-liveposition-root-not-rootelement",t);Uo.call(this)}detach(){this.stopListening()}toPosition(){return new g(this.root,this.path.slice(),this.stickiness)}static fromPosition(t,e){return new this(t.root,t.path.slice(),e||t.stickiness)}}D.prototype.is=function(r){return r==="livePosition"||r==="model:livePosition"||r=="position"||r==="model:position"};function Uo(){this.listenTo(this.root.document.model,"applyOperation",(r,t)=>{const e=t[0];e.isDocumentOperation&&Jo.call(this,e)},{priority:"low"})}function Jo(r){const t=this.getTransformedByOperation(r);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}class Se{constructor(t={}){c(this,"operations");c(this,"isUndoable");c(this,"isLocal");c(this,"isUndo");c(this,"isTyping");typeof t=="string"&&(t=t==="transparent"?{isUndoable:!1}:{},W("batch-constructor-deprecated-string-type"));const{isUndoable:e=!0,isLocal:n=!0,isUndo:s=!1,isTyping:i=!1}=t;this.operations=[],this.isUndoable=e,this.isLocal=n,this.isUndo=s,this.isTyping=i}get type(){return W("batch-type-deprecated"),"default"}get baseVersion(){for(const t of this.operations)if(t.baseVersion!==null)return t.baseVersion;return null}addOperation(t){return t.isDocumentOperation&&(t.batch=this,this.operations.push(t)),t}}const Ge=class Ge{constructor(t){c(this,"_markerCollection");c(this,"_changesInElement",new Map);c(this,"_elementsSnapshots",new Map);c(this,"_elementChildrenSnapshots",new Map);c(this,"_elementState",new Map);c(this,"_changedMarkers",new Map);c(this,"_changedRoots",new Map);c(this,"_changeCount",0);c(this,"_cachedChanges",null);c(this,"_cachedChangesWithGraveyard",null);c(this,"_refreshedItems",new Set);this._markerCollection=t}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(t){const e=t;switch(e.type){case"insert":{if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break}case"addAttribute":case"removeAttribute":case"changeAttribute":{for(const n of e.range.getItems({shallow:!0}))this._isInInsertedElement(n.parent)||this._markAttribute(n);break}case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const n=this._isInInsertedElement(e.sourcePosition.parent),s=this._isInInsertedElement(e.targetPosition.parent);n||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),s||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);const i=f._createFromPositionAndShift(e.sourcePosition,e.howMany);for(const o of i.getItems({shallow:!0}))this._setElementState(o,"move");break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const n=f._createFromPositionAndShift(e.position,1);for(const s of this._markerCollection.getMarkersIntersectingRange(n)){const i=s.getData();this.bufferMarkerChange(s.name,i,i)}this._setElementState(e.position.nodeAfter,"rename");break}case"split":{const n=e.splitPosition.parent;if(!this._isInInsertedElement(n)){this._markRemove(n,e.splitPosition.offset,e.howMany);const s=f._createFromPositionAndShift(e.splitPosition,e.howMany);for(const i of s.getItems({shallow:!0}))this._setElementState(i,"move")}this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&(this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1),this._setElementState(e.graveyardPosition.nodeAfter,"move"));break}case"merge":{const n=e.sourcePosition.parent;this._isInInsertedElement(n.parent)||this._markRemove(n.parent,n.startOffset,1);const s=e.graveyardPosition.parent;this._markInsert(s,e.graveyardPosition.offset,1),this._setElementState(n,"move");const i=e.targetPosition.parent;if(!this._isInInsertedElement(i)){this._markInsert(i,e.targetPosition.offset,n.maxOffset);const o=f._createFromPositionAndShift(e.sourcePosition,e.howMany);for(const a of o.getItems({shallow:!0}))this._setElementState(a,"move")}break}case"detachRoot":case"addRoot":{const n=e.affectedSelectable;if(!n._isLoaded||n.isAttached()==e.isAdd)return;this._bufferRootStateChange(e.rootName,e.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!e.root._isLoaded)return;const n=e.root.rootName;this._bufferRootAttributeChange(n,e.key,e.oldValue,e.newValue);break}}this._cachedChanges=null}bufferMarkerChange(t,e,n){e.range&&e.range.root.is("rootElement")&&!e.range.root._isLoaded&&(e.range=null),n.range&&n.range.root.is("rootElement")&&!n.range.root._isLoaded&&(n.range=null);let s=this._changedMarkers.get(t);s?s.newMarkerData=n:(s={newMarkerData:n,oldMarkerData:e},this._changedMarkers.set(t,s)),s.oldMarkerData.range==null&&n.range==null&&this._changedMarkers.delete(t)}getMarkersToRemove(){const t=[];for(const[e,n]of this._changedMarkers)n.oldMarkerData.range!=null&&t.push({name:e,range:n.oldMarkerData.range});return t}getMarkersToAdd(){const t=[];for(const[e,n]of this._changedMarkers)n.newMarkerData.range!=null&&t.push({name:e,range:n.newMarkerData.range});return t}getChangedMarkers(){return Array.from(this._changedMarkers).map(([t,e])=>({name:t,data:{oldRange:e.oldMarkerData.range,newRange:e.newMarkerData.range}}))}hasDataChanges(){if(this.getChanges().length||this._changedRoots.size>0)return!0;for(const{newMarkerData:t,oldMarkerData:e}of this._changedMarkers.values()){if(t.affectsData!==e.affectsData)return!0;if(t.affectsData){const n=t.range&&!e.range,s=!t.range&&e.range,i=t.range&&e.range&&!t.range.isEqual(e.range);if(n||s||i)return!0}}return!1}getChanges(t={}){if(this._cachedChanges)return t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let e=[];for(const n of this._changesInElement.keys()){const s=this._changesInElement.get(n).sort((u,m)=>u.offset===m.offset?u.type!=m.type?u.type=="remove"?-1:1:0:u.offset<m.offset?-1:1),i=this._elementChildrenSnapshots.get(n),o=Bn(n.getChildren()),a=jo(i.length,s);let l=0,h=0;for(const u of a)if(u==="i"){const m=this._getDiffActionForNode(o[l].node,"insert"),p=this._elementsSnapshots.get(o[l].node),w=this._getInsertDiff(n,l,m,o[l],p);e.push(w),l++}else if(u==="r"){const m=this._getDiffActionForNode(i[h].node,"remove"),p=this._getRemoveDiff(n,l,m,i[h]);e.push(p),h++}else if(u==="a"){const m=i[h].attributes,p=o[l].attributes;let w;if(o[l].name=="$text")w=new f(g._createAt(n,l),g._createAt(n,l+1));else{const I=n.offsetToIndex(l);w=new f(g._createAt(n,l),g._createAt(n.getChild(I),0))}const v=this._getAttributesDiff(w,m,p);e.push(...v),l++,h++}else l++,h++}e.sort((n,s)=>n.position.root!=s.position.root?n.position.root.rootName<s.position.root.rootName?-1:1:n.position.isEqual(s.position)?n.changeCount-s.changeCount:n.position.isBefore(s.position)?-1:1);for(let n=1,s=0;n<e.length;n++){const i=e[s],o=e[n],a=i.type=="remove"&&o.type=="remove"&&i.name=="$text"&&o.name=="$text"&&i.position.isEqual(o.position),l=i.type=="insert"&&o.type=="insert"&&i.name=="$text"&&o.name=="$text"&&i.position.parent==o.position.parent&&i.position.offset+i.length==o.position.offset,h=i.type=="attribute"&&o.type=="attribute"&&i.position.parent==o.position.parent&&i.range.isFlat&&o.range.isFlat&&i.position.offset+i.length==o.position.offset&&i.attributeKey==o.attributeKey&&i.attributeOldValue==o.attributeOldValue&&i.attributeNewValue==o.attributeNewValue;a||l||h?(i.length++,h&&(i.range.end=i.range.end.getShiftedBy(1)),e[n]=null):s=n}e=e.filter(n=>n);for(const n of e)delete n.changeCount,n.type=="attribute"&&(delete n.position,delete n.length);return this._changeCount=0,this._cachedChangesWithGraveyard=e,this._cachedChanges=e.filter(Go),t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(t=>{const e={...t};return e.state!==void 0&&delete e.attributes,e})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementChildrenSnapshots.clear(),this._elementsSnapshots.clear(),this._elementState.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems.clear(),this._cachedChanges=null}_refreshItem(t){if(this._isInInsertedElement(t.parent))return;this._markRemove(t.parent,t.startOffset,t.offsetSize),this._markInsert(t.parent,t.startOffset,t.offsetSize),this._refreshedItems.add(t),this._setElementState(t,"refresh");const e=f._createOn(t);for(const n of this._markerCollection.getMarkersIntersectingRange(e)){const s=n.getData();this.bufferMarkerChange(n.name,s,s)}this._cachedChanges=null}_bufferRootLoad(t){if(t.isAttached()){this._bufferRootStateChange(t.rootName,!0),this._markInsert(t,0,t.maxOffset);for(const e of t.getAttributeKeys())this._bufferRootAttributeChange(t.rootName,e,null,t.getAttribute(e));for(const e of this._markerCollection)if(e.getRange().root==t){const n=e.getData();this.bufferMarkerChange(e.name,{...n,range:null},n)}}}_bufferRootStateChange(t,e){if(!this._changedRoots.has(t)){this._changedRoots.set(t,{name:t,state:e?"attached":"detached"});return}const n=this._changedRoots.get(t);n.state!==void 0?(delete n.state,n.attributes===void 0&&this._changedRoots.delete(t)):n.state=e?"attached":"detached"}_bufferRootAttributeChange(t,e,n,s){const i=this._changedRoots.get(t)||{name:t},o=i.attributes||{};if(o[e]){const a=o[e];s===a.oldValue?delete o[e]:a.newValue=s}else o[e]={oldValue:n,newValue:s};Object.entries(o).length===0?(delete i.attributes,i.state===void 0&&this._changedRoots.delete(t)):(i.attributes=o,this._changedRoots.set(t,i))}_markInsert(t,e,n){if(t.root.is("rootElement")&&!t.root._isLoaded)return;const s={type:"insert",offset:e,howMany:n,count:this._changeCount++};this._markChange(t,s)}_markRemove(t,e,n){if(t.root.is("rootElement")&&!t.root._isLoaded)return;const s={type:"remove",offset:e,howMany:n,count:this._changeCount++};this._markChange(t,s),this._removeAllNestedChanges(t,e,n)}_markAttribute(t){if(t.root.is("rootElement")&&!t.root._isLoaded)return;const e={type:"attribute",offset:t.startOffset,howMany:t.offsetSize,count:this._changeCount++};this._markChange(t.parent,e)}_markChange(t,e){this._makeSnapshots(t);const n=this._getChangesForElement(t);this._handleChange(e,n),n.push(e);for(let s=0;s<n.length;s++)n[s].howMany<1&&(n.splice(s,1),s--)}_setElementState(t,e){if(!t.is("element"))return;const n=Ge._statesPriority.indexOf(this._elementState.get(t));Ge._statesPriority.indexOf(e)>n&&this._elementState.set(t,e)}_getDiffActionForNode(t,e){if(!t.is("element")||!this._elementsSnapshots.has(t))return e;const n=this._elementState.get(t);return!n||n=="move"?e:n}_getChangesForElement(t){let e;return this._changesInElement.has(t)?e=this._changesInElement.get(t):(e=[],this._changesInElement.set(t,e)),e}_makeSnapshots(t){if(this._elementChildrenSnapshots.has(t))return;const e=Bn(t.getChildren());this._elementChildrenSnapshots.set(t,e);for(const n of e)this._elementsSnapshots.set(n.node,n)}_handleChange(t,e){t.nodesToHandle=t.howMany;for(const n of e){const s=t.offset+t.howMany,i=n.offset+n.howMany;if(t.type=="insert"&&(n.type=="insert"&&(t.offset<=n.offset?n.offset+=t.howMany:t.offset<i&&(n.howMany+=t.nodesToHandle,t.nodesToHandle=0)),n.type=="remove"&&t.offset<n.offset&&(n.offset+=t.howMany),n.type=="attribute")){if(t.offset<=n.offset)n.offset+=t.howMany;else if(t.offset<i){const o=n.howMany;n.howMany=t.offset-n.offset,e.unshift({type:"attribute",offset:s,howMany:o-n.howMany,count:this._changeCount++})}}if(t.type=="remove"){if(n.type=="insert"){if(s<=n.offset)n.offset-=t.howMany;else if(s<=i)if(t.offset<n.offset){const o=s-n.offset;n.offset=t.offset,n.howMany-=o,t.nodesToHandle-=o}else n.howMany-=t.nodesToHandle,t.nodesToHandle=0;else if(t.offset<=n.offset)t.nodesToHandle-=n.howMany,n.howMany=0;else if(t.offset<i){const o=i-t.offset;n.howMany-=o,t.nodesToHandle-=o}}if(n.type=="remove"&&(s<=n.offset?n.offset-=t.howMany:t.offset<n.offset&&(t.nodesToHandle+=n.howMany,n.howMany=0)),n.type=="attribute"){if(s<=n.offset)n.offset-=t.howMany;else if(t.offset<n.offset){const o=s-n.offset;n.offset=t.offset,n.howMany-=o}else if(t.offset<i)if(s<=i){const o=n.howMany;n.howMany=t.offset-n.offset;const a=o-n.howMany-t.nodesToHandle;e.unshift({type:"attribute",offset:t.offset,howMany:a,count:this._changeCount++})}else n.howMany-=i-t.offset}}if(t.type=="attribute"){if(n.type=="insert")if(t.offset<n.offset&&s>n.offset){if(s>i){const o={type:"attribute",offset:i,howMany:s-i,count:this._changeCount++};this._handleChange(o,e),e.push(o)}t.nodesToHandle=n.offset-t.offset,t.howMany=t.nodesToHandle}else t.offset>=n.offset&&t.offset<i&&(s>i?(t.nodesToHandle=s-i,t.offset=i):t.nodesToHandle=0);if(n.type=="remove"&&t.offset<n.offset&&s>n.offset){const o={type:"attribute",offset:n.offset,howMany:s-n.offset,count:this._changeCount++};this._handleChange(o,e),e.push(o),t.nodesToHandle=n.offset-t.offset,t.howMany=t.nodesToHandle}n.type=="attribute"&&(t.offset>=n.offset&&s<=i?(t.nodesToHandle=0,t.howMany=0,t.offset=0):t.offset<=n.offset&&s>=i&&(n.howMany=0))}}t.howMany=t.nodesToHandle,delete t.nodesToHandle}_getInsertDiff(t,e,n,s,i){const o={type:"insert",position:g._createAt(t,e),name:s.name,attributes:new Map(s.attributes),length:1,changeCount:this._changeCount++,action:n};return n!="insert"&&i&&(o.before={name:i.name,attributes:new Map(i.attributes)}),o}_getRemoveDiff(t,e,n,s){return{type:"remove",action:n,position:g._createAt(t,e),name:s.name,attributes:new Map(s.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(t,e,n){const s=[];n=new Map(n);for(const[i,o]of e){const a=n.has(i)?n.get(i):null;a!==o&&s.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:i,attributeOldValue:o,attributeNewValue:a,changeCount:this._changeCount++}),n.delete(i)}for(const[i,o]of n)s.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:i,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return s}_isInInsertedElement(t){const e=t.parent;if(!e)return!1;const n=this._changesInElement.get(e),s=t.startOffset;if(n){for(const i of n)if(i.type=="insert"&&s>=i.offset&&s<i.offset+i.howMany)return!0}return this._isInInsertedElement(e)}_removeAllNestedChanges(t,e,n){const s=new f(g._createAt(t,e),g._createAt(t,e+n));for(const i of s.getItems({shallow:!0}))i.is("element")&&(this._changesInElement.delete(i),this._removeAllNestedChanges(i,0,i.maxOffset))}};c(Ge,"_statesPriority",[void 0,"refresh","rename","move"]);let Wt=Ge;function Fn(r){return{node:r,name:r.is("$text")?"$text":r.name,attributes:new Map(r.getAttributes())}}function Bn(r){const t=[];for(const e of r)if(e.is("$text"))for(let n=0;n<e.data.length;++n)t.push(Fn(e));else t.push(Fn(e));return t}function jo(r,t){const e=[];let n=0,s=0;for(const i of t){if(i.offset>n){for(let o=0;o<i.offset-n;o++)e.push("e");s+=i.offset-n}if(i.type=="insert"){for(let o=0;o<i.howMany;o++)e.push("i");n=i.offset+i.howMany}else if(i.type=="remove"){for(let o=0;o<i.howMany;o++)e.push("r");n=i.offset,s+=i.howMany}else{if(i.howMany>1500)for(let o=0;o<i.howMany;o++)e.push("a");else e.push(..."a".repeat(i.howMany).split(""));n=i.offset+i.howMany,s+=i.howMany}}if(s<r)for(let i=0;i<r-s-n;i++)e.push("e");return e}function Go(r){const t="position"in r&&r.position.root.rootName=="$graveyard",e="range"in r&&r.range.root.rootName=="$graveyard";return!t&&!e}class Ho{constructor(){c(this,"_operations",[]);c(this,"_undoPairs",new Map);c(this,"_undoneOperations",new Set);c(this,"_baseVersionToOperationIndex",new Map);c(this,"_version",0);c(this,"_gaps",new Map)}get version(){return this._version}set version(t){this._operations.length&&t>this._version+1&&this._gaps.set(this._version,t),this._version=t}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(t){if(t.baseVersion!==this.version)throw new d("model-document-history-addoperation-incorrect-version",this,{operation:t,historyVersion:this.version});this._operations.push(t),this._version++,this._baseVersionToOperationIndex.set(t.baseVersion,this._operations.length-1)}getOperations(t,e=this.version){if(!this._operations.length)return[];const n=this._operations[0];t===void 0&&(t=n.baseVersion);let s=e-1;for(const[a,l]of this._gaps)t>a&&t<l&&(t=l),s>a&&s<l&&(s=a-1);if(s<n.baseVersion||t>this.lastOperation.baseVersion)return[];let i=this._baseVersionToOperationIndex.get(t);i===void 0&&(i=0);let o=this._baseVersionToOperationIndex.get(s);return o===void 0&&(o=this._operations.length-1),this._operations.slice(i,o+1)}getOperation(t){const e=this._baseVersionToOperationIndex.get(t);if(e!==void 0)return this._operations[e]}setOperationAsUndone(t,e){this._undoPairs.set(e,t),this._undoneOperations.add(t)}isUndoingOperation(t){return this._undoPairs.has(t)}isUndoneOperation(t){return this._undoneOperations.has(t)}getUndoneOperation(t){return this._undoPairs.get(t)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class dt extends k{constructor(e,n,s="main"){super(n);c(this,"rootName");c(this,"_document");c(this,"_isAttached",!0);c(this,"_isLoaded",!0);this._document=e,this.rootName=s}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}dt.prototype.is=function(r,t){return t?t===this.name&&(r==="rootElement"||r==="model:rootElement"||r==="element"||r==="model:element"):r==="rootElement"||r==="model:rootElement"||r==="element"||r==="model:element"||r==="node"||r==="model:node"};const Dn="$graveyard";class Ko extends O(){constructor(e){super();c(this,"model");c(this,"history");c(this,"selection");c(this,"roots");c(this,"differ");c(this,"isReadOnly");c(this,"_postFixers");c(this,"_hasSelectionChangedFromTheLastChangeBlock");this.model=e,this.history=new Ho,this.selection=new H(this),this.roots=new qt({idProperty:"rootName"}),this.differ=new Wt(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Dn),this.listenTo(e,"applyOperation",(n,s)=>{const i=s[0];i.isDocumentOperation&&this.differ.bufferOperation(i)},{priority:"high"}),this.listenTo(e,"applyOperation",(n,s)=>{const i=s[0];i.isDocumentOperation&&this.history.addOperation(i)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(n,s,i,o,a)=>{const l={...s.getData(),range:o};this.differ.bufferMarkerChange(s.name,a,l),i===null&&s.on("change",(h,u)=>{const m=s.getData();this.differ.bufferMarkerChange(s.name,{...m,range:u},m)})}),this.registerPostFixer(n=>{let s=!1;for(const i of this.roots)!i.isAttached()&&!i.isEmpty&&(n.remove(n.createRangeIn(i)),s=!0);for(const i of this.model.markers)i.getRange().root.isAttached()||(n.removeMarker(i),s=!0);return s})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(Dn)}createRoot(e="$root",n="main"){if(this.roots.get(n))throw new d("model-document-createroot-name-exists",this,{name:n});const s=new dt(this,e,n);return this.roots.add(s),s}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map(n=>n.rootName)}getRoots(e=!1){return this.roots.filter(n=>n!=this.graveyard&&(e||n.isAttached())&&n._isLoaded)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=jn(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),n=this.model,s=n.schema,i=n.createPositionFromPath(e,[0]);return s.getNearestSelectionRange(i)||n.createRange(i)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&Vn(e.start)&&Vn(e.end)}_callPostFixers(e){let n=!1;do for(const s of this._postFixers)if(this.selection.refresh(),n=s(e),n)break;while(n)}}function Vn(r){const t=r.textNode;if(t){const e=t.data,n=r.offset-t.startOffset;return!zn(e,n)&&!Un(e,n)}return!0}class Xo extends O(){constructor(){super(...arguments);c(this,"_markers",new Map)}[Symbol.iterator](){return this._markers.values()}has(e){const n=e instanceof Ee?e.name:e;return this._markers.has(n)}get(e){return this._markers.get(e)||null}_set(e,n,s=!1,i=!1){const o=e instanceof Ee?e.name:e;if(o.includes(","))throw new d("markercollection-incorrect-marker-name",this);const a=this._markers.get(o);if(a){const u=a.getData(),m=a.getRange();let p=!1;return m.isEqual(n)||(a._attachLiveRange(be.fromRange(n)),p=!0),s!=a.managedUsingOperations&&(a._managedUsingOperations=s,p=!0),typeof i=="boolean"&&i!=a.affectsData&&(a._affectsData=i,p=!0),p&&this.fire(`update:${o}`,a,m,n,u),a}const l=be.fromRange(n),h=new Ee(o,l,s,i);return this._markers.set(o,h),this.fire(`update:${o}`,h,null,n,{...h.getData(),range:null}),h}_remove(e){const n=e instanceof Ee?e.name:e,s=this._markers.get(n);return s?(this._markers.delete(n),this.fire(`update:${n}`,s,s.getRange(),null,s.getData()),this._destroyMarker(s),!0):!1}_refresh(e){const n=e instanceof Ee?e.name:e,s=this._markers.get(n);if(!s)throw new d("markercollection-refresh-marker-not-exists",this);const i=s.getRange();this.fire(`update:${n}`,s,i,i,s.getData())}*getMarkersAtPosition(e){for(const n of this)n.getRange().containsPosition(e)&&(yield n)}*getMarkersIntersectingRange(e){for(const n of this)n.getRange().getIntersection(e)!==null&&(yield n)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const n of this._markers.values())n.name.startsWith(e+":")&&(yield n)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Ee extends O(ue){constructor(e,n,s,i){super();c(this,"name");c(this,"_managedUsingOperations");c(this,"_affectsData");c(this,"_liveRange");this.name=e,this._liveRange=this._attachLiveRange(n),this._managedUsingOperations=s,this._affectsData=i}get managedUsingOperations(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Ee.prototype.is=function(r){return r==="marker"||r==="model:marker"};class Yo extends q{constructor(e,n){super(null);c(this,"sourcePosition");c(this,"howMany");this.sourcePosition=e.clone(),this.howMany=n}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new d("detach-operation-on-document-node",this)}_execute(){Rs(f._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class X extends ue{constructor(e){super();c(this,"markers",new Map);c(this,"_children",new Ue);e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildAtOffset(e){return this._children.getNodeAtOffset(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let n=this;for(const s of e)n=n.getChildAtOffset(s);return n}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const n of this._children)e.push(n.toJSON());return e}static fromJSON(e){const n=[];for(const s of e)s.name?n.push(k.fromJSON(s)):n.push(A.fromJSON(s));return new X(n)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,n){const s=Qo(n);for(const i of s)i.parent!==null&&i._remove(),i.parent=this;this._children._insertNodes(e,s)}_removeChildren(e,n=1){const s=this._children._removeNodes(e,n);for(const i of s)i.parent=null;return s}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const n of e)n.parent=null}}X.prototype.is=function(r){return r==="documentFragment"||r==="model:documentFragment"};function Qo(r){return typeof r=="string"?[new A(r)]:(ce(r)||(r=[r]),Array.from(r).map(t=>typeof t=="string"?new A(t):t instanceof G?new A(t.data,t.getAttributes()):t))}class Zo{constructor(t,e){c(this,"model");c(this,"batch");this.model=t,this.batch=e}createText(t,e){return new A(t,e)}createElement(t,e){return new k(t,e)}createDocumentFragment(){return new X}cloneElement(t,e=!0){return t._clone(e)}insert(t,e,n=0){if(this._assertWriterUsedCorrectly(),t instanceof A&&t.data=="")return;const s=g._createAt(e,n);if(t.parent)if(Wn(t.root,s.root)){this.move(f._createOn(t),s);return}else{if(t.root.document)throw new d("model-writer-insert-forbidden-move",this);this.remove(t)}const i=s.root.document?s.root.document.version:null,o=t instanceof X?t._removeChildren(0,t.childCount):t,a=new x(s,o,i);if(t instanceof A&&(a.shouldReceiveAttributes=!0),this.batch.addOperation(a),this.model.applyOperation(a),t instanceof X)for(const[l,h]of t.markers){const u=g._createAt(h.root,0),p={range:new f(h.start._getCombined(u,s),h.end._getCombined(u,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(l)?this.updateMarker(l,p):this.addMarker(l,p)}}insertText(t,e,n,s){e instanceof X||e instanceof k||e instanceof g?this.insert(this.createText(t),e,n):this.insert(this.createText(t,e),n,s)}insertElement(t,e,n,s){e instanceof X||e instanceof k||e instanceof g?this.insert(this.createElement(t),e,n):this.insert(this.createElement(t,e),n,s)}append(t,e){this.insert(t,e,"end")}appendText(t,e,n){e instanceof X||e instanceof k?this.insert(this.createText(t),e,"end"):this.insert(this.createText(t,e),n,"end")}appendElement(t,e,n){e instanceof X||e instanceof k?this.insert(this.createElement(t),e,"end"):this.insert(this.createElement(t,e),n,"end")}setAttribute(t,e,n){if(this._assertWriterUsedCorrectly(),n instanceof f){const s=n.getMinimalFlatRanges();for(const i of s)$n(this,t,e,i)}else Ln(this,t,e,n)}setAttributes(t,e){for(const[n,s]of we(t))this.setAttribute(n,s,e)}removeAttribute(t,e){if(this._assertWriterUsedCorrectly(),e instanceof f){const n=e.getMinimalFlatRanges();for(const s of n)$n(this,t,null,s)}else Ln(this,t,null,e)}clearAttributes(t){this._assertWriterUsedCorrectly();const e=n=>{for(const s of n.getAttributeKeys())this.removeAttribute(s,n)};if(!(t instanceof f))e(t);else for(const n of t.getItems())e(n)}move(t,e,n){if(this._assertWriterUsedCorrectly(),!(t instanceof f))throw new d("writer-move-invalid-range",this);if(!t.isFlat)throw new d("writer-move-range-not-flat",this);const s=g._createAt(e,n);if(s.isEqual(t.start))return;if(this._addOperationForAffectedMarkers("move",t),!Wn(t.root,s.root))throw new d("writer-move-different-document",this);const i=t.root.document?t.root.document.version:null,o=new P(t.start,t.end.offset-t.start.offset,s,i);this.batch.addOperation(o),this.model.applyOperation(o)}remove(t){this._assertWriterUsedCorrectly();const n=(t instanceof f?t:f._createOn(t)).getMinimalFlatRanges().reverse();for(const s of n)this._addOperationForAffectedMarkers("move",s),ea(s.start,s.end.offset-s.start.offset,this.batch,this.model)}merge(t){this._assertWriterUsedCorrectly();const e=t.nodeBefore,n=t.nodeAfter;if(this._addOperationForAffectedMarkers("merge",t),!(e instanceof k))throw new d("writer-merge-no-element-before",this);if(!(n instanceof k))throw new d("writer-merge-no-element-after",this);t.root.document?this._merge(t):this._mergeDetached(t)}createPositionFromPath(t,e,n){return this.model.createPositionFromPath(t,e,n)}createPositionAt(t,e){return this.model.createPositionAt(t,e)}createPositionAfter(t){return this.model.createPositionAfter(t)}createPositionBefore(t){return this.model.createPositionBefore(t)}createRange(t,e){return this.model.createRange(t,e)}createRangeIn(t){return this.model.createRangeIn(t)}createRangeOn(t){return this.model.createRangeOn(t)}createSelection(...t){return this.model.createSelection(...t)}_mergeDetached(t){const e=t.nodeBefore,n=t.nodeAfter;this.move(f._createIn(n),g._createAt(e,"end")),this.remove(n)}_merge(t){const e=g._createAt(t.nodeBefore,"end"),n=g._createAt(t.nodeAfter,0),s=t.root.document.graveyard,i=new g(s,[0]),o=t.root.document.version,a=new S(n,t.nodeAfter.maxOffset,e,i,o);this.batch.addOperation(a),this.model.applyOperation(a)}rename(t,e){if(this._assertWriterUsedCorrectly(),!(t instanceof k))throw new d("writer-rename-not-element-instance",this);const n=t.root.document?t.root.document.version:null,s=new V(g._createBefore(t),t.name,e,n);this.batch.addOperation(s),this.model.applyOperation(s)}split(t,e){this._assertWriterUsedCorrectly();let n=t.parent;if(!n.parent)throw new d("writer-split-element-no-parent",this);if(e||(e=n.parent),!t.parent.getAncestors({includeSelf:!0}).includes(e))throw new d("writer-split-invalid-limit-element",this);let s,i;do{const o=n.root.document?n.root.document.version:null,a=n.maxOffset-t.offset,l=C.getInsertionPosition(t),h=new C(t,a,l,null,o);this.batch.addOperation(h),this.model.applyOperation(h),!s&&!i&&(s=n,i=t.parent.nextSibling),t=this.createPositionAfter(t.parent),n=t.parent}while(n!==e);return{position:t,range:new f(g._createAt(s,"end"),g._createAt(i,0))}}wrap(t,e){if(this._assertWriterUsedCorrectly(),!t.isFlat)throw new d("writer-wrap-range-not-flat",this);const n=e instanceof k?e:new k(e);if(n.childCount>0)throw new d("writer-wrap-element-not-empty",this);if(n.parent!==null)throw new d("writer-wrap-element-attached",this);this.insert(n,t.start);const s=new f(t.start.getShiftedBy(1),t.end.getShiftedBy(1));this.move(s,g._createAt(n,0))}unwrap(t){if(this._assertWriterUsedCorrectly(),t.parent===null)throw new d("writer-unwrap-element-no-parent",this);this.move(f._createIn(t),this.createPositionAfter(t)),this.remove(t)}addMarker(t,e){if(this._assertWriterUsedCorrectly(),!e||typeof e.usingOperation!="boolean")throw new d("writer-addmarker-no-usingoperation",this);const n=e.usingOperation,s=e.range,i=e.affectsData===void 0?!1:e.affectsData;if(this.model.markers.has(t))throw new d("writer-addmarker-marker-exists",this);if(!s)throw new d("writer-addmarker-no-range",this);return n?(De(this,t,null,s,i),this.model.markers.get(t)):this.model.markers._set(t,s,n,i)}updateMarker(t,e){this._assertWriterUsedCorrectly();const n=typeof t=="string"?t:t.name,s=this.model.markers.get(n);if(!s)throw new d("writer-updatemarker-marker-not-exists",this);if(!e){W("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),this.model.markers._refresh(s);return}const i=typeof e.usingOperation=="boolean",o=typeof e.affectsData=="boolean",a=o?e.affectsData:s.affectsData;if(!i&&!e.range&&!o)throw new d("writer-updatemarker-wrong-options",this);const l=s.getRange(),h=e.range?e.range:l;if(i&&e.usingOperation!==s.managedUsingOperations){e.usingOperation?De(this,n,null,h,a):(De(this,n,l,null,a),this.model.markers._set(n,h,void 0,a));return}s.managedUsingOperations?De(this,n,l,h,a):this.model.markers._set(n,h,void 0,a)}removeMarker(t){this._assertWriterUsedCorrectly();const e=typeof t=="string"?t:t.name;if(!this.model.markers.has(e))throw new d("writer-removemarker-no-marker",this);const n=this.model.markers.get(e);if(!n.managedUsingOperations){this.model.markers._remove(e);return}const s=n.getRange();De(this,e,s,null,n.affectsData)}addRoot(t,e="$root"){this._assertWriterUsedCorrectly();const n=this.model.document.getRoot(t);if(n&&n.isAttached())throw new d("writer-addroot-root-exists",this);const s=this.model.document,i=new Y(t,e,!0,s,s.version);return this.batch.addOperation(i),this.model.applyOperation(i),this.model.document.getRoot(t)}detachRoot(t){this._assertWriterUsedCorrectly();const e=typeof t=="string"?this.model.document.getRoot(t):t;if(!e||!e.isAttached())throw new d("writer-detachroot-no-root",this);for(const i of this.model.markers)i.getRange().root===e&&this.removeMarker(i);for(const i of e.getAttributeKeys())this.removeAttribute(i,e);this.remove(this.createRangeIn(e));const n=this.model.document,s=new Y(e.rootName,e.name,!1,n,n.version);this.batch.addOperation(s),this.model.applyOperation(s)}setSelection(...t){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...t)}setSelectionFocus(t,e){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(t,e)}setSelectionAttribute(t,e){if(this._assertWriterUsedCorrectly(),typeof t=="string")this._setSelectionAttribute(t,e);else for(const[n,s]of we(t))this._setSelectionAttribute(n,s)}removeSelectionAttribute(t){if(this._assertWriterUsedCorrectly(),typeof t=="string")this._removeSelectionAttribute(t);else for(const e of t)this._removeSelectionAttribute(e)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(t){this.model.document.selection._restoreGravity(t)}_setSelectionAttribute(t,e){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const s=H._getStoreAttributeKey(t);this.setAttribute(s,e,n.anchor.parent)}n._setAttribute(t,e)}_removeSelectionAttribute(t){const e=this.model.document.selection;if(e.isCollapsed&&e.anchor.parent.isEmpty){const n=H._getStoreAttributeKey(t);this.removeAttribute(n,e.anchor.parent)}e._removeAttribute(t)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new d("writer-incorrect-use",this)}_addOperationForAffectedMarkers(t,e){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const s=n.getRange();let i=!1;if(t==="move"){const o=e;i=o.containsPosition(s.start)||o.start.isEqual(s.start)||o.containsPosition(s.end)||o.end.isEqual(s.end)}else{const o=e,a=o.nodeBefore,l=o.nodeAfter,h=s.start.parent==a&&s.start.isAtEnd,u=s.end.parent==l&&s.end.offset==0,m=s.end.nodeAfter==l,p=s.start.nodeAfter==l;i=h||u||m||p}i&&this.updateMarker(n.name,{range:s})}}}function $n(r,t,e,n){const s=r.model,i=s.document;let o=n.start,a,l,h;for(const m of n.getWalker({shallow:!0}))h=m.item.getAttribute(t),a&&l!=h&&(l!=e&&u(),o=a),a=m.nextPosition,l=h;a instanceof g&&a!=o&&l!=e&&u();function u(){const m=new f(o,a),p=m.root.document?i.version:null,w=new E(m,t,l,e,p);r.batch.addOperation(w),s.applyOperation(w)}}function Ln(r,t,e,n){const s=r.model,i=s.document,o=n.getAttribute(t);let a,l;if(o!=e){if(n.root===n){const u=n.document?i.version:null;l=new te(n,t,o,e,u)}else{a=new f(g._createBefore(n),r.createPositionAfter(n));const u=a.root.document?i.version:null;l=new E(a,t,o,e,u)}r.batch.addOperation(l),s.applyOperation(l)}}function De(r,t,e,n,s){const i=r.model,o=i.document,a=new B(t,e,n,i.markers,!!s,o.version);r.batch.addOperation(a),i.applyOperation(a)}function ea(r,t,e,n){let s;if(r.root.document){const i=n.document,o=new g(i.graveyard,[0]);s=new P(r,t,o,i.version)}else s=new Yo(r,t);e.addOperation(s),n.applyOperation(s)}function Wn(r,t){return r===t||r instanceof dt&&t instanceof dt}function ta(r,t,e={}){if(t.isCollapsed)return;const n=t.getFirstRange();if(n.root.rootName=="$graveyard")return;const s=r.schema;r.change(i=>{if(!e.doNotResetEntireContent&&ha(s,t)){ca(i,t);return}const o={};if(!e.doNotAutoparagraph){const h=t.getSelectedElement();h&&Object.assign(o,s.getAttributesWithProperty(h,"copyOnReplace",!0))}const[a,l]=na(n);a.isTouching(l)||i.remove(i.createRange(a,l)),e.leaveUnmerged||(ra(i,a,l),s.removeDisallowedAttributes(a.parent.getChildren(),i)),Fs(i,t,a),!e.doNotAutoparagraph&&aa(s,a)&&Is(i,a,t,o),a.detach(),l.detach()})}function na(r){const t=r.root.document.model,e=r.start;let n=r.end;if(t.hasContent(r,{ignoreMarkers:!0})){const s=sa(n);if(s&&n.isTouching(t.createPositionAt(s,0))){const i=t.createSelection(r);t.modifySelection(i,{direction:"backward"});const o=i.getLastPosition(),a=t.createRange(o,n);t.hasContent(a,{ignoreMarkers:!0})||(n=o)}}return[D.fromPosition(e,"toPrevious"),D.fromPosition(n,"toNext")]}function sa(r){const t=r.parent,e=t.root.document.model.schema,n=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of n){if(e.isLimit(s))return null;if(e.isBlock(s))return s}}function ra(r,t,e){const n=r.model;if(!Zt(r.model.schema,t,e))return;const[s,i]=oa(t,e);!s||!i||(!n.hasContent(s,{ignoreMarkers:!0})&&n.hasContent(i,{ignoreMarkers:!0})?Os(r,t,e,s.parent):Ns(r,t,e,s.parent))}function Ns(r,t,e,n){const s=t.parent,i=e.parent;if(!(s==n||i==n)){for(t=r.createPositionAfter(s),e=r.createPositionBefore(i),e.isEqual(t)||r.insert(i,t),r.merge(t);e.parent.isEmpty;){const o=e.parent;e=r.createPositionBefore(o),r.remove(o)}Zt(r.model.schema,t,e)&&Ns(r,t,e,n)}}function Os(r,t,e,n){const s=t.parent,i=e.parent;if(!(s==n||i==n)){for(t=r.createPositionAfter(s),e=r.createPositionBefore(i),e.isEqual(t)||r.insert(s,e);t.parent.isEmpty;){const o=t.parent;t=r.createPositionBefore(o),r.remove(o)}e=r.createPositionBefore(i),ia(r,e),Zt(r.model.schema,t,e)&&Os(r,t,e,n)}}function ia(r,t){const e=t.nodeBefore,n=t.nodeAfter;e.name!=n.name&&r.rename(e,n.name),r.clearAttributes(e),r.setAttributes(Object.fromEntries(n.getAttributes()),e),r.merge(t)}function Zt(r,t,e){const n=t.parent,s=e.parent;return n==s||r.isLimit(n)||r.isLimit(s)?!1:la(t,e,r)}function oa(r,t){const e=r.getAncestors(),n=t.getAncestors();let s=0;for(;e[s]&&e[s]==n[s];)s++;return[e[s],n[s]]}function aa(r,t){const e=r.checkChild(t,"$text"),n=r.checkChild(t,"paragraph");return!e&&n}function la(r,t,e){const n=new f(r,t);for(const s of n.getWalker())if(e.isLimit(s.item))return!1;return!0}function Is(r,t,e,n={}){const s=r.createElement("paragraph");r.model.schema.setAllowedAttributes(s,n,r),r.insert(s,t),Fs(r,e,r.createPositionAt(s,0))}function ca(r,t){const e=r.model.schema.getLimitElement(t);r.remove(r.createRangeIn(e)),Is(r,r.createPositionAt(e,0),t)}function ha(r,t){const e=r.getLimitElement(t);if(!t.containsEntireContent(e))return!1;const n=t.getFirstRange();return n.start.parent==n.end.parent?!1:r.checkChild(e,"paragraph")}function Fs(r,t,e){t instanceof H?r.setSelection(e):t.setTo(e)}/**