@ckeditor/ckeditor5-table 47.3.0-alpha.0 → 47.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/build/table.js +1 -1
  2. package/build/translations/ar.js +1 -1
  3. package/build/translations/bg.js +1 -1
  4. package/build/translations/bn.js +1 -1
  5. package/build/translations/ca.js +1 -1
  6. package/build/translations/cs.js +1 -1
  7. package/build/translations/da.js +1 -1
  8. package/build/translations/de.js +1 -1
  9. package/build/translations/el.js +1 -1
  10. package/build/translations/es.js +1 -1
  11. package/build/translations/et.js +1 -1
  12. package/build/translations/fi.js +1 -1
  13. package/build/translations/fr.js +1 -1
  14. package/build/translations/he.js +1 -1
  15. package/build/translations/hi.js +1 -1
  16. package/build/translations/hu.js +1 -1
  17. package/build/translations/id.js +1 -1
  18. package/build/translations/it.js +1 -1
  19. package/build/translations/ja.js +1 -1
  20. package/build/translations/ko.js +1 -1
  21. package/build/translations/lt.js +1 -1
  22. package/build/translations/lv.js +1 -1
  23. package/build/translations/ms.js +1 -1
  24. package/build/translations/nl.js +1 -1
  25. package/build/translations/no.js +1 -1
  26. package/build/translations/pl.js +1 -1
  27. package/build/translations/pt-br.js +1 -1
  28. package/build/translations/pt.js +1 -1
  29. package/build/translations/ro.js +1 -1
  30. package/build/translations/ru.js +1 -1
  31. package/build/translations/sk.js +1 -1
  32. package/build/translations/sr.js +1 -1
  33. package/build/translations/sv.js +1 -1
  34. package/build/translations/th.js +1 -1
  35. package/build/translations/tr.js +1 -1
  36. package/build/translations/uk.js +1 -1
  37. package/build/translations/vi.js +1 -1
  38. package/build/translations/zh-cn.js +1 -1
  39. package/build/translations/zh.js +1 -1
  40. package/dist/index-editor.css +8 -0
  41. package/dist/index.css +8 -0
  42. package/dist/index.css.map +1 -1
  43. package/dist/translations/ar.js +1 -1
  44. package/dist/translations/ar.umd.js +1 -1
  45. package/dist/translations/bg.js +1 -1
  46. package/dist/translations/bg.umd.js +1 -1
  47. package/dist/translations/bn.js +1 -1
  48. package/dist/translations/bn.umd.js +1 -1
  49. package/dist/translations/ca.js +1 -1
  50. package/dist/translations/ca.umd.js +1 -1
  51. package/dist/translations/cs.js +1 -1
  52. package/dist/translations/cs.umd.js +1 -1
  53. package/dist/translations/da.js +1 -1
  54. package/dist/translations/da.umd.js +1 -1
  55. package/dist/translations/de.js +1 -1
  56. package/dist/translations/de.umd.js +1 -1
  57. package/dist/translations/el.js +1 -1
  58. package/dist/translations/el.umd.js +1 -1
  59. package/dist/translations/es.js +1 -1
  60. package/dist/translations/es.umd.js +1 -1
  61. package/dist/translations/et.js +1 -1
  62. package/dist/translations/et.umd.js +1 -1
  63. package/dist/translations/fi.js +1 -1
  64. package/dist/translations/fi.umd.js +1 -1
  65. package/dist/translations/fr.js +1 -1
  66. package/dist/translations/fr.umd.js +1 -1
  67. package/dist/translations/he.js +1 -1
  68. package/dist/translations/he.umd.js +1 -1
  69. package/dist/translations/hi.js +1 -1
  70. package/dist/translations/hi.umd.js +1 -1
  71. package/dist/translations/hu.js +1 -1
  72. package/dist/translations/hu.umd.js +1 -1
  73. package/dist/translations/id.js +1 -1
  74. package/dist/translations/id.umd.js +1 -1
  75. package/dist/translations/it.js +1 -1
  76. package/dist/translations/it.umd.js +1 -1
  77. package/dist/translations/ja.js +1 -1
  78. package/dist/translations/ja.umd.js +1 -1
  79. package/dist/translations/ko.js +1 -1
  80. package/dist/translations/ko.umd.js +1 -1
  81. package/dist/translations/lt.js +1 -1
  82. package/dist/translations/lt.umd.js +1 -1
  83. package/dist/translations/lv.js +1 -1
  84. package/dist/translations/lv.umd.js +1 -1
  85. package/dist/translations/ms.js +1 -1
  86. package/dist/translations/ms.umd.js +1 -1
  87. package/dist/translations/nl.js +1 -1
  88. package/dist/translations/nl.umd.js +1 -1
  89. package/dist/translations/no.js +1 -1
  90. package/dist/translations/no.umd.js +1 -1
  91. package/dist/translations/pl.js +1 -1
  92. package/dist/translations/pl.umd.js +1 -1
  93. package/dist/translations/pt-br.js +1 -1
  94. package/dist/translations/pt-br.umd.js +1 -1
  95. package/dist/translations/pt.js +1 -1
  96. package/dist/translations/pt.umd.js +1 -1
  97. package/dist/translations/ro.js +1 -1
  98. package/dist/translations/ro.umd.js +1 -1
  99. package/dist/translations/ru.js +1 -1
  100. package/dist/translations/ru.umd.js +1 -1
  101. package/dist/translations/sk.js +1 -1
  102. package/dist/translations/sk.umd.js +1 -1
  103. package/dist/translations/sr.js +1 -1
  104. package/dist/translations/sr.umd.js +1 -1
  105. package/dist/translations/sv.js +1 -1
  106. package/dist/translations/sv.umd.js +1 -1
  107. package/dist/translations/th.js +1 -1
  108. package/dist/translations/th.umd.js +1 -1
  109. package/dist/translations/tr.js +1 -1
  110. package/dist/translations/tr.umd.js +1 -1
  111. package/dist/translations/uk.js +1 -1
  112. package/dist/translations/uk.umd.js +1 -1
  113. package/dist/translations/vi.js +1 -1
  114. package/dist/translations/vi.umd.js +1 -1
  115. package/dist/translations/zh-cn.js +1 -1
  116. package/dist/translations/zh-cn.umd.js +1 -1
  117. package/dist/translations/zh.js +1 -1
  118. package/dist/translations/zh.umd.js +1 -1
  119. package/lang/translations/ar.po +6 -6
  120. package/lang/translations/bg.po +6 -6
  121. package/lang/translations/bn.po +6 -6
  122. package/lang/translations/ca.po +6 -6
  123. package/lang/translations/cs.po +6 -6
  124. package/lang/translations/da.po +6 -6
  125. package/lang/translations/de.po +6 -6
  126. package/lang/translations/el.po +6 -6
  127. package/lang/translations/es.po +6 -6
  128. package/lang/translations/et.po +6 -6
  129. package/lang/translations/fi.po +6 -6
  130. package/lang/translations/fr.po +6 -6
  131. package/lang/translations/he.po +6 -6
  132. package/lang/translations/hi.po +6 -6
  133. package/lang/translations/hu.po +6 -6
  134. package/lang/translations/id.po +6 -6
  135. package/lang/translations/it.po +6 -6
  136. package/lang/translations/ja.po +6 -6
  137. package/lang/translations/ko.po +6 -6
  138. package/lang/translations/lt.po +6 -6
  139. package/lang/translations/lv.po +6 -6
  140. package/lang/translations/ms.po +6 -6
  141. package/lang/translations/nl.po +6 -6
  142. package/lang/translations/no.po +6 -6
  143. package/lang/translations/pl.po +6 -6
  144. package/lang/translations/pt-br.po +6 -6
  145. package/lang/translations/pt.po +6 -6
  146. package/lang/translations/ro.po +6 -6
  147. package/lang/translations/ru.po +6 -6
  148. package/lang/translations/sk.po +6 -6
  149. package/lang/translations/sr.po +6 -6
  150. package/lang/translations/sv.po +6 -6
  151. package/lang/translations/th.po +6 -6
  152. package/lang/translations/tr.po +6 -6
  153. package/lang/translations/uk.po +6 -6
  154. package/lang/translations/vi.po +6 -6
  155. package/lang/translations/zh-cn.po +6 -6
  156. package/lang/translations/zh.po +6 -6
  157. package/package.json +9 -9
  158. package/theme/tableform-experimental.css +12 -0
package/build/table.js CHANGED
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var e={29:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-form-default-width:340px}.ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form.ck-form_default-width{width:var(--ck-form-default-width)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-number,.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}@media screen and (max-width:600px){.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit{align-items:stretch;flex-direction:column;padding:0}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit>.ck{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit .ck-button_with-text{justify-content:center}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_large-bottom-padding{padding-bottom:var(--ck-spacing-large)}}[dir=ltr] .ck.ck-form.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-form.ck-responsive-form>:not(:last-child){margin-left:0}",""]);const a=r},49:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,'.ck-editor__editable.ck-editor__editable_inline>.ck-widget.ck-widget_with-selection-handle.layout-table:first-child{margin-top:var(--ck-spacing-large)}.ck-editor__editable.ck-editor__editable_inline>.ck-widget.ck-widget_with-selection-handle.layout-table:last-child,.ck-editor__editable.ck-editor__editable_inline>.ck-widget.ck-widget_with-selection-handle.layout-table:nth-last-child(2):has(+.ck-fake-selection-container){margin-bottom:var(--ck-spacing-large)}.ck-editor__editable .table.layout-table{display:table;margin:0}.ck-editor__editable .table.layout-table.ck-widget:hover{z-index:var(--ck-z-default)}.ck-editor__editable .table.layout-table.ck-widget:hover>.ck-widget__selection-handle{opacity:.75;visibility:visible}.ck-editor__editable .table.layout-table.ck-widget:hover>.ck-widget__selection-handle:hover{opacity:1}.ck-editor__editable .table.layout-table.ck-widget:has(.ck-widget.table:hover)>.ck-widget__selection-handle{opacity:0;visibility:hidden}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_selected{z-index:var(--ck-z-default)}.ck-content figure.table.layout-table,.ck-content table.table.layout-table{margin-bottom:0;margin-top:0}.ck-content figure.table.layout-table>table,.ck-content table.table.layout-table{border-spacing:0}:root{--ck-table-layout-widget-type-around-button-size:16px;--ck-table-layout-widget-type-around-icon-width:10px;--ck-table-layout-widget-type-around-icon-height:8px;--ck-table-layout-widget-handler-icon-size:10px;--ck-table-layout-default-border-color:#d4d4d4}.ck-editor__editable .table.layout-table>table{border-collapse:revert;height:100%;width:100%}.ck-editor__editable .table.layout-table>table:not([style*="border:"],[style*=border-top],[style*=border-bottom],[style*=border-left],[style*=border-right],[style*=border-width],[style*=border-style],[style*=border-color]){border-color:transparent;border-width:0;outline:none}.ck-editor__editable .table.layout-table>table>tbody>tr>td{box-shadow:revert;min-width:2em;padding:revert;text-indent:1px}.ck-editor__editable .table.layout-table>table>tbody>tr>td[style*=" width:"],.ck-editor__editable .table.layout-table>table>tbody>tr>td[style*="\'width:"],.ck-editor__editable .table.layout-table>table>tbody>tr>td[style*=";width:"],.ck-editor__editable .table.layout-table>table>tbody>tr>td[style^="width:"]{min-width:auto}.ck-editor__editable .table.layout-table>table>tbody>tr>td:focus{background-color:transparent}.ck-editor__editable .table.layout-table>table>tbody>tr>td:not([style*="border:"],[style*=border-top],[style*=border-bottom],[style*=border-left],[style*=border-right],[style*=border-width],[style*=border-style],[style*=border-color]){border-color:transparent;border-width:0;outline:var(--ck-table-layout-default-border-color) 1px dashed;outline-offset:-1px}.ck-editor__editable .table.layout-table>table>tbody>tr>td:not([style*="border:"],[style*=border-top],[style*=border-bottom],[style*=border-left],[style*=border-right],[style*=border-width],[style*=border-style],[style*=border-color]):focus{outline:var(--ck-color-focus-border) 1px solid}.ck-editor__editable .table.layout-table>table>tbody>tr>td>.ck-table-bogus-paragraph{text-indent:0;width:calc(100% - 1px)}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around{--ck-widget-type-around-button-size:var(--ck-table-layout-widget-type-around-button-size)}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_after,.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_before{transform:translateY(0);z-index:2}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_before{border-radius:0 0 100px 100px;left:min(10%,30px);margin-left:var(--ck-table-layout-widget-type-around-button-size)}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_before:after{border-radius:0 0 100px 100px}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_after,.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_after:after{border-radius:100px 100px 0 0}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button svg{height:var(--ck-table-layout-widget-type-around-icon-height);width:var(--ck-table-layout-widget-type-around-icon-width)}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_with-selection-handle>.ck-widget__selection-handle{--ck-widget-handler-icon-size:var(--ck-table-layout-widget-handler-icon-size);transform:translateY(calc(0px - var(--ck-widget-outline-thickness)));z-index:3}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:0}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:0}',""]);const a=r},151:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}.ck-content figure.table:not(.layout-table){display:table}.ck-content figure.table:not(.layout-table)>table{height:100%;width:100%}.ck-content .table:not(.layout-table){margin:.9em auto}.ck-content figure.table:not(.layout-table)>table,.ck-content table.table:not(.layout-table){border:1px double #b3b3b3;border-collapse:collapse;border-spacing:0}.ck-content figure.table:not(.layout-table)>table>tbody>tr>th,.ck-content figure.table:not(.layout-table)>table>thead>tr>th,.ck-content table.table:not(.layout-table)>tbody>tr>th,.ck-content table.table:not(.layout-table)>thead>tr>th{background:rgba(0,0,0,.05);font-weight:700}.ck-content figure.table:not(.layout-table)>table>tbody>tr>td,.ck-content figure.table:not(.layout-table)>table>tbody>tr>th,.ck-content figure.table:not(.layout-table)>table>thead>tr>td,.ck-content figure.table:not(.layout-table)>table>thead>tr>th,.ck-content table.table:not(.layout-table)>tbody>tr>td,.ck-content table.table:not(.layout-table)>tbody>tr>th,.ck-content table.table:not(.layout-table)>thead>tr>td,.ck-content table.table:not(.layout-table)>thead>tr>th{border:1px solid #bfbfbf;min-width:2em;padding:.4em}.ck-content figure.table:not(.layout-table)>table>tbody>tr>td>p:first-of-type,.ck-content figure.table:not(.layout-table)>table>tbody>tr>th>p:first-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>td>p:first-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>th>p:first-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>td>p:first-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>th>p:first-of-type,.ck-content table.table:not(.layout-table)>thead>tr>td>p:first-of-type,.ck-content table.table:not(.layout-table)>thead>tr>th>p:first-of-type{margin-top:0}.ck-content figure.table:not(.layout-table)>table>tbody>tr>td>p:last-of-type,.ck-content figure.table:not(.layout-table)>table>tbody>tr>th>p:last-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>td>p:last-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>th>p:last-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>td>p:last-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>th>p:last-of-type,.ck-content table.table:not(.layout-table)>thead>tr>td>p:last-of-type,.ck-content table.table:not(.layout-table)>thead>tr>th>p:last-of-type{margin-bottom:0}@media print{.ck-content figure.table:not(.layout-table){height:fit-content;width:fit-content}.ck-content figure.table:not(.layout-table)>table{height:auto}}.ck-editor__editable .ck-table-bogus-paragraph{display:inline-block;width:100%}",""]);const a=r},163:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},188:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-input-color{display:flex;flex-direction:row-reverse;width:100%}.ck.ck-input-color>input.ck.ck-input-text{flex-grow:1;min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button{display:flex}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{overflow:hidden;position:relative}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{display:block;position:absolute}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-bottom-right-radius:0;border-top-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-bottom-left-radius:0;border-top-left-radius:0}.ck.ck-input-color>.ck.ck-input-text:focus{z-index:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-bottom-left-radius:0;border-top-left-radius:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button:not(:focus){border-left:1px solid transparent}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-bottom-right-radius:0;border-top-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button:not(:focus){border-right:1px solid transparent}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview{border:1px solid var(--ck-color-input-border);border-radius:0;height:20px;width:20px}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{background:red;border-radius:2px;height:150%;left:50%;top:-30%;transform:rotate(45deg);transform-origin:50%;width:8%}.ck.ck-input-color .ck.ck-input-color__remove-color{border-bottom-left-radius:0;border-bottom-right-radius:0;padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);width:100%}.ck.ck-input-color .ck.ck-input-color__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-input-border)}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard);margin-right:0}",""]);const a=r},237:e=>{"use strict";e.exports=CKEditor5.dll},305:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var o="",i=void 0!==t[5];return t[4]&&(o+="@supports (".concat(t[4],") {")),t[2]&&(o+="@media ".concat(t[2]," {")),i&&(o+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),o+=e(t),i&&(o+="}"),t[2]&&(o+="}"),t[4]&&(o+="}"),o}).join("")},t.i=function(e,o,i,l,n){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(i)for(var a=0;a<this.length;a++){var s=this[a][0];null!=s&&(r[s]=!0)}for(var c=0;c<e.length;c++){var d=[].concat(e[c]);i&&r[d[0]]||(void 0!==n&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=n),o&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=o):d[2]=o),l&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=l):d[4]="".concat(l)),t.push(d))}},t}},311:(e,t,o)=>{e.exports=o(237)("./src/ui.js")},331:(e,t,o)=>{e.exports=o(237)("./src/clipboard.js")},337:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,'.ck.ck-table-form .ck-form__row.ck-table-form__background-row,.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{align-items:center;flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{align-items:center;display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck-form__row>:not(.ck-label,.ck-table-form__dimension-operator){flex-grow:1}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;position:absolute;transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";left:50%;position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{max-width:80px;min-width:80px;width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:flex-end;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-field-view{padding-top:var(--ck-spacing-standard)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both;background:var(--ck-color-base-error);border-radius:0;color:var(--ck-color-base-background);min-width:var(--ck-table-properties-min-error-width);padding:var(--ck-spacing-small) var(--ck-spacing-medium);text-align:center}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-color:transparent transparent var(--ck-color-base-error) transparent;border-style:solid;border-width:0 var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size)}@media (prefers-reduced-motion:reduce){.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:none}}.ck.ck-table-form .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}',""]);const a=r},355:(e,t,o)=>{e.exports=o(237)("./src/icons.js")},380:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:first-of-type{flex-grow:0.57}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:last-of-type{flex-grow:0.43}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar .ck-button{flex-grow:1}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{align-self:flex-end;padding:0;width:25%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}",""]);const a=r},419:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,':root{--ck-color-table-focused-cell-background:rgba(158,201,250,.3);--ck-table-content-default-border-color:#d4d4d4}.ck-widget.table table[style*="border-style:none"],.ck-widget.table table[style*="border:none"]{outline:var(--ck-table-content-default-border-color) 1px dashed}.ck-widget.table td.ck-editor__nested-editable,.ck-widget.table th.ck-editor__nested-editable{outline:unset}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused:not(.ck-editor__editable_selected),.ck-widget.table td.ck-editor__nested-editable:not(.ck-editor__editable_selected):focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused:not(.ck-editor__editable_selected),.ck-widget.table th.ck-editor__nested-editable:not(.ck-editor__editable_selected):focus{background:var(--ck-color-table-focused-cell-background);outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}',""]);const a=r},424:e=>{"use strict";var t={};e.exports=function(e,o){var i=function(e){if(void 0===t[e]){var o=document.querySelector(e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}t[e]=o}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(o)}},433:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-color-table-column-resizer-hover:var(--ck-color-base-active);--ck-table-column-resizer-width:7px;--ck-table-column-resizer-position-offset:calc(var(--ck-table-column-resizer-width)*-0.5 - 0.5px)}.ck-content .table .ck-table-resized{table-layout:fixed}.ck-content .table td,.ck-content .table th{overflow-wrap:break-word}.ck.ck-editor__editable .table td,.ck.ck-editor__editable .table th{position:relative}.ck.ck-editor__editable .table .ck-table-column-resizer{bottom:0;cursor:col-resize;position:absolute;right:var(--ck-table-column-resizer-position-offset);top:0;user-select:none;width:var(--ck-table-column-resizer-width);z-index:var(--ck-z-default)}.ck.ck-editor__editable .table[draggable] .ck-table-column-resizer,.ck.ck-editor__editable.ck-column-resize_disabled .table .ck-table-column-resizer{display:none}.ck.ck-editor__editable .table .ck-table-column-resizer:hover,.ck.ck-editor__editable .table .ck-table-column-resizer__active{background-color:var(--ck-color-table-column-resizer-hover);opacity:.25}.ck.ck-editor__editable[dir=rtl] .table .ck-table-column-resizer{left:var(--ck-table-column-resizer-position-offset);right:unset}",""]);const a=r},489:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,':root{--ck-table-selected-cell-background:rgba(158,207,250,.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{box-shadow:unset;caret-color:transparent;position:relative}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{background-color:var(--ck-table-selected-cell-background);bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget{outline:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget>.ck-widget__selection-handle,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget>.ck-widget__selection-handle{display:none}',""]);const a=r},517:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach(function(o){e.setAttribute(o,t[o])})}},538:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0;width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2)}.ck .ck-insert-table-dropdown__label,.ck[dir=rtl] .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{border:1px solid var(--ck-color-base-border);border-radius:1px;margin:var(--ck-insert-table-dropdown-box-margin);min-height:var(--ck-insert-table-dropdown-box-height);min-width:var(--ck-insert-table-dropdown-box-width);outline:none;transition:none}@media (prefers-reduced-motion:reduce){.ck .ck-insert-table-dropdown-grid-box{transition:none}}.ck .ck-insert-table-dropdown-grid-box:focus{box-shadow:none}.ck .ck-insert-table-dropdown-grid-box.ck-on{background:var(--ck-color-focus-outer-shadow);border-color:var(--ck-color-focus-border)}",""]);const a=r},562:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-form__row.ck-table-form__action-row{justify-content:flex-end}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row>:not(.ck-label)+*{margin-inline-start:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{min-width:100%;width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}",""]);const a=r},584:(e,t,o)=>{e.exports=o(237)("./src/utils.js")},664:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-content:baseline;flex-basis:0;flex-wrap:wrap}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-self:flex-end;padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}",""]);const a=r},719:e=>{"use strict";var t=[];function o(e){for(var o=-1,i=0;i<t.length;i++)if(t[i].identifier===e){o=i;break}return o}function i(e,i){for(var n={},r=[],a=0;a<e.length;a++){var s=e[a],c=i.base?s[0]+i.base:s[0],d=n[c]||0,u="".concat(c," ").concat(d);n[c]=d+1;var b=o(u),h={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==b)t[b].references++,t[b].updater(h);else{var m=l(h,i);i.byIndex=a,t.splice(a,0,{identifier:u,updater:m,references:1})}r.push(u)}return r}function l(e,t){var o=t.domAPI(t);o.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;o.update(e=t)}else o.remove()}}e.exports=function(e,l){var n=i(e=e||[],l=l||{});return function(e){e=e||[];for(var r=0;r<n.length;r++){var a=o(n[r]);t[a].references--}for(var s=i(e,l),c=0;c<n.length;c++){var d=o(n[c]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}n=s}}},782:(e,t,o)=>{e.exports=o(237)("./src/core.js")},783:(e,t,o)=>{e.exports=o(237)("./src/engine.js")},792:e=>{"use strict";e.exports=function(e){return e[1]}},794:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,'.ck.ck-table-form .ck-form__row.ck-table-form__background-row,.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{align-items:center;flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{align-items:center;display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown{flex-grow:0}.ck.ck-table-form .ck-form__row:not(.ck-table-form__action-row)>:not(.ck-label,.ck-table-form__dimension-operator){flex-grow:1}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;position:absolute;transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";left:50%;position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form.ck-table-properties-form_experimental{--ck-table-form-default-input-width:80px}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{max-width:var(--ck-table-form-default-input-width);min-width:var(--ck-table-form-default-input-width);width:var(--ck-table-form-default-input-width)}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row{--ck-table-form-dimensions-input-width:calc(var(--ck-table-form-default-input-width)*2 + var(--ck-spacing-large));max-width:var(--ck-table-form-dimensions-input-width);min-width:var(--ck-table-form-dimensions-input-width);padding:0;width:var(--ck-table-form-dimensions-input-width)}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0;max-width:var(--ck-table-form-default-input-width);min-width:var(--ck-table-form-default-input-width);width:var(--ck-table-form-default-input-width)}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:flex-end;display:inline-block;height:var(--ck-ui-component-min-height);left:-.5ch;line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small);overflow:visible;position:relative;width:0}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view{padding-top:var(--ck-spacing-standard)}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both;background:var(--ck-color-base-error);border-radius:0;color:var(--ck-color-base-background);min-width:var(--ck-table-properties-min-error-width);padding:var(--ck-spacing-small) var(--ck-spacing-medium);text-align:center}.ck-rounded-corners .ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-color:transparent transparent var(--ck-color-base-error) transparent;border-style:solid;border-width:0 var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size)}@media (prefers-reduced-motion:reduce){.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:none}}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}',""]);const a=r},863:e=>{"use strict";var t,o=(t=[],function(e,o){return t[e]=o,t.filter(Boolean).join("\n")});function i(e,t,i,l){var n;if(i)n="";else{n="",l.supports&&(n+="@supports (".concat(l.supports,") {")),l.media&&(n+="@media ".concat(l.media," {"));var r=void 0!==l.layer;r&&(n+="@layer".concat(l.layer.length>0?" ".concat(l.layer):""," {")),n+=l.css,r&&(n+="}"),l.media&&(n+="}"),l.supports&&(n+="}")}if(e.styleSheet)e.styleSheet.cssText=o(t,n);else{var a=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}var l={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=l.singletonCounter++,o=l.singleton||(l.singleton=e.insertStyleElement(e));return{update:function(e){i(o,t,!1,e)},remove:function(e){i(o,t,!0,e)}}}},865:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row>:not(.ck-label)+*{margin-inline-start:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{min-width:100%;width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}",""]);const a=r},901:(e,t,o)=>{e.exports=o(237)("./src/widget.js")},965:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-content-color-table-caption-background:#f7f7f7;--ck-content-color-table-caption-text:#333;--ck-color-table-caption-highlighted-background:#fd0}.ck-content .table>figcaption,.ck-content figure.table>table>caption{background-color:var(--ck-content-color-table-caption-background);caption-side:top;color:var(--ck-content-color-table-caption-text);display:table-caption;font-size:.75em;outline-offset:-1px;overflow-wrap:anywhere;padding:.6em;text-align:center;word-break:normal}@media (forced-colors:active){.ck-content .table>figcaption,.ck-content figure.table>table>caption{background-color:unset;color:unset}}@media (forced-colors:none){.ck.ck-editor__editable .table>figcaption.table__caption_highlighted,.ck.ck-editor__editable figure.table>table>caption.table__caption_highlighted{animation:ck-table-caption-highlight .6s ease-out}}.ck.ck-editor__editable .table>figcaption.ck-placeholder:before,.ck.ck-editor__editable figure.table>table>caption.ck-placeholder:before{overflow:hidden;padding-left:inherit;padding-right:inherit;text-overflow:ellipsis;white-space:nowrap}@keyframes ck-table-caption-highlight{0%{background-color:var(--ck-color-table-caption-highlighted-background)}to{background-color:var(--ck-content-color-table-caption-background)}}",""]);const a=r},993:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-content-table-style-spacing:1.5em}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-content:baseline;flex-basis:0;flex-wrap:wrap}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck-content .table.table-style-align-left{float:left;margin-right:var(--ck-content-table-style-spacing)}.ck-content .table.table-style-align-right{float:right;margin-left:var(--ck-content-table-style-spacing)}.ck-content .table.table-style-align-center{margin-left:auto;margin-right:auto}.ck-content .table.table-style-block-align-left{margin-left:0;margin-right:auto}.ck-content .table.table-style-block-align-right{margin-left:auto;margin-right:0}.ck-editor__editable .table.layout-table.table-style-align-center{margin-left:auto;margin-right:auto}.ck-editor__editable .table.layout-table.table-style-align-left{margin-right:var(--ck-content-table-style-spacing)}.ck-editor__editable .table.layout-table.table-style-align-right{margin-left:var(--ck-content-table-style-spacing)}.ck-editor__editable .table.layout-table.table-style-block-align-left{margin-left:0;margin-right:auto}.ck-editor__editable .table.layout-table.table-style-block-align-right{margin-left:auto;margin-right:0}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-self:flex-end}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{flex:1}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-properties-form__alignment-row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__action-row{justify-content:flex-end}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__action-row>.ck.ck-button{flex-grow:0}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__action-row>.ck.ck-button .ck-button__label{color:currentColor}",""]);const a=r}},t={};function o(i){var l=t[i];if(void 0!==l)return l.exports;var n=t[i]={id:i,exports:{}};return e[i](n,n.exports,o),n.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";o.r(i),o.d(i,{InsertColumnCommand:()=>te,InsertRowCommand:()=>ee,InsertTableCommand:()=>Q,InsertTableLayoutCommand:()=>Ho,MergeCellCommand:()=>ie,MergeCellsCommand:()=>Fe,PlainTableOutput:()=>Wt,RemoveColumnCommand:()=>re,RemoveRowCommand:()=>ne,SelectColumnCommand:()=>Oe,SelectRowCommand:()=>ze,SetHeaderColumnCommand:()=>se,SetHeaderRowCommand:()=>ae,SplitCellCommand:()=>oe,Table:()=>Ft,TableAlignmentCommand:()=>Ci,TableBackgroundColorCommand:()=>gi,TableBorderColorCommand:()=>pi,TableBorderStyleCommand:()=>fi,TableBorderWidthCommand:()=>wi,TableCaption:()=>ji,TableCaptionEditing:()=>zi,TableCaptionUI:()=>Oi,TableCellBackgroundColorCommand:()=>Po,TableCellBorderColorCommand:()=>Bo,TableCellBorderStyleCommand:()=>Eo,TableCellBorderWidthCommand:()=>Lo,TableCellHeightCommand:()=>So,TableCellHorizontalAlignmentCommand:()=>Ro,TableCellPaddingCommand:()=>Vo,TableCellProperties:()=>No,TableCellPropertiesEditing:()=>Do,TableCellPropertiesUI:()=>vo,TableCellPropertiesUIExperimental:()=>al,TableCellPropertiesView:()=>ho,TableCellPropertiesViewExperimental:()=>ll,TableCellPropertyCommand:()=>To,TableCellVerticalAlignmentCommand:()=>Io,TableCellWidthCommand:()=>Ao,TableCellWidthEditing:()=>xo,TableClipboard:()=>Tt,TableColumnResize:()=>ni,TableColumnResizeEditing:()=>oi,TableEditing:()=>ut,TableHeightCommand:()=>ki,TableKeyboard:()=>St,TableLayout:()=>hi,TableLayoutEditing:()=>di,TableLayoutUI:()=>zo,TableMouse:()=>Rt,TableProperties:()=>Ei,TablePropertiesEditing:()=>yi,TablePropertiesUI:()=>Ri,TablePropertiesUIExperimental:()=>il,TablePropertiesView:()=>Si,TablePropertiesViewExperimental:()=>el,TablePropertyCommand:()=>mi,TableSelection:()=>yt,TableToolbar:()=>Mt,TableTypeCommand:()=>ri,TableUI:()=>wt,TableUtils:()=>Ie,TableWalker:()=>v,TableWidthCommand:()=>_i,TableWidthsCommand:()=>Zo,ToggleTableCaptionCommand:()=>Ni,_InsertTableView:()=>ft,_TABLE_COLUMN_MIN_WIDTH_AS_PERCENTAGE:()=>ce,_TABLE_COLUMN_MIN_WIDTH_IN_PIXELS:()=>de,_TABLE_COLUMN_RESIZE_DISTANCE_THRESHOLD:()=>be,_TABLE_COLUMN_WIDTH_PRECISION:()=>ue,_TABLE_DEFAULT_COLORS:()=>to,_TableColorInputView:()=>Ut,_TableMouseEventsObserver:()=>It,_addDefaultUnitToNumericValue:()=>H,_adjustLastTableColumnIndex:()=>F,_adjustLastTableRowIndex:()=>L,_clamp:()=>ke,_colorTableFieldValidator:()=>Xt,_convertParagraphInTableCell:()=>J,_createEmptyTableCell:()=>_,_createFilledArray:()=>Ce,_cropTableToDimensions:()=>A,_downcastTable:()=>K,_downcastTableAttribute:()=>s,_downcastTableAttributeToStyle:()=>a,_downcastTableCell:()=>q,_downcastTableResizedClass:()=>ei,_downcastTableRow:()=>G,_enableTableCellProperty:()=>C,_ensureParagraphInTableCell:()=>O,_fillTableOrCellToolbar:()=>eo,_getBalloonTableCellPositionData:()=>ko,_getBalloonTablePositionData:()=>_o,_getBorderTableStyleLabels:()=>Gt,_getChangedResizedTables:()=>he,_getDefaultTableValueAdjusted:()=>c,_getDomTableCellOuterWidth:()=>Te,_getElementWidthInPixels:()=>fe,_getHorizontallyOverlappingTableCells:()=>S,_getLabeledTableColorInputCreator:()=>oo,_getLocalizedTableColorErrorText:()=>qt,_getLocalizedTableLengthErrorText:()=>Jt,_getNormalizedDefaultTableBaseProperties:()=>j,_getNormalizedDefaultTableCellProperties:()=>$,_getNormalizedDefaultTableProperties:()=>U,_getSelectedTableWidget:()=>Nt,_getSelectionAffectedTable:()=>y,_getSelectionAffectedTableWidget:()=>Dt,_getTableBorderBoxSingleValue:()=>M,_getTableCaptionFromModelElement:()=>Fi,_getTableCaptionFromModelSelection:()=>Wi,_getTableColumnEdgesIndexes:()=>we,_getTableColumnElements:()=>Ve,_getTableColumnGroupElement:()=>xe,_getTableColumnMinWidthAsPercentage:()=>me,_getTableColumnsWidths:()=>Se,_getTableOrCellBorderStyleDefinitions:()=>Qt,_getTableWidgetAncestor:()=>zt,_getTableWidthInPixels:()=>ge,_getVerticallyOverlappingTableCells:()=>x,_injectTableCaptionPostFixer:()=>Bi,_injectTableCellParagraphPostFixer:()=>$e,_injectTableLayoutPostFixer:()=>Me,_isSingleTableParagraphWithoutAttributes:()=>X,_isTableHeadingColumnCell:()=>k,_isTableModelElement:()=>Li,_lengthTableFieldValidator:()=>Yt,_lineWidthTableFieldValidator:()=>Zt,_matchTableCaptionViewElement:()=>Di,_normalizeTableColumnWidths:()=>ve,_removeEmptyTableColumns:()=>R,_removeEmptyTableRows:()=>E,_removeEmptyTableRowsColumns:()=>B,_repositionTableContextualBalloon:()=>wo,_skipEmptyTableRow:()=>z,_splitTableCellHorizontally:()=>V,_splitTableCellVertically:()=>P,_sumArray:()=>ye,_tableCellRefreshHandler:()=>Ye,_tableHeadingsRefreshHandler:()=>Xe,_toPrecision:()=>_e,_translateTableColspanAttribute:()=>Pe,_trimTableCellIfNeeded:()=>I,_upcastNormalizedTableStyleToAttribute:()=>n,_upcastTable:()=>N,_upcastTableBorderStyles:()=>r,_upcastTableColgroupElement:()=>Qo,_upcastTableFigure:()=>D,_updateTableColumnElements:()=>Ae,_updateTableNumericAttribute:()=>w});var e=o(782),t=o(901),l=o(584);function n(e,t){const{modelAttribute:o,styleName:i,attributeName:l,attributeType:n,viewElement:r,defaultValue:a,shouldUpcast:s=()=>!0,reduceBoxSides:u=!1}=t;e.for("upcast").attributeToAttribute({view:{name:r,styles:{[i]:/[\s\S]+/}},model:{key:o,value:(e,t,o)=>{if(!s(e))return;const l=c(a,"",o),n=e.getNormalizedStyle(i),r=u?d(n):n;if(l!==r)return r;t.consumable.consume(e,{styles:i})}}}),l&&e.for("upcast").attributeToAttribute({view:{name:r,attributes:{[l]:/.+/}},model:{key:o,value:(e,t,o)=>{if("figure"==e.name||e.hasStyle(i)||"table"==e.name&&"figure"==e.parent.name&&e.parent.hasStyle(i))return;const r=c(a,"",o);let s=e.getAttribute(l);if(s&&"length"==n&&!s.endsWith("px")&&(s+="px"),r!==s)return s;t.consumable.consume(e,{attributes:l})}}})}function r(e,t,o,i){const{conversion:l}=e;l.for("upcast").add(e=>e.on("element:"+t,(e,t,l)=>{if(!t.modelRange)return;const n=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(e=>t.viewItem.hasStyle(e));if(!n.length)return;const r={styles:n};if(!l.consumable.test(t.viewItem,r))return;const a=[...t.modelRange.getItems({shallow:!0})].pop(),s=a.findAncestor("table",{includeSelf:!0});let c=i;s&&"layout"==s.getAttribute("tableType")&&(c={style:"none",color:"",width:""}),l.consumable.consume(t.viewItem,r);const u={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},b={style:d(u.style),color:d(u.color),width:d(u.width)};b.style!==c.style&&l.writer.setAttribute(o.style,b.style,a),b.color!==c.color&&l.writer.setAttribute(o.color,b.color,a),b.width!==c.width&&l.writer.setAttribute(o.width,b.width,a)})),e.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&l.for("upcast").add(e=>{e.on(`element:${t}`,(e,t,i)=>{const{modelRange:l,viewItem:n}=t,r=n.is("element","table")?n:n.findAncestor("table");if(!i.consumable.test(r,{attributes:"border"}))return;if("0"!==r.getAttribute("border"))return;const a=l?.start?.nodeAfter;a&&!a.hasAttribute(o.style)&&(i.writer.setAttribute(o.style,"none",a),n.is("element","table")&&i.consumable.consume(n,{attributes:"border"}))})})}function a(e,t){const{modelElement:o,modelAttribute:i,styleName:l}=t;e.for("downcast").attributeToAttribute({model:{name:o,key:i},view:e=>({key:"style",value:{[l]:e}})})}function s(e,t){const{modelAttribute:o,styleName:i}=t;e.for("downcast").add(e=>e.on(`attribute:${o}:table`,(e,t,o)=>{const{item:l,attributeNewValue:n}=t,{mapper:r,writer:a}=o;if(!o.consumable.consume(t.item,e.name))return;const s=[...r.toViewElement(l).getChildren()].find(e=>e.is("element","table"));n?a.setStyle(i,n,s):a.removeStyle(i,s)}))}function c(e,t,o){const i=o.modelRange&&(0,l.first)(o.modelRange.getItems({shallow:!0})),n=i&&i.is("element")&&i.findAncestor("table",{includeSelf:!0});return n&&"layout"===n.getAttribute("tableType")?t:e}function d(e){if(!e)return;const t=["top","right","bottom","left"];if(!t.every(t=>e[t]))return e;const o=e.top;return t.every(t=>e[t]===o)?o:e}const u={className:"table-style-align-left"},b={className:"table-style-align-center"},h={className:"table-style-align-right"},m={className:"table-style-block-align-left"},g={className:"table-style-block-align-right"},p=[{view:{name:/^(table|figure)$/,styles:{float:/^(left|none|right)$/}},getAlign:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t},getConsumables(e){const t=e.getStyle("float"),o=["float"];return"left"===t&&e.hasStyle("margin-right")?o.push("margin-right"):"right"===t&&e.hasStyle("margin-left")&&o.push("margin-left"),{styles:o}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},getAlign:()=>"center",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,key:"class",value:"table-style-align-left"},getAlign:()=>"left",getConsumables:()=>({classes:u.className})},{view:{name:/^(table|figure)$/,key:"class",value:h.className},getAlign:()=>"right",getConsumables:()=>({classes:h.className})},{view:{name:/^(table|figure)$/,key:"class",value:b.className},getAlign:()=>"center",getConsumables:()=>({classes:b.className})},{view:{name:/^(table|figure)$/,key:"class",value:m.className},getAlign:()=>"blockLeft",getConsumables:()=>({classes:m.className})},{view:{name:/^(table|figure)$/,key:"class",value:g.className},getAlign:()=>"blockRight",getConsumables:()=>({classes:g.className})},{view:{name:/^(table|figure)$/,styles:{"margin-left":"0","margin-right":"auto"}},getAlign:()=>"blockLeft",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"0"}},getAlign:()=>"blockRight",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:"table",attributes:{align:/^(left|center|right)$/}},getAlign:e=>e.getAttribute("align"),getConsumables:()=>({attributes:"align"})}],f={center:{align:"center",style:"margin-left: auto; margin-right: auto;",className:"table-style-align-center"},left:{align:"left",style:"float: left;",className:"table-style-align-left"},right:{align:"right",style:"float: right;",className:"table-style-align-right"},blockLeft:{align:void 0,style:"margin-left: 0; margin-right: auto;",className:m.className},blockRight:{align:void 0,style:"margin-left: auto; margin-right: 0;",className:g.className}};function w(e,t,o,i,l=1){null!=t&&null!=l&&t>l?i.setAttribute(e,t,o):i.removeAttribute(e,o)}function _(e,t,o={}){const i=e.createElement("tableCell",o);return e.insertElement("paragraph",i),e.insert(i,t),i}function k(e,t){const o=t.parent.parent,i=parseInt(o.getAttribute("headingColumns")||"0"),{column:l}=e.getCellLocation(t);return!!i&&l<i}function C(e,t,o){const{modelAttribute:i}=o;e.extend("tableCell",{allowAttributes:[i]}),e.setAttributeProperties(i,{isFormatting:!0}),n(t,{viewElement:/^(td|th)$/,...o}),a(t,{modelElement:"tableCell",...o})}function y(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}class v{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const o=this._getSpanned();if(o)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(o.cell,o.row,o.column));else{const o=e.getChild(this._cellIndex);if(!o)return this._advanceToNextRow();const i=parseInt(o.getAttribute("colspan")||"1"),l=parseInt(o.getAttribute("rowspan")||"1");(i>1||l>1)&&this._recordSpans(o,l,i),this._shouldSkipSlot()||(t=this._formatOutValue(o)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,o=this._column){return{done:!1,value:new T(this,e,t,o)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,o=this._column<this._startColumn,i=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||o||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){const i={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+o;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,i)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,o)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}}class T{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,o,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function A(e,t,o){const{startRow:i,startColumn:l,endRow:n,endColumn:r}=t,a=o.createElement("table"),s=e.getAttribute("tableType");s&&o.setAttribute("tableType",s,a);const c=n-i+1;for(let e=0;e<c;e++)o.insertElement("tableRow",a,"end");const d=[...new v(e,{startRow:i,endRow:n,startColumn:l,endColumn:r,includeAllSlots:!0})];for(const{row:e,column:t,cell:s,isAnchor:c,cellAnchorRow:u,cellAnchorColumn:b}of d){const d=e-i,h=a.getChild(d);if(c){const i=o.cloneElement(s);o.append(i,h),I(i,e,t,n,r,o)}else(u<i||b<l)&&_(o,o.createPositionAt(h,"end"))}return function(e,t,o,i,l){const n=parseInt(t.getAttribute("headingRows")||"0");if(n>0){w("headingRows",n-o,e,l,0)}const r=parseInt(t.getAttribute("headingColumns")||"0");if(r>0){w("headingColumns",r-i,e,l,0)}}(a,e,i,l,o),a}function x(e,t,o=0){const i=[],l=new v(e,{startRow:o,endRow:t-1});for(const e of l){const{row:o,cellHeight:l}=e;o<t&&t<=o+l-1&&i.push(e)}return i}function V(e,t,o){const i=e.parent,l=i.parent,n=i.index,r=t-n,a={},s=parseInt(e.getAttribute("rowspan"))-r;s>1&&(a.rowspan=s);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const d=n+r,u=[...new v(l,{startRow:n,endRow:d,includeAllSlots:!0})];let b,h=null;for(const t of u){const{row:i,column:l,cell:n}=t;n===e&&void 0===b&&(b=l),void 0!==b&&b===l&&i===d&&(h=_(o,t.getPositionBefore(),a))}return w("rowspan",r,e,o),h}function S(e,t){const o=[],i=new v(e);for(const e of i){const{column:i,cellWidth:l}=e;i<t&&t<=i+l-1&&o.push(e)}return o}function P(e,t,o,i){const l=o-t,n={},r=parseInt(e.getAttribute("colspan"))-l;r>1&&(n.colspan=r);const a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(n.rowspan=a);const s=_(i,i.createPositionAfter(e),n);return w("colspan",l,e,i),s}function I(e,t,o,i,l,n){const r=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");if(o+r-1>l){w("colspan",l-o+1,e,n,1)}if(t+a-1>i){w("rowspan",i-t+1,e,n,1)}}function R(e,t){const o=t.getColumns(e),i=new Array(o).fill(0);for(const{column:t}of new v(e))i[t]++;const l=i.reduce((e,t,o)=>t?e:[...e,o],[]);if(l.length>0){const o=l[l.length-1];return t.removeColumns(e,{at:o}),!0}return!1}function E(e,t){const o=[],i=t.getRows(e);for(let t=0;t<i;t++){e.getChild(t).isEmpty&&o.push(t)}if(o.length>0){const i=o[o.length-1];return t.removeRows(e,{at:i}),!0}return!1}function B(e,t){R(e,t)||E(e,t)}function L(e,t){const o=Array.from(new v(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(o.every(({cellHeight:e})=>1===e))return t.lastRow;const i=o[0].cellHeight-1;return t.lastRow+i}function F(e,t){const o=Array.from(new v(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(o.every(({cellWidth:e})=>1===e))return t.lastColumn;const i=o[0].cellWidth-1;return t.lastColumn+i}function W(e){for(const t of e.getChildren())if(t.is("element","table"))return t}function D(){return e=>{e.on("element:figure",(e,t,o)=>{if(!o.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const i=W(t.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(t.viewItem,{name:!0,classes:"table"});const n=o.convertItem(i,t.modelCursor),r=(0,l.first)(n.modelRange.getItems());if(!r||!r.is("element","table"))return o.consumable.revert(t.viewItem,{name:!0,classes:"table"}),void(n.modelRange&&!n.modelRange.isCollapsed&&(t.modelRange=n.modelRange,t.modelCursor=n.modelCursor));o.convertChildren(t.viewItem,o.writer.createPositionAt(r,"end")),o.updateConversionResult(r,t)})}}function N(){return e=>{e.on("element:table",(e,t,o)=>{const i=t.viewItem;if(!o.consumable.test(i,{name:!0}))return;const{rows:l,headingRows:n,headingColumns:r}=function(e){let t,o=0;const i=[],l=[];let n;for(const t of Array.from(e.getChildren())){if("tbody"!==t.name&&"thead"!==t.name&&"tfoot"!==t.name)continue;"thead"!==t.name||n||(n=t);const e=Array.from(t.getChildren()).filter(e=>e.is("element","tr"));let r=null;for(const a of e){const e=Array.from(a.getChildren()).filter(e=>e.is("element","td")||e.is("element","th"));n&&t===n||"tbody"===t.name&&e.length>0&&(null===r||e.length===r)&&e.every(e=>e.is("element","th"))?(o++,i.push(a)):l.push(a),r=Math.max(r||0,e.length)}}const r=function(e){let t=new Map,o=0;const i=e.map(e=>{const i=[],l=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name),n=new Map;for(;l.length||i.length<o;){const e=t.get(i.length);if(e&&e.remaining>0)i.push(e.cell);else{const e=l.shift();if(!e){i.push(null);continue}{const t=parseInt(e.getAttribute("colspan")||"1"),o=parseInt(e.getAttribute("rowspan")||"1");for(let l=0;l<t;l++)o>1&&n.set(i.length,{cell:e,remaining:o-1}),i.push(e)}}}for(const[e,o]of t.entries())o.remaining-=1,o.remaining>0&&!n.has(e)&&n.set(e,o);return t=n,o=Math.max(o,i.length),i});for(const e of i)for(;e.length<o;)e.push(null);return i}(l);for(const e of r){let o=0;for(;o<e.length&&"th"===e[o]?.name;)o+=1;(!t||o<t)&&(t=o)}return{headingRows:o,headingColumns:t||0,rows:[...i,...l]}}(i),a={};r&&(a.headingColumns=r),n&&(a.headingRows=n);const s=o.writer.createElement("table",a);if(o.safeInsert(s,t.modelCursor)){if(o.consumable.consume(i,{name:!0}),l.forEach(e=>o.convertItem(e,o.writer.createPositionAt(s,"end"))),o.convertChildren(i,o.writer.createPositionAt(s,"end")),s.isEmpty){const e=o.writer.createElement("tableRow");o.writer.insert(e,o.writer.createPositionAt(s,"end")),_(o.writer,o.writer.createPositionAt(e,"end"))}o.updateConversionResult(s,t)}})}}function z(){return e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}}function O(e){return t=>{t.on(`element:${e}`,(e,t,{writer:o})=>{if(!t.modelRange)return;const i=t.modelRange.start.nodeAfter,l=o.createPositionAt(i,0);if(t.viewItem.isEmpty)return void o.insertElement("paragraph",l);const n=Array.from(i.getChildren());if(n.every(e=>e.is("element","$marker"))){const e=o.createElement("paragraph");o.insert(e,o.createPositionAt(i,0));for(const t of n)o.move(o.createRangeOn(t),o.createPositionAt(e,"end"))}},{priority:"low"})}}function M(e){if(!e||(null===(t=e)||"object"!=typeof t&&"function"!=typeof t))return e;var t;const{top:o,right:i,bottom:l,left:n}=e;return o==i&&i==l&&l==n?o:void 0}function H(e,t){const o=parseFloat(e);return Number.isNaN(o)||String(o)!==String(e)?e:`${o}${t}`}function j(e,t={}){const o={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!o.alignment&&(o.alignment="center"),t.includePaddingProperty&&!o.padding&&(o.padding=""),t.includeVerticalAlignmentProperty&&!o.verticalAlignment&&(o.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!o.horizontalAlignment&&(o.horizontalAlignment=t.isRightToLeftContent?"right":"left"),o}function U(e,t){return j({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...e},t)}function $(e,t){return j({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...e},t)}function K(e,o){return(i,{writer:l})=>{const n=i.getAttribute("headingRows")||0,r=l.createContainerElement("table",null,[]),a=l.createContainerElement("figure",{class:"table"},r);n>0&&l.insert(l.createPositionAt(r,"end"),l.createContainerElement("thead",null,l.createSlot(e=>e.is("element","tableRow")&&e.index<n))),n<e.getRows(i)&&l.insert(l.createPositionAt(r,"end"),l.createContainerElement("tbody",null,l.createSlot(e=>e.is("element","tableRow")&&e.index>=n)));for(const{positionOffset:e,filter:t}of o.additionalSlots)l.insert(l.createPositionAt(r,e),l.createSlot(t));return l.insert(l.createPositionAt(r,"after"),l.createSlot(e=>!e.is("element","tableRow")&&!o.additionalSlots.some(({filter:t})=>t(e)))),o.asWidget?function(e,o){return o.setCustomProperty("table",!0,e),(0,t.toWidget)(e,o,{hasSelectionHandle:!0})}(a,l):a}}function G(){return(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}function q(e={}){return(o,{writer:i})=>{const l=o.parent,n=l.parent,r=n.getChildIndex(l),a=new v(n,{row:r}),s=n.getAttribute("headingRows")||0,c=n.getAttribute("headingColumns")||0;let d=null;for(const l of a)if(l.cell==o){const o=l.row<s||l.column<c?"th":"td";d=e.asWidget?(0,t.toWidgetEditable)(i.createEditableElement(o),i,{withAriaRole:!1}):i.createContainerElement(o);break}return d}}function J(e={}){return(t,{writer:o})=>{if(!t.parent.is("element","tableCell"))return null;if(!X(t))return null;if(e.asWidget)return o.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=o.createContainerElement("p");return o.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function X(e){return 1==e.parent.childCount&&!function(e){for(const t of e.getAttributeKeys())if(!t.startsWith("selection:")&&"htmlEmptyBlock"!=t)return!0;return!1}(e)}function Y(e){return(t,o)=>{const i=e.plugins.has("PlainTableOutput"),l=o.options.isClipboardPipeline,n=e.config.get("experimentalFlags.useExtendedTableBlockAlignment");return i||n&&l?function(e,t,o){const i=t.writer,l=e.getAttribute("headingRows")||0,n=i.createSlot(e=>e.is("element","tableRow")&&e.index<l),r=i.createSlot(e=>e.is("element","tableRow")&&e.index>=l),a=i.createSlot(e=>!e.is("element","tableRow")),s=i.createContainerElement("thead",null,n),c=i.createContainerElement("tbody",null,r),d=[];l&&d.push(s);l<e.childCount&&d.push(c);const u={class:"table"};if(o.plugins.has("TableProperties")&&t.options.isClipboardPipeline){const t=U(o.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),i=e.getAttribute("tableAlignment");let l=t.alignment;"layout"===e.getAttribute("tableType")&&(l="");const n=i||l;n&&(u.class+=" "+f[n].className,u.style=f[n].style,void 0!==f[n].align&&(u.align=f[n].align))}return i.createContainerElement("table",u,[a,...d])}(t,o,e):null}}function Z(e){return(t,{writer:o,options:i})=>{const l=e.plugins.has("PlainTableOutput"),n=i.isClipboardPipeline,r=e.config.get("experimentalFlags.useExtendedTableBlockAlignment");return(l||r&&n)&&"table"===t.parent.name?o.createContainerElement("caption"):null}}class Q extends e.Command{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema;this.isEnabled=function(e,t){const o=e.getFirstPosition().parent,i=o===o.root?o:o.parent;return t.checkChild(i,"table")}(t,o)}execute(e={}){const t=this.editor,o=t.model,i=t.plugins.get("TableUtils"),l=t.config.get("table.defaultHeadings.rows"),n=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&l&&(e.headingRows=l),void 0===e.headingColumns&&n&&(e.headingColumns=n),o.change(t=>{const l=i.createTable(t,e);o.insertObject(l,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}class ee extends e.Command{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i="above"===this.order,l=o.getSelectionAffectedTableCells(t),n=o.getRowIndexes(l),r=i?n.first:n.last,a=l[0].findAncestor("table");o.insertRows(a,{at:i?r:r+1,copyStructureFromAbove:!i})}}class te extends e.Command{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i="left"===this.order,l=o.getSelectionAffectedTableCells(t),n=o.getColumnIndexes(l),r=i?n.first:n.last,a=l[0].findAncestor("table");o.insertColumns(a,{columns:1,at:i?r:r+1})}}class oe extends e.Command{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}class ie extends e.Command{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,o=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,l=this.direction;e.change(e=>{const t="right"==l||"down"==l,n=t?o:i,r=t?i:o,a=r.parent;!function(e,t,o){le(e)||(le(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end")));o.remove(e)}(r,n,e);const s=this.isHorizontal?"colspan":"rowspan",c=parseInt(o.getAttribute(s)||"1"),d=parseInt(i.getAttribute(s)||"1");e.setAttribute(s,c+d,n),e.setSelection(e.createRangeIn(n));const u=this.editor.plugins.get("TableUtils");B(a.findAncestor("table"),u)})}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),o=t.getTableCellsContainingSelection(e.selection)[0];if(!o)return;const i=this.isHorizontal?function(e,t,o){const i=e.parent,l=i.parent,n="right"==t?e.nextSibling:e.previousSibling,r=(l.getAttribute("headingColumns")||0)>0;if(!n)return;const a="right"==t?e:n,s="right"==t?n:e,{column:c}=o.getCellLocation(a),{column:d}=o.getCellLocation(s),u=parseInt(a.getAttribute("colspan")||"1"),b=k(o,a),h=k(o,s);if(r&&b!=h)return;return c+u===d?n:void 0}(o,this.direction,t):function(e,t,o){const i=e.parent,l=i.parent,n=l.getChildIndex(i);if("down"==t&&n===o.getRows(l)-1||"up"==t&&0===n)return null;const r=parseInt(e.getAttribute("rowspan")||"1"),a=l.getAttribute("headingRows")||0,s="down"==t&&n+r===a,c="up"==t&&n===a;if(a&&(s||c))return null;const d=parseInt(e.getAttribute("rowspan")||"1"),u="down"==t?n+d:n,b=[...new v(l,{endRow:u})],h=b.find(t=>t.cell===e),m=h.column,g=b.find(({row:e,cellHeight:o,column:i})=>i===m&&("down"==t?e===u:u===e+o));return g&&g.cell?g.cell:null}(o,this.direction,t);if(!i)return;const l=this.isHorizontal?"rowspan":"colspan",n=parseInt(o.getAttribute(l)||"1");return parseInt(i.getAttribute(l)||"1")===n?i:void 0}}function le(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class ne extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){const i=o.findAncestor("table"),l=e.getRows(i)-1,n=e.getRowIndexes(t),r=0===n.first&&n.last===l;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),l=o[0],n=l.findAncestor("table"),r=t.getCellLocation(l).column;e.change(e=>{const o=i.last-i.first+1;t.removeRows(n,{at:i.first,rows:o});const l=function(e,t,o,i){const l=e.getChild(Math.min(t,i-1));let n=l.getChild(0),r=0;for(const e of l.getChildren()){if(r>o)return n;n=e,r+=parseInt(e.getAttribute("colspan")||"1")}return n}(n,i.first,r,t.getRows(n));e.setSelection(e.createPositionAt(l,0))})}}class re extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){const i=o.findAncestor("table"),l=e.getColumns(i),{first:n,last:r}=e.getColumnIndexes(t);this.isEnabled=r-n<l-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,o]=function(e,t){const o=t.getSelectionAffectedTableCells(e),i=o[0],l=o.pop(),n=[i,l];return i.isBefore(l)?n:n.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,l=[...new v(i)],n={first:l.find(e=>e.cell===t).column,last:l.find(e=>e.cell===o).column},r=function(e,t,o,i){const l=parseInt(o.getAttribute("colspan")||"1");return l>1?o:t.previousSibling||o.nextSibling?o.nextSibling||t.previousSibling:i.first?e.reverse().find(({column:e})=>e<i.first).cell:e.reverse().find(({column:e})=>e>i.last).cell}(l,t,o,n);this.editor.model.change(t=>{const o=n.last-n.first+1;e.removeColumns(i,{at:n.first,columns:o}),t.setSelection(t.createPositionAt(r,0))})}}class ae extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection);if(0===o.length)return this.isEnabled=!1,void(this.value=!1);const i=o[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(i,"headingRows"),this.value=o.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),l=i[0].findAncestor("table"),{first:n,last:r}=t.getRowIndexes(i),a=this.value?n:r+1,s=l.getAttribute("headingRows")||0;o.change(e=>{if(a){const t=x(l,a,a>s?s:0);for(const{cell:o}of t)V(o,a,e)}w("headingRows",a,l,e,0)})}_isInHeading(e,t){const o=parseInt(t.getAttribute("headingRows")||"0");return!!o&&e.parent.index<o}}class se extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection);if(0===o.length)return this.isEnabled=!1,void(this.value=!1);const i=o[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(i,"headingColumns"),this.value=o.every(t=>k(e,t))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),l=i[0].findAncestor("table"),{first:n,last:r}=t.getColumnIndexes(i),a=this.value?n:r+1;o.change(e=>{if(a){const t=S(l,a);for(const{cell:o,column:i}of t)P(o,i,a,e)}w("headingColumns",a,l,e,0)})}}const ce=5,de=40,ue=2,be=3;function he(e){const t=new Set;for(const o of e.document.differ.getChanges()){let i=null;switch(o.type){case"insert":i=["table","tableRow","tableCell"].includes(o.name)?o.position:null;break;case"remove":i=["tableRow","tableCell"].includes(o.name)?o.position:null;break;case"attribute":o.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(o.range.start.nodeAfter.name)?o.range.start:null)}if(!i)continue;const l=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAncestor("table");for(const o of e.createRangeOn(l).getItems())o.is("element","table")&&xe(o)&&t.add(o)}return t}function me(e,t){return 100*de/ge(e,t)}function ge(e,t){const o=pe(e,"tbody",t)||pe(e,"thead",t);return fe(t.editing.view.domConverter.mapViewToDom(o))}function pe(e,t,o){return[...[...o.editing.mapper.toViewElement(e).getChildren()].find(e=>e.is("element","table")).getChildren()].find(e=>e.is("element",t))}function fe(e){const t=l.global.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function we(e,t){const o=t.getCellLocation(e).column;return{leftEdge:o,rightEdge:o+(e.getAttribute("colspan")||1)-1}}function _e(e){const t=Math.pow(10,ue),o="number"==typeof e?e:parseFloat(e);return Math.round(o*t)/t}function ke(e,t,o){return _e(e<=t?t:e>=o?o:e)}function Ce(e,t){return Array(e).fill(t)}function ye(e){return e.map(e=>"number"==typeof e?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function ve(e){let t=function(e){const t=e.filter(e=>"auto"===e).length;if(0===t)return e.map(e=>_e(e));const o=ye(e),i=Math.max((100-o)/t,ce);return e.map(e=>"auto"===e?i:e).map(e=>_e(e))}(e.map(e=>"auto"===e||void 0===e?"auto":parseFloat(e.replace("%",""))));const o=ye(t);return 100!==o&&(t=t.map(e=>_e(100*e/o)).map((e,t,o)=>{if(!(t===o.length-1))return e;return _e(e+100-ye(o))})),t.map(e=>e+"%")}function Te(e){const t=l.global.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function Ae(e,t,o,i){for(let l=0;l<Math.max(o.length,e.length);l++){const n=e[l],r=o[l];r?n?i.setAttribute("columnWidth",r,n):i.appendElement("tableColumn",{columnWidth:r},t):i.remove(n)}}function xe(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find(e=>e.is("element","tableColumnGroup"))}function Ve(e){const t=xe(e);return t?Array.from(t.getChildren()):[]}function Se(e){return Ve(e).map(e=>e.getAttribute("columnWidth"))}function Pe(e,t){return Ve(e).reduce((e,o)=>{const i=o.getAttribute("columnWidth"),l=o.getAttribute("colSpan");if(!l)return e.push(i),e;for(let t=0;t<l;t++)e.push(i);return t.removeAttribute("colSpan",o),e},[])}class Ie extends e.Plugin{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,o=t.parent,i=o.getChildIndex(t),l=new v(o,{row:i});for(const{cell:t,row:o,column:i}of l)if(t===e)return{row:o,column:i}}createTable(e,t){const o=e.createElement("table"),i=t.rows||2,l=t.columns||2;return Re(e,o,0,i,l),t.headingRows&&w("headingRows",Math.min(t.headingRows,i),o,e,0),t.headingColumns&&w("headingColumns",Math.min(t.headingColumns,l),o,e,0),o}insertRows(e,t={}){const o=this.editor.model,i=t.at||0,n=t.rows||1,r=void 0!==t.copyStructureFromAbove,a=t.copyStructureFromAbove?i-1:i,s=this.getRows(e),c=this.getColumns(e);if(i>s)throw new l.CKEditorError("tableutils-insertrows-insert-out-of-range",this,{options:t});o.change(t=>{const o=e.getAttribute("headingRows")||0;if(o>i&&w("headingRows",o+n,e,t,0),!r&&(0===i||i===s))return void Re(t,e,i,n,c);const l=r?Math.max(i,a):i,d=new v(e,{endRow:l}),u=new Array(c).fill(1);for(const{row:e,column:o,cellHeight:l,cellWidth:s,cell:c}of d){const d=e+l-1,b=e<=a&&a<=d;e<i&&i<=d?(t.setAttribute("rowspan",l+n,c),u[o]=-s):r&&b&&(u[o]=s)}for(let o=0;o<n;o++){const o=t.createElement("tableRow");t.insert(o,e,i);for(let e=0;e<u.length;e++){const i=u[e],l=t.createPositionAt(o,"end");i>0&&_(t,l,i>1?{colspan:i}:void 0),e+=Math.abs(i)-1}}})}insertColumns(e,t={}){const o=this.editor.model,i=t.at||0,l=t.columns||1;o.change(t=>{const o=e.getAttribute("headingColumns");i<o&&t.setAttribute("headingColumns",o+l,e);const n=this.getColumns(e);if(0===i||n===i){for(const o of e.getChildren())o.is("element","tableRow")&&Ee(l,t,t.createPositionAt(o,i?"end":0));return}const r=new v(e,{column:i,includeAllSlots:!0});for(const e of r){const{row:o,cell:n,cellAnchorColumn:a,cellAnchorRow:s,cellWidth:c,cellHeight:d}=e;if(a<i){t.setAttribute("colspan",c+l,n);const e=s+d-1;for(let t=o;t<=e;t++)r.skipRow(t)}else Ee(l,t,e.getPositionBefore())}})}removeRows(e,t){const o=this.editor.model,i=t.rows||1,n=this.getRows(e),r=t.at,a=r+i-1;if(a>n-1)throw new l.CKEditorError("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});o.change(t=>{const o={first:r,last:a},{cellsToMove:i,cellsToTrim:l}=function(e,{first:t,last:o}){const i=new Map,l=[];for(const{row:n,column:r,cellHeight:a,cell:s}of new v(e,{endRow:o})){const e=n+a-1;if(n>=t&&n<=o&&e>o){const e=a-(o-n+1);i.set(r,{cell:s,rowspan:e})}if(n<t&&e>=t){let i;i=e>=o?o-t+1:e-t+1,l.push({cell:s,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:l}}(e,o);if(i.size){!function(e,t,o,i){const l=new v(e,{includeAllSlots:!0,row:t}),n=[...l],r=e.getChild(t);let a;for(const{column:e,cell:t,isAnchor:l}of n)if(o.has(e)){const{cell:t,rowspan:l}=o.get(e),n=a?i.createPositionAfter(a):i.createPositionAt(r,0);i.move(i.createRangeOn(t),n),w("rowspan",l,t,i),a=t}else l&&(a=t)}(e,a+1,i,t)}for(let o=a;o>=r;o--)t.remove(e.getChild(o));for(const{rowspan:e,cell:o}of l)w("rowspan",e,o,t);!function(e,{first:t,last:o},i){const l=e.getAttribute("headingRows")||0;if(t<l){w("headingRows",o<l?l-(o-t+1):t,e,i,0)}}(e,o,t),R(e,this)||E(e,this)})}removeColumns(e,t){const o=this.editor.model,i=t.at,l=t.columns||1,n=t.at+l-1;o.change(t=>{!function(e,t,o){const i=e.getAttribute("headingColumns")||0;if(i&&t.first<i){const l=Math.min(i-1,t.last)-t.first+1;o.setAttribute("headingColumns",i-l,e)}}(e,{first:i,last:n},t);const o=Ve(e);for(let l=n;l>=i;l--){for(const{cell:o,column:i,cellWidth:n}of[...new v(e)])i<=l&&n>1&&i+n>l?w("colspan",n-1,o,t):i===l&&t.remove(o);if(o[l]){const e=0===l?o[1]:o[l-1],i=parseFloat(o[l].getAttribute("columnWidth")),n=parseFloat(e.getAttribute("columnWidth"));t.remove(o[l]),t.setAttribute("columnWidth",i+n+"%",e)}}E(e,this)||R(e,this)})}splitCellVertically(e,t=2){const o=this.editor.model,i=e.parent.parent,l=parseInt(e.getAttribute("rowspan")||"1"),n=parseInt(e.getAttribute("colspan")||"1");o.change(o=>{if(n>1){const{newCellsSpan:i,updatedSpan:r}=Be(n,t);w("colspan",r,e,o);const a={};i>1&&(a.colspan=i),l>1&&(a.rowspan=l);Ee(n>t?t-1:n-1,o,o.createPositionAfter(e),a)}if(n<t){const r=t-n,a=[...new v(i)],{column:s}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:o,column:i})=>t!==e&&i===s||i<s&&i+o>s);for(const{cell:e,cellWidth:t}of c)o.setAttribute("colspan",t+r,e);const d={};l>1&&(d.rowspan=l),Ee(r,o,o.createPositionAfter(e),d);const u=i.getAttribute("headingColumns")||0;u>s&&w("headingColumns",u+r,i,o)}})}splitCellHorizontally(e,t=2){const o=this.editor.model,i=e.parent,l=i.parent,n=l.getChildIndex(i),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");o.change(o=>{if(r>1){const i=[...new v(l,{startRow:n,endRow:n+r-1,includeAllSlots:!0})],{newCellsSpan:s,updatedSpan:c}=Be(r,t);w("rowspan",c,e,o);const{column:d}=i.find(({cell:t})=>t===e),u={};s>1&&(u.rowspan=s),a>1&&(u.colspan=a);let b=0;for(const e of i){const{column:t,row:i}=e,l=t===d;b>=s&&l&&(b=0),i>=n+c&&l&&(b||Ee(1,o,e.getPositionBefore(),u),b++)}}if(r<t){const i=t-r,s=[...new v(l,{startRow:0,endRow:n})];for(const{cell:t,cellHeight:l,row:r}of s)if(t!==e&&r+l>n){const e=l+i;o.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),Re(o,l,n+1,i,1,c);const d=l.getAttribute("headingRows")||0;d>n&&w("headingRows",d+i,l,o)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(e=>e.is("element","tableCell")).reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0)}createTableWalker(e,t={}){return new v(e,t)}getSelectedTableCells(e){const t=[];for(const o of this.sortRanges(e.getRanges())){const e=o.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){const t=[];for(const o of e.getRanges()){const e=o.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(e=>e.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),o=[...new v(t)].filter(t=>e.includes(t.cell)).map(e=>e.column);return this._getFirstLastIndexesObject(o)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,o=new Set;let i=0;for(const l of e){const{row:e,column:n}=this.getCellLocation(l),r=parseInt(l.getAttribute("rowspan"))||1,a=parseInt(l.getAttribute("colspan"))||1;t.add(e),o.add(n),r>1&&t.add(e+r-1),a>1&&o.add(n+a-1),i+=r*a}const l=function(e,t){const o=Array.from(e.values()),i=Array.from(t.values()),l=Math.max(...o),n=Math.min(...o),r=Math.max(...i),a=Math.min(...i);return(l-n+1)*(r-a+1)}(t,o);return l==i}sortRanges(e){return Array.from(e).sort(Le)}_getFirstLastIndexesObject(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),o=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(o,i))return!1;const l=this.getColumnIndexes(e),n=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(l,n)}_areIndexesInSameSection({first:e,last:t},o){return e<o===t<o}}function Re(e,t,o,i,l,n={}){for(let r=0;r<i;r++){const i=e.createElement("tableRow");e.insert(i,t,o),Ee(l,e,e.createPositionAt(i,"end"),n)}}function Ee(e,t,o,i={}){for(let l=0;l<e;l++)_(t,o,i)}function Be(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const o=Math.floor(e/t);return{newCellsSpan:o,updatedSpan:e-o*t+o}}function Le(e,t){const o=e.start,i=t.start;return o.isBefore(i)?-1:1}class Fe extends e.Command{refresh(){const e=this.editor.plugins.get(Ie),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(Ie);e.change(o=>{const i=t.getSelectedTableCells(e.document.selection),l=i.shift(),{mergeWidth:n,mergeHeight:r}=function(e,t,o){let i=0,l=0;for(const e of t){const{row:t,column:n}=o.getCellLocation(e);i=Ne(e,n,i,"colspan"),l=Ne(e,t,l,"rowspan")}const{row:n,column:r}=o.getCellLocation(e),a=i-r,s=l-n;return{mergeWidth:a,mergeHeight:s}}(l,i,t);w("colspan",n,l,o),w("rowspan",r,l,o);for(const e of i)We(e,l,o);B(l.findAncestor("table"),t),o.setSelection(l,"in")})}}function We(e,t,o){De(e)||(De(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end"))),o.remove(e)}function De(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function Ne(e,t,o,i){const l=parseInt(e.getAttribute(i)||"1");return Math.max(o,t+l)}class ze extends e.Command{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),l=o[0].findAncestor("table"),n=[];for(let t=i.first;t<=i.last;t++)for(const o of l.getChild(t).getChildren())n.push(e.createRangeOn(o));e.change(e=>{e.setSelection(n)})}}class Oe extends e.Command{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),i=o[0],l=o.pop(),n=i.findAncestor("table"),r=e.getCellLocation(i),a=e.getCellLocation(l),s=Math.min(r.column,a.column),c=Math.max(r.column,a.column),d=[];for(const e of new v(n,{startColumn:s,endColumn:c}))d.push(t.createRangeOn(e.cell));t.change(e=>{e.setSelection(d)})}}function Me(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;const l=new Set;for(const t of o){let o=null;"insert"==t.type&&"table"==t.name&&(o=t.position.nodeAfter),"insert"!=t.type&&"remove"!=t.type||"tableRow"!=t.name&&"tableCell"!=t.name||(o=t.position.findAncestor("table")),Ue(t)&&(o=t.range.start.findAncestor("table")),o&&!l.has(o)&&(i=He(o,e)||i,i=je(o,e)||i,l.add(o))}return i}(t,e))}function He(e,t){let o=!1;const i=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),o=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),i=[];for(const{row:l,cell:n,cellHeight:r}of new v(e)){if(r<2)continue;const e=l<t?t:o;if(l+r>e){const t=e-l;i.push({cell:n,rowspan:t})}}return i}(e);if(i.length){o=!0;for(const e of i)w("rowspan",e.rowspan,e.cell,t,1)}return o}function je(e,t){let o=!1;const i=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:o}of new v(e,{includeAllSlots:!0}))t[o]++;return t}(e),l=[];for(const[t,o]of i.entries())!o&&e.getChild(t).is("element","tableRow")&&l.push(t);if(l.length){o=!0;for(const o of l.reverse())t.remove(e.getChild(o)),i.splice(o,1)}const n=i.filter((t,o)=>e.getChild(o).is("element","tableRow")),r=n[0];if(!n.every(e=>e===r)){const i=n.reduce((e,t)=>t>e?t:e,0);for(const[l,r]of n.entries()){const n=i-r;if(n){for(let o=0;o<n;o++)_(t,t.createPositionAt(e.getChild(l),"end"));o=!0}}}return o}function Ue(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function $e(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;for(const t of o)"insert"==t.type&&"table"==t.name&&(i=Ke(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableRow"==t.name&&(i=Ge(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableCell"==t.name&&(i=qe(t.position.nodeAfter,e)||i),"remove"!=t.type&&"insert"!=t.type||!Je(t)||(i=qe(t.position.parent,e)||i);return i}(t,e))}function Ke(e,t){let o=!1;for(const i of e.getChildren())i.is("element","tableRow")&&(o=Ge(i,t)||o);return o}function Ge(e,t){let o=!1;for(const i of e.getChildren())o=qe(i,t)||o;return o}function qe(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const o=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of o)t.wrap(t.createRangeOn(e),"paragraph");return!!o.length}function Je(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function Xe(e,t){const o=e.document.differ;for(const e of o.getChanges()){let o,i=!1;if("attribute"==e.type){const t=e.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=e.attributeKey&&"headingColumns"!=e.attributeKey)continue;o=t,i="headingRows"==e.attributeKey}else"tableRow"!=e.name&&"tableCell"!=e.name||(o=e.position.findAncestor("table"),i="tableRow"==e.name);if(!o)continue;const l=o.getAttribute("headingRows")||0,n=o.getAttribute("headingColumns")||0,r=new v(o);for(const e of r){const o=e.row<l||e.column<n?"th":"td",r=t.mapper.toViewElement(e.cell);r&&r.is("element")&&r.name!=o&&t.reconvertItem(i?e.cell.parent:e.cell)}}}function Ye(e,t){const o=e.document.differ,i=new Set;for(const e of o.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&i.add(t)}for(const e of i.values()){const o=Array.from(e.getChildren()).filter(e=>Ze(e,t.mapper));for(const e of o)t.reconvertItem(e)}}function Ze(e,t){if(!e.is("element","paragraph"))return!1;const o=t.toViewElement(e);return!!o&&X(e)!==o.is("element","span")}var Qe=o(719),et=o.n(Qe),tt=o(863),ot=o.n(tt),it=o(424),lt=o.n(it),nt=o(517),rt=o.n(nt),at=o(163),st=o.n(at),ct=o(419),dt={attributes:{"data-cke":!0}};dt.setAttributes=rt(),dt.insert=lt().bind(null,"head"),dt.domAPI=ot(),dt.insertStyleElement=st();et()(ct.A,dt);ct.A&&ct.A.locals&&ct.A.locals;class ut extends e.Plugin{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Ie]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,o=t.schema,i=e.conversion,l=e.plugins.get(Ie);o.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),o.register("tableRow",{allowIn:"table",isLimit:!0}),o.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add(D()),i.for("upcast").add(N()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:K(l,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:K(l,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),i.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(O("td")),i.for("upcast").add(O("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:q({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:q()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:J({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:J(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:bt("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:bt("rowspan")},view:"rowspan"}),this._addPlainTableOutputConverters(),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new Q(e)),e.commands.add("insertTableRowAbove",new ee(e,{order:"above"})),e.commands.add("insertTableRowBelow",new ee(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new te(e,{order:"left"})),e.commands.add("insertTableColumnRight",new te(e,{order:"right"})),e.commands.add("removeTableRow",new ne(e)),e.commands.add("removeTableColumn",new re(e)),e.commands.add("splitTableCellVertically",new oe(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new oe(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Fe(e)),e.commands.add("mergeTableCellRight",new ie(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new ie(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new ie(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new ie(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new se(e)),e.commands.add("setTableRowHeader",new ae(e)),e.commands.add("selectTableRow",new ze(e)),e.commands.add("selectTableColumn",new Oe(e)),Me(t),$e(t),this.listenTo(t.document,"change:data",()=>{Xe(t,e.editing),Ye(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}_addPlainTableOutputConverters(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:Y(e),converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:Z(e),converterPriority:"high"}),e.plugins.has("TableProperties")&&function(e){const t={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[o,i]of Object.entries(t))e.conversion.for("dataDowncast").add(t=>t.on(`attribute:${i}:table`,(t,i,l)=>{const{item:n,attributeNewValue:r}=i,{mapper:a,writer:s}=l,c=e.plugins.has("PlainTableOutput"),d=l.options.isClipboardPipeline,u=e.config.get("experimentalFlags.useExtendedTableBlockAlignment");if(!(c||u&&d))return;if(!l.consumable.consume(n,t.name))return;const b=a.toViewElement(n);r?s.setStyle(o,r,b):s.removeStyle(o,b)},{priority:"high"}))}(e)}}function bt(e){return t=>{const o=parseInt(t.getAttribute(e));return Number.isNaN(o)||o<=0?null:o}}var ht=o(355),mt=o(311),gt=o(538),pt={attributes:{"data-cke":!0}};pt.setAttributes=rt(),pt.insert=lt().bind(null,"head"),pt.domAPI=ot(),pt.insertStyleElement=st();et()(gt.A,pt);gt.A&&gt.A.locals&&gt.A.locals;class ft extends mt.View{items;keystrokes;focusTracker;constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new l.KeystrokeHandler,this.focusTracker=new l.FocusTracker,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} × ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(e,t)=>{const{row:o,column:i}=t.target.dataset;this.items.get(10*(parseInt(o,10)-1)+(parseInt(i,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(e,t,o)=>{if(!o)return;const{row:i,column:l}=o.dataset;this.set({rows:parseInt(i),columns:parseInt(l)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),(0,mt.addKeyboardHandlingForGrid)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((o,i)=>{const l=Math.floor(i/10)<e&&i%10<t;o.set("isOn",l)})}_createGridButton(e,t,o,i){const l=new mt.ButtonView(e);return l.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),l.extendTemplate({attributes:{"data-row":t,"data-column":o}}),l}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const o=Math.floor(t/10),i=t%10,l=`${o+1} × ${i+1}`;e.push(this._createGridButton(this.locale,o+1,i+1,l))}return this.createCollection(e)}}class wt extends e.Plugin{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t,o="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",o=>{const i=e.commands.get("insertTable"),l=(0,mt.createDropdown)(o);let n;return l.bind("isEnabled").to(i),l.buttonView.set({icon:ht.IconTable,label:t("Insert table"),tooltip:!0}),l.on("change:isOpen",()=>{n||(n=new ft(o),l.panelView.children.add(n),n.delegate("execute").to(l),l.on("execute",()=>{e.execute("insertTable",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}))}),l}),e.ui.componentFactory.add("menuBar:insertTable",o=>{const i=e.commands.get("insertTable"),l=new mt.MenuBarMenuView(o),n=new ft(o);return n.delegate("execute").to(l),l.on("change:isOpen",(e,t,o)=>{o||n.reset()}),n.on("execute",()=>{e.execute("insertTable",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}),l.buttonView.set({label:t("Table"),icon:ht.IconTable}),l.panelView.children.add(n),l.bind("isEnabled").to(i),l}),e.ui.componentFactory.add("tableColumn",e=>{const i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),ht.IconTableColumn,i,e)}),e.ui.componentFactory.add("tableRow",e=>{const o=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),ht.IconTableRow,o,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),ht.IconTableMergeCell,i,e)})}_prepareDropdown(e,t,o,i){const l=this.editor,n=(0,mt.createDropdown)(i),r=this._fillDropdownWithListOptions(n,o);return n.buttonView.set({label:e,icon:t,tooltip:!0}),n.bind("isEnabled").toMany(r,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(n,"execute",e=>{l.execute(e.source.commandName),e.source instanceof mt.SwitchButtonView||l.editing.view.focus()}),n}_prepareMergeSplitButtonDropdown(e,t,o,i){const l=this.editor,n=(0,mt.createDropdown)(i,mt.SplitButtonView),r="mergeTableCells",a=l.commands.get(r),s=this._fillDropdownWithListOptions(n,o);return n.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),n.bind("isEnabled").toMany([a,...s],"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(n.buttonView,"execute",()=>{l.execute(r),l.editing.view.focus()}),this.listenTo(n,"execute",e=>{l.execute(e.source.commandName),l.editing.view.focus()}),n}_fillDropdownWithListOptions(e,t){const o=this.editor,i=[],n=new l.Collection;for(const e of t)_t(e,o,i,n);return(0,mt.addListToDropdown)(e,n),i}}function _t(e,t,o,i){if("button"===e.type||"switchbutton"===e.type){const i=e.model=new mt.UIModel(e.model),{commandName:l,bindIsOn:n}=e.model,r=t.commands.get(l);o.push(r),i.set({commandName:l}),i.bind("isEnabled").to(r),n&&i.bind("isOn").to(r,"value"),i.set({withText:!0})}i.add(e)}var kt=o(489),Ct={attributes:{"data-cke":!0}};Ct.setAttributes=rt(),Ct.insert=lt().bind(null,"head"),Ct.domAPI=ot(),Ct.insertStyleElement=st();et()(kt.A,Ct);kt.A&&kt.A.locals&&kt.A.locals;class yt extends e.Plugin{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[Ie,Ie]}init(){const e=this.editor,t=e.model,o=e.editing.view;this.listenTo(t,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this.listenTo(o.document,"insertText",(e,t)=>this._handleInsertTextEvent(e,t),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(Ie),t=this.editor.model.document.selection,o=e.getSelectedTableCells(t);return 0==o.length?null:o}getSelectionAsFragment(){const e=this.editor.plugins.get(Ie),t=this.getSelectedTableCells();return t?this.editor.model.change(o=>{const i=o.createDocumentFragment(),{first:l,last:n}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),s=t[0].findAncestor("table");let c=a,d=n;if(e.isSelectionRectangular(t)){const e={firstColumn:l,lastColumn:n,firstRow:r,lastRow:a};c=L(s,e),d=F(s,e)}const u=A(s,{startRow:r,startColumn:l,endRow:c,endColumn:d},o);return o.insert(u,i,0),i}):null}setCellSelection(e,t){const o=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(o.cells.map(t=>e.createRangeOn(t)),{backward:o.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=this.editor.model.document.selection,t=(0,l.first)(e.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,o,i)=>{const l=i.writer;!function(e){for(const o of t)e.removeClass("ck-editor__editable_selected",o);t.clear()}(l);const n=this.getSelectedTableCells();if(!n)return;for(const e of n){const o=i.mapper.toViewElement(e);l.addClass("ck-editor__editable_selected",o),t.add(o)}const r=i.mapper.toViewElement(n[n.length-1]);l.setSelection(r,0)},{priority:"lowest"}))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(o=>{const i=o.createPositionAt(t[0],0),l=e.model.schema.getNearestSelectionRange(i);o.setSelection(l)})}})}_handleDeleteContent(e,t){const o=this.editor.plugins.get(Ie),i=t[0],l=t[1],n=this.editor.model,r=!l||"backward"==l.direction,a=o.getSelectedTableCells(i);a.length&&(e.stop(),n.change(e=>{const t=a[r?a.length-1:0];n.change(e=>{for(const t of a)n.deleteContent(e.createSelection(t,"in"))});const o=n.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(o):i.setTo(o)}))}_handleInsertTextEvent(e,t){const o=this.editor,i=this.getSelectedTableCells();if(!i)return;const l=o.editing.view,n=o.editing.mapper,r=i.map(e=>l.createRangeOn(n.toViewElement(e)));t.selection=l.createSelection(r),t.preventDefault()}_getCellsToSelect(e,t){const o=this.editor.plugins.get("TableUtils"),i=o.getCellLocation(e),l=o.getCellLocation(t),n=Math.min(i.row,l.row),r=Math.max(i.row,l.row),a=Math.min(i.column,l.column),s=parseInt(t.getAttribute("colspan")||"1")-1,c=Math.max(i.column,l.column+s),d=new Array(r-n+1).fill(null).map(()=>[]),u={startRow:n,endRow:r,startColumn:a,endColumn:c};for(const{row:t,cell:o}of new v(e.findAncestor("table"),u))d[t-n].push(o);const b=l.row<i.row,h=l.column<i.column;return b&&d.reverse(),h&&d.forEach(e=>e.reverse()),{cells:d.flat(),backward:b||h}}}var vt=o(331);class Tt extends e.Plugin{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[vt.ClipboardMarkersUtils,vt.ClipboardPipeline,yt,Ie]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e,"cut",(e,t)=>this._onCopyCut(e,t)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell")}_listenToContentInsertion(){const{editor:e}=this,t=e.plugins.get(vt.ClipboardPipeline),o=e.plugins.get(yt);let i=!1;t.on("contentInsertion",(e,t)=>{i="paste"===t.method}),this.listenTo(e.model,"insertContent",(e,[t,l])=>{(i||null!==o.getSelectedTableCells())&&this._onInsertContent(e,t,l)},{priority:"high"}),t.on("contentInsertion",()=>{i=!1},{priority:"lowest"})}_onCopyCut(e,t){const o=this.editor.editing.view,i=this.editor.plugins.get(yt),l=this.editor.plugins.get(vt.ClipboardMarkersUtils);i.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},()=>{const n=l._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>i.getSelectionAsFragment());o.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(n),method:e.name})}))}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;const i=this.editor.model,l=this.editor.plugins.get(Ie),n=this.editor.plugins.get(vt.ClipboardMarkersUtils),r=this.getTableIfOnlyTableInContent(t,i);if(!r)return;const a=l.getSelectionAffectedTableCells(i.document.selection);a.length?(e.stop(),t.is("documentFragment")?n._pasteMarkersIntoTransformedElement(t.markers,e=>this._replaceSelectedCells(r,a,e)):this.editor.model.change(e=>{this._replaceSelectedCells(r,a,e)})):B(r,l)}_replaceSelectedCells(e,t,o){const i=this.editor.plugins.get(Ie),l={width:i.getColumns(e),height:i.getRows(e)},n=function(e,t,o,i){const l=e[0].findAncestor("table"),n=i.getColumnIndexes(e),r=i.getRowIndexes(e),a={firstColumn:n.first,lastColumn:n.last,firstRow:r.first,lastRow:r.last},s=1===e.length;s&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,o,i){const l=i.getColumns(e),n=i.getRows(e);o>l&&i.insertColumns(e,{at:l,columns:o-l});t>n&&i.insertRows(e,{at:n,rows:t-n})}(l,a.lastRow+1,a.lastColumn+1,i));s||!i.isSelectionRectangular(e)?function(e,t,o){const{firstRow:i,lastRow:l,firstColumn:n,lastColumn:r}=t,a={first:i,last:l},s={first:n,last:r};xt(e,n,a,o),xt(e,r+1,a,o),At(e,i,s,o),At(e,l+1,s,o,i)}(l,a,o):(a.lastRow=L(l,a),a.lastColumn=F(l,a));return a}(t,l,o,i),r=n.lastRow-n.firstRow+1,a=n.lastColumn-n.firstColumn+1;e=A(e,{startRow:0,startColumn:0,endRow:Math.min(r,l.height)-1,endColumn:Math.min(a,l.width)-1},o);const s=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,l,s,n,o);if(this.editor.plugins.get("TableSelection").isEnabled){const e=i.sortRanges(c.map(e=>o.createRangeOn(e)));o.setSelection(e)}else o.setSelection(c[0],0);return s}_replaceSelectedCellsWithPasted(e,t,o,i,l){const{width:n,height:r}=t,a=function(e,t,o){const i=new Array(o).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:o,cell:l}of new v(e))i[o][t]=l;return i}(e,n,r),s=[...new v(o,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of s){const{row:t,column:o}=e;o===i.firstColumn&&(d=e.getPositionBefore());const s=t-i.firstRow,u=o-i.firstColumn,b=a[s%r][u%n],h=b?l.cloneElement(b):null,m=this._replaceTableSlotCell(e,h,d,l);m&&(I(m,t,o,i.lastRow,i.lastColumn,l),c.push(m),d=l.createPositionAfter(m))}const u=parseInt(o.getAttribute("headingRows")||"0"),b=parseInt(o.getAttribute("headingColumns")||"0"),h=i.firstRow<u&&u<=i.lastRow,m=i.firstColumn<b&&b<=i.lastColumn;if(h){const e=At(o,u,{first:i.firstColumn,last:i.lastColumn},l,i.firstRow);c.push(...e)}if(m){const e=xt(o,b,{first:i.firstRow,last:i.lastRow},l);c.push(...e)}return c}_replaceTableSlotCell(e,t,o,i){const{cell:l,isAnchor:n}=e;return n&&i.remove(l),t?(i.insert(t,o),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const o=t.createRangeIn(e);for(const e of o.getItems())if(e.is("element","table")){const i=t.createRange(o.start,t.createPositionBefore(e));if(t.hasContent(i,{ignoreWhitespaces:!0}))return null;const l=t.createRange(t.createPositionAfter(e),o.end);return t.hasContent(l,{ignoreWhitespaces:!0})?null:e}return null}}function At(e,t,o,i,l=0){if(t<1)return;return x(e,t,l).filter(({column:e,cellWidth:t})=>Vt(e,t,o)).map(({cell:e})=>V(e,t,i))}function xt(e,t,o,i){if(t<1)return;return S(e,t).filter(({row:e,cellHeight:t})=>Vt(e,t,o)).map(({cell:e,column:o})=>P(e,o,t,i))}function Vt(e,t,o){const i=e+t-1,{first:l,last:n}=o;return e>=l&&e<=n||e<l&&i>=l}class St extends e.Plugin{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[yt,Ie]}init(){const e=this.editor,t=e.editing.view.document,o=e.t;this.listenTo(t,"arrowKey",(...e)=>this._onArrowKey(...e),{context:"table"}),this.listenTo(t,"tab",(...e)=>this._handleTabOnSelectedTable(...e),{context:"figure"}),this.listenTo(t,"tab",(...e)=>this._handleTab(...e),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:o("Keystrokes that can be used in a table cell"),keystrokes:[{label:o("Move the selection to the next cell"),keystroke:"Tab"},{label:o("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:o("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:o("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const o=this.editor.model.document.selection.getSelectedElement();o&&o.is("element","table")&&t.stopPropagation()}_handleTab(e,t){const o=this.editor,i=this.editor.plugins.get(Ie),l=this.editor.plugins.get("TableSelection"),n=o.model.document.selection,r=!t.shiftKey;let a=i.getTableCellsContainingSelection(n)[0];if(a||(a=l.getFocusCell()),!a)return;t.stopPropagation();const s=a.parent,c=s.parent,d=c.getChildIndex(s),u=s.getChildIndex(a)===s.childCount-1,b=d===i.getRows(c)-1;r&&b&&u&&o.execute("insertTableRowBelow")}_onArrowKey(e,t){const o=this.editor,i=t.keyCode,n=(0,l.getLocalizedArrowKeyCodeDirection)(i,o.locale.contentLanguageDirection);this._handleArrowKeys(n,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const o=this.editor.plugins.get(Ie),i=this.editor.plugins.get("TableSelection"),l=this.editor.model,n=l.document.selection,r=["right","down"].includes(e),a=o.getSelectedTableCells(n);if(a.length){let o;return o=t?i.getFocusCell():r?a[a.length-1]:a[0],this._navigateFromCellInDirection(o,e,t),!0}const s=n.focus.findAncestor("tableCell");if(!s)return!1;if(!n.isCollapsed)if(t){if(n.isBackward==r&&!n.containsEntireContent(s))return!1}else{const e=n.getSelectedElement();if(!e||!l.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(n,s,r)&&(this._navigateFromCellInDirection(s,e,t),!0)}_isSelectionAtCellEdge(e,t,o){const i=this.editor.model,l=this.editor.model.schema,n=o?e.getLastPosition():e.getFirstPosition();if(!l.getLimitElement(n).is("element","tableCell")){return i.createPositionAt(t,o?"end":0).isTouching(n)}const r=i.createSelection(n);return i.modifySelection(r,{direction:o?"forward":"backward"}),n.isEqual(r.focus)}_navigateFromCellInDirection(e,t,o=!1){const i=this.editor.model,l=e.findAncestor("table"),n=[...new v(l,{includeAllSlots:!0})],{row:r,column:a}=n[n.length-1],s=n.find(({cell:t})=>t==e);let{row:c,column:d}=s;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=s.cellWidth;break;case"down":c+=s.cellHeight}if(c<0||c>r||d<0&&c<=0||d>a&&c>=r)return void i.change(e=>{e.setSelection(e.createRangeOn(l))});d<0?(d=o?0:a,c--):d>a&&(d=o?a:0,c++);const u=n.find(e=>e.row==c&&e.column==d).cell,b=["right","down"].includes(t),h=this.editor.plugins.get("TableSelection");if(o&&h.isEnabled){const t=h.getAnchorCell()||e;h.setCellSelection(t,u)}else{const e=i.createPositionAt(u,b?0:"end");i.change(t=>{t.setSelection(e)})}}}var Pt=o(783);class It extends Pt.DomEventObserver{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}}class Rt extends e.Plugin{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[yt,Ie]}init(){this.editor.editing.view.addObserver(It),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(Ie);let o=!1;const i=e.plugins.get(yt);this.listenTo(e.editing.view.document,"mousedown",(l,n)=>{const r=e.model.document.selection;if(!this.isEnabled||!i.isEnabled)return;if(!n.domEvent.shiftKey)return;const a=i.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const s=this._getModelTableCellFromDomEvent(n);s&&Et(a,s)&&(o=!0,i.setCellSelection(a,s),n.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{o=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{o&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,o,i=!1,l=!1;const n=e.plugins.get(yt);this.listenTo(e.editing.view.document,"mousedown",(e,o)=>{this.isEnabled&&n.isEnabled&&(o.domEvent.shiftKey||o.domEvent.ctrlKey||o.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(o)))}),this.listenTo(e.editing.view.document,"mousemove",(e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(r);a&&Et(t,a)&&(o=a,i||o==t||(i=!0)),i&&(l=!0,n.setCellSelection(t,o),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1,l=!1,t=null,o=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{l&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,o=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function Et(e,t){return e.parent.parent==t.parent.parent}var Bt=o(151),Lt={attributes:{"data-cke":!0}};Lt.setAttributes=rt(),Lt.insert=lt().bind(null,"head"),Lt.domAPI=ot(),Lt.insertStyleElement=st();et()(Bt.A,Lt);Bt.A&&Bt.A.locals&&Bt.A.locals;class Ft extends e.Plugin{static get requires(){return[ut,wt,yt,Rt,St,Tt,t.Widget]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}class Wt extends e.Plugin{static get pluginName(){return"PlainTableOutput"}static get isOfficialPlugin(){return!0}static get requires(){return[Ft]}init(){this.editor.conversion.for("upcast").add(e=>{e.on("element:table",(e,t,o)=>{o.consumable.consume(t.viewItem,{classes:"table"})})})}}function Dt(e){const t=Nt(e);return t||zt(e)}function Nt(e){const t=e.getSelectedElement();return t&&Ot(t)?t:null}function zt(e){const t=e.getFirstPosition();if(!t)return null;let o=t.parent;for(;o;){if(o.is("element")&&Ot(o))return o;o=o.parent}return null}function Ot(e){return e.is("element")&&!!e.getCustomProperty("table")&&(0,t.isWidget)(e)}class Mt extends e.Plugin{static get requires(){return[t.WidgetToolbarRepository]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,o=e.t,i=e.plugins.get(t.WidgetToolbarRepository),l=e.config.get("table.contentToolbar"),n=e.config.get("table.tableToolbar");l&&i.register("tableContent",{ariaLabel:o("Table toolbar"),items:l,getRelatedElement:zt}),n&&i.register("table",{ariaLabel:o("Table toolbar"),items:n,getRelatedElement:Nt})}}var Ht=o(188),jt={attributes:{"data-cke":!0}};jt.setAttributes=rt(),jt.insert=lt().bind(null,"head"),jt.domAPI=ot(),jt.insertStyleElement=st();et()(Ht.A,jt);Ht.A&&Ht.A.locals&&Ht.A.locals;class Ut extends mt.View{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new l.FocusTracker,this._focusables=new mt.ViewCollection,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new l.KeystrokeHandler,this._stillTyping=!1,this.focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(e,t,o)=>this._setInputValue(o))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,o=this.bindTemplate,i=this._createColorSelector(e),l=(0,mt.createDropdown)(e),n=new mt.View;return n.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:o.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",o.if("value","ck-hidden",e=>""!=e)]}}]}),l.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),l.buttonView.children.add(n),l.buttonView.label=t("Color picker"),l.buttonView.tooltip=!0,l.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",l.panelView.children.add(i),l.bind("isEnabled").to(this,"isReadOnly",e=>!e),l.on("change:isOpen",(e,t,o)=>{o&&(i.updateSelectedColors(),i.showColorGridsFragment())}),l}_createInputTextView(){const e=this.locale,t=new mt.InputTextView(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const e=t.element.value,o=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=o&&o.color||e}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,o=this.options.defaultColorValue||"",i=t(o?"Restore default":"Remove color"),l=new mt.ColorSelectorView(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:t("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});l.appendUI(),l.on("execute",(e,t)=>{"colorPickerSaveButton"!==t.source?(this.value=t.value||o,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1});let n=this.value;return l.on("colorPicker:cancel",()=>{this.value=n,this.fire("input"),this.dropdownView.isOpen=!1}),l.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{n=this.value}),l.bind("selectedColor").to(this,"value"),l}_setInputValue(e){if(!this._stillTyping){const t=$t(e),o=this.options.colorDefinitions.find(e=>t===$t(e.color));this.inputView.value=o?o.label:e||""}}}function $t(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const Kt=e=>""===e;function Gt(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function qt(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Jt(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function Xt(e){return e=e.trim().toLowerCase(),Kt(e)||(0,Pt.isColorStyleValue)(e)}function Yt(e){return e=e.trim(),Kt(e)||io(e)||(0,Pt.isLengthStyleValue)(e)||(0,Pt.isPercentageStyleValue)(e)}function Zt(e){return e=e.trim(),Kt(e)||io(e)||(0,Pt.isLengthStyleValue)(e)}function Qt(e,t){const o=new l.Collection,i=Gt(e.t);for(const l in i){const n={type:"button",model:new mt.UIModel({_borderStyleValue:l,label:i[l],role:"menuitemradio",withText:!0})};"none"===l?n.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===l):n.model.bind("isOn").to(e,"borderStyle",e=>e===l),o.add(n)}return o}function eo(e){const{view:t,icons:o,toolbar:i,labels:l,propertyName:n,nameToValue:r,defaultValue:a}=e;for(const e in l){const s=new mt.ButtonView(t.locale);s.set({role:"radio",isToggleable:!0,label:l[e],icon:o[e],tooltip:l[e]});const c=r?r(e):e;s.bind("isOn").to(t,n,e=>{let t=e;return""===e&&a&&(t=a),c===t}),s.on("execute",()=>{!a&&c&&t[n]===c?t[n]=void 0:t[n]=c}),i.items.add(s)}}const to=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function oo(e){return(t,o,i)=>{const l=new Ut(t.locale,{colorDefinitions:(n=e.colorConfig,n.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var n;return l.inputView.set({id:o,ariaDescribedById:i}),l.bind("isReadOnly").to(t,"isEnabled",e=>!e),l.bind("hasError").to(t,"errorText",e=>!!e),l.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(l),l}}function io(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}var lo=o(29),no={attributes:{"data-cke":!0}};no.setAttributes=rt(),no.insert=lt().bind(null,"head"),no.domAPI=ot(),no.insertStyleElement=st();et()(lo.A,no);lo.A&&lo.A.locals&&lo.A.locals;var ro=o(865),ao={attributes:{"data-cke":!0}};ao.setAttributes=rt(),ao.insert=lt().bind(null,"head"),ao.domAPI=ot(),ao.insertStyleElement=st();et()(ro.A,ao);ro.A&&ro.A.locals&&ro.A.locals;var so=o(337),co={attributes:{"data-cke":!0}};co.setAttributes=rt(),co.insert=lt().bind(null,"head"),co.domAPI=ot(),co.insertStyleElement=st();et()(so.A,co);so.A&&so.A.locals&&so.A.locals;var uo=o(380),bo={attributes:{"data-cke":!0}};bo.setAttributes=rt(),bo.insert=lt().bind(null,"head"),bo.domAPI=ot(),bo.insertStyleElement=st();et()(uo.A,bo);uo.A&&uo.A.locals&&uo.A.locals;class ho extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new mt.FormHeaderView(e,{label:this.t("Cell properties")})),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new mt.FormRowView(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new mt.FormRowView(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=oo({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Gt(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,Qt(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",mo),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",mo),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{mo(i)||(this.borderColor="",this.borderWidth=""),mo(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=oo({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createPaddingField(){const e=this.locale,t=this.t,o=new mt.LabeledFieldView(e,mt.createLabeledInputText);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",()=>{this.padding=o.fieldView.element.value}),o}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e),i={left:ht.IconAlignLeft,center:ht.IconAlignCenter,right:ht.IconAlignRight,justify:ht.IconAlignJustify,top:ht.IconAlignTop,middle:ht.IconAlignMiddle,bottom:ht.IconAlignBottom};o.text=t("Table cell text alignment");const l=new mt.ToolbarView(e),n="rtl"===e.contentLanguageDirection;l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),eo({view:this,icons:i,toolbar:l,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(n){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new mt.ToolbarView(e);return r.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),eo({view:this,icons:i,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:l,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),icon:ht.IconCheck,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),icon:ht.IconCancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),i=t("Align cell text to the center"),l=t("Align cell text to the right"),n=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:l,center:i,left:o,justify:n}:{left:o,center:i,right:l,justify:n}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function mo(e){return"none"!==e}function go(e,t,{signal:o,edges:i}={}){let l,n=null;const r=null!=i&&i.includes("leading"),a=null==i||i.includes("trailing"),s=()=>{null!==n&&(e.apply(l,n),l=void 0,n=null)};let c=null;const d=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,a&&s(),b()},t)},u=()=>{null!==c&&(clearTimeout(c),c=null)},b=()=>{u(),l=void 0,n=null},h=function(...e){if(o?.aborted)return;l=this,n=e;const t=null==c;d(),r&&t&&s()};return h.schedule=d,h.cancel=b,h.flush=()=>{u(),s()},o?.addEventListener("abort",b,{once:!0}),h}function po(e,t=0,o={}){"object"!=typeof o&&(o={});const{leading:i=!1,trailing:l=!0,maxWait:n}=o,r=Array(2);let a;i&&(r[0]="leading"),l&&(r[1]="trailing");let s=null;const c=go(function(...t){a=e.apply(this,t),s=null},t,{edges:r}),d=function(...t){return null!=n&&(null===s&&(s=Date.now()),Date.now()-s>=n)?(a=e.apply(this,t),s=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,t),a)};return d.cancel=c.cancel,d.flush=()=>(c.flush(),a),d}const fo=(()=>[mt.BalloonPanelView.defaultPositions.northArrowSouth,mt.BalloonPanelView.defaultPositions.northArrowSouthWest,mt.BalloonPanelView.defaultPositions.northArrowSouthEast,mt.BalloonPanelView.defaultPositions.southArrowNorth,mt.BalloonPanelView.defaultPositions.southArrowNorthWest,mt.BalloonPanelView.defaultPositions.southArrowNorthEast,mt.BalloonPanelView.defaultPositions.viewportStickyNorth])();function wo(e,t){const o=e.plugins.get("ContextualBalloon"),i=e.editing.view.document.selection;let l;"cell"===t?zt(i)&&(l=ko(e)):Dt(i)&&(l=_o(e)),l&&o.updatePosition(l)}function _o(e){const t=y(e.model.document.selection),o=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(o),positions:fo}}function ko(e){const t=e.editing.mapper,o=e.editing.view.domConverter,i=e.model.document.selection;if(i.rangeCount>1)return{target:()=>function(e,t){const o=t.editing.mapper,i=t.editing.view.domConverter,n=Array.from(e).map(e=>{const t=Co(e.start),n=o.toViewElement(t);return new l.Rect(i.mapViewToDom(n))});return l.Rect.getBoundingRect(n)}(i.getRanges(),e),positions:fo};const n=Co(i.getFirstPosition()),r=t.toViewElement(n);return{target:o.mapViewToDom(r),positions:fo}}function Co(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const yo={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class vo extends e.Plugin{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor,t=e.t;this._defaultContentTableCellProperties=$(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._defaultLayoutTableCellProperties=j(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(mt.ContextualBalloon),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",o=>{const i=new mt.ButtonView(o);i.set({label:t("Cell properties"),icon:ht.IconTableCellProperties,tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());const l=Object.values(yo).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableCellProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new ho(t.locale,{borderColors:l,backgroundColors:r,defaultTableCellProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:Zt})),s.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:s.paddingInput,commandName:"tableCellPadding",errorText:u,validator:Yt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableCellWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableCellHeight",errorText:u,validator:Yt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:Xt})),s.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),s.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(yo).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[i]||"":this._defaultLayoutTableCellProperties[i]||"";return[t,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ko(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;zt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}class To extends e.Command{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,o){switch(super(e),this.attributeName=t,this._defaultContentTableValue=o,t){case"tableCellBorderStyle":this._defaultLayoutTableValue="none";break;case"tableCellHorizontalAlignment":this._defaultLayoutTableValue="left";break;case"tableCellVerticalAlignment":this._defaultLayoutTableValue="middle";break;default:this._defaultLayoutTableValue=void 0}}refresh(){const e=this.editor.model.document.selection,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e),o=y(e);this._defaultValue=o&&"layout"===o.getAttribute("tableType")?this._defaultLayoutTableValue:this._defaultContentTableValue,this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){const{value:t,batch:o}=e,i=this.editor.model,l=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),n=this._getValueToSet(t);i.enqueueChange(o,e=>{n?l.forEach(t=>e.setAttribute(this.attributeName,n,t)):l.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class Ao extends To{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=H(e,"px"))!==this._defaultValue)return e}}class xo extends e.Plugin{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ut]}init(){const e=this.editor,t=$(e.config.get("table.tableCellProperties.defaultProperties"));C(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:t.width}),e.commands.add("tableCellWidth",new Ao(e,t.width))}}class Vo extends To{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class So extends To{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class Po extends To{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class Io extends To{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class Ro extends To{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class Eo extends To{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Bo extends To{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Lo extends To{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}const Fo=/^(top|middle|bottom)$/,Wo=/^(left|center|right|justify)$/;class Do extends e.Plugin{static get pluginName(){return"TableCellPropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[ut,xo]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const i=$(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(Pt.addBorderStylesRules),function(e,t){const{conversion:o}=e,{schema:i}=e.model,l={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};i.extend("tableCell",{allowAttributes:Object.values(l)});for(const e of Object.values(l))i.setAttributeProperties(e,{isFormatting:!0});r(e,"td",l,t),r(e,"th",l,t),a(o,{modelElement:"tableCell",modelAttribute:l.style,styleName:"border-style"}),a(o,{modelElement:"tableCell",modelAttribute:l.color,styleName:"border-color"}),a(o,{modelElement:"tableCell",modelAttribute:l.width,styleName:"border-width"})}(e,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableCellBorderStyle",new Eo(e,i.borderStyle)),e.commands.add("tableCellBorderColor",new Bo(e,i.borderColor)),e.commands.add("tableCellBorderWidth",new Lo(e,i.borderWidth)),C(t,o,{modelAttribute:"tableCellHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:i.height}),e.commands.add("tableCellHeight",new So(e,i.height)),e.data.addStyleProcessorRules(Pt.addPaddingStylesRules),C(t,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),e.commands.add("tableCellPadding",new Vo(e,i.padding)),e.data.addStyleProcessorRules(Pt.addBackgroundStylesRules),C(t,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:i.backgroundColor}),e.commands.add("tableCellBackgroundColor",new Po(e,i.backgroundColor)),function(e,t,o){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),e.setAttributeProperties("tableCellHorizontalAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":Wo}},model:{key:"tableCellHorizontalAlignment",value:(e,t,i)=>{const l=c(o,"left",i),n=e.getStyle("text-align");if(n!==l)return n;t.consumable.consume(e,{styles:"text-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Wo}},model:{key:"tableCellHorizontalAlignment",value:(e,t,i)=>{const l=c(o,"left",i),n=e.getAttribute("align");if(n!==l)return n;t.consumable.consume(e,{attributes:"align"})}}})}(t,o,i.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new Ro(e,i.horizontalAlignment)),function(e,t,o){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),e.setAttributeProperties("tableCellVerticalAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":Fo}},model:{key:"tableCellVerticalAlignment",value:(e,t,i)=>{const l=c(o,"middle",i),n=e.getStyle("vertical-align");if(n!==l)return n;t.consumable.consume(e,{styles:"vertical-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:Fo}},model:{key:"tableCellVerticalAlignment",value:(e,t,i)=>{const l=c(o,"middle",i),n=e.getAttribute("valign");if(n!==l)return n;t.consumable.consume(e,{attributes:"valign"})}}})}(t,o,i.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Io(e,i.verticalAlignment))}}class No extends e.Plugin{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[Do,vo]}}class zo extends e.Plugin{static get pluginName(){return"TableLayoutUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.ui.componentFactory.add("insertTableLayout",o=>{const i=e.commands.get("insertTableLayout"),l=(0,mt.createDropdown)(o);let n;return l.bind("isEnabled").to(i),l.buttonView.set({icon:ht.IconTableLayout,label:t("Insert table layout"),tooltip:!0}),l.on("change:isOpen",()=>{n||(n=new ft(o),l.panelView.children.add(n),n.delegate("execute").to(l),l.on("execute",()=>{e.execute("insertTableLayout",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}))}),l}),e.ui.componentFactory.add("menuBar:insertTableLayout",o=>{const i=e.commands.get("insertTableLayout"),l=new mt.MenuBarMenuView(o),n=new ft(o);return n.delegate("execute").to(l),l.on("change:isOpen",(e,t,o)=>{o||n.reset()}),n.on("execute",()=>{e.execute("insertTableLayout",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}),l.buttonView.set({label:t("Table layout"),icon:ht.IconTableLayout}),l.panelView.children.add(n),l.bind("isEnabled").to(i),l}),e.ui.componentFactory.add("tableType",()=>{const e=this.editor,t=e.t,o=new mt.DropdownButtonView(e.locale);return o.set({label:t("Table type"),icon:ht.IconTableProperties,tooltip:!0}),Oo(e,o)})}afterInit(){const e=this.editor;if(!e.plugins.has("TablePropertiesUI"))return;const t=e.plugins.get("TablePropertiesUI");e.ui.componentFactory.add("tableProperties",o=>{const i=t._createTablePropertiesButton(),l=new mt.SplitButtonView(o,i);return Oo(e,l)})}}function Oo(e,t){const o=e.t,i=e.locale,n=e.commands.get("tableType"),r=(0,mt.createDropdown)(i,t),a=function(e){const t=e.t,o=e.commands.get("tableType"),i=new l.Collection;return i.add(Mo(o,"layout",t("Layout table"))),i.add(Mo(o,"content",t("Content table"))),i}(e);return(0,mt.addListToDropdown)(r,a,{ariaLabel:o("Table type options"),role:"menu"}),t.tooltip=o("Choose table type"),r.on("execute",e=>{const t=e.source.tableType;t&&n.execute(t)}),r}function Mo(e,t,o){const i=new mt.UIModel({label:o,role:"menuitemradio",withText:!0,tableType:t});return i.bind("isEnabled").to(e,"isEnabled"),i.bind("isOn").to(e,"value",e=>e===t),{type:"button",model:i}}class Ho extends e.Command{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema;this.isEnabled=function(e,t){const o=e.getFirstPosition().parent,i=o===o.root?o:o.parent;return t.checkChild(i,"table")}(t,o)}execute(e={}){const t=this.editor,o=t.model,i=t.plugins.get("TableUtils");o.change(l=>{const n={rows:e.rows||2,columns:e.columns||2},r=i.createTable(l,n);l.setAttribute("tableType","layout",r),o.insertObject(r,null,null,{findOptimalPosition:"auto"});const a=100/n.columns+"%",s=Array(n.columns).fill(a);t.commands.get("resizeColumnWidths").execute({tableWidth:"100%",columnWidths:s,table:r}),l.setSelection(l.createPositionAt(r.getNodeByPath([0,0,0]),0))})}}function jo(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function Uo(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function $o(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Ko="[object Arguments]",Go="[object Object]";function qo(e,t,o,i,l,n,r){const a=r(e,t,o,i,l,n);if(void 0!==a)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return e===t;case"number":return e===t||Object.is(e,t);case"object":return Jo(e,t,n,r)}return Jo(e,t,n,r)}function Jo(e,t,o,i){if(Object.is(e,t))return!0;let l=$o(e),n=$o(t);if(l===Ko&&(l=Go),n===Ko&&(n=Go),l!==n)return!1;switch(l){case"[object String]":return e.toString()===t.toString();case"[object Number]":{const o=e.valueOf(),i=t.valueOf();return(r=o)===(a=i)||Number.isNaN(r)&&Number.isNaN(a)}case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(e.valueOf(),t.valueOf());case"[object RegExp]":return e.source===t.source&&e.flags===t.flags;case"[object Function]":return e===t}var r,a;const s=(o=o??new Map).get(e),c=o.get(t);if(null!=s&&null!=c)return s===t;o.set(e,t),o.set(t,e);try{switch(l){case"[object Map]":if(e.size!==t.size)return!1;for(const[l,n]of e.entries())if(!t.has(l)||!qo(n,t.get(l),l,e,t,o,i))return!1;return!0;case"[object Set]":{if(e.size!==t.size)return!1;const l=Array.from(e.values()),n=Array.from(t.values());for(let r=0;r<l.length;r++){const a=l[r],s=n.findIndex(l=>qo(a,l,void 0,e,t,o,i));if(-1===s)return!1;n.splice(s,1)}return!0}case"[object Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":case"[object BigUint64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object BigInt64Array]":case"[object Float32Array]":case"[object Float64Array]":if("undefined"!=typeof Buffer&&Buffer.isBuffer(e)!==Buffer.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(let l=0;l<e.length;l++)if(!qo(e[l],t[l],l,e,t,o,i))return!1;return!0;case"[object ArrayBuffer]":return e.byteLength===t.byteLength&&Jo(new Uint8Array(e),new Uint8Array(t),o,i);case"[object DataView]":return e.byteLength===t.byteLength&&e.byteOffset===t.byteOffset&&Jo(new Uint8Array(e),new Uint8Array(t),o,i);case"[object Error]":return e.name===t.name&&e.message===t.message;case Go:{if(!(Jo(e.constructor,t.constructor,o,i)||jo(e)&&jo(t)))return!1;const l=[...Object.keys(e),...Uo(e)],n=[...Object.keys(t),...Uo(t)];if(l.length!==n.length)return!1;for(let n=0;n<l.length;n++){const r=l[n],a=e[r];if(!Object.hasOwn(t,r))return!1;if(!qo(a,t[r],r,e,t,o,i))return!1}return!0}default:return!1}}finally{o.delete(e),o.delete(t)}}function Xo(){}function Yo(e,t){return function(e,t,o){return qo(e,t,void 0,void 0,void 0,void 0,o)}(e,t,Xo)}class Zo extends e.Command{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:o}=this.editor;let{table:i=t.document.selection.getSelectedElement(),columnWidths:l,tableWidth:n}=e;l&&(l=Array.isArray(l)?l:l.split(",")),t.change(e=>{n?e.setAttribute("tableWidth",n,i):e.removeAttribute("tableWidth",i);const t=o.get("TableColumnResizeEditing").getColumnGroupElement(i);if(!l&&!t)return;if(!l)return e.remove(t);const r=ve(l);if(t)Array.from(t.getChildren()).forEach((t,o)=>e.setAttribute("columnWidth",r[o],t));else{const t=e.createElement("tableColumnGroup");r.forEach(o=>e.appendElement("tableColumn",{columnWidth:o},t)),e.append(t,i)}})}}function Qo(e){return t=>t.on("element:colgroup",(t,o,i)=>{const l=o.modelCursor.findAncestor("table"),n=xe(l);if(!n)return;const r=Ve(n),a=e.getColumns(l);let s=Pe(n,i.writer);s=Array.from({length:a},(e,t)=>s[t]||"auto"),(s.length!=r.length||s.includes("auto"))&&Ae(r,n,ve(s),i.writer)},{priority:"low"})}function ei(){return e=>e.on("insert:table",(e,t,o)=>{const i=o.writer,l=t.item,n=o.mapper.toViewElement(l),r=n.is("element","table")?n:Array.from(n.getChildren()).find(e=>e.is("element","table"));xe(l)?i.addClass("ck-table-resized",r):i.removeClass("ck-table-resized",r)},{priority:"low"})}const ti=(0,l.toUnit)("px");class oi extends e.Plugin{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;_initialMouseEventData=null;static get requires(){return[ut,Ie]}static get pluginName(){return"TableColumnResizeEditing"}static get licenseFeatureCode(){return"TCR"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new((0,l.DomEmitterMixin)()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(t,o,i)=>{const l=i?"removeClass":"addClass";e.editing.view.change(t=>{for(const o of e.editing.view.document.roots)t[l]("ck-column-resize_disabled",e.editing.view.document.getRoot(o.rootName))})})}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});const o=new Zo(e);e.commands.add("resizeTableWidth",o),e.commands.add("resizeColumnWidths",o),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",o,"isEnabled",(e,t,o)=>!e&&t&&o)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return xe(e)}getTableColumnElements(e){return Ve(e)}getTableColumnsWidths(e){return Se(e)}_extendSchema(){const e=this.editor.model.schema;e.extend("table",{allowAttributes:["tableWidth"]}),e.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),e.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0}),e.setAttributeProperties("columnWidth",{isFormatting:!0})}_registerPostFixer(){const e=this.editor.model;function t(e,t,o){const i=o._tableUtilsPlugin.getColumns(t);if(0===i-e.length)return e;const l=e.map(e=>Number(e.replace("%",""))),n=function(e,t){const o=new Set;for(const i of e.getChanges())if("insert"==i.type&&i.position.nodeAfter&&"tableCell"==i.position.nodeAfter.name&&i.position.nodeAfter.getAncestors().includes(t))o.add(i.position.nodeAfter);else if("remove"==i.type){const e=i.position.nodeBefore||i.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&o.add(e)}return o}(o.editor.model.document.differ,t);for(const e of n){const n=i-l.length;if(0===n)continue;const r=n>0,a=o._tableUtilsPlugin.getCellLocation(e).column;if(r){const e=Ce(n,me(t,o.editor));l.splice(a,0,...e)}else{const e=l.splice(a,Math.abs(n));l[a]+=ye(e)}}return l.map(e=>e+"%")}e.document.registerPostFixer(o=>{let i=!1;for(const l of he(e)){const e=this.getColumnGroupElement(l),n=this.getTableColumnElements(e),r=this.getTableColumnsWidths(e);let a=ve(r);a=t(a,l,this),Yo(r,a)||(Ae(n,e,a,o),i=!0)}return i})}_registerConverters(){const e=this.editor.conversion;e.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{key:"tableWidth",value:e=>{if(!e.parent.is("element","figure"))return e.getStyle("width")}}}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),e.elementToElement({model:"tableColumnGroup",view:"colgroup"}),e.elementToElement({model:"tableColumn",view:"col"}),e.for("downcast").add(ei()),e.for("upcast").add(e=>{e.on("element:table",(e,t,o)=>{o.consumable.consume(t.viewItem,{classes:"ck-table-resized"})})}),e.for("upcast").add(Qo(this._tableUtilsPlugin)),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),e.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),e.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver(It),e.document.on("mouseover",this._onMouseOverHandler.bind(this),{priority:"high"}),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),e.document.on("mouseout",this._onMouseOutHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(l.global.window.document,"mousemove",function(e,t=0,o={}){"object"!=typeof o&&(o={});const{leading:i=!0,trailing:l=!0}=o;return po(e,t,{leading:i,trailing:l,maxWait:t})}(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(l.global.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){const t=this.editor,o=t.editing.view.domConverter,i=o.mapViewToDom(e.findAncestor("table")),n=o.mapViewToDom(e.findAncestor(e=>["td","th"].includes(e.name))),r=new l.Rect(i),a=new l.Rect(n),s=ti(Number((r.top-a.top).toFixed(4))),c=ti(Number((a.bottom-r.bottom).toFixed(4)));t.editing.view.change(t=>{t.setStyle("top",s,e),t.setStyle("bottom",c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(t=>{t.removeStyle("top",e),t.removeStyle("bottom",e)})}_onMouseOverHandler(e,t){const o=t.target;o.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(o)}_onMouseOutHandler(e,t){const o=t.target;o.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(o))}_onMouseDownHandler(e,t){const o=t.target;if(!o.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const i=this.editor,l=i.editing.mapper.toModelElement(o.findAncestor("figure"));i.model.canEditAt(l)&&(t.preventDefault(),e.stop(),this._initialMouseEventData=t)}_startResizingAfterThreshold(){const e=this._initialMouseEventData,{target:t}=e,o=this.editor.editing.mapper.toModelElement(t.findAncestor("figure")),i=t.findAncestor("table"),l=function(e,t,o){const i=Array(t.getColumns(e)),l=new v(e);for(const e of l){const t=o.editing.mapper.toViewElement(e.cell),l=Te(o.editing.view.domConverter.mapViewToDom(t));(!i[e.column]||l<i[e.column])&&(i[e.column]=_e(l))}return i}(o,this._tableUtilsPlugin,this.editor);Array.from(i.getChildren()).find(e=>e.is("element","colgroup"))||this.editor.editing.view.change(e=>{!function(e,t,o){const i=e.createContainerElement("colgroup");for(let o=0;o<t.length;o++){const l=e.createEmptyElement("col"),n=`${_e(t[o]/ye(t)*100)}%`;e.setStyle("width",n,l),e.insert(e.createPositionAt(i,"end"),l)}e.insert(e.createPositionAt(o,0),i)}(e,l,i)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,l),this.editor.editing.view.change(e=>function(e,t,o){const i=o.widths.viewFigureWidth/o.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",o.elements.viewResizer),e.setStyle("width",`${_e(100*i)}%`,t.findAncestor("figure"))}(e,i,this._resizingData))}_onMouseMoveHandler(e,t){if(this._initialMouseEventData){const e=this._initialMouseEventData.domEvent;if(!(Math.abs(t.clientX-e.clientX)>=be))return;this._startResizingAfterThreshold(),this._initialMouseEventData=null}if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:o,flags:{isRightEdge:i,isTableCentered:l,isLtrContent:n},elements:{viewFigure:r,viewLeftColumn:a,viewRightColumn:s,viewResizer:c},widths:{viewFigureParentWidth:d,tableWidth:u,leftColumnWidth:b,rightColumnWidth:h}}=this._resizingData,m=-b+de,g=i?d-u:h-de,p=(n?1:-1)*(i&&l?2:1),f=ke((t.clientX-o)*p,Math.min(m,0),Math.max(g,0));0!==f&&(this.editor.editing.view.change(e=>{const t=_e(100*(b+f)/u);if(e.setStyle("width",`${t}%`,a),i){const t=_e(100*(u+f)/d);e.setStyle("width",`${t}%`,r)}else{const t=_e(100*(h-f)/u);e.setStyle("width",`${t}%`,s)}}),this._recalculateResizerElement(c))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:o,viewColgroup:i}=this._resizingData.elements,l=this.editor,n=l.editing.view,r=this.getColumnGroupElement(t),a=Array.from(i.getChildren()).filter(e=>e.is("view:element")),s=r?this.getTableColumnsWidths(r):null,c=a.map(e=>e.getStyle("width")),d=!Yo(s,c),u=t.getAttribute("tableWidth"),b=o.getStyle("width"),h=u!==b;(d||h)&&(this._isResizingAllowed?l.execute("resizeTableWidth",{table:t,tableWidth:`${_e(b)}%`,columnWidths:c}):n.change(e=>{if(s)for(const t of a)e.setStyle("width",s.shift(),t);else e.remove(i);h&&(u?e.setStyle("width",u,o):e.removeStyle("width",o)),s||u||e.removeClass("ck-table-resized",[...o.getChildren()].find(e=>"table"===e.name))})),n.change(t=>{t.removeClass("ck-table-column-resizer__active",e)});n.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const o=this.editor,i=e.domEvent.clientX,l=e.target,n=l.findAncestor("td")||l.findAncestor("th"),r=o.editing.mapper.toModelElement(n),a=r.findAncestor("table"),s=we(r,this._tableUtilsPlugin).rightEdge,c=s===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),u="rtl"!==o.locale.contentLanguageDirection,b=n.findAncestor("table"),h=b.findAncestor("figure"),m=[...b.getChildren()].find(e=>e.is("element","colgroup")),g=m.getChild(s),p=c?void 0:m.getChild(s+1);return{columnPosition:i,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:u},elements:{viewResizer:l,modelTable:a,viewFigure:h,viewColgroup:m,viewLeftColumn:g,viewRightColumn:p},widths:{viewFigureParentWidth:fe(o.editing.view.domConverter.mapViewToDom(h.parent)),viewFigureWidth:fe(o.editing.view.domConverter.mapViewToDom(h)),tableWidth:ge(a,o),leftColumnWidth:t[s],rightColumnWidth:c?void 0:t[s+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(e,t,o)=>{const i=t.item,l=o.mapper.toViewElement(i),n=o.writer;n.insert(n.createPositionAt(l,"end"),n.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}}var ii=o(433),li={attributes:{"data-cke":!0}};li.setAttributes=rt(),li.insert=lt().bind(null,"head"),li.domAPI=ot(),li.insertStyleElement=st();et()(ii.A,li);ii.A&&ii.A.locals&&ii.A.locals;class ni extends e.Plugin{static get requires(){return[oi,xo]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}class ri extends e.Command{refresh(){const e=y(this.editor.model.document.selection);e?(this.isEnabled=!0,this.value=e.getAttribute("tableType")):(this.isEnabled=!1,this.value=null)}execute(e){const t=this.editor.model,o=y(t.document.selection);o.getAttribute("tableType")!==e&&t.change(i=>{i.setAttribute("tableType",e,o),t.schema.removeDisallowedAttributes([o],i);const l=o.getChildren();for(const e of l)t.schema.checkChild(o,e)||i.remove(e)})}}var ai=o(49),si={attributes:{"data-cke":!0}};si.setAttributes=rt(),si.insert=lt().bind(null,"head"),si.domAPI=ot(),si.insertStyleElement=st();et()(ai.A,si);ai.A&&ai.A.locals&&ai.A.locals;const ci=["content","layout"];class di extends e.Plugin{static get pluginName(){return"TableLayoutEditing"}static get licenseFeatureCode(){return"TL"}static get requires(){return[ni]}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this._defineSchema(),this._defineConverters(),this._defineClipboardPasteHandlers(),this._registerTableTypeAttributePostfixer(),this.editor.commands.add("insertTableLayout",new Ho(this.editor)),this.editor.commands.add("tableType",new ri(this.editor))}_defineSchema(){const{schema:e}=this.editor.model;e.extend("table",{allowAttributes:"tableType"}),e.addChildCheck(bi,"caption"),e.addAttributeCheck(bi,"headingRows"),e.addAttributeCheck(bi,"headingColumns")}_defineConverters(){const{editor:e}=this,{conversion:t}=e,o=e.config.get("table.tableLayout.preferredExternalTableType");t.for("upcast").add(function(e,t){return o=>{o.on("element:table",(o,i,l)=>{const n=i.viewItem;if(!l.consumable.test(n,{name:!0}))return;if("content"==ui(n,t))return;const r=l.writer.createElement("table",{tableType:"layout"});if(l.safeInsert(r,i.modelCursor)){l.consumable.consume(n,{name:!0}),l.consumable.consume(n,{attributes:["role"]}),l.consumable.consume(n,{classes:["layout-table"]}),e.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&"0"===n.getAttribute("border")&&l.consumable.consume(n,{attributes:["border"]});for(const e of n.getChildren())if(e.is("element"))for(const t of e.getChildren())t.is("element","tr")&&l.convertItem(t,l.writer.createPositionAt(r,"end"));if(l.convertChildren(n,l.writer.createPositionAt(r,"end")),r.isEmpty){const e=l.writer.createElement("tableRow");l.writer.insert(e,l.writer.createPositionAt(r,"end")),_(l.writer,l.writer.createPositionAt(e,"end"))}l.updateConversionResult(r,i)}},{priority:"high"}),o.on("element:table",(e,o,i)=>{const{viewItem:l,modelRange:n}=o;n&&(i.writer.setAttribute("tableType",ui(l,t),n),i.consumable.consume(l,{classes:["layout-table"]}),i.consumable.consume(l,{classes:["content-table"]}))},{priority:"low"})}}(e,o)),t.for("dataDowncast").add(e=>e.on("attribute:tableType:table",(e,t,o)=>{const{item:i,attributeNewValue:l}=t,{mapper:n,writer:r}=o;if(!o.consumable.test(i,e.name))return;const a=n.toViewElement(i);r.addClass(`${l}-table`,a),"layout"==l&&r.setAttribute("role","presentation",a),o.consumable.consume(i,e.name)})),t.for("editingDowncast").attributeToAttribute({model:{key:"tableType",values:["layout","content"]},view:{layout:{key:"class",value:["layout-table"]},content:{key:"class",value:["content-table"]}}})}_defineClipboardPasteHandlers(){const{plugins:e}=this.editor;if(!e.has("ClipboardPipeline"))return;const t=e.get("ClipboardPipeline");this.listenTo(t,"contentInsertion",(e,t)=>{t.sourceEditorId||this.editor.model.change(e=>{for(const{item:o}of e.createRangeIn(t.content))o.is("element","table")&&e.setAttribute("tableType","content",o)})})}_registerTableTypeAttributePostfixer(){const e=this.editor;e.model.document.registerPostFixer(t=>{const o=e.model.document.differ.getChanges();let i=!1;for(const l of o){if("insert"==l.type&&"$text"!=l.name){const e=l.position.nodeAfter,o=t.createRangeOn(e);for(const e of o.getItems())e.is("element","table")&&!e.hasAttribute("tableType")&&(t.setAttribute("tableType","content",e),i=!0)}if("attribute"==l.type&&"tableType"==l.attributeKey)for(const o of l.range.getItems())if(o.is("element","table")){e.model.schema.removeDisallowedAttributes([o],t);const l=o.getChildren();for(const n of l)e.model.schema.checkChild(o,n)||(t.remove(n),i=!0)}}return i})}}function ui(e,t){if(e.hasClass("content-table"))return"content";if(e.hasClass("layout-table"))return"layout";if(t&&ci.includes(t))return t;return e.parent.is("element","figure")||Array.from(e.getChildren()).some(e=>e.is("element","caption"))?"content":"layout"}function bi(e){if(e.endsWith("table")&&"layout"==e.last.getAttribute("tableType"))return!1}class hi extends e.Plugin{static get pluginName(){return"TableLayout"}static get isOfficialPlugin(){return!0}static get requires(){return[Wt,ni,di,zo]}}class mi extends e.Command{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,o){super(e),this.attributeName=t,this._defaultContentTableValue=o,this._defaultLayoutTableValue="tableBorderStyle"===t?"none":void 0}refresh(){const e=y(this.editor.model.document.selection);this._defaultValue=e&&"layout"===e.getAttribute("tableType")?this._defaultLayoutTableValue:this._defaultContentTableValue,this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,o=t.document.selection,{value:i,batch:l}=e,n=y(o),r=this._getValueToSet(i);t.enqueueChange(l,e=>{r?e.setAttribute(this.attributeName,r,n):e.removeAttribute(this.attributeName,n)})}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class gi extends mi{constructor(e,t){super(e,"tableBackgroundColor",t)}}class pi extends mi{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class fi extends mi{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class wi extends mi{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class _i extends mi{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=H(e,"px"))!==this._defaultValue)return e}}class ki extends mi{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=H(e,"px"))!==this._defaultValue)return e}}class Ci extends mi{constructor(e,t){super(e,"tableAlignment",t)}}class yi extends e.Plugin{static get pluginName(){return"TablePropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[ut]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const i=U(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),a=!1!==e.config.get("table.tableProperties.alignment.useInlineStyles");if(e.data.addStyleProcessorRules(Pt.addMarginStylesRules),e.data.addStyleProcessorRules(Pt.addBorderStylesRules),function(e,t){const{conversion:o}=e,{schema:i}=e.model,l={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};i.extend("table",{allowAttributes:Object.values(l)});for(const e of Object.values(l))i.setAttributeProperties(e,{isFormatting:!0});r(e,"table",l,t),s(o,{modelAttribute:l.color,styleName:"border-color"}),s(o,{modelAttribute:l.style,styleName:"border-style"}),s(o,{modelAttribute:l.width,styleName:"border-width"})}(e,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableBorderColor",new pi(e,i.borderColor)),e.commands.add("tableBorderStyle",new fi(e,i.borderStyle)),e.commands.add("tableBorderWidth",new wi(e,i.borderWidth)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")?function(e,t,o,i){e.extend("table",{allowAttributes:["tableAlignment"]}),e.setAttributeProperties("tableAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right","blockLeft","blockRight"]},view:{left:i?{key:"style",value:{float:"left","margin-right":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:u.className},right:i?{key:"style",value:{float:"right","margin-left":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:h.className},center:i?{key:"style",value:{"margin-left":"auto","margin-right":"auto"}}:{key:"class",value:b.className},blockLeft:i?{key:"style",value:{"margin-left":"0","margin-right":"auto"}}:{key:"class",value:m.className},blockRight:i?{key:"style",value:{"margin-left":"auto","margin-right":"0"}}:{key:"class",value:g.className}},converterPriority:"high"}),p.forEach(e=>{t.for("upcast").attributeToAttribute({view:e.view,model:{key:"tableAlignment",value:(t,i,l)=>{if(function(e){return"figure"==e.name&&!e.hasClass("table")}(t))return;const n=c(o,"",l),r=e.getAlign(t),a=e.getConsumables(t);return i.consumable.consume(t,a),r!==n?r:void 0}}})}),t.for("upcast").add(function(e){return t=>{t.on("element:div",(t,o,i)=>{if(!i.consumable.test(o.viewItem,{name:!0,attributes:"align"}))return;const n=W(o.viewItem);if(!n||!i.consumable.test(n,{name:!0}))return;i.consumable.consume(o.viewItem,{name:!0,attributes:"align"});const r=i.convertItem(n,o.modelCursor),a=(0,l.first)(r.modelRange.getItems());if(!a||!a.is("element","table"))return i.consumable.revert(o.viewItem,{name:!0,attributes:"align"}),void(r.modelRange&&!r.modelRange.isCollapsed&&(o.modelRange=r.modelRange,o.modelCursor=r.modelCursor));const s=function(e,t,o){if(e)switch(e){case"right":return"right"===t?"right":"left"===t?"left":"blockRight";case"center":return"center";case"left":return void 0===t?"blockLeft":"left";default:return o}return}(o.viewItem.getAttribute("align"),n.getAttribute("align"),c(e,"",o));s&&i.writer.setAttribute("tableAlignment",s,a),i.convertChildren(o.viewItem,i.writer.createPositionAt(a,"end")),i.updateConversionResult(a,o)})}}(o))}(t,o,i.alignment,a):function(e,t,o){const i=/^(left|center|right)$/,l=/^(left|none|right)$/;e.extend("table",{allowAttributes:["tableAlignment"]}),e.setAttributeProperties("tableAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}},center:(e,t,o)=>({key:"style",value:"layout"!==o.item.getAttribute("tableType")?{float:"none"}:{"margin-left":"auto","margin-right":"auto"}})},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:l}},model:{key:"tableAlignment",value:(e,t,i)=>{if("figure"==e.name&&!e.hasClass("table"))return;const l=c(o,"",i);let n=e.getStyle("float");if("none"===n&&(n="center"),n!==l)return n;t.consumable.consume(e,{styles:"float"})}}}).attributeToAttribute({view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},model:{key:"tableAlignment",value:(e,t,i)=>{if("figure"==e.name&&!e.hasClass("table"))return;const l="center";if(l!==c(o,"",i))return l;t.consumable.consume(e,{styles:["margin-left","margin-right"]})}}}).attributeToAttribute({view:{name:"table",attributes:{align:i}},model:{key:"tableAlignment",value:(e,t,i)=>{const l=c(o,"",i),n=e.getAttribute("align");if(n!==l)return n;t.consumable.consume(e,{attributes:"align"})}}})}(t,o,i.alignment),e.commands.add("tableAlignment",new Ci(e,i.alignment)),Ai(t,o,{modelAttribute:"tableWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:i.width}),e.commands.add("tableWidth",new _i(e,i.width)),Ai(t,o,{modelAttribute:"tableHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:i.height}),e.commands.add("tableHeight",new ki(e,i.height)),e.data.addStyleProcessorRules(Pt.addBackgroundStylesRules),function(e,t,o){const{modelAttribute:i}=o;e.extend("table",{allowAttributes:[i]}),e.setAttributeProperties(i,{isFormatting:!0}),n(t,{viewElement:"table",...o}),s(t,o)}(t,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:i.backgroundColor}),e.commands.add("tableBackgroundColor",new gi(e,i.backgroundColor)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")){const t=e.editing.view.document;this.listenTo(t,"clipboardOutput",(t,o)=>{e.editing.view.change(e=>{for(const{item:t}of e.createRangeIn(o.content))vi(t,e);o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content))})},{priority:"lowest"})}}}function vi(e,t){if(!e.is("element","table"))return;const o=e.getAttribute("align"),i=e.getStyle("float"),l=e.getStyle("margin-left"),n=e.getStyle("margin-right");o&&"center"===o||i&&"right"===i&&o&&"right"===o?Ti(t,o,e):void 0===i&&"auto"===l&&"0"===n&&Ti(t,"right",e)}function Ti(e,t,o){const i=e.createPositionBefore(o),l=e.createContainerElement("div",{align:t},o);e.insert(i,l)}function Ai(e,t,o){const{modelAttribute:i}=o;e.extend("table",{allowAttributes:[i]}),e.setAttributeProperties(i,{isFormatting:!0}),n(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name||"figure"==e.name&&!e.hasClass("table")),...o}),a(t,{modelElement:"table",...o})}var xi=o(664),Vi={attributes:{"data-cke":!0}};Vi.setAttributes=rt(),Vi.insert=lt().bind(null,"head"),Vi.domAPI=ot(),Vi.insertStyleElement=st();et()(xi.A,Vi);xi.A&&xi.A.locals&&xi.A.locals;class Si extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new mt.FormHeaderView(e,{label:this.t("Table properties")})),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new mt.FormRowView(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=oo({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Gt(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,Qt(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",Pi),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",Pi),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{Pi(i)||(this.borderColor="",this.borderWidth=""),Pi(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=oo({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Alignment");const i=new mt.ToolbarView(e);return i.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),eo({view:this,icons:{left:ht.IconObjectInlineLeft,center:ht.IconObjectCenter,right:ht.IconObjectInlineRight},toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),icon:ht.IconCheck,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),icon:ht.IconCancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left"),i=t("Center table"),l=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:l,center:i,left:o}:{left:o,center:i,right:l}}}function Pi(e){return"none"!==e}const Ii={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Ri extends e.Plugin{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor;this._defaultContentTableProperties=U(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=j(),this._balloon=e.plugins.get(mt.ContextualBalloon),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,t=e.t,o=new mt.ButtonView(e.locale);o.set({label:t("Table properties"),icon:ht.IconTableProperties,tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const i=Object.values(Ii).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),o}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new Si(t.locale,{borderColors:l,backgroundColors:r,defaultTableProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:Zt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Xt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableHeight",errorText:u,validator:Yt})),s.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(Ii).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[i]||"":this._defaultLayoutTableProperties[i]||"";return[i,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:_o(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;Dt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}class Ei extends e.Plugin{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[yi,Ri]}}function Bi(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;for(const t of o){if("insert"!=t.type)continue;const o=t.position.parent;if(o.is("element","table")||"table"==t.name){const l="table"==t.name?t.position.nodeAfter:o,n=Array.from(l.getChildren()).filter(e=>e.is("element","caption")),r=n.shift();if(!r)continue;for(const t of n)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),l,"end"),i=!0),i=!!n.length||i}}return i}(t,e))}function Li(e){return!!e&&e.is("element","table")}function Fi(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function Wi(e){const t=y(e);return t?Fi(t):null}function Di(e){const t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class Ni extends e.Command{refresh(){const e=this.editor,t=y(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,"caption"),this.isEnabled?this.value=!!Fi(t):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)})}_showTableCaption(e,t){const o=this.editor.model,i=y(o.document.selection),l=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(i)||e.createElement("caption");o.insertContent(l,i,"end"),t&&e.setSelection(l,"in")}_hideTableCaption(e){const t=this.editor.model,o=y(t.document.selection),i=this.editor.plugins.get("TableCaptionEditing"),l=Fi(o);i._saveCaption(o,l),t.deleteContent(e.createSelection(l,"on"))}}class zi extends e.Plugin{_savedCaptionsMap=new WeakMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.model.schema,i=e.editing.view,l=e.t,n=e.config.get("table.tableCaption.useCaptionElement");if(o.isRegistered("caption")?o.extend("caption",{allowIn:"table"}):o.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new Ni(this.editor)),n){e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","caption"),positionOffset:"end"})}e.conversion.for("upcast").elementToElement({view:Di,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>Li(e.parent)?t.createContainerElement(n?"caption":"figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:o})=>{if(!Li(e.parent))return null;const r=o.createEditableElement(n?"caption":"figcaption");return o.setCustomProperty("tableCaption",!0,r),r.placeholder=l("Enter table caption"),(0,Pt.enableViewPlaceholder)({view:i,element:r,keepOnFocus:!0}),(0,t.toWidgetEditable)(r,o)}}),Bi(e.model)}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Pt.ModelElement.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class Oi extends e.Plugin{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,o=e.t;e.ui.componentFactory.add("toggleTableCaption",i=>{const l=e.commands.get("toggleTableCaption"),n=new mt.ButtonView(i);return n.set({icon:ht.IconCaption,tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(l,"value","isEnabled"),n.bind("label").to(l,"value",e=>o(e?"Toggle caption off":"Toggle caption on")),this.listenTo(n,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),l.value){const o=Wi(e.model.document.selection),i=e.editing.mapper.toViewElement(o);if(!i)return;t.scrollToTheSelection(),t.change(e=>{e.addClass("table__caption_highlighted",i)})}e.editing.view.focus()}),n})}}var Mi=o(965),Hi={attributes:{"data-cke":!0}};Hi.setAttributes=rt(),Hi.insert=lt().bind(null,"head"),Hi.domAPI=ot(),Hi.insertStyleElement=st();et()(Mi.A,Hi);Mi.A&&Mi.A.locals&&Mi.A.locals;class ji extends e.Plugin{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[zi,Oi]}}function Ui(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function $i(e,t){const o=new l.Collection,i=Ui(e.t);for(const l in i){const n={type:"button",model:new mt.UIModel({_borderStyleValue:l,label:i[l],role:"menuitemradio",withText:!0})};"none"===l?n.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===l):n.model.bind("isOn").to(e,"borderStyle",e=>e===l),o.add(n)}return o}function Ki(e){const{view:t,icons:o,toolbar:i,labels:l,propertyName:n,nameToValue:r,defaultValue:a}=e;for(const e in l){const s=new mt.ButtonView(t.locale);s.set({role:"radio",isToggleable:!0,label:l[e],icon:o[e],tooltip:l[e]});const c=r?r(e):e;s.bind("isOn").to(t,n,e=>{let t=e;return""===e&&a&&(t=a),c===t}),s.on("execute",()=>{!a&&c&&t[n]===c?t[n]=void 0:t[n]=c}),i.items.add(s)}}function Gi(e){return(t,o,i)=>{const l=new Ut(t.locale,{colorDefinitions:(n=e.colorConfig,n.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var n;return l.inputView.set({id:o,ariaDescribedById:i}),l.bind("isReadOnly").to(t,"isEnabled",e=>!e),l.bind("hasError").to(t,"errorText",e=>!!e),l.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(l),l}}var qi=o(562),Ji={attributes:{"data-cke":!0}};Ji.setAttributes=rt(),Ji.insert=lt().bind(null,"head"),Ji.domAPI=ot(),Ji.insertStyleElement=st();et()(qi.A,Ji);qi.A&&qi.A.locals&&qi.A.locals;var Xi=o(794),Yi={attributes:{"data-cke":!0}};Yi.setAttributes=rt(),Yi.insert=lt().bind(null,"head"),Yi.domAPI=ot(),Yi.insertStyleElement=st();et()(Xi.A,Yi);Xi.A&&Xi.A.locals&&Xi.A.locals;var Zi=o(993),Qi={attributes:{"data-cke":!0}};Qi.setAttributes=rt(),Qi.insert=lt().bind(null,"head"),Qi.domAPI=ot(),Qi.insertStyleElement=st();et()(Zi.A,Qi);Zi.A&&Zi.A.locals&&Zi.A.locals;class el extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this.backButtonView=this._createBackButton(),this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const f=new mt.FormHeaderView(e,{label:this.t("Table properties")});f.children.add(this.backButtonView,0),this.children.add(f),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,i,n],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})]})),this.children.add(new mt.FormRowView(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})),this.children.add(new mt.FormRowView(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form","ck-table-properties-form_experimental"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderWidthInput,this.borderColorInput,this.widthInput,this.heightInput,this.backgroundInput,this.alignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Gi({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Ui(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,$i(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",tl),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",tl),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{tl(i)||(this.borderColor="",this.borderWidth=""),tl(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=Gi({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Table Alignment");const i=new mt.ToolbarView(e);return i.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Ki({view:this,icons:{left:ht.IconObjectInlineLeft,center:ht.IconObjectCenter,right:ht.IconObjectInlineRight,blockLeft:ht.IconObjectLeft,blockRight:ht.IconObjectRight},toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}_createBackButton(){const e=this.locale.t,t=new mt.ButtonView(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ht.IconPreviousArrow,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left with no text wrapping"),i=t("Align table to the right with no text wrapping"),l=t("Align table to the left with text wrapping"),n=t("Center table with no text wrapping"),r=t("Align table to the right with text wrapping");return"rtl"===e.uiLanguageDirection?{right:r,left:l,blockRight:i,center:n,blockLeft:o}:{blockLeft:o,center:n,blockRight:i,left:l,right:r}}}function tl(e){return"none"!==e}const ol={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class il extends e.Plugin{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TablePropertiesUIExperimental"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor;this._defaultContentTableProperties=U(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=j(),this._balloon=e.plugins.get(mt.ContextualBalloon),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,t=e.t,o=new mt.ButtonView(e.locale);o.set({label:t("Table properties"),icon:ht.IconTableProperties,tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const i=Object.values(ol).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),o}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new el(t.locale,{borderColors:l,backgroundColors:r,defaultTableProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:Zt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Xt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableHeight",errorText:u,validator:Yt})),s.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(ol).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[i]||"":this._defaultLayoutTableProperties[i]||"";return[i,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:_o(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;Dt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}class ll extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this.backButtonView=this._createBackButton(),this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const w=new mt.FormHeaderView(e,{label:this.t("Cell properties")});w.children.add(this.backButtonView,0),this.children.add(w),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new mt.FormRowView(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new mt.FormRowView(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Gi({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Ui(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,$i(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",nl),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",nl),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{nl(i)||(this.borderColor="",this.borderWidth=""),nl(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=Gi({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createPaddingField(){const e=this.locale,t=this.t,o=new mt.LabeledFieldView(e,mt.createLabeledInputText);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",()=>{this.padding=o.fieldView.element.value}),o}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e),i={left:ht.IconAlignLeft,center:ht.IconAlignCenter,right:ht.IconAlignRight,justify:ht.IconAlignJustify,top:ht.IconAlignTop,middle:ht.IconAlignMiddle,bottom:ht.IconAlignBottom};o.text=t("Table cell text alignment");const l=new mt.ToolbarView(e),n="rtl"===e.contentLanguageDirection;l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),Ki({view:this,icons:i,toolbar:l,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(n){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new mt.ToolbarView(e);return r.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),Ki({view:this,icons:i,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:l,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}_createBackButton(){const e=this.locale.t,t=new mt.ButtonView(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ht.IconPreviousArrow,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),i=t("Align cell text to the center"),l=t("Align cell text to the right"),n=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:l,center:i,left:o,justify:n}:{left:o,center:i,right:l,justify:n}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function nl(e){return"none"!==e}const rl={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class al extends e.Plugin{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TableCellPropertiesUIExperimental"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor,t=e.t;this._defaultContentTableCellProperties=$(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._defaultLayoutTableCellProperties=j(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(mt.ContextualBalloon),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",o=>{const i=new mt.ButtonView(o);i.set({label:t("Cell properties"),icon:ht.IconTableCellProperties,tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());const l=Object.values(rl).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableCellProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new ll(t.locale,{borderColors:l,backgroundColors:r,defaultTableCellProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:Zt})),s.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:s.paddingInput,commandName:"tableCellPadding",errorText:u,validator:Yt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableCellWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableCellHeight",errorText:u,validator:Yt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:Xt})),s.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),s.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(rl).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[i]||"":this._defaultLayoutTableCellProperties[i]||"";return[t,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ko(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;zt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}})(),(window.CKEditor5=window.CKEditor5||{}).table=i})();
5
+ */(()=>{var e={29:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-form-default-width:340px}.ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form.ck-form_default-width{width:var(--ck-form-default-width)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-number,.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}@media screen and (max-width:600px){.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit{align-items:stretch;flex-direction:column;padding:0}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit>.ck{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit .ck-button_with-text{justify-content:center}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_large-bottom-padding{padding-bottom:var(--ck-spacing-large)}}[dir=ltr] .ck.ck-form.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-form.ck-responsive-form>:not(:last-child){margin-left:0}",""]);const a=r},49:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,'.ck-editor__editable.ck-editor__editable_inline>.ck-widget.ck-widget_with-selection-handle.layout-table:first-child{margin-top:var(--ck-spacing-large)}.ck-editor__editable.ck-editor__editable_inline>.ck-widget.ck-widget_with-selection-handle.layout-table:last-child,.ck-editor__editable.ck-editor__editable_inline>.ck-widget.ck-widget_with-selection-handle.layout-table:nth-last-child(2):has(+.ck-fake-selection-container){margin-bottom:var(--ck-spacing-large)}.ck-editor__editable .table.layout-table{display:table;margin:0}.ck-editor__editable .table.layout-table.ck-widget:hover{z-index:var(--ck-z-default)}.ck-editor__editable .table.layout-table.ck-widget:hover>.ck-widget__selection-handle{opacity:.75;visibility:visible}.ck-editor__editable .table.layout-table.ck-widget:hover>.ck-widget__selection-handle:hover{opacity:1}.ck-editor__editable .table.layout-table.ck-widget:has(.ck-widget.table:hover)>.ck-widget__selection-handle{opacity:0;visibility:hidden}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_selected{z-index:var(--ck-z-default)}.ck-content figure.table.layout-table,.ck-content table.table.layout-table{margin-bottom:0;margin-top:0}.ck-content figure.table.layout-table>table,.ck-content table.table.layout-table{border-spacing:0}:root{--ck-table-layout-widget-type-around-button-size:16px;--ck-table-layout-widget-type-around-icon-width:10px;--ck-table-layout-widget-type-around-icon-height:8px;--ck-table-layout-widget-handler-icon-size:10px;--ck-table-layout-default-border-color:#d4d4d4}.ck-editor__editable .table.layout-table>table{border-collapse:revert;height:100%;width:100%}.ck-editor__editable .table.layout-table>table:not([style*="border:"],[style*=border-top],[style*=border-bottom],[style*=border-left],[style*=border-right],[style*=border-width],[style*=border-style],[style*=border-color]){border-color:transparent;border-width:0;outline:none}.ck-editor__editable .table.layout-table>table>tbody>tr>td{box-shadow:revert;min-width:2em;padding:revert;text-indent:1px}.ck-editor__editable .table.layout-table>table>tbody>tr>td[style*=" width:"],.ck-editor__editable .table.layout-table>table>tbody>tr>td[style*="\'width:"],.ck-editor__editable .table.layout-table>table>tbody>tr>td[style*=";width:"],.ck-editor__editable .table.layout-table>table>tbody>tr>td[style^="width:"]{min-width:auto}.ck-editor__editable .table.layout-table>table>tbody>tr>td:focus{background-color:transparent}.ck-editor__editable .table.layout-table>table>tbody>tr>td:not([style*="border:"],[style*=border-top],[style*=border-bottom],[style*=border-left],[style*=border-right],[style*=border-width],[style*=border-style],[style*=border-color]){border-color:transparent;border-width:0;outline:var(--ck-table-layout-default-border-color) 1px dashed;outline-offset:-1px}.ck-editor__editable .table.layout-table>table>tbody>tr>td:not([style*="border:"],[style*=border-top],[style*=border-bottom],[style*=border-left],[style*=border-right],[style*=border-width],[style*=border-style],[style*=border-color]):focus{outline:var(--ck-color-focus-border) 1px solid}.ck-editor__editable .table.layout-table>table>tbody>tr>td>.ck-table-bogus-paragraph{text-indent:0;width:calc(100% - 1px)}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around{--ck-widget-type-around-button-size:var(--ck-table-layout-widget-type-around-button-size)}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_after,.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_before{transform:translateY(0);z-index:2}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_before{border-radius:0 0 100px 100px;left:min(10%,30px);margin-left:var(--ck-table-layout-widget-type-around-button-size)}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_before:after{border-radius:0 0 100px 100px}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_after,.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button.ck-widget__type-around__button_after:after{border-radius:100px 100px 0 0}.ck-editor__editable .table.layout-table.ck-widget>.ck-widget__type-around>.ck-widget__type-around__button svg{height:var(--ck-table-layout-widget-type-around-icon-height);width:var(--ck-table-layout-widget-type-around-icon-width)}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_with-selection-handle>.ck-widget__selection-handle{--ck-widget-handler-icon-size:var(--ck-table-layout-widget-handler-icon-size);transform:translateY(calc(0px - var(--ck-widget-outline-thickness)));z-index:3}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:0}.ck-editor__editable .table.layout-table.ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:0}',""]);const a=r},151:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}.ck-content figure.table:not(.layout-table){display:table}.ck-content figure.table:not(.layout-table)>table{height:100%;width:100%}.ck-content .table:not(.layout-table){margin:.9em auto}.ck-content figure.table:not(.layout-table)>table,.ck-content table.table:not(.layout-table){border:1px double #b3b3b3;border-collapse:collapse;border-spacing:0}.ck-content figure.table:not(.layout-table)>table>tbody>tr>th,.ck-content figure.table:not(.layout-table)>table>thead>tr>th,.ck-content table.table:not(.layout-table)>tbody>tr>th,.ck-content table.table:not(.layout-table)>thead>tr>th{background:rgba(0,0,0,.05);font-weight:700}.ck-content figure.table:not(.layout-table)>table>tbody>tr>td,.ck-content figure.table:not(.layout-table)>table>tbody>tr>th,.ck-content figure.table:not(.layout-table)>table>thead>tr>td,.ck-content figure.table:not(.layout-table)>table>thead>tr>th,.ck-content table.table:not(.layout-table)>tbody>tr>td,.ck-content table.table:not(.layout-table)>tbody>tr>th,.ck-content table.table:not(.layout-table)>thead>tr>td,.ck-content table.table:not(.layout-table)>thead>tr>th{border:1px solid #bfbfbf;min-width:2em;padding:.4em}.ck-content figure.table:not(.layout-table)>table>tbody>tr>td>p:first-of-type,.ck-content figure.table:not(.layout-table)>table>tbody>tr>th>p:first-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>td>p:first-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>th>p:first-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>td>p:first-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>th>p:first-of-type,.ck-content table.table:not(.layout-table)>thead>tr>td>p:first-of-type,.ck-content table.table:not(.layout-table)>thead>tr>th>p:first-of-type{margin-top:0}.ck-content figure.table:not(.layout-table)>table>tbody>tr>td>p:last-of-type,.ck-content figure.table:not(.layout-table)>table>tbody>tr>th>p:last-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>td>p:last-of-type,.ck-content figure.table:not(.layout-table)>table>thead>tr>th>p:last-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>td>p:last-of-type,.ck-content table.table:not(.layout-table)>tbody>tr>th>p:last-of-type,.ck-content table.table:not(.layout-table)>thead>tr>td>p:last-of-type,.ck-content table.table:not(.layout-table)>thead>tr>th>p:last-of-type{margin-bottom:0}@media print{.ck-content figure.table:not(.layout-table){height:fit-content;width:fit-content}.ck-content figure.table:not(.layout-table)>table{height:auto}}.ck-editor__editable .ck-table-bogus-paragraph{display:inline-block;width:100%}",""]);const a=r},163:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},188:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-input-color{display:flex;flex-direction:row-reverse;width:100%}.ck.ck-input-color>input.ck.ck-input-text{flex-grow:1;min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button{display:flex}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{overflow:hidden;position:relative}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{display:block;position:absolute}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-bottom-right-radius:0;border-top-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-bottom-left-radius:0;border-top-left-radius:0}.ck.ck-input-color>.ck.ck-input-text:focus{z-index:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-bottom-left-radius:0;border-top-left-radius:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button:not(:focus){border-left:1px solid transparent}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-bottom-right-radius:0;border-top-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button:not(:focus){border-right:1px solid transparent}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview{border:1px solid var(--ck-color-input-border);border-radius:0;height:20px;width:20px}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{background:red;border-radius:2px;height:150%;left:50%;top:-30%;transform:rotate(45deg);transform-origin:50%;width:8%}.ck.ck-input-color .ck.ck-input-color__remove-color{border-bottom-left-radius:0;border-bottom-right-radius:0;padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);width:100%}.ck.ck-input-color .ck.ck-input-color__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-input-border)}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard);margin-right:0}",""]);const a=r},237:e=>{"use strict";e.exports=CKEditor5.dll},305:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var o="",i=void 0!==t[5];return t[4]&&(o+="@supports (".concat(t[4],") {")),t[2]&&(o+="@media ".concat(t[2]," {")),i&&(o+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),o+=e(t),i&&(o+="}"),t[2]&&(o+="}"),t[4]&&(o+="}"),o}).join("")},t.i=function(e,o,i,l,n){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(i)for(var a=0;a<this.length;a++){var s=this[a][0];null!=s&&(r[s]=!0)}for(var c=0;c<e.length;c++){var d=[].concat(e[c]);i&&r[d[0]]||(void 0!==n&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=n),o&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=o):d[2]=o),l&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=l):d[4]="".concat(l)),t.push(d))}},t}},311:(e,t,o)=>{e.exports=o(237)("./src/ui.js")},331:(e,t,o)=>{e.exports=o(237)("./src/clipboard.js")},337:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,'.ck.ck-table-form .ck-form__row.ck-table-form__background-row,.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{align-items:center;flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{align-items:center;display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck-form__row>:not(.ck-label,.ck-table-form__dimension-operator){flex-grow:1}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;position:absolute;transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";left:50%;position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{max-width:80px;min-width:80px;width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:flex-end;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-field-view{padding-top:var(--ck-spacing-standard)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both;background:var(--ck-color-base-error);border-radius:0;color:var(--ck-color-base-background);min-width:var(--ck-table-properties-min-error-width);padding:var(--ck-spacing-small) var(--ck-spacing-medium);text-align:center}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-color:transparent transparent var(--ck-color-base-error) transparent;border-style:solid;border-width:0 var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size)}@media (prefers-reduced-motion:reduce){.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:none}}.ck.ck-table-form .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}',""]);const a=r},355:(e,t,o)=>{e.exports=o(237)("./src/icons.js")},380:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:first-of-type{flex-grow:0.57}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:last-of-type{flex-grow:0.43}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar .ck-button{flex-grow:1}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{align-self:flex-end;padding:0;width:25%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}",""]);const a=r},419:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,':root{--ck-color-table-focused-cell-background:rgba(158,201,250,.3);--ck-table-content-default-border-color:#d4d4d4}.ck-widget.table table[style*="border-style:none"],.ck-widget.table table[style*="border:none"]{outline:var(--ck-table-content-default-border-color) 1px dashed}.ck-widget.table td.ck-editor__nested-editable,.ck-widget.table th.ck-editor__nested-editable{outline:unset}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused:not(.ck-editor__editable_selected),.ck-widget.table td.ck-editor__nested-editable:not(.ck-editor__editable_selected):focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused:not(.ck-editor__editable_selected),.ck-widget.table th.ck-editor__nested-editable:not(.ck-editor__editable_selected):focus{background:var(--ck-color-table-focused-cell-background);outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}',""]);const a=r},424:e=>{"use strict";var t={};e.exports=function(e,o){var i=function(e){if(void 0===t[e]){var o=document.querySelector(e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}t[e]=o}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(o)}},433:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-color-table-column-resizer-hover:var(--ck-color-base-active);--ck-table-column-resizer-width:7px;--ck-table-column-resizer-position-offset:calc(var(--ck-table-column-resizer-width)*-0.5 - 0.5px)}.ck-content .table .ck-table-resized{table-layout:fixed}.ck-content .table td,.ck-content .table th{overflow-wrap:break-word}.ck.ck-editor__editable .table td,.ck.ck-editor__editable .table th{position:relative}.ck.ck-editor__editable .table .ck-table-column-resizer{bottom:0;cursor:col-resize;position:absolute;right:var(--ck-table-column-resizer-position-offset);top:0;user-select:none;width:var(--ck-table-column-resizer-width);z-index:var(--ck-z-default)}.ck.ck-editor__editable .table[draggable] .ck-table-column-resizer,.ck.ck-editor__editable.ck-column-resize_disabled .table .ck-table-column-resizer{display:none}.ck.ck-editor__editable .table .ck-table-column-resizer:hover,.ck.ck-editor__editable .table .ck-table-column-resizer__active{background-color:var(--ck-color-table-column-resizer-hover);opacity:.25}.ck.ck-editor__editable[dir=rtl] .table .ck-table-column-resizer{left:var(--ck-table-column-resizer-position-offset);right:unset}",""]);const a=r},489:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,':root{--ck-table-selected-cell-background:rgba(158,207,250,.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{box-shadow:unset;caret-color:transparent;position:relative}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{background-color:var(--ck-table-selected-cell-background);bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget{outline:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget>.ck-widget__selection-handle,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget>.ck-widget__selection-handle{display:none}',""]);const a=r},517:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach(function(o){e.setAttribute(o,t[o])})}},538:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0;width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2)}.ck .ck-insert-table-dropdown__label,.ck[dir=rtl] .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{border:1px solid var(--ck-color-base-border);border-radius:1px;margin:var(--ck-insert-table-dropdown-box-margin);min-height:var(--ck-insert-table-dropdown-box-height);min-width:var(--ck-insert-table-dropdown-box-width);outline:none;transition:none}@media (prefers-reduced-motion:reduce){.ck .ck-insert-table-dropdown-grid-box{transition:none}}.ck .ck-insert-table-dropdown-grid-box:focus{box-shadow:none}.ck .ck-insert-table-dropdown-grid-box.ck-on{background:var(--ck-color-focus-outer-shadow);border-color:var(--ck-color-focus-border)}",""]);const a=r},562:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-form__row.ck-table-form__action-row{justify-content:flex-end}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row>:not(.ck-label)+*{margin-inline-start:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{min-width:100%;width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}",""]);const a=r},584:(e,t,o)=>{e.exports=o(237)("./src/utils.js")},664:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-content:baseline;flex-basis:0;flex-wrap:wrap}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-self:flex-end;padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}",""]);const a=r},719:e=>{"use strict";var t=[];function o(e){for(var o=-1,i=0;i<t.length;i++)if(t[i].identifier===e){o=i;break}return o}function i(e,i){for(var n={},r=[],a=0;a<e.length;a++){var s=e[a],c=i.base?s[0]+i.base:s[0],d=n[c]||0,u="".concat(c," ").concat(d);n[c]=d+1;var b=o(u),h={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==b)t[b].references++,t[b].updater(h);else{var m=l(h,i);i.byIndex=a,t.splice(a,0,{identifier:u,updater:m,references:1})}r.push(u)}return r}function l(e,t){var o=t.domAPI(t);o.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;o.update(e=t)}else o.remove()}}e.exports=function(e,l){var n=i(e=e||[],l=l||{});return function(e){e=e||[];for(var r=0;r<n.length;r++){var a=o(n[r]);t[a].references--}for(var s=i(e,l),c=0;c<n.length;c++){var d=o(n[c]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}n=s}}},782:(e,t,o)=>{e.exports=o(237)("./src/core.js")},783:(e,t,o)=>{e.exports=o(237)("./src/engine.js")},792:e=>{"use strict";e.exports=function(e){return e[1]}},794:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,'.ck.ck-table-form .ck-form__row.ck-table-form__background-row,.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{align-items:center;flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{align-items:center;display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown{flex-grow:0}.ck.ck-table-form .ck-form__row:not(.ck-table-form__action-row)>:not(.ck-label,.ck-table-form__dimension-operator){flex-grow:1}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;position:absolute;transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";left:50%;position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translateX(-50%)}.ck.ck-table-form:has(.ck-form__header>.ck-button-back) .ck-form__row.ck-table-form__action-row>.ck.ck-button{flex-grow:0}.ck.ck-table-form:has(.ck-form__header>.ck-button-back) .ck-form__row.ck-table-form__action-row>.ck.ck-button .ck-button__label{color:currentColor}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form.ck-table-properties-form_experimental{--ck-table-form-default-input-width:80px}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{max-width:var(--ck-table-form-default-input-width);min-width:var(--ck-table-form-default-input-width);width:var(--ck-table-form-default-input-width)}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row{--ck-table-form-dimensions-input-width:calc(var(--ck-table-form-default-input-width)*2 + var(--ck-spacing-large));max-width:var(--ck-table-form-dimensions-input-width);min-width:var(--ck-table-form-dimensions-input-width);padding:0;width:var(--ck-table-form-dimensions-input-width)}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0;max-width:var(--ck-table-form-default-input-width);min-width:var(--ck-table-form-default-input-width);width:var(--ck-table-form-default-input-width)}.ck.ck-table-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:flex-end;display:inline-block;height:var(--ck-ui-component-min-height);left:-.5ch;line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small);overflow:visible;position:relative;width:0}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view{padding-top:var(--ck-spacing-standard)}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both;background:var(--ck-color-base-error);border-radius:0;color:var(--ck-color-base-background);min-width:var(--ck-table-properties-min-error-width);padding:var(--ck-spacing-small) var(--ck-spacing-medium);text-align:center}.ck-rounded-corners .ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-color:transparent transparent var(--ck-color-base-error) transparent;border-style:solid;border-width:0 var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size)}@media (prefers-reduced-motion:reduce){.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:none}}.ck.ck-table-form.ck-table-properties-form_experimental .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}',""]);const a=r},863:e=>{"use strict";var t,o=(t=[],function(e,o){return t[e]=o,t.filter(Boolean).join("\n")});function i(e,t,i,l){var n;if(i)n="";else{n="",l.supports&&(n+="@supports (".concat(l.supports,") {")),l.media&&(n+="@media ".concat(l.media," {"));var r=void 0!==l.layer;r&&(n+="@layer".concat(l.layer.length>0?" ".concat(l.layer):""," {")),n+=l.css,r&&(n+="}"),l.media&&(n+="}"),l.supports&&(n+="}")}if(e.styleSheet)e.styleSheet.cssText=o(t,n);else{var a=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}var l={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=l.singletonCounter++,o=l.singleton||(l.singleton=e.insertStyleElement(e));return{update:function(e){i(o,t,!1,e)},remove:function(e){i(o,t,!0,e)}}}},865:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,".ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row>:not(.ck-label)+*{margin-inline-start:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{min-width:100%;width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}",""]);const a=r},901:(e,t,o)=>{e.exports=o(237)("./src/widget.js")},965:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-content-color-table-caption-background:#f7f7f7;--ck-content-color-table-caption-text:#333;--ck-color-table-caption-highlighted-background:#fd0}.ck-content .table>figcaption,.ck-content figure.table>table>caption{background-color:var(--ck-content-color-table-caption-background);caption-side:top;color:var(--ck-content-color-table-caption-text);display:table-caption;font-size:.75em;outline-offset:-1px;overflow-wrap:anywhere;padding:.6em;text-align:center;word-break:normal}@media (forced-colors:active){.ck-content .table>figcaption,.ck-content figure.table>table>caption{background-color:unset;color:unset}}@media (forced-colors:none){.ck.ck-editor__editable .table>figcaption.table__caption_highlighted,.ck.ck-editor__editable figure.table>table>caption.table__caption_highlighted{animation:ck-table-caption-highlight .6s ease-out}}.ck.ck-editor__editable .table>figcaption.ck-placeholder:before,.ck.ck-editor__editable figure.table>table>caption.ck-placeholder:before{overflow:hidden;padding-left:inherit;padding-right:inherit;text-overflow:ellipsis;white-space:nowrap}@keyframes ck-table-caption-highlight{0%{background-color:var(--ck-color-table-caption-highlighted-background)}to{background-color:var(--ck-content-color-table-caption-background)}}",""]);const a=r},993:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var i=o(792),l=o.n(i),n=o(305),r=o.n(n)()(l());r.push([e.id,":root{--ck-content-table-style-spacing:1.5em}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-content:baseline;flex-basis:0;flex-wrap:wrap}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck-content .table.table-style-align-left{float:left;margin-right:var(--ck-content-table-style-spacing)}.ck-content .table.table-style-align-right{float:right;margin-left:var(--ck-content-table-style-spacing)}.ck-content .table.table-style-align-center{margin-left:auto;margin-right:auto}.ck-content .table.table-style-block-align-left{margin-left:0;margin-right:auto}.ck-content .table.table-style-block-align-right{margin-left:auto;margin-right:0}.ck-editor__editable .table.layout-table.table-style-align-center{margin-left:auto;margin-right:auto}.ck-editor__editable .table.layout-table.table-style-align-left{margin-right:var(--ck-content-table-style-spacing)}.ck-editor__editable .table.layout-table.table-style-align-right{margin-left:var(--ck-content-table-style-spacing)}.ck-editor__editable .table.layout-table.table-style-block-align-left{margin-left:0;margin-right:auto}.ck-editor__editable .table.layout-table.table-style-block-align-right{margin-left:auto;margin-right:0}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-self:flex-end}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{flex:1}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-properties-form__alignment-row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__action-row{justify-content:flex-end}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__action-row>.ck.ck-button{flex-grow:0}.ck.ck-table-properties-form.ck-table-properties-form_experimental .ck-form__row.ck-table-form__action-row>.ck.ck-button .ck-button__label{color:currentColor}",""]);const a=r}},t={};function o(i){var l=t[i];if(void 0!==l)return l.exports;var n=t[i]={id:i,exports:{}};return e[i](n,n.exports,o),n.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";o.r(i),o.d(i,{InsertColumnCommand:()=>te,InsertRowCommand:()=>ee,InsertTableCommand:()=>Q,InsertTableLayoutCommand:()=>Ho,MergeCellCommand:()=>ie,MergeCellsCommand:()=>Fe,PlainTableOutput:()=>Wt,RemoveColumnCommand:()=>re,RemoveRowCommand:()=>ne,SelectColumnCommand:()=>Oe,SelectRowCommand:()=>ze,SetHeaderColumnCommand:()=>se,SetHeaderRowCommand:()=>ae,SplitCellCommand:()=>oe,Table:()=>Ft,TableAlignmentCommand:()=>Ci,TableBackgroundColorCommand:()=>gi,TableBorderColorCommand:()=>pi,TableBorderStyleCommand:()=>fi,TableBorderWidthCommand:()=>wi,TableCaption:()=>ji,TableCaptionEditing:()=>zi,TableCaptionUI:()=>Oi,TableCellBackgroundColorCommand:()=>Po,TableCellBorderColorCommand:()=>Bo,TableCellBorderStyleCommand:()=>Eo,TableCellBorderWidthCommand:()=>Lo,TableCellHeightCommand:()=>So,TableCellHorizontalAlignmentCommand:()=>Ro,TableCellPaddingCommand:()=>Vo,TableCellProperties:()=>No,TableCellPropertiesEditing:()=>Do,TableCellPropertiesUI:()=>vo,TableCellPropertiesUIExperimental:()=>al,TableCellPropertiesView:()=>ho,TableCellPropertiesViewExperimental:()=>ll,TableCellPropertyCommand:()=>To,TableCellVerticalAlignmentCommand:()=>Io,TableCellWidthCommand:()=>Ao,TableCellWidthEditing:()=>xo,TableClipboard:()=>Tt,TableColumnResize:()=>ni,TableColumnResizeEditing:()=>oi,TableEditing:()=>ut,TableHeightCommand:()=>_i,TableKeyboard:()=>St,TableLayout:()=>hi,TableLayoutEditing:()=>di,TableLayoutUI:()=>zo,TableMouse:()=>Rt,TableProperties:()=>Ei,TablePropertiesEditing:()=>yi,TablePropertiesUI:()=>Ri,TablePropertiesUIExperimental:()=>il,TablePropertiesView:()=>Si,TablePropertiesViewExperimental:()=>el,TablePropertyCommand:()=>mi,TableSelection:()=>yt,TableToolbar:()=>Mt,TableTypeCommand:()=>ri,TableUI:()=>wt,TableUtils:()=>Ie,TableWalker:()=>v,TableWidthCommand:()=>ki,TableWidthsCommand:()=>Zo,ToggleTableCaptionCommand:()=>Ni,_InsertTableView:()=>ft,_TABLE_COLUMN_MIN_WIDTH_AS_PERCENTAGE:()=>ce,_TABLE_COLUMN_MIN_WIDTH_IN_PIXELS:()=>de,_TABLE_COLUMN_RESIZE_DISTANCE_THRESHOLD:()=>be,_TABLE_COLUMN_WIDTH_PRECISION:()=>ue,_TABLE_DEFAULT_COLORS:()=>to,_TableColorInputView:()=>Ut,_TableMouseEventsObserver:()=>It,_addDefaultUnitToNumericValue:()=>H,_adjustLastTableColumnIndex:()=>F,_adjustLastTableRowIndex:()=>L,_clamp:()=>_e,_colorTableFieldValidator:()=>Xt,_convertParagraphInTableCell:()=>J,_createEmptyTableCell:()=>k,_createFilledArray:()=>Ce,_cropTableToDimensions:()=>A,_downcastTable:()=>K,_downcastTableAttribute:()=>s,_downcastTableAttributeToStyle:()=>a,_downcastTableCell:()=>q,_downcastTableResizedClass:()=>ei,_downcastTableRow:()=>G,_enableTableCellProperty:()=>C,_ensureParagraphInTableCell:()=>O,_fillTableOrCellToolbar:()=>eo,_getBalloonTableCellPositionData:()=>_o,_getBalloonTablePositionData:()=>ko,_getBorderTableStyleLabels:()=>Gt,_getChangedResizedTables:()=>he,_getDefaultTableValueAdjusted:()=>c,_getDomTableCellOuterWidth:()=>Te,_getElementWidthInPixels:()=>fe,_getHorizontallyOverlappingTableCells:()=>S,_getLabeledTableColorInputCreator:()=>oo,_getLocalizedTableColorErrorText:()=>qt,_getLocalizedTableLengthErrorText:()=>Jt,_getNormalizedDefaultTableBaseProperties:()=>j,_getNormalizedDefaultTableCellProperties:()=>$,_getNormalizedDefaultTableProperties:()=>U,_getSelectedTableWidget:()=>Nt,_getSelectionAffectedTable:()=>y,_getSelectionAffectedTableWidget:()=>Dt,_getTableBorderBoxSingleValue:()=>M,_getTableCaptionFromModelElement:()=>Fi,_getTableCaptionFromModelSelection:()=>Wi,_getTableColumnEdgesIndexes:()=>we,_getTableColumnElements:()=>Ve,_getTableColumnGroupElement:()=>xe,_getTableColumnMinWidthAsPercentage:()=>me,_getTableColumnsWidths:()=>Se,_getTableOrCellBorderStyleDefinitions:()=>Qt,_getTableWidgetAncestor:()=>zt,_getTableWidthInPixels:()=>ge,_getVerticallyOverlappingTableCells:()=>x,_injectTableCaptionPostFixer:()=>Bi,_injectTableCellParagraphPostFixer:()=>$e,_injectTableLayoutPostFixer:()=>Me,_isSingleTableParagraphWithoutAttributes:()=>X,_isTableHeadingColumnCell:()=>_,_isTableModelElement:()=>Li,_lengthTableFieldValidator:()=>Yt,_lineWidthTableFieldValidator:()=>Zt,_matchTableCaptionViewElement:()=>Di,_normalizeTableColumnWidths:()=>ve,_removeEmptyTableColumns:()=>R,_removeEmptyTableRows:()=>E,_removeEmptyTableRowsColumns:()=>B,_repositionTableContextualBalloon:()=>wo,_skipEmptyTableRow:()=>z,_splitTableCellHorizontally:()=>V,_splitTableCellVertically:()=>P,_sumArray:()=>ye,_tableCellRefreshHandler:()=>Ye,_tableHeadingsRefreshHandler:()=>Xe,_toPrecision:()=>ke,_translateTableColspanAttribute:()=>Pe,_trimTableCellIfNeeded:()=>I,_upcastNormalizedTableStyleToAttribute:()=>n,_upcastTable:()=>N,_upcastTableBorderStyles:()=>r,_upcastTableColgroupElement:()=>Qo,_upcastTableFigure:()=>D,_updateTableColumnElements:()=>Ae,_updateTableNumericAttribute:()=>w});var e=o(782),t=o(901),l=o(584);function n(e,t){const{modelAttribute:o,styleName:i,attributeName:l,attributeType:n,viewElement:r,defaultValue:a,shouldUpcast:s=()=>!0,reduceBoxSides:u=!1}=t;e.for("upcast").attributeToAttribute({view:{name:r,styles:{[i]:/[\s\S]+/}},model:{key:o,value:(e,t,o)=>{if(!s(e))return;const l=c(a,"",o),n=e.getNormalizedStyle(i),r=u?d(n):n;if(l!==r)return r;t.consumable.consume(e,{styles:i})}}}),l&&e.for("upcast").attributeToAttribute({view:{name:r,attributes:{[l]:/.+/}},model:{key:o,value:(e,t,o)=>{if("figure"==e.name||e.hasStyle(i)||"table"==e.name&&"figure"==e.parent.name&&e.parent.hasStyle(i))return;const r=c(a,"",o);let s=e.getAttribute(l);if(s&&"length"==n&&!s.endsWith("px")&&(s+="px"),r!==s)return s;t.consumable.consume(e,{attributes:l})}}})}function r(e,t,o,i){const{conversion:l}=e;l.for("upcast").add(e=>e.on("element:"+t,(e,t,l)=>{if(!t.modelRange)return;const n=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(e=>t.viewItem.hasStyle(e));if(!n.length)return;const r={styles:n};if(!l.consumable.test(t.viewItem,r))return;const a=[...t.modelRange.getItems({shallow:!0})].pop(),s=a.findAncestor("table",{includeSelf:!0});let c=i;s&&"layout"==s.getAttribute("tableType")&&(c={style:"none",color:"",width:""}),l.consumable.consume(t.viewItem,r);const u={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},b={style:d(u.style),color:d(u.color),width:d(u.width)};b.style!==c.style&&l.writer.setAttribute(o.style,b.style,a),b.color!==c.color&&l.writer.setAttribute(o.color,b.color,a),b.width!==c.width&&l.writer.setAttribute(o.width,b.width,a)})),e.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&l.for("upcast").add(e=>{e.on(`element:${t}`,(e,t,i)=>{const{modelRange:l,viewItem:n}=t,r=n.is("element","table")?n:n.findAncestor("table");if(!i.consumable.test(r,{attributes:"border"}))return;if("0"!==r.getAttribute("border"))return;const a=l?.start?.nodeAfter;a&&!a.hasAttribute(o.style)&&(i.writer.setAttribute(o.style,"none",a),n.is("element","table")&&i.consumable.consume(n,{attributes:"border"}))})})}function a(e,t){const{modelElement:o,modelAttribute:i,styleName:l}=t;e.for("downcast").attributeToAttribute({model:{name:o,key:i},view:e=>({key:"style",value:{[l]:e}})})}function s(e,t){const{modelAttribute:o,styleName:i}=t;e.for("downcast").add(e=>e.on(`attribute:${o}:table`,(e,t,o)=>{const{item:l,attributeNewValue:n}=t,{mapper:r,writer:a}=o;if(!o.consumable.consume(t.item,e.name))return;const s=[...r.toViewElement(l).getChildren()].find(e=>e.is("element","table"));n?a.setStyle(i,n,s):a.removeStyle(i,s)}))}function c(e,t,o){const i=o.modelRange&&(0,l.first)(o.modelRange.getItems({shallow:!0})),n=i&&i.is("element")&&i.findAncestor("table",{includeSelf:!0});return n&&"layout"===n.getAttribute("tableType")?t:e}function d(e){if(!e)return;const t=["top","right","bottom","left"];if(!t.every(t=>e[t]))return e;const o=e.top;return t.every(t=>e[t]===o)?o:e}const u={className:"table-style-align-left"},b={className:"table-style-align-center"},h={className:"table-style-align-right"},m={className:"table-style-block-align-left"},g={className:"table-style-block-align-right"},p=[{view:{name:/^(table|figure)$/,styles:{float:/^(left|none|right)$/}},getAlign:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t},getConsumables(e){const t=e.getStyle("float"),o=["float"];return"left"===t&&e.hasStyle("margin-right")?o.push("margin-right"):"right"===t&&e.hasStyle("margin-left")&&o.push("margin-left"),{styles:o}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},getAlign:()=>"center",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,key:"class",value:"table-style-align-left"},getAlign:()=>"left",getConsumables:()=>({classes:u.className})},{view:{name:/^(table|figure)$/,key:"class",value:h.className},getAlign:()=>"right",getConsumables:()=>({classes:h.className})},{view:{name:/^(table|figure)$/,key:"class",value:b.className},getAlign:()=>"center",getConsumables:()=>({classes:b.className})},{view:{name:/^(table|figure)$/,key:"class",value:m.className},getAlign:()=>"blockLeft",getConsumables:()=>({classes:m.className})},{view:{name:/^(table|figure)$/,key:"class",value:g.className},getAlign:()=>"blockRight",getConsumables:()=>({classes:g.className})},{view:{name:/^(table|figure)$/,styles:{"margin-left":"0","margin-right":"auto"}},getAlign:()=>"blockLeft",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"0"}},getAlign:()=>"blockRight",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:"table",attributes:{align:/^(left|center|right)$/}},getAlign:e=>e.getAttribute("align"),getConsumables:()=>({attributes:"align"})}],f={center:{align:"center",style:"margin-left: auto; margin-right: auto;",className:"table-style-align-center"},left:{align:"left",style:"float: left;",className:"table-style-align-left"},right:{align:"right",style:"float: right;",className:"table-style-align-right"},blockLeft:{align:void 0,style:"margin-left: 0; margin-right: auto;",className:m.className},blockRight:{align:void 0,style:"margin-left: auto; margin-right: 0;",className:g.className}};function w(e,t,o,i,l=1){null!=t&&null!=l&&t>l?i.setAttribute(e,t,o):i.removeAttribute(e,o)}function k(e,t,o={}){const i=e.createElement("tableCell",o);return e.insertElement("paragraph",i),e.insert(i,t),i}function _(e,t){const o=t.parent.parent,i=parseInt(o.getAttribute("headingColumns")||"0"),{column:l}=e.getCellLocation(t);return!!i&&l<i}function C(e,t,o){const{modelAttribute:i}=o;e.extend("tableCell",{allowAttributes:[i]}),e.setAttributeProperties(i,{isFormatting:!0}),n(t,{viewElement:/^(td|th)$/,...o}),a(t,{modelElement:"tableCell",...o})}function y(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}class v{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const o=this._getSpanned();if(o)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(o.cell,o.row,o.column));else{const o=e.getChild(this._cellIndex);if(!o)return this._advanceToNextRow();const i=parseInt(o.getAttribute("colspan")||"1"),l=parseInt(o.getAttribute("rowspan")||"1");(i>1||l>1)&&this._recordSpans(o,l,i),this._shouldSkipSlot()||(t=this._formatOutValue(o)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,o=this._column){return{done:!1,value:new T(this,e,t,o)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,o=this._column<this._startColumn,i=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||o||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){const i={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+o;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,i)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,o)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}}class T{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,o,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function A(e,t,o){const{startRow:i,startColumn:l,endRow:n,endColumn:r}=t,a=o.createElement("table"),s=e.getAttribute("tableType");s&&o.setAttribute("tableType",s,a);const c=n-i+1;for(let e=0;e<c;e++)o.insertElement("tableRow",a,"end");const d=[...new v(e,{startRow:i,endRow:n,startColumn:l,endColumn:r,includeAllSlots:!0})];for(const{row:e,column:t,cell:s,isAnchor:c,cellAnchorRow:u,cellAnchorColumn:b}of d){const d=e-i,h=a.getChild(d);if(c){const i=o.cloneElement(s);o.append(i,h),I(i,e,t,n,r,o)}else(u<i||b<l)&&k(o,o.createPositionAt(h,"end"))}return function(e,t,o,i,l){const n=parseInt(t.getAttribute("headingRows")||"0");if(n>0){w("headingRows",n-o,e,l,0)}const r=parseInt(t.getAttribute("headingColumns")||"0");if(r>0){w("headingColumns",r-i,e,l,0)}}(a,e,i,l,o),a}function x(e,t,o=0){const i=[],l=new v(e,{startRow:o,endRow:t-1});for(const e of l){const{row:o,cellHeight:l}=e;o<t&&t<=o+l-1&&i.push(e)}return i}function V(e,t,o){const i=e.parent,l=i.parent,n=i.index,r=t-n,a={},s=parseInt(e.getAttribute("rowspan"))-r;s>1&&(a.rowspan=s);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const d=n+r,u=[...new v(l,{startRow:n,endRow:d,includeAllSlots:!0})];let b,h=null;for(const t of u){const{row:i,column:l,cell:n}=t;n===e&&void 0===b&&(b=l),void 0!==b&&b===l&&i===d&&(h=k(o,t.getPositionBefore(),a))}return w("rowspan",r,e,o),h}function S(e,t){const o=[],i=new v(e);for(const e of i){const{column:i,cellWidth:l}=e;i<t&&t<=i+l-1&&o.push(e)}return o}function P(e,t,o,i){const l=o-t,n={},r=parseInt(e.getAttribute("colspan"))-l;r>1&&(n.colspan=r);const a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(n.rowspan=a);const s=k(i,i.createPositionAfter(e),n);return w("colspan",l,e,i),s}function I(e,t,o,i,l,n){const r=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");if(o+r-1>l){w("colspan",l-o+1,e,n,1)}if(t+a-1>i){w("rowspan",i-t+1,e,n,1)}}function R(e,t){const o=t.getColumns(e),i=new Array(o).fill(0);for(const{column:t}of new v(e))i[t]++;const l=i.reduce((e,t,o)=>t?e:[...e,o],[]);if(l.length>0){const o=l[l.length-1];return t.removeColumns(e,{at:o}),!0}return!1}function E(e,t){const o=[],i=t.getRows(e);for(let t=0;t<i;t++){e.getChild(t).isEmpty&&o.push(t)}if(o.length>0){const i=o[o.length-1];return t.removeRows(e,{at:i}),!0}return!1}function B(e,t){R(e,t)||E(e,t)}function L(e,t){const o=Array.from(new v(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(o.every(({cellHeight:e})=>1===e))return t.lastRow;const i=o[0].cellHeight-1;return t.lastRow+i}function F(e,t){const o=Array.from(new v(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(o.every(({cellWidth:e})=>1===e))return t.lastColumn;const i=o[0].cellWidth-1;return t.lastColumn+i}function W(e){for(const t of e.getChildren())if(t.is("element","table"))return t}function D(){return e=>{e.on("element:figure",(e,t,o)=>{if(!o.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const i=W(t.viewItem);if(!i||!o.consumable.test(i,{name:!0}))return;o.consumable.consume(t.viewItem,{name:!0,classes:"table"});const n=o.convertItem(i,t.modelCursor),r=(0,l.first)(n.modelRange.getItems());if(!r||!r.is("element","table"))return o.consumable.revert(t.viewItem,{name:!0,classes:"table"}),void(n.modelRange&&!n.modelRange.isCollapsed&&(t.modelRange=n.modelRange,t.modelCursor=n.modelCursor));o.convertChildren(t.viewItem,o.writer.createPositionAt(r,"end")),o.updateConversionResult(r,t)})}}function N(){return e=>{e.on("element:table",(e,t,o)=>{const i=t.viewItem;if(!o.consumable.test(i,{name:!0}))return;const{rows:l,headingRows:n,headingColumns:r}=function(e){let t,o=0;const i=[],l=[];let n;for(const t of Array.from(e.getChildren())){if("tbody"!==t.name&&"thead"!==t.name&&"tfoot"!==t.name)continue;"thead"!==t.name||n||(n=t);const e=Array.from(t.getChildren()).filter(e=>e.is("element","tr"));let r=null;for(const a of e){const e=Array.from(a.getChildren()).filter(e=>e.is("element","td")||e.is("element","th"));n&&t===n||"tbody"===t.name&&e.length>0&&(null===r||e.length===r)&&e.every(e=>e.is("element","th"))?(o++,i.push(a)):l.push(a),r=Math.max(r||0,e.length)}}const r=function(e){let t=new Map,o=0;const i=e.map(e=>{const i=[],l=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name),n=new Map;for(;l.length||i.length<o;){const e=t.get(i.length);if(e&&e.remaining>0)i.push(e.cell);else{const e=l.shift();if(!e){i.push(null);continue}{const t=parseInt(e.getAttribute("colspan")||"1"),o=parseInt(e.getAttribute("rowspan")||"1");for(let l=0;l<t;l++)o>1&&n.set(i.length,{cell:e,remaining:o-1}),i.push(e)}}}for(const[e,o]of t.entries())o.remaining-=1,o.remaining>0&&!n.has(e)&&n.set(e,o);return t=n,o=Math.max(o,i.length),i});for(const e of i)for(;e.length<o;)e.push(null);return i}(l);for(const e of r){let o=0;for(;o<e.length&&"th"===e[o]?.name;)o+=1;(!t||o<t)&&(t=o)}return{headingRows:o,headingColumns:t||0,rows:[...i,...l]}}(i),a={};r&&(a.headingColumns=r),n&&(a.headingRows=n);const s=o.writer.createElement("table",a);if(o.safeInsert(s,t.modelCursor)){if(o.consumable.consume(i,{name:!0}),l.forEach(e=>o.convertItem(e,o.writer.createPositionAt(s,"end"))),o.convertChildren(i,o.writer.createPositionAt(s,"end")),s.isEmpty){const e=o.writer.createElement("tableRow");o.writer.insert(e,o.writer.createPositionAt(s,"end")),k(o.writer,o.writer.createPositionAt(e,"end"))}o.updateConversionResult(s,t)}})}}function z(){return e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}}function O(e){return t=>{t.on(`element:${e}`,(e,t,{writer:o})=>{if(!t.modelRange)return;const i=t.modelRange.start.nodeAfter,l=o.createPositionAt(i,0);if(t.viewItem.isEmpty)return void o.insertElement("paragraph",l);const n=Array.from(i.getChildren());if(n.every(e=>e.is("element","$marker"))){const e=o.createElement("paragraph");o.insert(e,o.createPositionAt(i,0));for(const t of n)o.move(o.createRangeOn(t),o.createPositionAt(e,"end"))}},{priority:"low"})}}function M(e){if(!e||(null===(t=e)||"object"!=typeof t&&"function"!=typeof t))return e;var t;const{top:o,right:i,bottom:l,left:n}=e;return o==i&&i==l&&l==n?o:void 0}function H(e,t){const o=parseFloat(e);return Number.isNaN(o)||String(o)!==String(e)?e:`${o}${t}`}function j(e,t={}){const o={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!o.alignment&&(o.alignment="center"),t.includePaddingProperty&&!o.padding&&(o.padding=""),t.includeVerticalAlignmentProperty&&!o.verticalAlignment&&(o.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!o.horizontalAlignment&&(o.horizontalAlignment=t.isRightToLeftContent?"right":"left"),o}function U(e,t){return j({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...e},t)}function $(e,t){return j({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...e},t)}function K(e,o){return(i,{writer:l})=>{const n=i.getAttribute("headingRows")||0,r=l.createContainerElement("table",null,[]),a=l.createContainerElement("figure",{class:"table"},r);n>0&&l.insert(l.createPositionAt(r,"end"),l.createContainerElement("thead",null,l.createSlot(e=>e.is("element","tableRow")&&e.index<n))),n<e.getRows(i)&&l.insert(l.createPositionAt(r,"end"),l.createContainerElement("tbody",null,l.createSlot(e=>e.is("element","tableRow")&&e.index>=n)));for(const{positionOffset:e,filter:t}of o.additionalSlots)l.insert(l.createPositionAt(r,e),l.createSlot(t));return l.insert(l.createPositionAt(r,"after"),l.createSlot(e=>!e.is("element","tableRow")&&!o.additionalSlots.some(({filter:t})=>t(e)))),o.asWidget?function(e,o){return o.setCustomProperty("table",!0,e),(0,t.toWidget)(e,o,{hasSelectionHandle:!0})}(a,l):a}}function G(){return(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}function q(e={}){return(o,{writer:i})=>{const l=o.parent,n=l.parent,r=n.getChildIndex(l),a=new v(n,{row:r}),s=n.getAttribute("headingRows")||0,c=n.getAttribute("headingColumns")||0;let d=null;for(const l of a)if(l.cell==o){const o=l.row<s||l.column<c?"th":"td";d=e.asWidget?(0,t.toWidgetEditable)(i.createEditableElement(o),i,{withAriaRole:!1}):i.createContainerElement(o);break}return d}}function J(e={}){return(t,{writer:o})=>{if(!t.parent.is("element","tableCell"))return null;if(!X(t))return null;if(e.asWidget)return o.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=o.createContainerElement("p");return o.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function X(e){return 1==e.parent.childCount&&!function(e){for(const t of e.getAttributeKeys())if(!t.startsWith("selection:")&&"htmlEmptyBlock"!=t)return!0;return!1}(e)}function Y(e){return(t,o)=>{const i=e.plugins.has("PlainTableOutput"),l=o.options.isClipboardPipeline,n=e.config.get("experimentalFlags.useExtendedTableBlockAlignment");return i||n&&l?function(e,t,o){const i=t.writer,l=e.getAttribute("headingRows")||0,n=i.createSlot(e=>e.is("element","tableRow")&&e.index<l),r=i.createSlot(e=>e.is("element","tableRow")&&e.index>=l),a=i.createSlot(e=>!e.is("element","tableRow")),s=i.createContainerElement("thead",null,n),c=i.createContainerElement("tbody",null,r),d=[];l&&d.push(s);l<e.childCount&&d.push(c);const u={class:"table"};if(o.plugins.has("TableProperties")&&t.options.isClipboardPipeline){const t=U(o.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),i=e.getAttribute("tableAlignment");let l=t.alignment;"layout"===e.getAttribute("tableType")&&(l="");const n=i||l;n&&(u.class+=" "+f[n].className,u.style=f[n].style,void 0!==f[n].align&&(u.align=f[n].align))}return i.createContainerElement("table",u,[a,...d])}(t,o,e):null}}function Z(e){return(t,{writer:o,options:i})=>{const l=e.plugins.has("PlainTableOutput"),n=i.isClipboardPipeline,r=e.config.get("experimentalFlags.useExtendedTableBlockAlignment");return(l||r&&n)&&"table"===t.parent.name?o.createContainerElement("caption"):null}}class Q extends e.Command{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema;this.isEnabled=function(e,t){const o=e.getFirstPosition().parent,i=o===o.root?o:o.parent;return t.checkChild(i,"table")}(t,o)}execute(e={}){const t=this.editor,o=t.model,i=t.plugins.get("TableUtils"),l=t.config.get("table.defaultHeadings.rows"),n=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&l&&(e.headingRows=l),void 0===e.headingColumns&&n&&(e.headingColumns=n),o.change(t=>{const l=i.createTable(t,e);o.insertObject(l,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}class ee extends e.Command{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i="above"===this.order,l=o.getSelectionAffectedTableCells(t),n=o.getRowIndexes(l),r=i?n.first:n.last,a=l[0].findAncestor("table");o.insertRows(a,{at:i?r:r+1,copyStructureFromAbove:!i})}}class te extends e.Command{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i="left"===this.order,l=o.getSelectionAffectedTableCells(t),n=o.getColumnIndexes(l),r=i?n.first:n.last,a=l[0].findAncestor("table");o.insertColumns(a,{columns:1,at:i?r:r+1})}}class oe extends e.Command{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}class ie extends e.Command{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,o=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,l=this.direction;e.change(e=>{const t="right"==l||"down"==l,n=t?o:i,r=t?i:o,a=r.parent;!function(e,t,o){le(e)||(le(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end")));o.remove(e)}(r,n,e);const s=this.isHorizontal?"colspan":"rowspan",c=parseInt(o.getAttribute(s)||"1"),d=parseInt(i.getAttribute(s)||"1");e.setAttribute(s,c+d,n),e.setSelection(e.createRangeIn(n));const u=this.editor.plugins.get("TableUtils");B(a.findAncestor("table"),u)})}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),o=t.getTableCellsContainingSelection(e.selection)[0];if(!o)return;const i=this.isHorizontal?function(e,t,o){const i=e.parent,l=i.parent,n="right"==t?e.nextSibling:e.previousSibling,r=(l.getAttribute("headingColumns")||0)>0;if(!n)return;const a="right"==t?e:n,s="right"==t?n:e,{column:c}=o.getCellLocation(a),{column:d}=o.getCellLocation(s),u=parseInt(a.getAttribute("colspan")||"1"),b=_(o,a),h=_(o,s);if(r&&b!=h)return;return c+u===d?n:void 0}(o,this.direction,t):function(e,t,o){const i=e.parent,l=i.parent,n=l.getChildIndex(i);if("down"==t&&n===o.getRows(l)-1||"up"==t&&0===n)return null;const r=parseInt(e.getAttribute("rowspan")||"1"),a=l.getAttribute("headingRows")||0,s="down"==t&&n+r===a,c="up"==t&&n===a;if(a&&(s||c))return null;const d=parseInt(e.getAttribute("rowspan")||"1"),u="down"==t?n+d:n,b=[...new v(l,{endRow:u})],h=b.find(t=>t.cell===e),m=h.column,g=b.find(({row:e,cellHeight:o,column:i})=>i===m&&("down"==t?e===u:u===e+o));return g&&g.cell?g.cell:null}(o,this.direction,t);if(!i)return;const l=this.isHorizontal?"rowspan":"colspan",n=parseInt(o.getAttribute(l)||"1");return parseInt(i.getAttribute(l)||"1")===n?i:void 0}}function le(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class ne extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){const i=o.findAncestor("table"),l=e.getRows(i)-1,n=e.getRowIndexes(t),r=0===n.first&&n.last===l;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),l=o[0],n=l.findAncestor("table"),r=t.getCellLocation(l).column;e.change(e=>{const o=i.last-i.first+1;t.removeRows(n,{at:i.first,rows:o});const l=function(e,t,o,i){const l=e.getChild(Math.min(t,i-1));let n=l.getChild(0),r=0;for(const e of l.getChildren()){if(r>o)return n;n=e,r+=parseInt(e.getAttribute("colspan")||"1")}return n}(n,i.first,r,t.getRows(n));e.setSelection(e.createPositionAt(l,0))})}}class re extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),o=t[0];if(o){const i=o.findAncestor("table"),l=e.getColumns(i),{first:n,last:r}=e.getColumnIndexes(t);this.isEnabled=r-n<l-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,o]=function(e,t){const o=t.getSelectionAffectedTableCells(e),i=o[0],l=o.pop(),n=[i,l];return i.isBefore(l)?n:n.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,l=[...new v(i)],n={first:l.find(e=>e.cell===t).column,last:l.find(e=>e.cell===o).column},r=function(e,t,o,i){const l=parseInt(o.getAttribute("colspan")||"1");return l>1?o:t.previousSibling||o.nextSibling?o.nextSibling||t.previousSibling:i.first?e.reverse().find(({column:e})=>e<i.first).cell:e.reverse().find(({column:e})=>e>i.last).cell}(l,t,o,n);this.editor.model.change(t=>{const o=n.last-n.first+1;e.removeColumns(i,{at:n.first,columns:o}),t.setSelection(t.createPositionAt(r,0))})}}class ae extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection);if(0===o.length)return this.isEnabled=!1,void(this.value=!1);const i=o[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(i,"headingRows"),this.value=o.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),l=i[0].findAncestor("table"),{first:n,last:r}=t.getRowIndexes(i),a=this.value?n:r+1,s=l.getAttribute("headingRows")||0;o.change(e=>{if(a){const t=x(l,a,a>s?s:0);for(const{cell:o}of t)V(o,a,e)}w("headingRows",a,l,e,0)})}_isInHeading(e,t){const o=parseInt(t.getAttribute("headingRows")||"0");return!!o&&e.parent.index<o}}class se extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection);if(0===o.length)return this.isEnabled=!1,void(this.value=!1);const i=o[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(i,"headingColumns"),this.value=o.every(t=>_(e,t))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),o=this.editor.model,i=t.getSelectionAffectedTableCells(o.document.selection),l=i[0].findAncestor("table"),{first:n,last:r}=t.getColumnIndexes(i),a=this.value?n:r+1;o.change(e=>{if(a){const t=S(l,a);for(const{cell:o,column:i}of t)P(o,i,a,e)}w("headingColumns",a,l,e,0)})}}const ce=5,de=40,ue=2,be=3;function he(e){const t=new Set;for(const o of e.document.differ.getChanges()){let i=null;switch(o.type){case"insert":i=["table","tableRow","tableCell"].includes(o.name)?o.position:null;break;case"remove":i=["tableRow","tableCell"].includes(o.name)?o.position:null;break;case"attribute":o.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(o.range.start.nodeAfter.name)?o.range.start:null)}if(!i)continue;const l=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAncestor("table");for(const o of e.createRangeOn(l).getItems())o.is("element","table")&&xe(o)&&t.add(o)}return t}function me(e,t){return 100*de/ge(e,t)}function ge(e,t){const o=pe(e,"tbody",t)||pe(e,"thead",t);return fe(t.editing.view.domConverter.mapViewToDom(o))}function pe(e,t,o){return[...[...o.editing.mapper.toViewElement(e).getChildren()].find(e=>e.is("element","table")).getChildren()].find(e=>e.is("element",t))}function fe(e){const t=l.global.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function we(e,t){const o=t.getCellLocation(e).column;return{leftEdge:o,rightEdge:o+(e.getAttribute("colspan")||1)-1}}function ke(e){const t=Math.pow(10,ue),o="number"==typeof e?e:parseFloat(e);return Math.round(o*t)/t}function _e(e,t,o){return ke(e<=t?t:e>=o?o:e)}function Ce(e,t){return Array(e).fill(t)}function ye(e){return e.map(e=>"number"==typeof e?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function ve(e){let t=function(e){const t=e.filter(e=>"auto"===e).length;if(0===t)return e.map(e=>ke(e));const o=ye(e),i=Math.max((100-o)/t,ce);return e.map(e=>"auto"===e?i:e).map(e=>ke(e))}(e.map(e=>"auto"===e||void 0===e?"auto":parseFloat(e.replace("%",""))));const o=ye(t);return 100!==o&&(t=t.map(e=>ke(100*e/o)).map((e,t,o)=>{if(!(t===o.length-1))return e;return ke(e+100-ye(o))})),t.map(e=>e+"%")}function Te(e){const t=l.global.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function Ae(e,t,o,i){for(let l=0;l<Math.max(o.length,e.length);l++){const n=e[l],r=o[l];r?n?i.setAttribute("columnWidth",r,n):i.appendElement("tableColumn",{columnWidth:r},t):i.remove(n)}}function xe(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find(e=>e.is("element","tableColumnGroup"))}function Ve(e){const t=xe(e);return t?Array.from(t.getChildren()):[]}function Se(e){return Ve(e).map(e=>e.getAttribute("columnWidth"))}function Pe(e,t){return Ve(e).reduce((e,o)=>{const i=o.getAttribute("columnWidth"),l=o.getAttribute("colSpan");if(!l)return e.push(i),e;for(let t=0;t<l;t++)e.push(i);return t.removeAttribute("colSpan",o),e},[])}class Ie extends e.Plugin{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,o=t.parent,i=o.getChildIndex(t),l=new v(o,{row:i});for(const{cell:t,row:o,column:i}of l)if(t===e)return{row:o,column:i}}createTable(e,t){const o=e.createElement("table"),i=t.rows||2,l=t.columns||2;return Re(e,o,0,i,l),t.headingRows&&w("headingRows",Math.min(t.headingRows,i),o,e,0),t.headingColumns&&w("headingColumns",Math.min(t.headingColumns,l),o,e,0),o}insertRows(e,t={}){const o=this.editor.model,i=t.at||0,n=t.rows||1,r=void 0!==t.copyStructureFromAbove,a=t.copyStructureFromAbove?i-1:i,s=this.getRows(e),c=this.getColumns(e);if(i>s)throw new l.CKEditorError("tableutils-insertrows-insert-out-of-range",this,{options:t});o.change(t=>{const o=e.getAttribute("headingRows")||0;if(o>i&&w("headingRows",o+n,e,t,0),!r&&(0===i||i===s))return void Re(t,e,i,n,c);const l=r?Math.max(i,a):i,d=new v(e,{endRow:l}),u=new Array(c).fill(1);for(const{row:e,column:o,cellHeight:l,cellWidth:s,cell:c}of d){const d=e+l-1,b=e<=a&&a<=d;e<i&&i<=d?(t.setAttribute("rowspan",l+n,c),u[o]=-s):r&&b&&(u[o]=s)}for(let o=0;o<n;o++){const o=t.createElement("tableRow");t.insert(o,e,i);for(let e=0;e<u.length;e++){const i=u[e],l=t.createPositionAt(o,"end");i>0&&k(t,l,i>1?{colspan:i}:void 0),e+=Math.abs(i)-1}}})}insertColumns(e,t={}){const o=this.editor.model,i=t.at||0,l=t.columns||1;o.change(t=>{const o=e.getAttribute("headingColumns");i<o&&t.setAttribute("headingColumns",o+l,e);const n=this.getColumns(e);if(0===i||n===i){for(const o of e.getChildren())o.is("element","tableRow")&&Ee(l,t,t.createPositionAt(o,i?"end":0));return}const r=new v(e,{column:i,includeAllSlots:!0});for(const e of r){const{row:o,cell:n,cellAnchorColumn:a,cellAnchorRow:s,cellWidth:c,cellHeight:d}=e;if(a<i){t.setAttribute("colspan",c+l,n);const e=s+d-1;for(let t=o;t<=e;t++)r.skipRow(t)}else Ee(l,t,e.getPositionBefore())}})}removeRows(e,t){const o=this.editor.model,i=t.rows||1,n=this.getRows(e),r=t.at,a=r+i-1;if(a>n-1)throw new l.CKEditorError("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});o.change(t=>{const o={first:r,last:a},{cellsToMove:i,cellsToTrim:l}=function(e,{first:t,last:o}){const i=new Map,l=[];for(const{row:n,column:r,cellHeight:a,cell:s}of new v(e,{endRow:o})){const e=n+a-1;if(n>=t&&n<=o&&e>o){const e=a-(o-n+1);i.set(r,{cell:s,rowspan:e})}if(n<t&&e>=t){let i;i=e>=o?o-t+1:e-t+1,l.push({cell:s,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:l}}(e,o);if(i.size){!function(e,t,o,i){const l=new v(e,{includeAllSlots:!0,row:t}),n=[...l],r=e.getChild(t);let a;for(const{column:e,cell:t,isAnchor:l}of n)if(o.has(e)){const{cell:t,rowspan:l}=o.get(e),n=a?i.createPositionAfter(a):i.createPositionAt(r,0);i.move(i.createRangeOn(t),n),w("rowspan",l,t,i),a=t}else l&&(a=t)}(e,a+1,i,t)}for(let o=a;o>=r;o--)t.remove(e.getChild(o));for(const{rowspan:e,cell:o}of l)w("rowspan",e,o,t);!function(e,{first:t,last:o},i){const l=e.getAttribute("headingRows")||0;if(t<l){w("headingRows",o<l?l-(o-t+1):t,e,i,0)}}(e,o,t),R(e,this)||E(e,this)})}removeColumns(e,t){const o=this.editor.model,i=t.at,l=t.columns||1,n=t.at+l-1;o.change(t=>{!function(e,t,o){const i=e.getAttribute("headingColumns")||0;if(i&&t.first<i){const l=Math.min(i-1,t.last)-t.first+1;o.setAttribute("headingColumns",i-l,e)}}(e,{first:i,last:n},t);const o=Ve(e);for(let l=n;l>=i;l--){for(const{cell:o,column:i,cellWidth:n}of[...new v(e)])i<=l&&n>1&&i+n>l?w("colspan",n-1,o,t):i===l&&t.remove(o);if(o[l]){const e=0===l?o[1]:o[l-1],i=parseFloat(o[l].getAttribute("columnWidth")),n=parseFloat(e.getAttribute("columnWidth"));t.remove(o[l]),t.setAttribute("columnWidth",i+n+"%",e)}}E(e,this)||R(e,this)})}splitCellVertically(e,t=2){const o=this.editor.model,i=e.parent.parent,l=parseInt(e.getAttribute("rowspan")||"1"),n=parseInt(e.getAttribute("colspan")||"1");o.change(o=>{if(n>1){const{newCellsSpan:i,updatedSpan:r}=Be(n,t);w("colspan",r,e,o);const a={};i>1&&(a.colspan=i),l>1&&(a.rowspan=l);Ee(n>t?t-1:n-1,o,o.createPositionAfter(e),a)}if(n<t){const r=t-n,a=[...new v(i)],{column:s}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:o,column:i})=>t!==e&&i===s||i<s&&i+o>s);for(const{cell:e,cellWidth:t}of c)o.setAttribute("colspan",t+r,e);const d={};l>1&&(d.rowspan=l),Ee(r,o,o.createPositionAfter(e),d);const u=i.getAttribute("headingColumns")||0;u>s&&w("headingColumns",u+r,i,o)}})}splitCellHorizontally(e,t=2){const o=this.editor.model,i=e.parent,l=i.parent,n=l.getChildIndex(i),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");o.change(o=>{if(r>1){const i=[...new v(l,{startRow:n,endRow:n+r-1,includeAllSlots:!0})],{newCellsSpan:s,updatedSpan:c}=Be(r,t);w("rowspan",c,e,o);const{column:d}=i.find(({cell:t})=>t===e),u={};s>1&&(u.rowspan=s),a>1&&(u.colspan=a);let b=0;for(const e of i){const{column:t,row:i}=e,l=t===d;b>=s&&l&&(b=0),i>=n+c&&l&&(b||Ee(1,o,e.getPositionBefore(),u),b++)}}if(r<t){const i=t-r,s=[...new v(l,{startRow:0,endRow:n})];for(const{cell:t,cellHeight:l,row:r}of s)if(t!==e&&r+l>n){const e=l+i;o.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),Re(o,l,n+1,i,1,c);const d=l.getAttribute("headingRows")||0;d>n&&w("headingRows",d+i,l,o)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(e=>e.is("element","tableCell")).reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0)}createTableWalker(e,t={}){return new v(e,t)}getSelectedTableCells(e){const t=[];for(const o of this.sortRanges(e.getRanges())){const e=o.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){const t=[];for(const o of e.getRanges()){const e=o.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(e=>e.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),o=[...new v(t)].filter(t=>e.includes(t.cell)).map(e=>e.column);return this._getFirstLastIndexesObject(o)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,o=new Set;let i=0;for(const l of e){const{row:e,column:n}=this.getCellLocation(l),r=parseInt(l.getAttribute("rowspan"))||1,a=parseInt(l.getAttribute("colspan"))||1;t.add(e),o.add(n),r>1&&t.add(e+r-1),a>1&&o.add(n+a-1),i+=r*a}const l=function(e,t){const o=Array.from(e.values()),i=Array.from(t.values()),l=Math.max(...o),n=Math.min(...o),r=Math.max(...i),a=Math.min(...i);return(l-n+1)*(r-a+1)}(t,o);return l==i}sortRanges(e){return Array.from(e).sort(Le)}_getFirstLastIndexesObject(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),o=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(o,i))return!1;const l=this.getColumnIndexes(e),n=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(l,n)}_areIndexesInSameSection({first:e,last:t},o){return e<o===t<o}}function Re(e,t,o,i,l,n={}){for(let r=0;r<i;r++){const i=e.createElement("tableRow");e.insert(i,t,o),Ee(l,e,e.createPositionAt(i,"end"),n)}}function Ee(e,t,o,i={}){for(let l=0;l<e;l++)k(t,o,i)}function Be(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const o=Math.floor(e/t);return{newCellsSpan:o,updatedSpan:e-o*t+o}}function Le(e,t){const o=e.start,i=t.start;return o.isBefore(i)?-1:1}class Fe extends e.Command{refresh(){const e=this.editor.plugins.get(Ie),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(Ie);e.change(o=>{const i=t.getSelectedTableCells(e.document.selection),l=i.shift(),{mergeWidth:n,mergeHeight:r}=function(e,t,o){let i=0,l=0;for(const e of t){const{row:t,column:n}=o.getCellLocation(e);i=Ne(e,n,i,"colspan"),l=Ne(e,t,l,"rowspan")}const{row:n,column:r}=o.getCellLocation(e),a=i-r,s=l-n;return{mergeWidth:a,mergeHeight:s}}(l,i,t);w("colspan",n,l,o),w("rowspan",r,l,o);for(const e of i)We(e,l,o);B(l.findAncestor("table"),t),o.setSelection(l,"in")})}}function We(e,t,o){De(e)||(De(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end"))),o.remove(e)}function De(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function Ne(e,t,o,i){const l=parseInt(e.getAttribute(i)||"1");return Math.max(o,t+l)}class ze extends e.Command{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(o),l=o[0].findAncestor("table"),n=[];for(let t=i.first;t<=i.last;t++)for(const o of l.getChild(t).getChildren())n.push(e.createRangeOn(o));e.change(e=>{e.setSelection(n)})}}class Oe extends e.Command{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),i=o[0],l=o.pop(),n=i.findAncestor("table"),r=e.getCellLocation(i),a=e.getCellLocation(l),s=Math.min(r.column,a.column),c=Math.max(r.column,a.column),d=[];for(const e of new v(n,{startColumn:s,endColumn:c}))d.push(t.createRangeOn(e.cell));t.change(e=>{e.setSelection(d)})}}function Me(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;const l=new Set;for(const t of o){let o=null;"insert"==t.type&&"table"==t.name&&(o=t.position.nodeAfter),"insert"!=t.type&&"remove"!=t.type||"tableRow"!=t.name&&"tableCell"!=t.name||(o=t.position.findAncestor("table")),Ue(t)&&(o=t.range.start.findAncestor("table")),o&&!l.has(o)&&(i=He(o,e)||i,i=je(o,e)||i,l.add(o))}return i}(t,e))}function He(e,t){let o=!1;const i=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),o=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),i=[];for(const{row:l,cell:n,cellHeight:r}of new v(e)){if(r<2)continue;const e=l<t?t:o;if(l+r>e){const t=e-l;i.push({cell:n,rowspan:t})}}return i}(e);if(i.length){o=!0;for(const e of i)w("rowspan",e.rowspan,e.cell,t,1)}return o}function je(e,t){let o=!1;const i=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:o}of new v(e,{includeAllSlots:!0}))t[o]++;return t}(e),l=[];for(const[t,o]of i.entries())!o&&e.getChild(t).is("element","tableRow")&&l.push(t);if(l.length){o=!0;for(const o of l.reverse())t.remove(e.getChild(o)),i.splice(o,1)}const n=i.filter((t,o)=>e.getChild(o).is("element","tableRow")),r=n[0];if(!n.every(e=>e===r)){const i=n.reduce((e,t)=>t>e?t:e,0);for(const[l,r]of n.entries()){const n=i-r;if(n){for(let o=0;o<n;o++)k(t,t.createPositionAt(e.getChild(l),"end"));o=!0}}}return o}function Ue(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function $e(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;for(const t of o)"insert"==t.type&&"table"==t.name&&(i=Ke(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableRow"==t.name&&(i=Ge(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableCell"==t.name&&(i=qe(t.position.nodeAfter,e)||i),"remove"!=t.type&&"insert"!=t.type||!Je(t)||(i=qe(t.position.parent,e)||i);return i}(t,e))}function Ke(e,t){let o=!1;for(const i of e.getChildren())i.is("element","tableRow")&&(o=Ge(i,t)||o);return o}function Ge(e,t){let o=!1;for(const i of e.getChildren())o=qe(i,t)||o;return o}function qe(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const o=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of o)t.wrap(t.createRangeOn(e),"paragraph");return!!o.length}function Je(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function Xe(e,t){const o=e.document.differ;for(const e of o.getChanges()){let o,i=!1;if("attribute"==e.type){const t=e.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=e.attributeKey&&"headingColumns"!=e.attributeKey)continue;o=t,i="headingRows"==e.attributeKey}else"tableRow"!=e.name&&"tableCell"!=e.name||(o=e.position.findAncestor("table"),i="tableRow"==e.name);if(!o)continue;const l=o.getAttribute("headingRows")||0,n=o.getAttribute("headingColumns")||0,r=new v(o);for(const e of r){const o=e.row<l||e.column<n?"th":"td",r=t.mapper.toViewElement(e.cell);r&&r.is("element")&&r.name!=o&&t.reconvertItem(i?e.cell.parent:e.cell)}}}function Ye(e,t){const o=e.document.differ,i=new Set;for(const e of o.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&i.add(t)}for(const e of i.values()){const o=Array.from(e.getChildren()).filter(e=>Ze(e,t.mapper));for(const e of o)t.reconvertItem(e)}}function Ze(e,t){if(!e.is("element","paragraph"))return!1;const o=t.toViewElement(e);return!!o&&X(e)!==o.is("element","span")}var Qe=o(719),et=o.n(Qe),tt=o(863),ot=o.n(tt),it=o(424),lt=o.n(it),nt=o(517),rt=o.n(nt),at=o(163),st=o.n(at),ct=o(419),dt={attributes:{"data-cke":!0}};dt.setAttributes=rt(),dt.insert=lt().bind(null,"head"),dt.domAPI=ot(),dt.insertStyleElement=st();et()(ct.A,dt);ct.A&&ct.A.locals&&ct.A.locals;class ut extends e.Plugin{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Ie]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,o=t.schema,i=e.conversion,l=e.plugins.get(Ie);o.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),o.register("tableRow",{allowIn:"table",isLimit:!0}),o.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add(D()),i.for("upcast").add(N()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:K(l,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:K(l,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),i.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(O("td")),i.for("upcast").add(O("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:q({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:q()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:J({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:J(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:bt("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:bt("rowspan")},view:"rowspan"}),this._addPlainTableOutputConverters(),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new Q(e)),e.commands.add("insertTableRowAbove",new ee(e,{order:"above"})),e.commands.add("insertTableRowBelow",new ee(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new te(e,{order:"left"})),e.commands.add("insertTableColumnRight",new te(e,{order:"right"})),e.commands.add("removeTableRow",new ne(e)),e.commands.add("removeTableColumn",new re(e)),e.commands.add("splitTableCellVertically",new oe(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new oe(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Fe(e)),e.commands.add("mergeTableCellRight",new ie(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new ie(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new ie(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new ie(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new se(e)),e.commands.add("setTableRowHeader",new ae(e)),e.commands.add("selectTableRow",new ze(e)),e.commands.add("selectTableColumn",new Oe(e)),Me(t),$e(t),this.listenTo(t.document,"change:data",()=>{Xe(t,e.editing),Ye(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}_addPlainTableOutputConverters(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:Y(e),converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:Z(e),converterPriority:"high"}),e.plugins.has("TableProperties")&&function(e){const t={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[o,i]of Object.entries(t))e.conversion.for("dataDowncast").add(t=>t.on(`attribute:${i}:table`,(t,i,l)=>{const{item:n,attributeNewValue:r}=i,{mapper:a,writer:s}=l,c=e.plugins.has("PlainTableOutput"),d=l.options.isClipboardPipeline,u=e.config.get("experimentalFlags.useExtendedTableBlockAlignment");if(!(c||u&&d))return;if(!l.consumable.consume(n,t.name))return;const b=a.toViewElement(n);r?s.setStyle(o,r,b):s.removeStyle(o,b)},{priority:"high"}))}(e)}}function bt(e){return t=>{const o=parseInt(t.getAttribute(e));return Number.isNaN(o)||o<=0?null:o}}var ht=o(355),mt=o(311),gt=o(538),pt={attributes:{"data-cke":!0}};pt.setAttributes=rt(),pt.insert=lt().bind(null,"head"),pt.domAPI=ot(),pt.insertStyleElement=st();et()(gt.A,pt);gt.A&&gt.A.locals&&gt.A.locals;class ft extends mt.View{items;keystrokes;focusTracker;constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new l.KeystrokeHandler,this.focusTracker=new l.FocusTracker,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} × ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(e,t)=>{const{row:o,column:i}=t.target.dataset;this.items.get(10*(parseInt(o,10)-1)+(parseInt(i,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(e,t,o)=>{if(!o)return;const{row:i,column:l}=o.dataset;this.set({rows:parseInt(i),columns:parseInt(l)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),(0,mt.addKeyboardHandlingForGrid)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((o,i)=>{const l=Math.floor(i/10)<e&&i%10<t;o.set("isOn",l)})}_createGridButton(e,t,o,i){const l=new mt.ButtonView(e);return l.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),l.extendTemplate({attributes:{"data-row":t,"data-column":o}}),l}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const o=Math.floor(t/10),i=t%10,l=`${o+1} × ${i+1}`;e.push(this._createGridButton(this.locale,o+1,i+1,l))}return this.createCollection(e)}}class wt extends e.Plugin{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t,o="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",o=>{const i=e.commands.get("insertTable"),l=(0,mt.createDropdown)(o);let n;return l.bind("isEnabled").to(i),l.buttonView.set({icon:ht.IconTable,label:t("Insert table"),tooltip:!0}),l.on("change:isOpen",()=>{n||(n=new ft(o),l.panelView.children.add(n),n.delegate("execute").to(l),l.on("execute",()=>{e.execute("insertTable",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}))}),l}),e.ui.componentFactory.add("menuBar:insertTable",o=>{const i=e.commands.get("insertTable"),l=new mt.MenuBarMenuView(o),n=new ft(o);return n.delegate("execute").to(l),l.on("change:isOpen",(e,t,o)=>{o||n.reset()}),n.on("execute",()=>{e.execute("insertTable",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}),l.buttonView.set({label:t("Table"),icon:ht.IconTable}),l.panelView.children.add(n),l.bind("isEnabled").to(i),l}),e.ui.componentFactory.add("tableColumn",e=>{const i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),ht.IconTableColumn,i,e)}),e.ui.componentFactory.add("tableRow",e=>{const o=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),ht.IconTableRow,o,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),ht.IconTableMergeCell,i,e)})}_prepareDropdown(e,t,o,i){const l=this.editor,n=(0,mt.createDropdown)(i),r=this._fillDropdownWithListOptions(n,o);return n.buttonView.set({label:e,icon:t,tooltip:!0}),n.bind("isEnabled").toMany(r,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(n,"execute",e=>{l.execute(e.source.commandName),e.source instanceof mt.SwitchButtonView||l.editing.view.focus()}),n}_prepareMergeSplitButtonDropdown(e,t,o,i){const l=this.editor,n=(0,mt.createDropdown)(i,mt.SplitButtonView),r="mergeTableCells",a=l.commands.get(r),s=this._fillDropdownWithListOptions(n,o);return n.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),n.bind("isEnabled").toMany([a,...s],"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(n.buttonView,"execute",()=>{l.execute(r),l.editing.view.focus()}),this.listenTo(n,"execute",e=>{l.execute(e.source.commandName),l.editing.view.focus()}),n}_fillDropdownWithListOptions(e,t){const o=this.editor,i=[],n=new l.Collection;for(const e of t)kt(e,o,i,n);return(0,mt.addListToDropdown)(e,n),i}}function kt(e,t,o,i){if("button"===e.type||"switchbutton"===e.type){const i=e.model=new mt.UIModel(e.model),{commandName:l,bindIsOn:n}=e.model,r=t.commands.get(l);o.push(r),i.set({commandName:l}),i.bind("isEnabled").to(r),n&&i.bind("isOn").to(r,"value"),i.set({withText:!0})}i.add(e)}var _t=o(489),Ct={attributes:{"data-cke":!0}};Ct.setAttributes=rt(),Ct.insert=lt().bind(null,"head"),Ct.domAPI=ot(),Ct.insertStyleElement=st();et()(_t.A,Ct);_t.A&&_t.A.locals&&_t.A.locals;class yt extends e.Plugin{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[Ie,Ie]}init(){const e=this.editor,t=e.model,o=e.editing.view;this.listenTo(t,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this.listenTo(o.document,"insertText",(e,t)=>this._handleInsertTextEvent(e,t),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(Ie),t=this.editor.model.document.selection,o=e.getSelectedTableCells(t);return 0==o.length?null:o}getSelectionAsFragment(){const e=this.editor.plugins.get(Ie),t=this.getSelectedTableCells();return t?this.editor.model.change(o=>{const i=o.createDocumentFragment(),{first:l,last:n}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),s=t[0].findAncestor("table");let c=a,d=n;if(e.isSelectionRectangular(t)){const e={firstColumn:l,lastColumn:n,firstRow:r,lastRow:a};c=L(s,e),d=F(s,e)}const u=A(s,{startRow:r,startColumn:l,endRow:c,endColumn:d},o);return o.insert(u,i,0),i}):null}setCellSelection(e,t){const o=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(o.cells.map(t=>e.createRangeOn(t)),{backward:o.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=this.editor.model.document.selection,t=(0,l.first)(e.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,o,i)=>{const l=i.writer;!function(e){for(const o of t)e.removeClass("ck-editor__editable_selected",o);t.clear()}(l);const n=this.getSelectedTableCells();if(!n)return;for(const e of n){const o=i.mapper.toViewElement(e);l.addClass("ck-editor__editable_selected",o),t.add(o)}const r=i.mapper.toViewElement(n[n.length-1]);l.setSelection(r,0)},{priority:"lowest"}))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(o=>{const i=o.createPositionAt(t[0],0),l=e.model.schema.getNearestSelectionRange(i);o.setSelection(l)})}})}_handleDeleteContent(e,t){const o=this.editor.plugins.get(Ie),i=t[0],l=t[1],n=this.editor.model,r=!l||"backward"==l.direction,a=o.getSelectedTableCells(i);a.length&&(e.stop(),n.change(e=>{const t=a[r?a.length-1:0];n.change(e=>{for(const t of a)n.deleteContent(e.createSelection(t,"in"))});const o=n.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(o):i.setTo(o)}))}_handleInsertTextEvent(e,t){const o=this.editor,i=this.getSelectedTableCells();if(!i)return;const l=o.editing.view,n=o.editing.mapper,r=i.map(e=>l.createRangeOn(n.toViewElement(e)));t.selection=l.createSelection(r),t.preventDefault()}_getCellsToSelect(e,t){const o=this.editor.plugins.get("TableUtils"),i=o.getCellLocation(e),l=o.getCellLocation(t),n=Math.min(i.row,l.row),r=Math.max(i.row,l.row),a=Math.min(i.column,l.column),s=parseInt(t.getAttribute("colspan")||"1")-1,c=Math.max(i.column,l.column+s),d=new Array(r-n+1).fill(null).map(()=>[]),u={startRow:n,endRow:r,startColumn:a,endColumn:c};for(const{row:t,cell:o}of new v(e.findAncestor("table"),u))d[t-n].push(o);const b=l.row<i.row,h=l.column<i.column;return b&&d.reverse(),h&&d.forEach(e=>e.reverse()),{cells:d.flat(),backward:b||h}}}var vt=o(331);class Tt extends e.Plugin{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[vt.ClipboardMarkersUtils,vt.ClipboardPipeline,yt,Ie]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e,"cut",(e,t)=>this._onCopyCut(e,t)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell")}_listenToContentInsertion(){const{editor:e}=this,t=e.plugins.get(vt.ClipboardPipeline),o=e.plugins.get(yt);let i=!1;t.on("contentInsertion",(e,t)=>{i="paste"===t.method}),this.listenTo(e.model,"insertContent",(e,[t,l])=>{(i||null!==o.getSelectedTableCells())&&this._onInsertContent(e,t,l)},{priority:"high"}),t.on("contentInsertion",()=>{i=!1},{priority:"lowest"})}_onCopyCut(e,t){const o=this.editor.editing.view,i=this.editor.plugins.get(yt),l=this.editor.plugins.get(vt.ClipboardMarkersUtils);i.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},()=>{const n=l._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>i.getSelectionAsFragment());o.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(n),method:e.name})}))}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;const i=this.editor.model,l=this.editor.plugins.get(Ie),n=this.editor.plugins.get(vt.ClipboardMarkersUtils),r=this.getTableIfOnlyTableInContent(t,i);if(!r)return;const a=l.getSelectionAffectedTableCells(i.document.selection);a.length?(e.stop(),t.is("documentFragment")?n._pasteMarkersIntoTransformedElement(t.markers,e=>this._replaceSelectedCells(r,a,e)):this.editor.model.change(e=>{this._replaceSelectedCells(r,a,e)})):B(r,l)}_replaceSelectedCells(e,t,o){const i=this.editor.plugins.get(Ie),l={width:i.getColumns(e),height:i.getRows(e)},n=function(e,t,o,i){const l=e[0].findAncestor("table"),n=i.getColumnIndexes(e),r=i.getRowIndexes(e),a={firstColumn:n.first,lastColumn:n.last,firstRow:r.first,lastRow:r.last},s=1===e.length;s&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,o,i){const l=i.getColumns(e),n=i.getRows(e);o>l&&i.insertColumns(e,{at:l,columns:o-l});t>n&&i.insertRows(e,{at:n,rows:t-n})}(l,a.lastRow+1,a.lastColumn+1,i));s||!i.isSelectionRectangular(e)?function(e,t,o){const{firstRow:i,lastRow:l,firstColumn:n,lastColumn:r}=t,a={first:i,last:l},s={first:n,last:r};xt(e,n,a,o),xt(e,r+1,a,o),At(e,i,s,o),At(e,l+1,s,o,i)}(l,a,o):(a.lastRow=L(l,a),a.lastColumn=F(l,a));return a}(t,l,o,i),r=n.lastRow-n.firstRow+1,a=n.lastColumn-n.firstColumn+1;e=A(e,{startRow:0,startColumn:0,endRow:Math.min(r,l.height)-1,endColumn:Math.min(a,l.width)-1},o);const s=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,l,s,n,o);if(this.editor.plugins.get("TableSelection").isEnabled){const e=i.sortRanges(c.map(e=>o.createRangeOn(e)));o.setSelection(e)}else o.setSelection(c[0],0);return s}_replaceSelectedCellsWithPasted(e,t,o,i,l){const{width:n,height:r}=t,a=function(e,t,o){const i=new Array(o).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:o,cell:l}of new v(e))i[o][t]=l;return i}(e,n,r),s=[...new v(o,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of s){const{row:t,column:o}=e;o===i.firstColumn&&(d=e.getPositionBefore());const s=t-i.firstRow,u=o-i.firstColumn,b=a[s%r][u%n],h=b?l.cloneElement(b):null,m=this._replaceTableSlotCell(e,h,d,l);m&&(I(m,t,o,i.lastRow,i.lastColumn,l),c.push(m),d=l.createPositionAfter(m))}const u=parseInt(o.getAttribute("headingRows")||"0"),b=parseInt(o.getAttribute("headingColumns")||"0"),h=i.firstRow<u&&u<=i.lastRow,m=i.firstColumn<b&&b<=i.lastColumn;if(h){const e=At(o,u,{first:i.firstColumn,last:i.lastColumn},l,i.firstRow);c.push(...e)}if(m){const e=xt(o,b,{first:i.firstRow,last:i.lastRow},l);c.push(...e)}return c}_replaceTableSlotCell(e,t,o,i){const{cell:l,isAnchor:n}=e;return n&&i.remove(l),t?(i.insert(t,o),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const o=t.createRangeIn(e);for(const e of o.getItems())if(e.is("element","table")){const i=t.createRange(o.start,t.createPositionBefore(e));if(t.hasContent(i,{ignoreWhitespaces:!0}))return null;const l=t.createRange(t.createPositionAfter(e),o.end);return t.hasContent(l,{ignoreWhitespaces:!0})?null:e}return null}}function At(e,t,o,i,l=0){if(t<1)return;return x(e,t,l).filter(({column:e,cellWidth:t})=>Vt(e,t,o)).map(({cell:e})=>V(e,t,i))}function xt(e,t,o,i){if(t<1)return;return S(e,t).filter(({row:e,cellHeight:t})=>Vt(e,t,o)).map(({cell:e,column:o})=>P(e,o,t,i))}function Vt(e,t,o){const i=e+t-1,{first:l,last:n}=o;return e>=l&&e<=n||e<l&&i>=l}class St extends e.Plugin{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[yt,Ie]}init(){const e=this.editor,t=e.editing.view.document,o=e.t;this.listenTo(t,"arrowKey",(...e)=>this._onArrowKey(...e),{context:"table"}),this.listenTo(t,"tab",(...e)=>this._handleTabOnSelectedTable(...e),{context:"figure"}),this.listenTo(t,"tab",(...e)=>this._handleTab(...e),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:o("Keystrokes that can be used in a table cell"),keystrokes:[{label:o("Move the selection to the next cell"),keystroke:"Tab"},{label:o("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:o("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:o("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const o=this.editor.model.document.selection.getSelectedElement();o&&o.is("element","table")&&t.stopPropagation()}_handleTab(e,t){const o=this.editor,i=this.editor.plugins.get(Ie),l=this.editor.plugins.get("TableSelection"),n=o.model.document.selection,r=!t.shiftKey;let a=i.getTableCellsContainingSelection(n)[0];if(a||(a=l.getFocusCell()),!a)return;t.stopPropagation();const s=a.parent,c=s.parent,d=c.getChildIndex(s),u=s.getChildIndex(a)===s.childCount-1,b=d===i.getRows(c)-1;r&&b&&u&&o.execute("insertTableRowBelow")}_onArrowKey(e,t){const o=this.editor,i=t.keyCode,n=(0,l.getLocalizedArrowKeyCodeDirection)(i,o.locale.contentLanguageDirection);this._handleArrowKeys(n,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const o=this.editor.plugins.get(Ie),i=this.editor.plugins.get("TableSelection"),l=this.editor.model,n=l.document.selection,r=["right","down"].includes(e),a=o.getSelectedTableCells(n);if(a.length){let o;return o=t?i.getFocusCell():r?a[a.length-1]:a[0],this._navigateFromCellInDirection(o,e,t),!0}const s=n.focus.findAncestor("tableCell");if(!s)return!1;if(!n.isCollapsed)if(t){if(n.isBackward==r&&!n.containsEntireContent(s))return!1}else{const e=n.getSelectedElement();if(!e||!l.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(n,s,r)&&(this._navigateFromCellInDirection(s,e,t),!0)}_isSelectionAtCellEdge(e,t,o){const i=this.editor.model,l=this.editor.model.schema,n=o?e.getLastPosition():e.getFirstPosition();if(!l.getLimitElement(n).is("element","tableCell")){return i.createPositionAt(t,o?"end":0).isTouching(n)}const r=i.createSelection(n);return i.modifySelection(r,{direction:o?"forward":"backward"}),n.isEqual(r.focus)}_navigateFromCellInDirection(e,t,o=!1){const i=this.editor.model,l=e.findAncestor("table"),n=[...new v(l,{includeAllSlots:!0})],{row:r,column:a}=n[n.length-1],s=n.find(({cell:t})=>t==e);let{row:c,column:d}=s;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=s.cellWidth;break;case"down":c+=s.cellHeight}if(c<0||c>r||d<0&&c<=0||d>a&&c>=r)return void i.change(e=>{e.setSelection(e.createRangeOn(l))});d<0?(d=o?0:a,c--):d>a&&(d=o?a:0,c++);const u=n.find(e=>e.row==c&&e.column==d).cell,b=["right","down"].includes(t),h=this.editor.plugins.get("TableSelection");if(o&&h.isEnabled){const t=h.getAnchorCell()||e;h.setCellSelection(t,u)}else{const e=i.createPositionAt(u,b?0:"end");i.change(t=>{t.setSelection(e)})}}}var Pt=o(783);class It extends Pt.DomEventObserver{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}}class Rt extends e.Plugin{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[yt,Ie]}init(){this.editor.editing.view.addObserver(It),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(Ie);let o=!1;const i=e.plugins.get(yt);this.listenTo(e.editing.view.document,"mousedown",(l,n)=>{const r=e.model.document.selection;if(!this.isEnabled||!i.isEnabled)return;if(!n.domEvent.shiftKey)return;const a=i.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const s=this._getModelTableCellFromDomEvent(n);s&&Et(a,s)&&(o=!0,i.setCellSelection(a,s),n.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{o=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{o&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,o,i=!1,l=!1;const n=e.plugins.get(yt);this.listenTo(e.editing.view.document,"mousedown",(e,o)=>{this.isEnabled&&n.isEnabled&&(o.domEvent.shiftKey||o.domEvent.ctrlKey||o.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(o)))}),this.listenTo(e.editing.view.document,"mousemove",(e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(r);a&&Et(t,a)&&(o=a,i||o==t||(i=!0)),i&&(l=!0,n.setCellSelection(t,o),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1,l=!1,t=null,o=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{l&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,o=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function Et(e,t){return e.parent.parent==t.parent.parent}var Bt=o(151),Lt={attributes:{"data-cke":!0}};Lt.setAttributes=rt(),Lt.insert=lt().bind(null,"head"),Lt.domAPI=ot(),Lt.insertStyleElement=st();et()(Bt.A,Lt);Bt.A&&Bt.A.locals&&Bt.A.locals;class Ft extends e.Plugin{static get requires(){return[ut,wt,yt,Rt,St,Tt,t.Widget]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}class Wt extends e.Plugin{static get pluginName(){return"PlainTableOutput"}static get isOfficialPlugin(){return!0}static get requires(){return[Ft]}init(){this.editor.conversion.for("upcast").add(e=>{e.on("element:table",(e,t,o)=>{o.consumable.consume(t.viewItem,{classes:"table"})})})}}function Dt(e){const t=Nt(e);return t||zt(e)}function Nt(e){const t=e.getSelectedElement();return t&&Ot(t)?t:null}function zt(e){const t=e.getFirstPosition();if(!t)return null;let o=t.parent;for(;o;){if(o.is("element")&&Ot(o))return o;o=o.parent}return null}function Ot(e){return e.is("element")&&!!e.getCustomProperty("table")&&(0,t.isWidget)(e)}class Mt extends e.Plugin{static get requires(){return[t.WidgetToolbarRepository]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,o=e.t,i=e.plugins.get(t.WidgetToolbarRepository),l=e.config.get("table.contentToolbar"),n=e.config.get("table.tableToolbar");l&&i.register("tableContent",{ariaLabel:o("Table toolbar"),items:l,getRelatedElement:zt}),n&&i.register("table",{ariaLabel:o("Table toolbar"),items:n,getRelatedElement:Nt})}}var Ht=o(188),jt={attributes:{"data-cke":!0}};jt.setAttributes=rt(),jt.insert=lt().bind(null,"head"),jt.domAPI=ot(),jt.insertStyleElement=st();et()(Ht.A,jt);Ht.A&&Ht.A.locals&&Ht.A.locals;class Ut extends mt.View{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new l.FocusTracker,this._focusables=new mt.ViewCollection,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new l.KeystrokeHandler,this._stillTyping=!1,this.focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(e,t,o)=>this._setInputValue(o))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,o=this.bindTemplate,i=this._createColorSelector(e),l=(0,mt.createDropdown)(e),n=new mt.View;return n.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:o.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",o.if("value","ck-hidden",e=>""!=e)]}}]}),l.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),l.buttonView.children.add(n),l.buttonView.label=t("Color picker"),l.buttonView.tooltip=!0,l.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",l.panelView.children.add(i),l.bind("isEnabled").to(this,"isReadOnly",e=>!e),l.on("change:isOpen",(e,t,o)=>{o&&(i.updateSelectedColors(),i.showColorGridsFragment())}),l}_createInputTextView(){const e=this.locale,t=new mt.InputTextView(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const e=t.element.value,o=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=o&&o.color||e}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,o=this.options.defaultColorValue||"",i=t(o?"Restore default":"Remove color"),l=new mt.ColorSelectorView(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:t("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});l.appendUI(),l.on("execute",(e,t)=>{"colorPickerSaveButton"!==t.source?(this.value=t.value||o,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1});let n=this.value;return l.on("colorPicker:cancel",()=>{this.value=n,this.fire("input"),this.dropdownView.isOpen=!1}),l.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{n=this.value}),l.bind("selectedColor").to(this,"value"),l}_setInputValue(e){if(!this._stillTyping){const t=$t(e),o=this.options.colorDefinitions.find(e=>t===$t(e.color));this.inputView.value=o?o.label:e||""}}}function $t(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const Kt=e=>""===e;function Gt(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function qt(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Jt(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function Xt(e){return e=e.trim().toLowerCase(),Kt(e)||(0,Pt.isColorStyleValue)(e)}function Yt(e){return e=e.trim(),Kt(e)||io(e)||(0,Pt.isLengthStyleValue)(e)||(0,Pt.isPercentageStyleValue)(e)}function Zt(e){return e=e.trim(),Kt(e)||io(e)||(0,Pt.isLengthStyleValue)(e)}function Qt(e,t){const o=new l.Collection,i=Gt(e.t);for(const l in i){const n={type:"button",model:new mt.UIModel({_borderStyleValue:l,label:i[l],role:"menuitemradio",withText:!0})};"none"===l?n.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===l):n.model.bind("isOn").to(e,"borderStyle",e=>e===l),o.add(n)}return o}function eo(e){const{view:t,icons:o,toolbar:i,labels:l,propertyName:n,nameToValue:r,defaultValue:a}=e;for(const e in l){const s=new mt.ButtonView(t.locale);s.set({role:"radio",isToggleable:!0,label:l[e],icon:o[e],tooltip:l[e]});const c=r?r(e):e;s.bind("isOn").to(t,n,e=>{let t=e;return""===e&&a&&(t=a),c===t}),s.on("execute",()=>{!a&&c&&t[n]===c?t[n]=void 0:t[n]=c}),i.items.add(s)}}const to=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function oo(e){return(t,o,i)=>{const l=new Ut(t.locale,{colorDefinitions:(n=e.colorConfig,n.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var n;return l.inputView.set({id:o,ariaDescribedById:i}),l.bind("isReadOnly").to(t,"isEnabled",e=>!e),l.bind("hasError").to(t,"errorText",e=>!!e),l.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(l),l}}function io(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}var lo=o(29),no={attributes:{"data-cke":!0}};no.setAttributes=rt(),no.insert=lt().bind(null,"head"),no.domAPI=ot(),no.insertStyleElement=st();et()(lo.A,no);lo.A&&lo.A.locals&&lo.A.locals;var ro=o(865),ao={attributes:{"data-cke":!0}};ao.setAttributes=rt(),ao.insert=lt().bind(null,"head"),ao.domAPI=ot(),ao.insertStyleElement=st();et()(ro.A,ao);ro.A&&ro.A.locals&&ro.A.locals;var so=o(337),co={attributes:{"data-cke":!0}};co.setAttributes=rt(),co.insert=lt().bind(null,"head"),co.domAPI=ot(),co.insertStyleElement=st();et()(so.A,co);so.A&&so.A.locals&&so.A.locals;var uo=o(380),bo={attributes:{"data-cke":!0}};bo.setAttributes=rt(),bo.insert=lt().bind(null,"head"),bo.domAPI=ot(),bo.insertStyleElement=st();et()(uo.A,bo);uo.A&&uo.A.locals&&uo.A.locals;class ho extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new mt.FormHeaderView(e,{label:this.t("Cell properties")})),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new mt.FormRowView(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new mt.FormRowView(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=oo({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Gt(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,Qt(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",mo),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",mo),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{mo(i)||(this.borderColor="",this.borderWidth=""),mo(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=oo({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createPaddingField(){const e=this.locale,t=this.t,o=new mt.LabeledFieldView(e,mt.createLabeledInputText);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",()=>{this.padding=o.fieldView.element.value}),o}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e),i={left:ht.IconAlignLeft,center:ht.IconAlignCenter,right:ht.IconAlignRight,justify:ht.IconAlignJustify,top:ht.IconAlignTop,middle:ht.IconAlignMiddle,bottom:ht.IconAlignBottom};o.text=t("Table cell text alignment");const l=new mt.ToolbarView(e),n="rtl"===e.contentLanguageDirection;l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),eo({view:this,icons:i,toolbar:l,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(n){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new mt.ToolbarView(e);return r.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),eo({view:this,icons:i,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:l,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),icon:ht.IconCheck,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),icon:ht.IconCancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),i=t("Align cell text to the center"),l=t("Align cell text to the right"),n=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:l,center:i,left:o,justify:n}:{left:o,center:i,right:l,justify:n}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function mo(e){return"none"!==e}function go(e,t,{signal:o,edges:i}={}){let l,n=null;const r=null!=i&&i.includes("leading"),a=null==i||i.includes("trailing"),s=()=>{null!==n&&(e.apply(l,n),l=void 0,n=null)};let c=null;const d=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,a&&s(),b()},t)},u=()=>{null!==c&&(clearTimeout(c),c=null)},b=()=>{u(),l=void 0,n=null},h=function(...e){if(o?.aborted)return;l=this,n=e;const t=null==c;d(),r&&t&&s()};return h.schedule=d,h.cancel=b,h.flush=()=>{u(),s()},o?.addEventListener("abort",b,{once:!0}),h}function po(e,t=0,o={}){"object"!=typeof o&&(o={});const{leading:i=!1,trailing:l=!0,maxWait:n}=o,r=Array(2);let a;i&&(r[0]="leading"),l&&(r[1]="trailing");let s=null;const c=go(function(...t){a=e.apply(this,t),s=null},t,{edges:r}),d=function(...t){return null!=n&&(null===s&&(s=Date.now()),Date.now()-s>=n)?(a=e.apply(this,t),s=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,t),a)};return d.cancel=c.cancel,d.flush=()=>(c.flush(),a),d}const fo=(()=>[mt.BalloonPanelView.defaultPositions.northArrowSouth,mt.BalloonPanelView.defaultPositions.northArrowSouthWest,mt.BalloonPanelView.defaultPositions.northArrowSouthEast,mt.BalloonPanelView.defaultPositions.southArrowNorth,mt.BalloonPanelView.defaultPositions.southArrowNorthWest,mt.BalloonPanelView.defaultPositions.southArrowNorthEast,mt.BalloonPanelView.defaultPositions.viewportStickyNorth])();function wo(e,t){const o=e.plugins.get("ContextualBalloon"),i=e.editing.view.document.selection;let l;"cell"===t?zt(i)&&(l=_o(e)):Dt(i)&&(l=ko(e)),l&&o.updatePosition(l)}function ko(e){const t=y(e.model.document.selection),o=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(o),positions:fo}}function _o(e){const t=e.editing.mapper,o=e.editing.view.domConverter,i=e.model.document.selection;if(i.rangeCount>1)return{target:()=>function(e,t){const o=t.editing.mapper,i=t.editing.view.domConverter,n=Array.from(e).map(e=>{const t=Co(e.start),n=o.toViewElement(t);return new l.Rect(i.mapViewToDom(n))});return l.Rect.getBoundingRect(n)}(i.getRanges(),e),positions:fo};const n=Co(i.getFirstPosition()),r=t.toViewElement(n);return{target:o.mapViewToDom(r),positions:fo}}function Co(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const yo={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class vo extends e.Plugin{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor,t=e.t;this._defaultContentTableCellProperties=$(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._defaultLayoutTableCellProperties=j(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(mt.ContextualBalloon),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",o=>{const i=new mt.ButtonView(o);i.set({label:t("Cell properties"),icon:ht.IconTableCellProperties,tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());const l=Object.values(yo).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableCellProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new ho(t.locale,{borderColors:l,backgroundColors:r,defaultTableCellProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:Zt})),s.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:s.paddingInput,commandName:"tableCellPadding",errorText:u,validator:Yt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableCellWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableCellHeight",errorText:u,validator:Yt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:Xt})),s.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),s.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(yo).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[i]||"":this._defaultLayoutTableCellProperties[i]||"";return[t,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:_o(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;zt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}class To extends e.Command{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,o){switch(super(e),this.attributeName=t,this._defaultContentTableValue=o,t){case"tableCellBorderStyle":this._defaultLayoutTableValue="none";break;case"tableCellHorizontalAlignment":this._defaultLayoutTableValue="left";break;case"tableCellVerticalAlignment":this._defaultLayoutTableValue="middle";break;default:this._defaultLayoutTableValue=void 0}}refresh(){const e=this.editor.model.document.selection,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e),o=y(e);this._defaultValue=o&&"layout"===o.getAttribute("tableType")?this._defaultLayoutTableValue:this._defaultContentTableValue,this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){const{value:t,batch:o}=e,i=this.editor.model,l=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),n=this._getValueToSet(t);i.enqueueChange(o,e=>{n?l.forEach(t=>e.setAttribute(this.attributeName,n,t)):l.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class Ao extends To{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=H(e,"px"))!==this._defaultValue)return e}}class xo extends e.Plugin{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ut]}init(){const e=this.editor,t=$(e.config.get("table.tableCellProperties.defaultProperties"));C(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:t.width}),e.commands.add("tableCellWidth",new Ao(e,t.width))}}class Vo extends To{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class So extends To{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class Po extends To{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class Io extends To{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class Ro extends To{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class Eo extends To{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Bo extends To{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Lo extends To{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}const Fo=/^(top|middle|bottom)$/,Wo=/^(left|center|right|justify)$/;class Do extends e.Plugin{static get pluginName(){return"TableCellPropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[ut,xo]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const i=$(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(Pt.addBorderStylesRules),function(e,t){const{conversion:o}=e,{schema:i}=e.model,l={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};i.extend("tableCell",{allowAttributes:Object.values(l)});for(const e of Object.values(l))i.setAttributeProperties(e,{isFormatting:!0});r(e,"td",l,t),r(e,"th",l,t),a(o,{modelElement:"tableCell",modelAttribute:l.style,styleName:"border-style"}),a(o,{modelElement:"tableCell",modelAttribute:l.color,styleName:"border-color"}),a(o,{modelElement:"tableCell",modelAttribute:l.width,styleName:"border-width"})}(e,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableCellBorderStyle",new Eo(e,i.borderStyle)),e.commands.add("tableCellBorderColor",new Bo(e,i.borderColor)),e.commands.add("tableCellBorderWidth",new Lo(e,i.borderWidth)),C(t,o,{modelAttribute:"tableCellHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:i.height}),e.commands.add("tableCellHeight",new So(e,i.height)),e.data.addStyleProcessorRules(Pt.addPaddingStylesRules),C(t,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),e.commands.add("tableCellPadding",new Vo(e,i.padding)),e.data.addStyleProcessorRules(Pt.addBackgroundStylesRules),C(t,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:i.backgroundColor}),e.commands.add("tableCellBackgroundColor",new Po(e,i.backgroundColor)),function(e,t,o){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),e.setAttributeProperties("tableCellHorizontalAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":Wo}},model:{key:"tableCellHorizontalAlignment",value:(e,t,i)=>{const l=c(o,"left",i),n=e.getStyle("text-align");if(n!==l)return n;t.consumable.consume(e,{styles:"text-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Wo}},model:{key:"tableCellHorizontalAlignment",value:(e,t,i)=>{const l=c(o,"left",i),n=e.getAttribute("align");if(n!==l)return n;t.consumable.consume(e,{attributes:"align"})}}})}(t,o,i.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new Ro(e,i.horizontalAlignment)),function(e,t,o){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),e.setAttributeProperties("tableCellVerticalAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":Fo}},model:{key:"tableCellVerticalAlignment",value:(e,t,i)=>{const l=c(o,"middle",i),n=e.getStyle("vertical-align");if(n!==l)return n;t.consumable.consume(e,{styles:"vertical-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:Fo}},model:{key:"tableCellVerticalAlignment",value:(e,t,i)=>{const l=c(o,"middle",i),n=e.getAttribute("valign");if(n!==l)return n;t.consumable.consume(e,{attributes:"valign"})}}})}(t,o,i.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Io(e,i.verticalAlignment))}}class No extends e.Plugin{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[Do,vo]}}class zo extends e.Plugin{static get pluginName(){return"TableLayoutUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.ui.componentFactory.add("insertTableLayout",o=>{const i=e.commands.get("insertTableLayout"),l=(0,mt.createDropdown)(o);let n;return l.bind("isEnabled").to(i),l.buttonView.set({icon:ht.IconTableLayout,label:t("Insert table layout"),tooltip:!0}),l.on("change:isOpen",()=>{n||(n=new ft(o),l.panelView.children.add(n),n.delegate("execute").to(l),l.on("execute",()=>{e.execute("insertTableLayout",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}))}),l}),e.ui.componentFactory.add("menuBar:insertTableLayout",o=>{const i=e.commands.get("insertTableLayout"),l=new mt.MenuBarMenuView(o),n=new ft(o);return n.delegate("execute").to(l),l.on("change:isOpen",(e,t,o)=>{o||n.reset()}),n.on("execute",()=>{e.execute("insertTableLayout",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}),l.buttonView.set({label:t("Table layout"),icon:ht.IconTableLayout}),l.panelView.children.add(n),l.bind("isEnabled").to(i),l}),e.ui.componentFactory.add("tableType",()=>{const e=this.editor,t=e.t,o=new mt.DropdownButtonView(e.locale);return o.set({label:t("Table type"),icon:ht.IconTableProperties,tooltip:!0}),Oo(e,o)})}afterInit(){const e=this.editor;if(!e.plugins.has("TablePropertiesUI"))return;const t=e.plugins.get("TablePropertiesUI");e.ui.componentFactory.add("tableProperties",o=>{const i=t._createTablePropertiesButton(),l=new mt.SplitButtonView(o,i);return Oo(e,l)})}}function Oo(e,t){const o=e.t,i=e.locale,n=e.commands.get("tableType"),r=(0,mt.createDropdown)(i,t),a=function(e){const t=e.t,o=e.commands.get("tableType"),i=new l.Collection;return i.add(Mo(o,"layout",t("Layout table"))),i.add(Mo(o,"content",t("Content table"))),i}(e);return(0,mt.addListToDropdown)(r,a,{ariaLabel:o("Table type options"),role:"menu"}),t.tooltip=o("Choose table type"),r.on("execute",e=>{const t=e.source.tableType;t&&n.execute(t)}),r}function Mo(e,t,o){const i=new mt.UIModel({label:o,role:"menuitemradio",withText:!0,tableType:t});return i.bind("isEnabled").to(e,"isEnabled"),i.bind("isOn").to(e,"value",e=>e===t),{type:"button",model:i}}class Ho extends e.Command{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema;this.isEnabled=function(e,t){const o=e.getFirstPosition().parent,i=o===o.root?o:o.parent;return t.checkChild(i,"table")}(t,o)}execute(e={}){const t=this.editor,o=t.model,i=t.plugins.get("TableUtils");o.change(l=>{const n={rows:e.rows||2,columns:e.columns||2},r=i.createTable(l,n);l.setAttribute("tableType","layout",r),o.insertObject(r,null,null,{findOptimalPosition:"auto"});const a=100/n.columns+"%",s=Array(n.columns).fill(a);t.commands.get("resizeColumnWidths").execute({tableWidth:"100%",columnWidths:s,table:r}),l.setSelection(l.createPositionAt(r.getNodeByPath([0,0,0]),0))})}}function jo(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function Uo(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function $o(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Ko="[object Arguments]",Go="[object Object]";function qo(e,t,o,i,l,n,r){const a=r(e,t,o,i,l,n);if(void 0!==a)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return e===t;case"number":return e===t||Object.is(e,t);case"object":return Jo(e,t,n,r)}return Jo(e,t,n,r)}function Jo(e,t,o,i){if(Object.is(e,t))return!0;let l=$o(e),n=$o(t);if(l===Ko&&(l=Go),n===Ko&&(n=Go),l!==n)return!1;switch(l){case"[object String]":return e.toString()===t.toString();case"[object Number]":{const o=e.valueOf(),i=t.valueOf();return(r=o)===(a=i)||Number.isNaN(r)&&Number.isNaN(a)}case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(e.valueOf(),t.valueOf());case"[object RegExp]":return e.source===t.source&&e.flags===t.flags;case"[object Function]":return e===t}var r,a;const s=(o=o??new Map).get(e),c=o.get(t);if(null!=s&&null!=c)return s===t;o.set(e,t),o.set(t,e);try{switch(l){case"[object Map]":if(e.size!==t.size)return!1;for(const[l,n]of e.entries())if(!t.has(l)||!qo(n,t.get(l),l,e,t,o,i))return!1;return!0;case"[object Set]":{if(e.size!==t.size)return!1;const l=Array.from(e.values()),n=Array.from(t.values());for(let r=0;r<l.length;r++){const a=l[r],s=n.findIndex(l=>qo(a,l,void 0,e,t,o,i));if(-1===s)return!1;n.splice(s,1)}return!0}case"[object Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":case"[object BigUint64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object BigInt64Array]":case"[object Float32Array]":case"[object Float64Array]":if("undefined"!=typeof Buffer&&Buffer.isBuffer(e)!==Buffer.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(let l=0;l<e.length;l++)if(!qo(e[l],t[l],l,e,t,o,i))return!1;return!0;case"[object ArrayBuffer]":return e.byteLength===t.byteLength&&Jo(new Uint8Array(e),new Uint8Array(t),o,i);case"[object DataView]":return e.byteLength===t.byteLength&&e.byteOffset===t.byteOffset&&Jo(new Uint8Array(e),new Uint8Array(t),o,i);case"[object Error]":return e.name===t.name&&e.message===t.message;case Go:{if(!(Jo(e.constructor,t.constructor,o,i)||jo(e)&&jo(t)))return!1;const l=[...Object.keys(e),...Uo(e)],n=[...Object.keys(t),...Uo(t)];if(l.length!==n.length)return!1;for(let n=0;n<l.length;n++){const r=l[n],a=e[r];if(!Object.hasOwn(t,r))return!1;if(!qo(a,t[r],r,e,t,o,i))return!1}return!0}default:return!1}}finally{o.delete(e),o.delete(t)}}function Xo(){}function Yo(e,t){return function(e,t,o){return qo(e,t,void 0,void 0,void 0,void 0,o)}(e,t,Xo)}class Zo extends e.Command{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:o}=this.editor;let{table:i=t.document.selection.getSelectedElement(),columnWidths:l,tableWidth:n}=e;l&&(l=Array.isArray(l)?l:l.split(",")),t.change(e=>{n?e.setAttribute("tableWidth",n,i):e.removeAttribute("tableWidth",i);const t=o.get("TableColumnResizeEditing").getColumnGroupElement(i);if(!l&&!t)return;if(!l)return e.remove(t);const r=ve(l);if(t)Array.from(t.getChildren()).forEach((t,o)=>e.setAttribute("columnWidth",r[o],t));else{const t=e.createElement("tableColumnGroup");r.forEach(o=>e.appendElement("tableColumn",{columnWidth:o},t)),e.append(t,i)}})}}function Qo(e){return t=>t.on("element:colgroup",(t,o,i)=>{const l=o.modelCursor.findAncestor("table"),n=xe(l);if(!n)return;const r=Ve(n),a=e.getColumns(l);let s=Pe(n,i.writer);s=Array.from({length:a},(e,t)=>s[t]||"auto"),(s.length!=r.length||s.includes("auto"))&&Ae(r,n,ve(s),i.writer)},{priority:"low"})}function ei(){return e=>e.on("insert:table",(e,t,o)=>{const i=o.writer,l=t.item,n=o.mapper.toViewElement(l),r=n.is("element","table")?n:Array.from(n.getChildren()).find(e=>e.is("element","table"));xe(l)?i.addClass("ck-table-resized",r):i.removeClass("ck-table-resized",r)},{priority:"low"})}const ti=(0,l.toUnit)("px");class oi extends e.Plugin{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;_initialMouseEventData=null;static get requires(){return[ut,Ie]}static get pluginName(){return"TableColumnResizeEditing"}static get licenseFeatureCode(){return"TCR"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new((0,l.DomEmitterMixin)()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(t,o,i)=>{const l=i?"removeClass":"addClass";e.editing.view.change(t=>{for(const o of e.editing.view.document.roots)t[l]("ck-column-resize_disabled",e.editing.view.document.getRoot(o.rootName))})})}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});const o=new Zo(e);e.commands.add("resizeTableWidth",o),e.commands.add("resizeColumnWidths",o),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",o,"isEnabled",(e,t,o)=>!e&&t&&o)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return xe(e)}getTableColumnElements(e){return Ve(e)}getTableColumnsWidths(e){return Se(e)}_extendSchema(){const e=this.editor.model.schema;e.extend("table",{allowAttributes:["tableWidth"]}),e.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),e.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0}),e.setAttributeProperties("columnWidth",{isFormatting:!0})}_registerPostFixer(){const e=this.editor.model;function t(e,t,o){const i=o._tableUtilsPlugin.getColumns(t);if(0===i-e.length)return e;const l=e.map(e=>Number(e.replace("%",""))),n=function(e,t){const o=new Set;for(const i of e.getChanges())if("insert"==i.type&&i.position.nodeAfter&&"tableCell"==i.position.nodeAfter.name&&i.position.nodeAfter.getAncestors().includes(t))o.add(i.position.nodeAfter);else if("remove"==i.type){const e=i.position.nodeBefore||i.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&o.add(e)}return o}(o.editor.model.document.differ,t);for(const e of n){const n=i-l.length;if(0===n)continue;const r=n>0,a=o._tableUtilsPlugin.getCellLocation(e).column;if(r){const e=Ce(n,me(t,o.editor));l.splice(a,0,...e)}else{const e=l.splice(a,Math.abs(n));l[a]+=ye(e)}}return l.map(e=>e+"%")}e.document.registerPostFixer(o=>{let i=!1;for(const l of he(e)){const e=this.getColumnGroupElement(l),n=this.getTableColumnElements(e),r=this.getTableColumnsWidths(e);let a=ve(r);a=t(a,l,this),Yo(r,a)||(Ae(n,e,a,o),i=!0)}return i})}_registerConverters(){const e=this.editor.conversion;e.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{key:"tableWidth",value:e=>{if(!e.parent.is("element","figure"))return e.getStyle("width")}}}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),e.elementToElement({model:"tableColumnGroup",view:"colgroup"}),e.elementToElement({model:"tableColumn",view:"col"}),e.for("downcast").add(ei()),e.for("upcast").add(e=>{e.on("element:table",(e,t,o)=>{o.consumable.consume(t.viewItem,{classes:"ck-table-resized"})})}),e.for("upcast").add(Qo(this._tableUtilsPlugin)),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),e.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),e.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver(It),e.document.on("mouseover",this._onMouseOverHandler.bind(this),{priority:"high"}),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),e.document.on("mouseout",this._onMouseOutHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(l.global.window.document,"mousemove",function(e,t=0,o={}){"object"!=typeof o&&(o={});const{leading:i=!0,trailing:l=!0}=o;return po(e,t,{leading:i,trailing:l,maxWait:t})}(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(l.global.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){const t=this.editor,o=t.editing.view.domConverter,i=o.mapViewToDom(e.findAncestor("table")),n=o.mapViewToDom(e.findAncestor(e=>["td","th"].includes(e.name))),r=new l.Rect(i),a=new l.Rect(n),s=ti(Number((r.top-a.top).toFixed(4))),c=ti(Number((a.bottom-r.bottom).toFixed(4)));t.editing.view.change(t=>{t.setStyle("top",s,e),t.setStyle("bottom",c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(t=>{t.removeStyle("top",e),t.removeStyle("bottom",e)})}_onMouseOverHandler(e,t){const o=t.target;o.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(o)}_onMouseOutHandler(e,t){const o=t.target;o.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(o))}_onMouseDownHandler(e,t){const o=t.target;if(!o.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const i=this.editor,l=i.editing.mapper.toModelElement(o.findAncestor("figure"));i.model.canEditAt(l)&&(t.preventDefault(),e.stop(),this._initialMouseEventData=t)}_startResizingAfterThreshold(){const e=this._initialMouseEventData,{target:t}=e,o=this.editor.editing.mapper.toModelElement(t.findAncestor("figure")),i=t.findAncestor("table"),l=function(e,t,o){const i=Array(t.getColumns(e)),l=new v(e);for(const e of l){const t=o.editing.mapper.toViewElement(e.cell),l=Te(o.editing.view.domConverter.mapViewToDom(t));(!i[e.column]||l<i[e.column])&&(i[e.column]=ke(l))}return i}(o,this._tableUtilsPlugin,this.editor);Array.from(i.getChildren()).find(e=>e.is("element","colgroup"))||this.editor.editing.view.change(e=>{!function(e,t,o){const i=e.createContainerElement("colgroup");for(let o=0;o<t.length;o++){const l=e.createEmptyElement("col"),n=`${ke(t[o]/ye(t)*100)}%`;e.setStyle("width",n,l),e.insert(e.createPositionAt(i,"end"),l)}e.insert(e.createPositionAt(o,0),i)}(e,l,i)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,l),this.editor.editing.view.change(e=>function(e,t,o){const i=o.widths.viewFigureWidth/o.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",o.elements.viewResizer),e.setStyle("width",`${ke(100*i)}%`,t.findAncestor("figure"))}(e,i,this._resizingData))}_onMouseMoveHandler(e,t){if(this._initialMouseEventData){const e=this._initialMouseEventData.domEvent;if(!(Math.abs(t.clientX-e.clientX)>=be))return;this._startResizingAfterThreshold(),this._initialMouseEventData=null}if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:o,flags:{isRightEdge:i,isTableCentered:l,isLtrContent:n},elements:{viewFigure:r,viewLeftColumn:a,viewRightColumn:s,viewResizer:c},widths:{viewFigureParentWidth:d,tableWidth:u,leftColumnWidth:b,rightColumnWidth:h}}=this._resizingData,m=-b+de,g=i?d-u:h-de,p=(n?1:-1)*(i&&l?2:1),f=_e((t.clientX-o)*p,Math.min(m,0),Math.max(g,0));0!==f&&(this.editor.editing.view.change(e=>{const t=ke(100*(b+f)/u);if(e.setStyle("width",`${t}%`,a),i){const t=ke(100*(u+f)/d);e.setStyle("width",`${t}%`,r)}else{const t=ke(100*(h-f)/u);e.setStyle("width",`${t}%`,s)}}),this._recalculateResizerElement(c))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:o,viewColgroup:i}=this._resizingData.elements,l=this.editor,n=l.editing.view,r=this.getColumnGroupElement(t),a=Array.from(i.getChildren()).filter(e=>e.is("view:element")),s=r?this.getTableColumnsWidths(r):null,c=a.map(e=>e.getStyle("width")),d=!Yo(s,c),u=t.getAttribute("tableWidth"),b=o.getStyle("width"),h=u!==b;(d||h)&&(this._isResizingAllowed?l.execute("resizeTableWidth",{table:t,tableWidth:`${ke(b)}%`,columnWidths:c}):n.change(e=>{if(s)for(const t of a)e.setStyle("width",s.shift(),t);else e.remove(i);h&&(u?e.setStyle("width",u,o):e.removeStyle("width",o)),s||u||e.removeClass("ck-table-resized",[...o.getChildren()].find(e=>"table"===e.name))})),n.change(t=>{t.removeClass("ck-table-column-resizer__active",e)});n.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const o=this.editor,i=e.domEvent.clientX,l=e.target,n=l.findAncestor("td")||l.findAncestor("th"),r=o.editing.mapper.toModelElement(n),a=r.findAncestor("table"),s=we(r,this._tableUtilsPlugin).rightEdge,c=s===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),u="rtl"!==o.locale.contentLanguageDirection,b=n.findAncestor("table"),h=b.findAncestor("figure"),m=[...b.getChildren()].find(e=>e.is("element","colgroup")),g=m.getChild(s),p=c?void 0:m.getChild(s+1);return{columnPosition:i,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:u},elements:{viewResizer:l,modelTable:a,viewFigure:h,viewColgroup:m,viewLeftColumn:g,viewRightColumn:p},widths:{viewFigureParentWidth:fe(o.editing.view.domConverter.mapViewToDom(h.parent)),viewFigureWidth:fe(o.editing.view.domConverter.mapViewToDom(h)),tableWidth:ge(a,o),leftColumnWidth:t[s],rightColumnWidth:c?void 0:t[s+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(e,t,o)=>{const i=t.item,l=o.mapper.toViewElement(i),n=o.writer;n.insert(n.createPositionAt(l,"end"),n.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}}var ii=o(433),li={attributes:{"data-cke":!0}};li.setAttributes=rt(),li.insert=lt().bind(null,"head"),li.domAPI=ot(),li.insertStyleElement=st();et()(ii.A,li);ii.A&&ii.A.locals&&ii.A.locals;class ni extends e.Plugin{static get requires(){return[oi,xo]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}class ri extends e.Command{refresh(){const e=y(this.editor.model.document.selection);e?(this.isEnabled=!0,this.value=e.getAttribute("tableType")):(this.isEnabled=!1,this.value=null)}execute(e){const t=this.editor.model,o=y(t.document.selection);o.getAttribute("tableType")!==e&&t.change(i=>{i.setAttribute("tableType",e,o),t.schema.removeDisallowedAttributes([o],i);const l=o.getChildren();for(const e of l)t.schema.checkChild(o,e)||i.remove(e)})}}var ai=o(49),si={attributes:{"data-cke":!0}};si.setAttributes=rt(),si.insert=lt().bind(null,"head"),si.domAPI=ot(),si.insertStyleElement=st();et()(ai.A,si);ai.A&&ai.A.locals&&ai.A.locals;const ci=["content","layout"];class di extends e.Plugin{static get pluginName(){return"TableLayoutEditing"}static get licenseFeatureCode(){return"TL"}static get requires(){return[ni]}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this._defineSchema(),this._defineConverters(),this._defineClipboardPasteHandlers(),this._registerTableTypeAttributePostfixer(),this.editor.commands.add("insertTableLayout",new Ho(this.editor)),this.editor.commands.add("tableType",new ri(this.editor))}_defineSchema(){const{schema:e}=this.editor.model;e.extend("table",{allowAttributes:"tableType"}),e.addChildCheck(bi,"caption"),e.addAttributeCheck(bi,"headingRows"),e.addAttributeCheck(bi,"headingColumns")}_defineConverters(){const{editor:e}=this,{conversion:t}=e,o=e.config.get("table.tableLayout.preferredExternalTableType");t.for("upcast").add(function(e,t){return o=>{o.on("element:table",(o,i,l)=>{const n=i.viewItem;if(!l.consumable.test(n,{name:!0}))return;if("content"==ui(n,t))return;const r=l.writer.createElement("table",{tableType:"layout"});if(l.safeInsert(r,i.modelCursor)){l.consumable.consume(n,{name:!0}),l.consumable.consume(n,{attributes:["role"]}),l.consumable.consume(n,{classes:["layout-table"]}),e.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&"0"===n.getAttribute("border")&&l.consumable.consume(n,{attributes:["border"]});for(const e of n.getChildren())if(e.is("element"))for(const t of e.getChildren())t.is("element","tr")&&l.convertItem(t,l.writer.createPositionAt(r,"end"));if(l.convertChildren(n,l.writer.createPositionAt(r,"end")),r.isEmpty){const e=l.writer.createElement("tableRow");l.writer.insert(e,l.writer.createPositionAt(r,"end")),k(l.writer,l.writer.createPositionAt(e,"end"))}l.updateConversionResult(r,i)}},{priority:"high"}),o.on("element:table",(e,o,i)=>{const{viewItem:l,modelRange:n}=o;n&&(i.writer.setAttribute("tableType",ui(l,t),n),i.consumable.consume(l,{classes:["layout-table"]}),i.consumable.consume(l,{classes:["content-table"]}))},{priority:"low"})}}(e,o)),t.for("dataDowncast").add(e=>e.on("attribute:tableType:table",(e,t,o)=>{const{item:i,attributeNewValue:l}=t,{mapper:n,writer:r}=o;if(!o.consumable.test(i,e.name))return;const a=n.toViewElement(i);r.addClass(`${l}-table`,a),"layout"==l&&r.setAttribute("role","presentation",a),o.consumable.consume(i,e.name)})),t.for("editingDowncast").attributeToAttribute({model:{key:"tableType",values:["layout","content"]},view:{layout:{key:"class",value:["layout-table"]},content:{key:"class",value:["content-table"]}}})}_defineClipboardPasteHandlers(){const{plugins:e}=this.editor;if(!e.has("ClipboardPipeline"))return;const t=e.get("ClipboardPipeline");this.listenTo(t,"contentInsertion",(e,t)=>{t.sourceEditorId||this.editor.model.change(e=>{for(const{item:o}of e.createRangeIn(t.content))o.is("element","table")&&e.setAttribute("tableType","content",o)})})}_registerTableTypeAttributePostfixer(){const e=this.editor;e.model.document.registerPostFixer(t=>{const o=e.model.document.differ.getChanges();let i=!1;for(const l of o){if("insert"==l.type&&"$text"!=l.name){const e=l.position.nodeAfter,o=t.createRangeOn(e);for(const e of o.getItems())e.is("element","table")&&!e.hasAttribute("tableType")&&(t.setAttribute("tableType","content",e),i=!0)}if("attribute"==l.type&&"tableType"==l.attributeKey)for(const o of l.range.getItems())if(o.is("element","table")){e.model.schema.removeDisallowedAttributes([o],t);const l=o.getChildren();for(const n of l)e.model.schema.checkChild(o,n)||(t.remove(n),i=!0)}}return i})}}function ui(e,t){if(e.hasClass("content-table"))return"content";if(e.hasClass("layout-table"))return"layout";if(t&&ci.includes(t))return t;return e.parent.is("element","figure")||Array.from(e.getChildren()).some(e=>e.is("element","caption"))?"content":"layout"}function bi(e){if(e.endsWith("table")&&"layout"==e.last.getAttribute("tableType"))return!1}class hi extends e.Plugin{static get pluginName(){return"TableLayout"}static get isOfficialPlugin(){return!0}static get requires(){return[Wt,ni,di,zo]}}class mi extends e.Command{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,o){super(e),this.attributeName=t,this._defaultContentTableValue=o,this._defaultLayoutTableValue="tableBorderStyle"===t?"none":void 0}refresh(){const e=y(this.editor.model.document.selection);this._defaultValue=e&&"layout"===e.getAttribute("tableType")?this._defaultLayoutTableValue:this._defaultContentTableValue,this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,o=t.document.selection,{value:i,batch:l}=e,n=y(o),r=this._getValueToSet(i);t.enqueueChange(l,e=>{r?e.setAttribute(this.attributeName,r,n):e.removeAttribute(this.attributeName,n)})}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class gi extends mi{constructor(e,t){super(e,"tableBackgroundColor",t)}}class pi extends mi{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class fi extends mi{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class wi extends mi{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=M(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=H(e,"px");if(t!==this._defaultValue)return t}}class ki extends mi{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=H(e,"px"))!==this._defaultValue)return e}}class _i extends mi{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=H(e,"px"))!==this._defaultValue)return e}}class Ci extends mi{constructor(e,t){super(e,"tableAlignment",t)}}class yi extends e.Plugin{static get pluginName(){return"TablePropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[ut]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const i=U(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),a=!1!==e.config.get("table.tableProperties.alignment.useInlineStyles");if(e.data.addStyleProcessorRules(Pt.addMarginStylesRules),e.data.addStyleProcessorRules(Pt.addBorderStylesRules),function(e,t){const{conversion:o}=e,{schema:i}=e.model,l={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};i.extend("table",{allowAttributes:Object.values(l)});for(const e of Object.values(l))i.setAttributeProperties(e,{isFormatting:!0});r(e,"table",l,t),s(o,{modelAttribute:l.color,styleName:"border-color"}),s(o,{modelAttribute:l.style,styleName:"border-style"}),s(o,{modelAttribute:l.width,styleName:"border-width"})}(e,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),e.commands.add("tableBorderColor",new pi(e,i.borderColor)),e.commands.add("tableBorderStyle",new fi(e,i.borderStyle)),e.commands.add("tableBorderWidth",new wi(e,i.borderWidth)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")?function(e,t,o,i){e.extend("table",{allowAttributes:["tableAlignment"]}),e.setAttributeProperties("tableAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right","blockLeft","blockRight"]},view:{left:i?{key:"style",value:{float:"left","margin-right":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:u.className},right:i?{key:"style",value:{float:"right","margin-left":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:h.className},center:i?{key:"style",value:{"margin-left":"auto","margin-right":"auto"}}:{key:"class",value:b.className},blockLeft:i?{key:"style",value:{"margin-left":"0","margin-right":"auto"}}:{key:"class",value:m.className},blockRight:i?{key:"style",value:{"margin-left":"auto","margin-right":"0"}}:{key:"class",value:g.className}},converterPriority:"high"}),p.forEach(e=>{t.for("upcast").attributeToAttribute({view:e.view,model:{key:"tableAlignment",value:(t,i,l)=>{if(function(e){return"figure"==e.name&&!e.hasClass("table")}(t))return;const n=c(o,"",l),r=e.getAlign(t),a=e.getConsumables(t);return i.consumable.consume(t,a),r!==n?r:void 0}}})}),t.for("upcast").add(function(e){return t=>{t.on("element:div",(t,o,i)=>{if(!i.consumable.test(o.viewItem,{name:!0,attributes:"align"}))return;const n=W(o.viewItem);if(!n||!i.consumable.test(n,{name:!0}))return;i.consumable.consume(o.viewItem,{name:!0,attributes:"align"});const r=i.convertItem(n,o.modelCursor),a=(0,l.first)(r.modelRange.getItems());if(!a||!a.is("element","table"))return i.consumable.revert(o.viewItem,{name:!0,attributes:"align"}),void(r.modelRange&&!r.modelRange.isCollapsed&&(o.modelRange=r.modelRange,o.modelCursor=r.modelCursor));const s=function(e,t,o){if(e)switch(e){case"right":return"right"===t?"right":"left"===t?"left":"blockRight";case"center":return"center";case"left":return void 0===t?"blockLeft":"left";default:return o}return}(o.viewItem.getAttribute("align"),n.getAttribute("align"),c(e,"",o));s&&i.writer.setAttribute("tableAlignment",s,a),i.convertChildren(o.viewItem,i.writer.createPositionAt(a,"end")),i.updateConversionResult(a,o)})}}(o))}(t,o,i.alignment,a):function(e,t,o){const i=/^(left|center|right)$/,l=/^(left|none|right)$/;e.extend("table",{allowAttributes:["tableAlignment"]}),e.setAttributeProperties("tableAlignment",{isFormatting:!0}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}},center:(e,t,o)=>({key:"style",value:"layout"!==o.item.getAttribute("tableType")?{float:"none"}:{"margin-left":"auto","margin-right":"auto"}})},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:l}},model:{key:"tableAlignment",value:(e,t,i)=>{if("figure"==e.name&&!e.hasClass("table"))return;const l=c(o,"",i);let n=e.getStyle("float");if("none"===n&&(n="center"),n!==l)return n;t.consumable.consume(e,{styles:"float"})}}}).attributeToAttribute({view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},model:{key:"tableAlignment",value:(e,t,i)=>{if("figure"==e.name&&!e.hasClass("table"))return;const l="center";if(l!==c(o,"",i))return l;t.consumable.consume(e,{styles:["margin-left","margin-right"]})}}}).attributeToAttribute({view:{name:"table",attributes:{align:i}},model:{key:"tableAlignment",value:(e,t,i)=>{const l=c(o,"",i),n=e.getAttribute("align");if(n!==l)return n;t.consumable.consume(e,{attributes:"align"})}}})}(t,o,i.alignment),e.commands.add("tableAlignment",new Ci(e,i.alignment)),Ai(t,o,{modelAttribute:"tableWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:i.width}),e.commands.add("tableWidth",new ki(e,i.width)),Ai(t,o,{modelAttribute:"tableHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:i.height}),e.commands.add("tableHeight",new _i(e,i.height)),e.data.addStyleProcessorRules(Pt.addBackgroundStylesRules),function(e,t,o){const{modelAttribute:i}=o;e.extend("table",{allowAttributes:[i]}),e.setAttributeProperties(i,{isFormatting:!0}),n(t,{viewElement:"table",...o}),s(t,o)}(t,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:i.backgroundColor}),e.commands.add("tableBackgroundColor",new gi(e,i.backgroundColor)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")){const t=e.editing.view.document;this.listenTo(t,"clipboardOutput",(t,o)=>{e.editing.view.change(e=>{for(const{item:t}of e.createRangeIn(o.content))vi(t,e);o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content))})},{priority:"lowest"})}}}function vi(e,t){if(!e.is("element","table"))return;const o=e.getAttribute("align"),i=e.getStyle("float"),l=e.getStyle("margin-left"),n=e.getStyle("margin-right");o&&"center"===o||i&&"right"===i&&o&&"right"===o?Ti(t,o,e):void 0===i&&"auto"===l&&"0"===n&&Ti(t,"right",e)}function Ti(e,t,o){const i=e.createPositionBefore(o),l=e.createContainerElement("div",{align:t},o);e.insert(i,l)}function Ai(e,t,o){const{modelAttribute:i}=o;e.extend("table",{allowAttributes:[i]}),e.setAttributeProperties(i,{isFormatting:!0}),n(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name||"figure"==e.name&&!e.hasClass("table")),...o}),a(t,{modelElement:"table",...o})}var xi=o(664),Vi={attributes:{"data-cke":!0}};Vi.setAttributes=rt(),Vi.insert=lt().bind(null,"head"),Vi.domAPI=ot(),Vi.insertStyleElement=st();et()(xi.A,Vi);xi.A&&xi.A.locals&&xi.A.locals;class Si extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new mt.FormHeaderView(e,{label:this.t("Table properties")})),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new mt.FormRowView(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=oo({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Gt(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,Qt(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",Pi),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",Pi),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{Pi(i)||(this.borderColor="",this.borderWidth=""),Pi(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=oo({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Alignment");const i=new mt.ToolbarView(e);return i.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),eo({view:this,icons:{left:ht.IconObjectInlineLeft,center:ht.IconObjectCenter,right:ht.IconObjectInlineRight},toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),icon:ht.IconCheck,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),icon:ht.IconCancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left"),i=t("Center table"),l=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:l,center:i,left:o}:{left:o,center:i,right:l}}}function Pi(e){return"none"!==e}const Ii={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Ri extends e.Plugin{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor;this._defaultContentTableProperties=U(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=j(),this._balloon=e.plugins.get(mt.ContextualBalloon),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,t=e.t,o=new mt.ButtonView(e.locale);o.set({label:t("Table properties"),icon:ht.IconTableProperties,tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const i=Object.values(Ii).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),o}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new Si(t.locale,{borderColors:l,backgroundColors:r,defaultTableProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:Zt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Xt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableHeight",errorText:u,validator:Yt})),s.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(Ii).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[i]||"":this._defaultLayoutTableProperties[i]||"";return[i,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ko(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;Dt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}class Ei extends e.Plugin{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[yi,Ri]}}function Bi(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;for(const t of o){if("insert"!=t.type)continue;const o=t.position.parent;if(o.is("element","table")||"table"==t.name){const l="table"==t.name?t.position.nodeAfter:o,n=Array.from(l.getChildren()).filter(e=>e.is("element","caption")),r=n.shift();if(!r)continue;for(const t of n)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),l,"end"),i=!0),i=!!n.length||i}}return i}(t,e))}function Li(e){return!!e&&e.is("element","table")}function Fi(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function Wi(e){const t=y(e);return t?Fi(t):null}function Di(e){const t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class Ni extends e.Command{refresh(){const e=this.editor,t=y(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,"caption"),this.isEnabled?this.value=!!Fi(t):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)})}_showTableCaption(e,t){const o=this.editor.model,i=y(o.document.selection),l=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(i)||e.createElement("caption");o.insertContent(l,i,"end"),t&&e.setSelection(l,"in")}_hideTableCaption(e){const t=this.editor.model,o=y(t.document.selection),i=this.editor.plugins.get("TableCaptionEditing"),l=Fi(o);i._saveCaption(o,l),t.deleteContent(e.createSelection(l,"on"))}}class zi extends e.Plugin{_savedCaptionsMap=new WeakMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.model.schema,i=e.editing.view,l=e.t,n=e.config.get("table.tableCaption.useCaptionElement");if(o.isRegistered("caption")?o.extend("caption",{allowIn:"table"}):o.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new Ni(this.editor)),n){e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","caption"),positionOffset:"end"})}e.conversion.for("upcast").elementToElement({view:Di,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>Li(e.parent)?t.createContainerElement(n?"caption":"figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:o})=>{if(!Li(e.parent))return null;const r=o.createEditableElement(n?"caption":"figcaption");return o.setCustomProperty("tableCaption",!0,r),r.placeholder=l("Enter table caption"),(0,Pt.enableViewPlaceholder)({view:i,element:r,keepOnFocus:!0}),(0,t.toWidgetEditable)(r,o)}}),Bi(e.model)}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Pt.ModelElement.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class Oi extends e.Plugin{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,o=e.t;e.ui.componentFactory.add("toggleTableCaption",i=>{const l=e.commands.get("toggleTableCaption"),n=new mt.ButtonView(i);return n.set({icon:ht.IconCaption,tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(l,"value","isEnabled"),n.bind("label").to(l,"value",e=>o(e?"Toggle caption off":"Toggle caption on")),this.listenTo(n,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),l.value){const o=Wi(e.model.document.selection),i=e.editing.mapper.toViewElement(o);if(!i)return;t.scrollToTheSelection(),t.change(e=>{e.addClass("table__caption_highlighted",i)})}e.editing.view.focus()}),n})}}var Mi=o(965),Hi={attributes:{"data-cke":!0}};Hi.setAttributes=rt(),Hi.insert=lt().bind(null,"head"),Hi.domAPI=ot(),Hi.insertStyleElement=st();et()(Mi.A,Hi);Mi.A&&Mi.A.locals&&Mi.A.locals;class ji extends e.Plugin{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[zi,Oi]}}function Ui(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function $i(e,t){const o=new l.Collection,i=Ui(e.t);for(const l in i){const n={type:"button",model:new mt.UIModel({_borderStyleValue:l,label:i[l],role:"menuitemradio",withText:!0})};"none"===l?n.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===l):n.model.bind("isOn").to(e,"borderStyle",e=>e===l),o.add(n)}return o}function Ki(e){const{view:t,icons:o,toolbar:i,labels:l,propertyName:n,nameToValue:r,defaultValue:a}=e;for(const e in l){const s=new mt.ButtonView(t.locale);s.set({role:"radio",isToggleable:!0,label:l[e],icon:o[e],tooltip:l[e]});const c=r?r(e):e;s.bind("isOn").to(t,n,e=>{let t=e;return""===e&&a&&(t=a),c===t}),s.on("execute",()=>{!a&&c&&t[n]===c?t[n]=void 0:t[n]=c}),i.items.add(s)}}function Gi(e){return(t,o,i)=>{const l=new Ut(t.locale,{colorDefinitions:(n=e.colorConfig,n.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var n;return l.inputView.set({id:o,ariaDescribedById:i}),l.bind("isReadOnly").to(t,"isEnabled",e=>!e),l.bind("hasError").to(t,"errorText",e=>!!e),l.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(l),l}}var qi=o(562),Ji={attributes:{"data-cke":!0}};Ji.setAttributes=rt(),Ji.insert=lt().bind(null,"head"),Ji.domAPI=ot(),Ji.insertStyleElement=st();et()(qi.A,Ji);qi.A&&qi.A.locals&&qi.A.locals;var Xi=o(794),Yi={attributes:{"data-cke":!0}};Yi.setAttributes=rt(),Yi.insert=lt().bind(null,"head"),Yi.domAPI=ot(),Yi.insertStyleElement=st();et()(Xi.A,Yi);Xi.A&&Xi.A.locals&&Xi.A.locals;var Zi=o(993),Qi={attributes:{"data-cke":!0}};Qi.setAttributes=rt(),Qi.insert=lt().bind(null,"head"),Qi.domAPI=ot(),Qi.insertStyleElement=st();et()(Zi.A,Qi);Zi.A&&Zi.A.locals&&Zi.A.locals;class el extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this.backButtonView=this._createBackButton(),this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const f=new mt.FormHeaderView(e,{label:this.t("Table properties")});f.children.add(this.backButtonView,0),this.children.add(f),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,i,n],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})]})),this.children.add(new mt.FormRowView(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})),this.children.add(new mt.FormRowView(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form","ck-table-properties-form_experimental"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderWidthInput,this.borderColorInput,this.widthInput,this.heightInput,this.backgroundInput,this.alignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Gi({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Ui(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,$i(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",tl),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",tl),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{tl(i)||(this.borderColor="",this.borderWidth=""),tl(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=Gi({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Table Alignment");const i=new mt.ToolbarView(e);return i.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Ki({view:this,icons:{left:ht.IconObjectInlineLeft,center:ht.IconObjectCenter,right:ht.IconObjectInlineRight,blockLeft:ht.IconObjectLeft,blockRight:ht.IconObjectRight},toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}_createBackButton(){const e=this.locale.t,t=new mt.ButtonView(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ht.IconPreviousArrow,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left with no text wrapping"),i=t("Align table to the right with no text wrapping"),l=t("Align table to the left with text wrapping"),n=t("Center table with no text wrapping"),r=t("Align table to the right with text wrapping");return"rtl"===e.uiLanguageDirection?{right:r,left:l,blockRight:i,center:n,blockLeft:o}:{blockLeft:o,center:n,blockRight:i,left:l,right:r}}}function tl(e){return"none"!==e}const ol={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class il extends e.Plugin{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TablePropertiesUIExperimental"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor;this._defaultContentTableProperties=U(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=j(),this._balloon=e.plugins.get(mt.ContextualBalloon),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){const e=this.editor,t=e.t,o=new mt.ButtonView(e.locale);o.set({label:t("Table properties"),icon:ht.IconTableProperties,tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const i=Object.values(ol).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),o}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new el(t.locale,{borderColors:l,backgroundColors:r,defaultTableProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:Zt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Xt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableHeight",errorText:u,validator:Yt})),s.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(ol).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[i]||"":this._defaultLayoutTableProperties[i]||"";return[i,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ko(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;Dt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}class ll extends mt.View{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:d,heightInput:u,dimensionsLabel:b}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=s,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=u,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this.backButtonView=this._createBackButton(),this._focusables=new mt.ViewCollection,this._focusCycler=new mt.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const w=new mt.FormHeaderView(e,{label:this.t("Cell properties")});w.children.add(this.backButtonView,0),this.children.add(w),this.children.add(new mt.FormRowView(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new mt.FormRowView(e,{labelView:a,children:[a,s],class:"ck-table-form__background-row"})),this.children.add(new mt.FormRowView(e,{children:[new mt.FormRowView(e,{labelView:b,children:[b,c,d,u],class:"ck-table-form__dimensions-row"}),new mt.FormRowView(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new mt.FormRowView(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new mt.FormRowView(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,mt.submitHandler)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},o=Gi({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,l=this.t,n=l("Style"),r=new mt.LabelView(i);r.text=l("Border");const a=Ui(l),s=new mt.LabeledFieldView(i,mt.createLabeledDropdown);s.set({label:n,class:"ck-table-form__border-style"}),s.fieldView.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),s.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),s.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),s.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,mt.addListToDropdown)(s.fieldView,$i(this,t.style),{role:"menu",ariaLabel:n});const c=new mt.LabeledFieldView(i,mt.createLabeledInputText);c.set({label:l("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",nl),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});const d=new mt.LabeledFieldView(i,o);return d.set({label:l("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",nl),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(e,o,i,l)=>{nl(i)||(this.borderColor="",this.borderWidth=""),nl(l)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:s,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Background");const i=Gi({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),l=new mt.LabeledFieldView(e,i);return l.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),l.fieldView.bind("value").to(this,"backgroundColor"),l.fieldView.on("input",()=>{this.backgroundColor=l.fieldView.value}),{backgroundRowLabel:o,backgroundInput:l}}_createDimensionFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e);o.text=t("Dimensions");const i=new mt.LabeledFieldView(e,mt.createLabeledInputText);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const l=new mt.View(e);l.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const n=new mt.LabeledFieldView(e,mt.createLabeledInputText);return n.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),n.fieldView.bind("value").to(this,"height"),n.fieldView.on("input",()=>{this.height=n.fieldView.element.value}),{dimensionsLabel:o,widthInput:i,operatorLabel:l,heightInput:n}}_createPaddingField(){const e=this.locale,t=this.t,o=new mt.LabeledFieldView(e,mt.createLabeledInputText);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",()=>{this.padding=o.fieldView.element.value}),o}_createAlignmentFields(){const e=this.locale,t=this.t,o=new mt.LabelView(e),i={left:ht.IconAlignLeft,center:ht.IconAlignCenter,right:ht.IconAlignRight,justify:ht.IconAlignJustify,top:ht.IconAlignTop,middle:ht.IconAlignMiddle,bottom:ht.IconAlignBottom};o.text=t("Table cell text alignment");const l=new mt.ToolbarView(e),n="rtl"===e.contentLanguageDirection;l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),Ki({view:this,icons:i,toolbar:l,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(n){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new mt.ToolbarView(e);return r.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),Ki({view:this,icons:i,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:l,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const e=this.locale,t=this.t,o=new mt.ButtonView(e),i=new mt.ButtonView(e),l=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:!0}),o.bind("isEnabled").toMany(l,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}_createBackButton(){const e=this.locale.t,t=new mt.ButtonView(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ht.IconPreviousArrow,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),i=t("Align cell text to the center"),l=t("Align cell text to the right"),n=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:l,center:i,left:o,justify:n}:{left:o,center:i,right:l,justify:n}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function nl(e){return"none"!==e}const rl={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class al extends e.Plugin{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[mt.ContextualBalloon]}static get pluginName(){return"TableCellPropertiesUIExperimental"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:to,backgroundColors:to})}init(){const e=this.editor,t=e.t;this._defaultContentTableCellProperties=$(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._defaultLayoutTableCellProperties=j(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(mt.ContextualBalloon),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",o=>{const i=new mt.ButtonView(o);i.set({label:t("Cell properties"),icon:ht.IconTableCellProperties,tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());const l=Object.values(rl).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){const t=this.editor,o=t.config.get("table.tableCellProperties"),i=(0,mt.normalizeColorOptions)(o.borderColors),l=(0,mt.getLocalizedColorOptions)(t.locale,i),n=(0,mt.normalizeColorOptions)(o.backgroundColors),r=(0,mt.getLocalizedColorOptions)(t.locale,n),a=!1!==o.colorPicker,s=new ll(t.locale,{borderColors:l,backgroundColors:r,defaultTableCellProperties:e,colorPickerConfig:!!a&&(o.colorPicker||{})}),c=t.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,mt.clickOutsideHandler)({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=qt(c),u=Jt(c);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Xt})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:Zt})),s.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:s.paddingInput,commandName:"tableCellPadding",errorText:u,validator:Yt})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableCellWidth",errorText:u,validator:Yt})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableCellHeight",errorText:u,validator:Yt})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:Xt})),s.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),s.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(rl).map(([t,o])=>{const i=t,l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[i]||"":this._defaultLayoutTableCellProperties[i]||"";return[t,e.get(o).value||l]}).forEach(([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)}),this._isReady=!0}_showView(){const e=this.editor,t=Dt(e.editing.view.document.selection),o=t&&e.editing.mapper.toModelElement(t),i=!o||"layout"!==o.getAttribute("tableType");i&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):i||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=i?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:_o(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;zt(e.editing.view.document.selection)?this._isViewVisible&&wo(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:i,errorText:l}=e,n=po(()=>{o.errorText=l},500);return(e,l,r)=>{n.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),o.errorText=null):n())}}}})(),(window.CKEditor5=window.CKEditor5||{}).table=i})();