UNPKG

157 kBJavaScriptView Raw
1!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment",Background:"Background",Border:"Border","Cell properties":"Cell properties","Center table":"Center table",Color:"Color","Color picker":"Color picker",Column:"Column",Dashed:"Dashed","Delete column":"Delete column","Delete row":"Delete row",Dimensions:"Dimensions",Dotted:"Dotted",Double:"Double","Enter table caption":"Enter table caption",Groove:"Groove","Header column":"Header column","Header row":"Header row",Height:"Height","Horizontal text alignment toolbar":"Horizontal text alignment toolbar","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Inset:"Inset","Justify cell text":"Justify cell text","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",None:"None",Outset:"Outset",Padding:"Padding",Ridge:"Ridge",Row:"Row","Select column":"Select column","Select row":"Select row",Solid:"Solid","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Style:"Style","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".','The value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"Toggle caption off":"Toggle caption off","Toggle caption on":"Toggle caption on","Vertical text alignment toolbar":"Vertical text alignment toolbar",Width:"Width"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
2/*!
3 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
4 * For licensing, see LICENSE.md.
5 */(()=>{var e={252:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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-radius:0}.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{border:1px solid var(--ck-color-input-border);height:20px;width:20px}.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 r=i},934:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.push([e.id,".ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form:focus{outline:none}.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%}",""]);const r=i},333:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.push([e.id,".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.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{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}[dir=ltr] .ck.ck-form__row>:not(.ck-label)+*{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-form__row>:not(.ck-label)+*{margin-right: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 r=i},272:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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}.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 r=i},660:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.push([e.id,".ck-content .table{display:table;margin:.9em auto}.ck-content .table table{border:1px double #b3b3b3;border-collapse:collapse;border-spacing:0;height:100%;width:100%}.ck-content .table table td,.ck-content .table table th{border:1px solid #bfbfbf;min-width:2em;padding:.4em}.ck-content .table table th{background:rgba(0,0,0,.05);font-weight:700}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}.ck-editor__editable .ck-table-bogus-paragraph{display:inline-block;width:100%}",""]);const r=i},665:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.push([e.id,":root{--ck-color-table-caption-background:#f7f7f7;--ck-color-table-caption-text:#333;--ck-color-table-caption-highlighted-background:#fd0}.ck-content .table>figcaption{background-color:var(--ck-color-table-caption-background);caption-side:top;color:var(--ck-color-table-caption-text);display:table-caption;font-size:.75em;outline-offset:-1px;padding:.6em;text-align:center;word-break:break-word}.ck.ck-editor__editable .table>figcaption.table__caption_highlighted{animation:ck-table-caption-highlight .6s ease-out}.ck.ck-editor__editable .table>figcaption.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-color-table-caption-background)}}",""]);const r=i},773:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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 r=i},975:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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 table{overflow:hidden}.ck-content .table td,.ck-content .table th{position:relative}.ck.ck-editor__editable .table .ck-table-column-resizer{bottom:-999999px;cursor:col-resize;position:absolute;right:var(--ck-table-column-resizer-position-offset);top:-999999px;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 r=i},482:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.push([e.id,":root{--ck-color-table-focused-cell-background:rgba(158,201,250,.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}",""]);const r=i},686:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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.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{border-radius:0}.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{background:var(--ck-color-base-error);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.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)}.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}.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 r=i},99:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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 r=i},475:(e,t,o)=>{"use strict";o.d(t,{Z:()=>r});var n=o(609),i=o.n(n)()((function(e){return e[1]}));i.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;outline:unset;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 r=i},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o=e(t);return t[2]?"@media ".concat(t[2]," {").concat(o,"}"):o})).join("")},t.i=function(e,o,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var r=0;r<this.length;r++){var l=this[r][0];null!=l&&(i[l]=!0)}for(var s=0;s<e.length;s++){var a=[].concat(e[s]);n&&i[a[0]]||(o&&(a[2]?a[2]="".concat(o," and ").concat(a[2]):a[2]=o),t.push(a))}},t}},62:(e,t,o)=>{"use strict";var n,i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),l=[];function s(e){for(var t=-1,o=0;o<l.length;o++)if(l[o].identifier===e){t=o;break}return t}function a(e,t){for(var o={},n=[],i=0;i<e.length;i++){var r=e[i],a=t.base?r[0]+t.base:r[0],c=o[a]||0,d="".concat(a," ").concat(c);o[a]=c+1;var u=s(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(l[u].references++,l[u].updater(h)):l.push({identifier:d,updater:p(h,t),references:1}),n.push(d)}return n}function c(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var i=o.nc;i&&(n.nonce=i)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var l=r(e.insert||"head");if(!l)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");l.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,o,n){var i=o?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var r=document.createTextNode(i),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(r,l[t]):e.appendChild(r)}}function b(e,t,o){var n=o.css,i=o.media,r=o.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var m=null,g=0;function p(e,t){var o,n,i;if(t.singleton){var r=g++;o=m||(m=c(t)),n=h.bind(null,o,r,!1),i=h.bind(null,o,r,!0)}else o=c(t),n=b.bind(null,o,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(o)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var o=a(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<o.length;n++){var i=s(o[n]);l[i].references--}for(var r=a(e,t),c=0;c<o.length;c++){var d=s(o[c]);0===l[d].references&&(l[d].updater(),l.splice(d,1))}o=r}}}},704:(e,t,o)=>{e.exports=o(79)("./src/core.js")},492:(e,t,o)=>{e.exports=o(79)("./src/engine.js")},273:(e,t,o)=>{e.exports=o(79)("./src/ui.js")},209:(e,t,o)=>{e.exports=o(79)("./src/utils.js")},995:(e,t,o)=>{e.exports=o(79)("./src/widget.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={id:n,exports:{}};return e[n](r,r.exports,o),r.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 n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},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})},o.nc=void 0;var n={};(()=>{"use strict";o.r(n),o.d(n,{PlainTableOutput:()=>Ue,Table:()=>Me,TableCaption:()=>mn,TableCaptionEditing:()=>dn,TableCaptionUI:()=>un,TableCellProperties:()=>Io,TableCellPropertiesEditing:()=>Ro,TableCellPropertiesUI:()=>go,TableCellWidthEditing:()=>wo,TableClipboard:()=>Pe,TableColumnResize:()=>il,TableColumnResizeEditing:()=>tl,TableEditing:()=>ke,TableKeyboard:()=>Le,TableMouse:()=>We,TableProperties:()=>on,TablePropertiesEditing:()=>Ko,TablePropertiesUI:()=>tn,TableSelection:()=>Ee,TableToolbar:()=>qe,TableUI:()=>Se,TableUtils:()=>J});var e=o(704),t=o(995);function i(e,t){const{modelAttribute:o,styleName:n,viewElement:i,defaultValue:r,reduceBoxSides:l=!1,shouldUpcast:s=(()=>!0)}=t;e.for("upcast").attributeToAttribute({view:{name:i,styles:{[n]:/[\s\S]+/}},model:{key:o,value:e=>{if(!s(e))return;const t=e.getNormalizedStyle(n),o=l?a(t):t;return r!==o?o:void 0}}})}function r(e,t,o,n){e.for("upcast").add((e=>e.on("element:"+t,((e,t,i)=>{if(!t.modelRange)return;const r=["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(!r.length)return;const l={styles:r};if(!i.consumable.test(t.viewItem,l))return;const s=[...t.modelRange.getItems({shallow:!0})].pop();i.consumable.consume(t.viewItem,l);const c={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},d={style:a(c.style),color:a(c.color),width:a(c.width)};d.style!==n.style&&i.writer.setAttribute(o.style,d.style,s),d.color!==n.color&&i.writer.setAttribute(o.color,d.color,s),d.width!==n.width&&i.writer.setAttribute(o.width,d.width,s)}))))}function l(e,t){const{modelElement:o,modelAttribute:n,styleName:i}=t;e.for("downcast").attributeToAttribute({model:{name:o,key:n},view:e=>({key:"style",value:{[i]:e}})})}function s(e,t){const{modelAttribute:o,styleName:n}=t;e.for("downcast").add((e=>e.on(`attribute:${o}:table`,((e,t,o)=>{const{item:i,attributeNewValue:r}=t,{mapper:l,writer:s}=o;if(!o.consumable.consume(t.item,e.name))return;const a=[...l.toViewElement(i).getChildren()].find((e=>e.is("element","table")));r?s.setStyle(n,r,a):s.removeStyle(n,a)}))))}function a(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}var c=Object.defineProperty,d=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,b=(e,t,o)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,m=(e,t)=>{for(var o in t||(t={}))u.call(t,o)&&b(e,o,t[o]);if(d)for(var o of d(t))h.call(t,o)&&b(e,o,t[o]);return e};function g(e,t,o,n,i=1){null!=t&&null!=i&&t>i?n.setAttribute(e,t,o):n.removeAttribute(e,o)}function p(e,t,o={}){const n=e.createElement("tableCell",o);return e.insertElement("paragraph",n),e.insert(n,t),n}function f(e,t){const o=t.parent.parent,n=parseInt(o.getAttribute("headingColumns")||"0"),{column:i}=e.getCellLocation(t);return!!n&&i<n}function w(e,t,o){const{modelAttribute:n}=o;e.extend("tableCell",{allowAttributes:[n]}),i(t,m({viewElement:/^(td|th)$/},o)),l(t,m({modelElement:"tableCell"},o))}var _=o(209);function v(){return e=>{e.on("element:table",((e,t,o)=>{const n=t.viewItem;if(!o.consumable.test(n,{name:!0}))return;const{rows:i,headingRows:r,headingColumns:l}=function(e){let t,o=0;const n=[],i=[];let r;for(const l of Array.from(e.getChildren())){if("tbody"!==l.name&&"thead"!==l.name&&"tfoot"!==l.name)continue;"thead"!==l.name||r||(r=l);const e=Array.from(l.getChildren()).filter((e=>e.is("element","tr")));for(const s of e)if(r&&l===r||"tbody"===l.name&&Array.from(s.getChildren()).length&&Array.from(s.getChildren()).every((e=>e.is("element","th"))))o++,n.push(s);else{i.push(s);const e=C(s);(!t||e<t)&&(t=e)}}return{headingRows:o,headingColumns:t||0,rows:[...n,...i]}}(n),s={};l&&(s.headingColumns=l),r&&(s.headingRows=r);const a=o.writer.createElement("table",s);if(o.safeInsert(a,t.modelCursor)){if(o.consumable.consume(n,{name:!0}),i.forEach((e=>o.convertItem(e,o.writer.createPositionAt(a,"end")))),o.convertChildren(n,o.writer.createPositionAt(a,"end")),a.isEmpty){const e=o.writer.createElement("tableRow");o.writer.insert(e,o.writer.createPositionAt(a,"end")),p(o.writer,o.writer.createPositionAt(e,"end"))}o.updateConversionResult(a,t)}}))}}function k(e){return t=>{t.on(`element:${e}`,((e,t,{writer:o})=>{if(!t.modelRange)return;const n=t.modelRange.start.nodeAfter,i=o.createPositionAt(n,0);if(t.viewItem.isEmpty)return void o.insertElement("paragraph",i);const r=Array.from(n.getChildren());if(r.every((e=>e.is("element","$marker")))){const e=o.createElement("paragraph");o.insert(e,o.createPositionAt(n,0));for(const t of r)o.move(o.createRangeOn(t),o.createPositionAt(e,"end"))}}),{priority:"low"})}}function C(e){let t=0,o=0;const n=Array.from(e.getChildren()).filter((e=>"th"===e.name||"td"===e.name));for(;o<n.length&&"th"===n[o].name;){const e=n[o];t+=parseInt(e.getAttribute("colspan")||"1"),o++}return t}class y{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(){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 n=parseInt(o.getAttribute("colspan")||"1"),i=parseInt(o.getAttribute("rowspan")||"1");(n>1||i>1)&&this._recordSpans(o,i,n),this._shouldSkipSlot()||(t=this._formatOutValue(o)),this._nextCellAtColumn=this._column+n}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,n=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||o||n}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){const n={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,n)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,o)}}class T{constructor(e,t,o,n){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=n,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,o){return(n,{writer:i})=>{const r=n.getAttribute("headingRows")||0,l=i.createContainerElement("table",null,[]),s=i.createContainerElement("figure",{class:"table"},l);r>0&&i.insert(i.createPositionAt(l,"end"),i.createContainerElement("thead",null,i.createSlot((e=>e.is("element","tableRow")&&e.index<r)))),r<e.getRows(n)&&i.insert(i.createPositionAt(l,"end"),i.createContainerElement("tbody",null,i.createSlot((e=>e.is("element","tableRow")&&e.index>=r))));for(const{positionOffset:e,filter:t}of o.additionalSlots)i.insert(i.createPositionAt(l,e),i.createSlot(t));return i.insert(i.createPositionAt(l,"after"),i.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})}(s,i):s}}function x(e={}){return(o,{writer:n})=>{const i=o.parent,r=i.parent,l=r.getChildIndex(i),s=new y(r,{row:l}),a=r.getAttribute("headingRows")||0,c=r.getAttribute("headingColumns")||0;let d=null;for(const i of s)if(i.cell==o){const o=i.row<a||i.column<c?"th":"td";d=e.asWidget?(0,t.toWidgetEditable)(n.createEditableElement(o),n):n.createContainerElement(o);break}return d}}function S(e={}){return(t,{writer:o})=>{if(!t.parent.is("element","tableCell"))return null;if(!V(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 V(e){return 1==e.parent.childCount&&!!e.getAttributeKeys().next().done}class R 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,n=o===o.root?o:o.parent;return t.checkChild(n,"table")}(t,o)}execute(e={}){const t=this.editor,o=t.model,n=t.plugins.get("TableUtils"),i=t.config.get("table.defaultHeadings.rows"),r=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&i&&(e.headingRows=i),void 0===e.headingColumns&&r&&(e.headingColumns=r),o.change((t=>{const i=n.createTable(t,e);o.insertObject(i,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(i.getNodeByPath([0,0,0]),0))}))}}class I extends e.Command{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"),n="above"===this.order,i=o.getSelectionAffectedTableCells(t),r=o.getRowIndexes(i),l=n?r.first:r.last,s=i[0].findAncestor("table");o.insertRows(s,{at:n?l:l+1,copyStructureFromAbove:!n})}}class E extends e.Command{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"),n="left"===this.order,i=o.getSelectionAffectedTableCells(t),r=o.getColumnIndexes(i),l=n?r.first:r.last,s=i[0].findAncestor("table");o.insertColumns(s,{columns:1,at:n?l:l+1})}}class P extends e.Command{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)}}function z(e,t,o){const{startRow:n,startColumn:i,endRow:r,endColumn:l}=t,s=o.createElement("table"),a=r-n+1;for(let e=0;e<a;e++)o.insertElement("tableRow",s,"end");const c=[...new y(e,{startRow:n,endRow:r,startColumn:i,endColumn:l,includeAllSlots:!0})];for(const{row:e,column:t,cell:a,isAnchor:d,cellAnchorRow:u,cellAnchorColumn:h}of c){const c=e-n,b=s.getChild(c);if(d){const n=o.cloneElement(a);o.append(n,b),F(n,e,t,r,l,o)}else(u<n||h<i)&&p(o,o.createPositionAt(b,"end"))}return function(e,t,o,n,i){const r=parseInt(t.getAttribute("headingRows")||"0");if(r>0){g("headingRows",r-o,e,i,0)}const l=parseInt(t.getAttribute("headingColumns")||"0");if(l>0){g("headingColumns",l-n,e,i,0)}}(s,e,n,i,o),s}function B(e,t,o=0){const n=[],i=new y(e,{startRow:o,endRow:t-1});for(const e of i){const{row:o,cellHeight:i}=e;o<t&&t<=o+i-1&&n.push(e)}return n}function O(e,t,o){const n=e.parent,i=n.parent,r=n.index,l=t-r,s={},a=parseInt(e.getAttribute("rowspan"))-l;a>1&&(s.rowspan=a);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(s.colspan=c);const d=r+l,u=[...new y(i,{startRow:r,endRow:d,includeAllSlots:!0})];let h,b=null;for(const t of u){const{row:n,column:i,cell:r}=t;r===e&&void 0===h&&(h=i),void 0!==h&&h===i&&n===d&&(b=p(o,t.getPositionBefore(),s))}return g("rowspan",l,e,o),b}function L(e,t){const o=[],n=new y(e);for(const e of n){const{column:n,cellWidth:i}=e;n<t&&t<=n+i-1&&o.push(e)}return o}function j(e,t,o,n){const i=o-t,r={},l=parseInt(e.getAttribute("colspan"))-i;l>1&&(r.colspan=l);const s=parseInt(e.getAttribute("rowspan")||"1");s>1&&(r.rowspan=s);const a=p(n,n.createPositionAfter(e),r);return g("colspan",i,e,n),a}function F(e,t,o,n,i,r){const l=parseInt(e.getAttribute("colspan")||"1"),s=parseInt(e.getAttribute("rowspan")||"1");if(o+l-1>i){g("colspan",i-o+1,e,r,1)}if(t+s-1>n){g("rowspan",n-t+1,e,r,1)}}function W(e,t){const o=t.getColumns(e),n=new Array(o).fill(0);for(const{column:t}of new y(e))n[t]++;const i=n.reduce(((e,t,o)=>t?e:[...e,o]),[]);if(i.length>0){const o=i[i.length-1];return t.removeColumns(e,{at:o}),!0}return!1}function N(e,t){const o=[],n=t.getRows(e);for(let t=0;t<n;t++){e.getChild(t).isEmpty&&o.push(t)}if(o.length>0){const n=o[o.length-1];return t.removeRows(e,{at:n}),!0}return!1}function D(e,t){W(e,t)||N(e,t)}function H(e,t){const o=Array.from(new y(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(o.every((({cellHeight:e})=>1===e)))return t.lastRow;const n=o[0].cellHeight-1;return t.lastRow+n}function M(e,t){const o=Array.from(new y(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(o.every((({cellWidth:e})=>1===e)))return t.lastColumn;const n=o[0].cellWidth-1;return t.lastColumn+n}class U extends e.Command{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],n=this.value,i=this.direction;e.change((e=>{const t="right"==i||"down"==i,r=t?o:n,l=t?n:o,s=l.parent;!function(e,t,o){$(e)||($(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end")));o.remove(e)}(l,r,e);const a=this.isHorizontal?"colspan":"rowspan",c=parseInt(o.getAttribute(a)||"1"),d=parseInt(n.getAttribute(a)||"1");e.setAttribute(a,c+d,r),e.setSelection(e.createRangeIn(r));const u=this.editor.plugins.get("TableUtils");D(s.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 n=this.isHorizontal?function(e,t,o){const n=e.parent,i=n.parent,r="right"==t?e.nextSibling:e.previousSibling,l=(i.getAttribute("headingColumns")||0)>0;if(!r)return;const s="right"==t?e:r,a="right"==t?r:e,{column:c}=o.getCellLocation(s),{column:d}=o.getCellLocation(a),u=parseInt(s.getAttribute("colspan")||"1"),h=f(o,s),b=f(o,a);if(l&&h!=b)return;return c+u===d?r:void 0}(o,this.direction,t):function(e,t,o){const n=e.parent,i=n.parent,r=i.getChildIndex(n);if("down"==t&&r===o.getRows(i)-1||"up"==t&&0===r)return null;const l=parseInt(e.getAttribute("rowspan")||"1"),s=i.getAttribute("headingRows")||0,a="down"==t&&r+l===s,c="up"==t&&r===s;if(s&&(a||c))return null;const d=parseInt(e.getAttribute("rowspan")||"1"),u="down"==t?r+d:r,h=[...new y(i,{endRow:u})],b=h.find((t=>t.cell===e)),m=b.column,g=h.find((({row:e,cellHeight:o,column:n})=>n===m&&("down"==t?e===u:u===e+o)));return g&&g.cell?g.cell:null}(o,this.direction,t);if(!n)return;const i=this.isHorizontal?"rowspan":"colspan",r=parseInt(o.getAttribute(i)||"1");return parseInt(n.getAttribute(i)||"1")===r?n:void 0}}function $(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class Z 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 n=o.findAncestor("table"),i=e.getRows(n)-1,r=e.getRowIndexes(t),l=0===r.first&&r.last===i;this.isEnabled=!l}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(o),i=o[0],r=i.findAncestor("table"),l=t.getCellLocation(i).column;e.change((e=>{const o=n.last-n.first+1;t.removeRows(r,{at:n.first,rows:o});const i=function(e,t,o,n){const i=e.getChild(Math.min(t,n-1));let r=i.getChild(0),l=0;for(const e of i.getChildren()){if(l>o)return r;r=e,l+=parseInt(e.getAttribute("colspan")||"1")}return r}(r,n.first,l,t.getRows(r));e.setSelection(e.createPositionAt(i,0))}))}}class K 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 n=o.findAncestor("table"),i=e.getColumns(n),{first:r,last:l}=e.getColumnIndexes(t);this.isEnabled=l-r<i-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,o]=function(e,t){const o=t.getSelectionAffectedTableCells(e),n=o[0],i=o.pop(),r=[n,i];return n.isBefore(i)?r:r.reverse()}(this.editor.model.document.selection,e),n=t.parent.parent,i=[...new y(n)],r={first:i.find((e=>e.cell===t)).column,last:i.find((e=>e.cell===o)).column},l=function(e,t,o,n){const i=parseInt(o.getAttribute("colspan")||"1");return i>1?o:t.previousSibling||o.nextSibling?o.nextSibling||t.previousSibling:n.first?e.reverse().find((({column:e})=>e<n.first)).cell:e.reverse().find((({column:e})=>e>n.last)).cell}(i,t,o,r);this.editor.model.change((t=>{const o=r.last-r.first+1;e.removeColumns(n,{at:r.first,columns:o}),t.setSelection(t.createPositionAt(l,0))}))}}class G extends e.Command{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,o=e.getSelectionAffectedTableCells(t.document.selection),n=o.length>0;this.isEnabled=n,this.value=n&&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,n=t.getSelectionAffectedTableCells(o.document.selection),i=n[0].findAncestor("table"),{first:r,last:l}=t.getRowIndexes(n),s=this.value?r:l+1,a=i.getAttribute("headingRows")||0;o.change((e=>{if(s){const t=B(i,s,s>a?a:0);for(const{cell:o}of t)O(o,s,e)}g("headingRows",s,i,e,0)}))}_isInHeading(e,t){const o=parseInt(t.getAttribute("headingRows")||"0");return!!o&&e.parent.index<o}}class q extends e.Command{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),o=t.getSelectionAffectedTableCells(e.document.selection),n=o.length>0;this.isEnabled=n,this.value=n&&o.every((e=>f(t,e)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),o=this.editor.model,n=t.getSelectionAffectedTableCells(o.document.selection),i=n[0].findAncestor("table"),{first:r,last:l}=t.getColumnIndexes(n),s=this.value?r:l+1;o.change((e=>{if(s){const t=L(i,s);for(const{cell:o,column:n}of t)j(o,n,s,e)}g("headingColumns",s,i,e,0)}))}}class J extends e.Plugin{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,o=t.parent,n=o.getChildIndex(t),i=new y(o,{row:n});for(const{cell:t,row:o,column:n}of i)if(t===e)return{row:o,column:n}}createTable(e,t){const o=e.createElement("table"),n=t.rows||2,i=t.columns||2;return X(e,o,0,n,i),t.headingRows&&g("headingRows",Math.min(t.headingRows,n),o,e,0),t.headingColumns&&g("headingColumns",Math.min(t.headingColumns,i),o,e,0),o}insertRows(e,t={}){const o=this.editor.model,n=t.at||0,i=t.rows||1,r=void 0!==t.copyStructureFromAbove,l=t.copyStructureFromAbove?n-1:n,s=this.getRows(e),a=this.getColumns(e);if(n>s)throw new _.CKEditorError("tableutils-insertrows-insert-out-of-range",this,{options:t});o.change((t=>{const o=e.getAttribute("headingRows")||0;if(o>n&&g("headingRows",o+i,e,t,0),!r&&(0===n||n===s))return void X(t,e,n,i,a);const c=r?Math.max(n,l):n,d=new y(e,{endRow:c}),u=new Array(a).fill(1);for(const{row:e,column:o,cellHeight:s,cellWidth:a,cell:c}of d){const d=e+s-1,h=e<=l&&l<=d;e<n&&n<=d?(t.setAttribute("rowspan",s+i,c),u[o]=-a):r&&h&&(u[o]=a)}for(let o=0;o<i;o++){const o=t.createElement("tableRow");t.insert(o,e,n);for(let e=0;e<u.length;e++){const n=u[e],i=t.createPositionAt(o,"end");n>0&&p(t,i,n>1?{colspan:n}:void 0),e+=Math.abs(n)-1}}}))}insertColumns(e,t={}){const o=this.editor.model,n=t.at||0,i=t.columns||1;o.change((t=>{const o=e.getAttribute("headingColumns");n<o&&t.setAttribute("headingColumns",o+i,e);const r=this.getColumns(e);if(0===n||r===n){for(const o of e.getChildren())o.is("element","tableRow")&&Y(i,t,t.createPositionAt(o,n?"end":0));return}const l=new y(e,{column:n,includeAllSlots:!0});for(const e of l){const{row:o,cell:r,cellAnchorColumn:s,cellAnchorRow:a,cellWidth:c,cellHeight:d}=e;if(s<n){t.setAttribute("colspan",c+i,r);const e=a+d-1;for(let t=o;t<=e;t++)l.skipRow(t)}else Y(i,t,e.getPositionBefore())}}))}removeRows(e,t){const o=this.editor.model,n=t.rows||1,i=this.getRows(e),r=t.at,l=r+n-1;if(l>i-1)throw new _.CKEditorError("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});o.change((t=>{const o={first:r,last:l},{cellsToMove:n,cellsToTrim:i}=function(e,{first:t,last:o}){const n=new Map,i=[];for(const{row:r,column:l,cellHeight:s,cell:a}of new y(e,{endRow:o})){const e=r+s-1;if(r>=t&&r<=o&&e>o){const e=s-(o-r+1);n.set(l,{cell:a,rowspan:e})}if(r<t&&e>=t){let n;n=e>=o?o-t+1:e-t+1,i.push({cell:a,rowspan:s-n})}}return{cellsToMove:n,cellsToTrim:i}}(e,o);if(n.size){!function(e,t,o,n){const i=new y(e,{includeAllSlots:!0,row:t}),r=[...i],l=e.getChild(t);let s;for(const{column:e,cell:t,isAnchor:i}of r)if(o.has(e)){const{cell:t,rowspan:i}=o.get(e),r=s?n.createPositionAfter(s):n.createPositionAt(l,0);n.move(n.createRangeOn(t),r),g("rowspan",i,t,n),s=t}else i&&(s=t)}(e,l+1,n,t)}for(let o=l;o>=r;o--)t.remove(e.getChild(o));for(const{rowspan:e,cell:o}of i)g("rowspan",e,o,t);!function(e,{first:t,last:o},n){const i=e.getAttribute("headingRows")||0;if(t<i){g("headingRows",o<i?i-(o-t+1):t,e,n,0)}}(e,o,t),W(e,this)||N(e,this)}))}removeColumns(e,t){const o=this.editor.model,n=t.at,i=t.columns||1,r=t.at+i-1;o.change((t=>{!function(e,t,o){const n=e.getAttribute("headingColumns")||0;if(n&&t.first<n){const i=Math.min(n-1,t.last)-t.first+1;o.setAttribute("headingColumns",n-i,e)}}(e,{first:n,last:r},t);for(let o=r;o>=n;o--)for(const{cell:n,column:i,cellWidth:r}of[...new y(e)])i<=o&&r>1&&i+r>o?g("colspan",r-1,n,t):i===o&&t.remove(n);N(e,this)||W(e,this)}))}splitCellVertically(e,t=2){const o=this.editor.model,n=e.parent.parent,i=parseInt(e.getAttribute("rowspan")||"1"),r=parseInt(e.getAttribute("colspan")||"1");o.change((o=>{if(r>1){const{newCellsSpan:n,updatedSpan:l}=Q(r,t);g("colspan",l,e,o);const s={};n>1&&(s.colspan=n),i>1&&(s.rowspan=i);Y(r>t?t-1:r-1,o,o.createPositionAfter(e),s)}if(r<t){const l=t-r,s=[...new y(n)],{column:a}=s.find((({cell:t})=>t===e)),c=s.filter((({cell:t,cellWidth:o,column:n})=>t!==e&&n===a||n<a&&n+o>a));for(const{cell:e,cellWidth:t}of c)o.setAttribute("colspan",t+l,e);const d={};i>1&&(d.rowspan=i),Y(l,o,o.createPositionAfter(e),d);const u=n.getAttribute("headingColumns")||0;u>a&&g("headingColumns",u+l,n,o)}}))}splitCellHorizontally(e,t=2){const o=this.editor.model,n=e.parent,i=n.parent,r=i.getChildIndex(n),l=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");o.change((o=>{if(l>1){const n=[...new y(i,{startRow:r,endRow:r+l-1,includeAllSlots:!0})],{newCellsSpan:a,updatedSpan:c}=Q(l,t);g("rowspan",c,e,o);const{column:d}=n.find((({cell:t})=>t===e)),u={};a>1&&(u.rowspan=a),s>1&&(u.colspan=s);for(const e of n){const{column:t,row:n}=e;n>=r+c&&t===d&&(n+r+c)%a==0&&Y(1,o,e.getPositionBefore(),u)}}if(l<t){const n=t-l,a=[...new y(i,{startRow:0,endRow:r})];for(const{cell:t,cellHeight:i,row:l}of a)if(t!==e&&l+i>r){const e=i+n;o.setAttribute("rowspan",e,t)}const c={};s>1&&(c.colspan=s),X(o,i,r+1,n,1,c);const d=i.getAttribute("headingRows")||0;d>r&&g("headingRows",d+n,i,o)}}))}getColumns(e){return[...e.getChild(0).getChildren()].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 y(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 y(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 n=0;for(const i of e){const{row:e,column:r}=this.getCellLocation(i),l=parseInt(i.getAttribute("rowspan"))||1,s=parseInt(i.getAttribute("colspan"))||1;t.add(e),o.add(r),l>1&&t.add(e+l-1),s>1&&o.add(r+s-1),n+=l*s}const i=function(e,t){const o=Array.from(e.values()),n=Array.from(t.values()),i=Math.max(...o),r=Math.min(...o),l=Math.max(...n),s=Math.min(...n);return(i-r+1)*(l-s+1)}(t,o);return i==n}sortRanges(e){return Array.from(e).sort(ee)}_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),n=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(o,n))return!1;const i=this.getColumnIndexes(e),r=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(i,r)}_areIndexesInSameSection({first:e,last:t},o){return e<o===t<o}}function X(e,t,o,n,i,r={}){for(let l=0;l<n;l++){const n=e.createElement("tableRow");e.insert(n,t,o),Y(i,e,e.createPositionAt(n,"end"),r)}}function Y(e,t,o,n={}){for(let i=0;i<e;i++)p(t,o,n)}function Q(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 ee(e,t){const o=e.start,n=t.start;return o.isBefore(n)?-1:1}class te extends e.Command{refresh(){const e=this.editor.plugins.get(J),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(J);e.change((o=>{const n=t.getSelectedTableCells(e.document.selection),i=n.shift(),{mergeWidth:r,mergeHeight:l}=function(e,t,o){let n=0,i=0;for(const e of t){const{row:t,column:r}=o.getCellLocation(e);n=ie(e,r,n,"colspan"),i=ie(e,t,i,"rowspan")}const{row:r,column:l}=o.getCellLocation(e),s=n-l,a=i-r;return{mergeWidth:s,mergeHeight:a}}(i,n,t);g("colspan",r,i,o),g("rowspan",l,i,o);for(const e of n)oe(e,i,o);D(i.findAncestor("table"),t),o.setSelection(i,"in")}))}}function oe(e,t,o){ne(e)||(ne(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end"))),o.remove(e)}function ne(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function ie(e,t,o,n){const i=parseInt(e.getAttribute(n)||"1");return Math.max(o,t+i)}class re 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),n=t.getRowIndexes(o),i=o[0].findAncestor("table"),r=[];for(let t=n.first;t<=n.last;t++)for(const o of i.getChild(t).getChildren())r.push(e.createRangeOn(o));e.change((e=>{e.setSelection(r)}))}}class le 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),n=o[0],i=o.pop(),r=n.findAncestor("table"),l=e.getCellLocation(n),s=e.getCellLocation(i),a=Math.min(l.column,s.column),c=Math.max(l.column,s.column),d=[];for(const e of new y(r,{startColumn:a,endColumn:c}))d.push(t.createRangeOn(e.cell));t.change((e=>{e.setSelection(d)}))}}function se(e){e.document.registerPostFixer((t=>function(e,t){const o=t.document.differ.getChanges();let n=!1;const i=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")),de(t)&&(o=t.range.start.findAncestor("table")),o&&!i.has(o)&&(n=ae(o,e)||n,n=ce(o,e)||n,i.add(o))}return n}(t,e)))}function ae(e,t){let o=!1;const n=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),n=[];for(const{row:i,cell:r,cellHeight:l}of new y(e)){if(l<2)continue;const e=i<t?t:o;if(i+l>e){const t=e-i;n.push({cell:r,rowspan:t})}}return n}(e);if(n.length){o=!0;for(const e of n)g("rowspan",e.rowspan,e.cell,t,1)}return o}function ce(e,t){let o=!1;const n=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:o}of new y(e,{includeAllSlots:!0}))t[o]++;return t}(e),i=[];for(const[t,o]of n.entries())!o&&e.getChild(t).is("element","tableRow")&&i.push(t);if(i.length){o=!0;for(const o of i.reverse())t.remove(e.getChild(o)),n.splice(o,1)}const r=n.filter(((t,o)=>e.getChild(o).is("element","tableRow"))),l=r[0];if(!r.every((e=>e===l))){const n=r.reduce(((e,t)=>t>e?t:e),0);for(const[i,l]of r.entries()){const r=n-l;if(r){for(let o=0;o<r;o++)p(t,t.createPositionAt(e.getChild(i),"end"));o=!0}}}return o}function de(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function ue(e){e.document.registerPostFixer((t=>function(e,t){const o=t.document.differ.getChanges();let n=!1;for(const t of o)"insert"==t.type&&"table"==t.name&&(n=he(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableRow"==t.name&&(n=be(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableCell"==t.name&&(n=me(t.position.nodeAfter,e)||n),"remove"!=t.type&&"insert"!=t.type||!ge(t)||(n=me(t.position.parent,e)||n);return n}(t,e)))}function he(e,t){let o=!1;for(const n of e.getChildren())n.is("element","tableRow")&&(o=be(n,t)||o);return o}function be(e,t){let o=!1;for(const n of e.getChildren())o=me(n,t)||o;return o}function me(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 ge(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function pe(e,t){if(!e.is("element","paragraph"))return!1;const o=t.toViewElement(e);return!!o&&V(e)!==o.is("element","span")}var fe=o(62),we=o.n(fe),_e=o(482),ve={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(_e.Z,ve);_e.Z.locals;class ke extends e.Plugin{constructor(e){super(e),this._additionalSlots=[]}static get pluginName(){return"TableEditing"}static get requires(){return[J]}init(){const e=this.editor,t=e.model,o=t.schema,n=e.conversion,i=e.plugins.get(J);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}),n.for("upcast").add((e=>{e.on("element:figure",((e,t,o)=>{if(!o.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const n=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!n||!o.consumable.test(n,{name:!0}))return;o.consumable.consume(t.viewItem,{name:!0,classes:"table"});const i=o.convertItem(n,t.modelCursor),r=(0,_.first)(i.modelRange.getItems());r?(o.convertChildren(t.viewItem,o.writer.createPositionAt(r,"end")),o.updateConversionResult(r,t)):o.consumable.revert(t.viewItem,{name:!0,classes:"table"})}))})),n.for("upcast").add(v()),n.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:A(i,{asWidget:!0,additionalSlots:this._additionalSlots})}),n.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:A(i,{additionalSlots:this._additionalSlots})}),n.for("upcast").elementToElement({model:"tableRow",view:"tr"}),n.for("upcast").add((e=>{e.on("element:tr",((e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()}),{priority:"high"})})),n.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),n.for("upcast").elementToElement({model:"tableCell",view:"td"}),n.for("upcast").elementToElement({model:"tableCell",view:"th"}),n.for("upcast").add(k("td")),n.for("upcast").add(k("th")),n.for("editingDowncast").elementToElement({model:"tableCell",view:x({asWidget:!0})}),n.for("dataDowncast").elementToElement({model:"tableCell",view:x()}),n.for("editingDowncast").elementToElement({model:"paragraph",view:S({asWidget:!0}),converterPriority:"high"}),n.for("dataDowncast").elementToElement({model:"paragraph",view:S(),converterPriority:"high"}),n.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),n.for("upcast").attributeToAttribute({model:{key:"colspan",value:Ce("colspan")},view:"colspan"}),n.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),n.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Ce("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new R(e)),e.commands.add("insertTableRowAbove",new I(e,{order:"above"})),e.commands.add("insertTableRowBelow",new I(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new E(e,{order:"left"})),e.commands.add("insertTableColumnRight",new E(e,{order:"right"})),e.commands.add("removeTableRow",new Z(e)),e.commands.add("removeTableColumn",new K(e)),e.commands.add("splitTableCellVertically",new P(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new P(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new te(e)),e.commands.add("mergeTableCellRight",new U(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new U(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new U(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new U(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new q(e)),e.commands.add("setTableRowHeader",new G(e)),e.commands.add("selectTableRow",new re(e)),e.commands.add("selectTableColumn",new le(e)),se(t),ue(t),this.listenTo(t.document,"change:data",(()=>{!function(e,t){const o=e.document.differ;for(const e of o.getChanges()){let o,n=!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,n="headingRows"==e.attributeKey}else"tableRow"!=e.name&&"tableCell"!=e.name||(o=e.position.findAncestor("table"),n="tableRow"==e.name);if(!o)continue;const i=o.getAttribute("headingRows")||0,r=o.getAttribute("headingColumns")||0,l=new y(o);for(const e of l){const o=e.row<i||e.column<r?"th":"td",l=t.mapper.toViewElement(e.cell);l&&l.is("element")&&l.name!=o&&t.reconvertItem(n?e.cell.parent:e.cell)}}}(t,e.editing),function(e,t){const o=e.document.differ,n=new Set;for(const e of o.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&n.add(t)}for(const e of n.values()){const o=Array.from(e.getChildren()).filter((e=>pe(e,t.mapper)));for(const e of o)t.reconvertItem(e)}}(t,e.editing)}))}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function Ce(e){return t=>{const o=parseInt(t.getAttribute(e));return Number.isNaN(o)||o<=0?null:o}}var ye=o(273),Te=o(272),Ae={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(Te.Z,Ae);Te.Z.locals;class xe extends ye.View{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new _.KeystrokeHandler,this.focusTracker=new _.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:n}=t.target.dataset;this.items.get(10*(parseInt(o,10)-1)+(parseInt(n,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((e,t,o)=>{if(!o)return;const{row:n,column:i}=o.dataset;this.set({rows:parseInt(n),columns:parseInt(i)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),(0,ye.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)}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map(((o,n)=>{const i=Math.floor(n/10)<e&&n%10<t;o.set("isOn",i)}))}_createGridButton(e,t,o,n){const i=new ye.ButtonView(e);return i.set({label:n,class:"ck-insert-table-dropdown-grid-box"}),i.extendTemplate({attributes:{"data-row":t,"data-column":o}}),i}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const o=Math.floor(t/10),n=t%10,i=`${o+1} × ${n+1}`;e.push(this._createGridButton(this.locale,o+1,n+1,i))}return this.createCollection(e)}}class Se extends e.Plugin{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,o="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",(o=>{const n=e.commands.get("insertTable"),i=(0,ye.createDropdown)(o);let r;return i.bind("isEnabled").to(n),i.buttonView.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 6v3h4V6H3zm0 4v3h4v-3H3zm0 4v3h4v-3H3zm5 3h4v-3H8v3zm5 0h4v-3h-4v3zm4-4v-3h-4v3h4zm0-4V6h-4v3h4zm1.5 8a1.5 1.5 0 0 1-1.5 1.5H3A1.5 1.5 0 0 1 1.5 17V4c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13zM12 13v-3H8v3h4zm0-4V6H8v3h4z"/></svg>',label:t("Insert table"),tooltip:!0}),i.on("change:isOpen",(()=>{r||(r=new xe(o),i.panelView.children.add(r),r.delegate("execute").to(i),i.on("execute",(()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()})))})),i})),e.ui.componentFactory.add("tableColumn",(e=>{const n=[{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"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',n,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"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',o,e)})),e.ui.componentFactory.add("mergeTableCells",(e=>{const n=[{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"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',n,e)}))}_prepareDropdown(e,t,o,n){const i=this.editor,r=(0,ye.createDropdown)(n),l=this._fillDropdownWithListOptions(r,o);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(l,"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(r,"execute",(e=>{i.execute(e.source.commandName),e.source instanceof ye.SwitchButtonView||i.editing.view.focus()})),r}_prepareMergeSplitButtonDropdown(e,t,o,n){const i=this.editor,r=(0,ye.createDropdown)(n,ye.SplitButtonView),l="mergeTableCells",s=i.commands.get(l),a=this._fillDropdownWithListOptions(r,o);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([s,...a],"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(r.buttonView,"execute",(()=>{i.execute(l),i.editing.view.focus()})),this.listenTo(r,"execute",(e=>{i.execute(e.source.commandName),i.editing.view.focus()})),r}_fillDropdownWithListOptions(e,t){const o=this.editor,n=[],i=new _.Collection;for(const e of t)Ve(e,o,n,i);return(0,ye.addListToDropdown)(e,i),n}}function Ve(e,t,o,n){if("button"===e.type||"switchbutton"===e.type){const n=e.model=new ye.Model(e.model),{commandName:i,bindIsOn:r}=e.model,l=t.commands.get(i);o.push(l),n.set({commandName:i}),n.bind("isEnabled").to(l),r&&n.bind("isOn").to(l,"value"),n.set({withText:!0})}n.add(e)}var Re=o(475),Ie={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(Re.Z,Ie);Re.Z.locals;class Ee extends e.Plugin{static get pluginName(){return"TableSelection"}static get requires(){return[J,J]}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(J),t=this.editor.model.document.selection,o=e.getSelectedTableCells(t);return 0==o.length?null:o}getSelectionAsFragment(){const e=this.editor.plugins.get(J),t=this.getSelectedTableCells();return t?this.editor.model.change((o=>{const n=o.createDocumentFragment(),{first:i,last:r}=e.getColumnIndexes(t),{first:l,last:s}=e.getRowIndexes(t),a=t[0].findAncestor("table");let c=s,d=r;if(e.isSelectionRectangular(t)){const e={firstColumn:i,lastColumn:r,firstRow:l,lastRow:s};c=H(a,e),d=M(a,e)}const u=z(a,{startRow:l,startColumn:i,endRow:c,endColumn:d},o);return o.insert(u,n,0),n})):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,_.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,n)=>{const i=n.writer;!function(e){for(const o of t)e.removeClass("ck-editor__editable_selected",o);t.clear()}(i);const r=this.getSelectedTableCells();if(!r)return;for(const e of r){const o=n.mapper.toViewElement(e);i.addClass("ck-editor__editable_selected",o),t.add(o)}const l=n.mapper.toViewElement(r[r.length-1]);i.setSelection(l,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 n=o.createPositionAt(t[0],0),i=e.model.schema.getNearestSelectionRange(n);o.setSelection(i)}))}}))}_handleDeleteContent(e,t){const o=this.editor.plugins.get(J),n=t[0],i=t[1],r=this.editor.model,l=!i||"backward"==i.direction,s=o.getSelectedTableCells(n);s.length&&(e.stop(),r.change((e=>{const t=s[l?s.length-1:0];r.change((e=>{for(const t of s)r.deleteContent(e.createSelection(t,"in"))}));const o=r.schema.getNearestSelectionRange(e.createPositionAt(t,0));n.is("documentSelection")?e.setSelection(o):n.setTo(o)})))}_handleInsertTextEvent(e,t){const o=this.editor,n=this.getSelectedTableCells();if(!n)return;const i=o.editing.view,r=o.editing.mapper,l=n.map((e=>i.createRangeOn(r.toViewElement(e))));t.selection=i.createSelection(l)}_getCellsToSelect(e,t){const o=this.editor.plugins.get("TableUtils"),n=o.getCellLocation(e),i=o.getCellLocation(t),r=Math.min(n.row,i.row),l=Math.max(n.row,i.row),s=Math.min(n.column,i.column),a=Math.max(n.column,i.column),c=new Array(l-r+1).fill(null).map((()=>[])),d={startRow:r,endRow:l,startColumn:s,endColumn:a};for(const{row:t,cell:o}of new y(e.findAncestor("table"),d))c[t-r].push(o);const u=i.row<n.row,h=i.column<n.column;return u&&c.reverse(),h&&c.forEach((e=>e.reverse())),{cells:c.flat(),backward:u||h}}}class Pe extends e.Plugin{static get pluginName(){return"TableClipboard"}static get requires(){return[Ee,J]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",((e,t)=>this._onCopyCut(e,t))),this.listenTo(t,"cut",((e,t)=>this._onCopyCut(e,t))),this.listenTo(e.model,"insertContent",((e,[t,o])=>this._onInsertContent(e,t,o)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const o=this.editor.plugins.get(Ee);if(!o.getSelectedTableCells())return;if("cut"==e.name&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;t.preventDefault(),e.stop();const n=this.editor.data,i=this.editor.editing.view.document,r=n.toView(o.getSelectionAsFragment());i.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;const n=this.editor.model,i=this.editor.plugins.get(J);let r=this.getTableIfOnlyTableInContent(t,n);if(!r)return;const l=i.getSelectionAffectedTableCells(n.document.selection);l.length?(e.stop(),n.change((e=>{const t={width:i.getColumns(r),height:i.getRows(r)},o=function(e,t,o,n){const i=e[0].findAncestor("table"),r=n.getColumnIndexes(e),l=n.getRowIndexes(e),s={firstColumn:r.first,lastColumn:r.last,firstRow:l.first,lastRow:l.last},a=1===e.length;a&&(s.lastRow+=t.height-1,s.lastColumn+=t.width-1,function(e,t,o,n){const i=n.getColumns(e),r=n.getRows(e);o>i&&n.insertColumns(e,{at:i,columns:o-i});t>r&&n.insertRows(e,{at:r,rows:t-r})}(i,s.lastRow+1,s.lastColumn+1,n));a||!n.isSelectionRectangular(e)?function(e,t,o){const{firstRow:n,lastRow:i,firstColumn:r,lastColumn:l}=t,s={first:n,last:i},a={first:r,last:l};Be(e,r,s,o),Be(e,l+1,s,o),ze(e,n,a,o),ze(e,i+1,a,o,n)}(i,s,o):(s.lastRow=H(i,s),s.lastColumn=M(i,s));return s}(l,t,e,i),n=o.lastRow-o.firstRow+1,s=o.lastColumn-o.firstColumn+1,a={startRow:0,startColumn:0,endRow:Math.min(n,t.height)-1,endColumn:Math.min(s,t.width)-1};r=z(r,a,e);const c=l[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(r,t,c,o,e);if(this.editor.plugins.get("TableSelection").isEnabled){const t=i.sortRanges(d.map((t=>e.createRangeOn(t))));e.setSelection(t)}else e.setSelection(d[0],0)}))):D(r,i)}_replaceSelectedCellsWithPasted(e,t,o,n,i){const{width:r,height:l}=t,s=function(e,t,o){const n=new Array(o).fill(null).map((()=>new Array(t).fill(null)));for(const{column:t,row:o,cell:i}of new y(e))n[o][t]=i;return n}(e,r,l),a=[...new y(o,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of a){const{row:t,column:o}=e;o===n.firstColumn&&(d=e.getPositionBefore());const a=t-n.firstRow,u=o-n.firstColumn,h=s[a%l][u%r],b=h?i.cloneElement(h):null,m=this._replaceTableSlotCell(e,b,d,i);m&&(F(m,t,o,n.lastRow,n.lastColumn,i),c.push(m),d=i.createPositionAfter(m))}const u=parseInt(o.getAttribute("headingRows")||"0"),h=parseInt(o.getAttribute("headingColumns")||"0"),b=n.firstRow<u&&u<=n.lastRow,m=n.firstColumn<h&&h<=n.lastColumn;if(b){const e=ze(o,u,{first:n.firstColumn,last:n.lastColumn},i,n.firstRow);c.push(...e)}if(m){const e=Be(o,h,{first:n.firstRow,last:n.lastRow},i);c.push(...e)}return c}_replaceTableSlotCell(e,t,o,n){const{cell:i,isAnchor:r}=e;return r&&n.remove(i),t?(n.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 n=t.createRange(o.start,t.createPositionBefore(e));if(t.hasContent(n,{ignoreWhitespaces:!0}))return null;const i=t.createRange(t.createPositionAfter(e),o.end);return t.hasContent(i,{ignoreWhitespaces:!0})?null:e}return null}}function ze(e,t,o,n,i=0){if(t<1)return;return B(e,t,i).filter((({column:e,cellWidth:t})=>Oe(e,t,o))).map((({cell:e})=>O(e,t,n)))}function Be(e,t,o,n){if(t<1)return;return L(e,t).filter((({row:e,cellHeight:t})=>Oe(e,t,o))).map((({cell:e,column:o})=>j(e,o,t,n)))}function Oe(e,t,o){const n=e+t-1,{first:i,last:r}=o;return e>=i&&e<=r||e<i&&n>=i}class Le extends e.Plugin{static get pluginName(){return"TableKeyboard"}static get requires(){return[Ee,J]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"arrowKey",((...e)=>this._onArrowKey(...e)),{context:"table"}),this.listenTo(e,"tab",((...e)=>this._handleTabOnSelectedTable(...e)),{context:"figure"}),this.listenTo(e,"tab",((...e)=>this._handleTab(...e)),{context:["th","td"]})}_handleTabOnSelectedTable(e,t){const o=this.editor,n=o.model.document.selection.getSelectedElement();n&&n.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),o.model.change((e=>{e.setSelection(e.createRangeIn(n.getChild(0).getChild(0)))})))}_handleTab(e,t){const o=this.editor,n=this.editor.plugins.get(J),i=this.editor.plugins.get("TableSelection"),r=o.model.document.selection,l=!t.shiftKey;let s=n.getTableCellsContainingSelection(r)[0];if(s||(s=i.getFocusCell()),!s)return;t.preventDefault(),t.stopPropagation(),e.stop();const a=s.parent,c=a.parent,d=c.getChildIndex(a),u=a.getChildIndex(s),h=0===u;if(!l&&h&&0===d)return void o.model.change((e=>{e.setSelection(e.createRangeOn(c))}));const b=u===a.childCount-1,m=d===n.getRows(c)-1;if(l&&m&&b&&(o.execute("insertTableRowBelow"),d===n.getRows(c)-1))return void o.model.change((e=>{e.setSelection(e.createRangeOn(c))}));let g;if(l&&b){const e=c.getChild(d+1);g=e.getChild(0)}else if(!l&&h){const e=c.getChild(d-1);g=e.getChild(e.childCount-1)}else g=a.getChild(u+(l?1:-1));o.model.change((e=>{e.setSelection(e.createRangeIn(g))}))}_onArrowKey(e,t){const o=this.editor,n=t.keyCode,i=(0,_.getLocalizedArrowKeyCodeDirection)(n,o.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const o=this.editor.plugins.get(J),n=this.editor.plugins.get("TableSelection"),i=this.editor.model,r=i.document.selection,l=["right","down"].includes(e),s=o.getSelectedTableCells(r);if(s.length){let o;return o=t?n.getFocusCell():l?s[s.length-1]:s[0],this._navigateFromCellInDirection(o,e,t),!0}const a=r.focus.findAncestor("tableCell");if(!a)return!1;if(!r.isCollapsed)if(t){if(r.isBackward==l&&!r.containsEntireContent(a))return!1}else{const e=r.getSelectedElement();if(!e||!i.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(r,a,l)&&(this._navigateFromCellInDirection(a,e,t),!0)}_isSelectionAtCellEdge(e,t,o){const n=this.editor.model,i=this.editor.model.schema,r=o?e.getLastPosition():e.getFirstPosition();if(!i.getLimitElement(r).is("element","tableCell")){return n.createPositionAt(t,o?"end":0).isTouching(r)}const l=n.createSelection(r);return n.modifySelection(l,{direction:o?"forward":"backward"}),r.isEqual(l.focus)}_navigateFromCellInDirection(e,t,o=!1){const n=this.editor.model,i=e.findAncestor("table"),r=[...new y(i,{includeAllSlots:!0})],{row:l,column:s}=r[r.length-1],a=r.find((({cell:t})=>t==e));let{row:c,column:d}=a;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=a.cellWidth;break;case"down":c+=a.cellHeight}if(c<0||c>l||d<0&&c<=0||d>s&&c>=l)return void n.change((e=>{e.setSelection(e.createRangeOn(i))}));d<0?(d=o?0:s,c--):d>s&&(d=o?s:0,c++);const u=r.find((e=>e.row==c&&e.column==d)).cell,h=["right","down"].includes(t),b=this.editor.plugins.get("TableSelection");if(o&&b.isEnabled){const t=b.getAnchorCell()||e;b.setCellSelection(t,u)}else{const e=n.createPositionAt(u,h?0:"end");n.change((t=>{t.setSelection(e)}))}}}var je=o(492);class Fe extends je.DomEventObserver{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class We extends e.Plugin{static get pluginName(){return"TableMouse"}static get requires(){return[Ee,J]}init(){this.editor.editing.view.addObserver(Fe),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(J);let o=!1;const n=e.plugins.get(Ee);this.listenTo(e.editing.view.document,"mousedown",((i,r)=>{const l=e.model.document.selection;if(!this.isEnabled||!n.isEnabled)return;if(!r.domEvent.shiftKey)return;const s=n.getAnchorCell()||t.getTableCellsContainingSelection(l)[0];if(!s)return;const a=this._getModelTableCellFromDomEvent(r);a&&Ne(s,a)&&(o=!0,n.setCellSelection(s,a),r.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,n=!1,i=!1;const r=e.plugins.get(Ee);this.listenTo(e.editing.view.document,"mousedown",((e,o)=>{this.isEnabled&&r.isEnabled&&(o.domEvent.shiftKey||o.domEvent.ctrlKey||o.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(o)))})),this.listenTo(e.editing.view.document,"mousemove",((e,l)=>{if(!l.domEvent.buttons)return;if(!t)return;const s=this._getModelTableCellFromDomEvent(l);s&&Ne(t,s)&&(o=s,n||o==t||(n=!0)),n&&(i=!0,r.setCellSelection(t,o),l.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{n=!1,i=!1,t=null,o=null})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{i&&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 Ne(e,t){return e.parent.parent==t.parent.parent}var De=o(660),He={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(De.Z,He);De.Z.locals;class Me extends e.Plugin{static get requires(){return[ke,Se,Ee,We,Le,Pe,t.Widget]}static get pluginName(){return"Table"}}class Ue extends e.Plugin{static get pluginName(){return"PlainTableOutput"}static get requires(){return[Me]}init(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:$e,converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if("table"===e.parent.name)return t.createContainerElement("caption")},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,n]of Object.entries(t))e.conversion.for("dataDowncast").add((e=>e.on(`attribute:${n}:table`,((e,t,n)=>{const{item:i,attributeNewValue:r}=t,{mapper:l,writer:s}=n;if(!n.consumable.consume(i,e.name))return;const a=l.toViewElement(i);r?s.setStyle(o,r,a):s.removeStyle(o,a)}),{priority:"high"})))}(e)}}function $e(e,{writer:t}){const o=e.getAttribute("headingRows")||0,n=t.createSlot((e=>e.is("element","tableRow")&&e.index<o)),i=t.createSlot((e=>e.is("element","tableRow")&&e.index>=o)),r=t.createSlot((e=>!e.is("element","tableRow"))),l=t.createContainerElement("thead",null,n),s=t.createContainerElement("tbody",null,i),a=[];return o&&a.push(l),o<e.childCount&&a.push(s),t.createContainerElement("table",null,[r,...a])}function Ze(e){const t=e.getSelectedElement();return t&&Ge(t)?t:null}function Ke(e){const t=e.getFirstPosition();if(!t)return null;let o=t.parent;for(;o;){if(o.is("element")&&Ge(o))return o;o=o.parent}return null}function Ge(e){return!!e.getCustomProperty("table")&&(0,t.isWidget)(e)}class qe extends e.Plugin{static get requires(){return[t.WidgetToolbarRepository]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,o=e.t,n=e.plugins.get(t.WidgetToolbarRepository),i=e.config.get("table.contentToolbar"),r=e.config.get("table.tableToolbar");i&&n.register("tableContent",{ariaLabel:o("Table toolbar"),items:i,getRelatedElement:Ke}),r&&n.register("table",{ariaLabel:o("Table toolbar"),items:r,getRelatedElement:Ze})}}var Je=o(252),Xe={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(Je.Z,Xe);Je.Z.locals;class Ye extends ye.View{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 _.FocusTracker,this._focusables=new ye.ViewCollection,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new _.KeystrokeHandler,this._stillTyping=!1,this._focusCycler=new ye.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.keystrokes.listenTo(this.dropdownView.panelView.element)}focus(){this.inputView.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,o=this.bindTemplate,n=this._createColorGrid(e),i=(0,ye.createDropdown)(e),r=new ye.View,l=this._createRemoveColorButton();return r.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))]}}]}),i.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),i.buttonView.children.add(r),i.buttonView.label=t("Color picker"),i.buttonView.tooltip=!0,i.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",i.panelView.children.add(l),i.panelView.children.add(n),i.bind("isEnabled").to(this,"isReadOnly",(e=>!e)),this._focusables.add(l),this._focusables.add(n),this.focusTracker.add(l.element),this.focusTracker.add(n.element),i}_createInputTextView(){const e=this.locale,t=new ye.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}_createRemoveColorButton(){const t=this.locale,o=t.t,n=new ye.ButtonView(t),i=this.options.defaultColorValue||"",r=o(i?"Restore default":"Remove color");return n.class="ck-input-color__remove-color",n.withText=!0,n.icon=e.icons.eraser,n.label=r,n.on("execute",(()=>{this.value=i,this.dropdownView.isOpen=!1,this.fire("input")})),n}_createColorGrid(e){const t=new ye.ColorGridView(e,{colorDefinitions:this.options.colorDefinitions,columns:this.options.columns});return t.on("execute",((e,t)=>{this.value=t.value,this.dropdownView.isOpen=!1,this.fire("input")})),t.bind("selectedColor").to(this,"value"),t}_setInputValue(e){if(!this._stillTyping){const t=Qe(e),o=this.options.colorDefinitions.find((e=>t===Qe(e.color)));this.inputView.value=o?o.label:e||""}}}function Qe(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const et=e=>""===e;function tt(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 ot(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function nt(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function it(e){return e=e.trim(),et(e)||(0,je.isColor)(e)}function rt(e){return e=e.trim(),et(e)||ut(e)||(0,je.isLength)(e)||(0,je.isPercentage)(e)}function lt(e){return e=e.trim(),et(e)||ut(e)||(0,je.isLength)(e)}function st(e,t){const o=new _.Collection,n=tt(e.t);for(const i in n){const r={type:"button",model:new ye.Model({_borderStyleValue:i,label:n[i],role:"menuitemradio",withText:!0})};"none"===i?r.model.bind("isOn").to(e,"borderStyle",(e=>"none"===t?!e:e===i)):r.model.bind("isOn").to(e,"borderStyle",(e=>e===i)),o.add(r)}return o}function at(e){const{view:t,icons:o,toolbar:n,labels:i,propertyName:r,nameToValue:l,defaultValue:s}=e;for(const e in i){const a=new ye.ButtonView(t.locale);a.set({label:i[e],icon:o[e],tooltip:i[e]});const c=l?l(e):e;a.bind("isOn").to(t,r,(e=>{let t=e;return""===e&&s&&(t=s),c===t})),a.on("execute",(()=>{t[r]=c})),n.items.add(a)}}const ct=[{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 dt(e){return(t,o,n)=>{const i=new Ye(t.locale,{colorDefinitions:(r=e.colorConfig,r.map((e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}})))),columns:e.columns,defaultColorValue:e.defaultColorValue});var r;return i.inputView.set({id:o,ariaDescribedById:n}),i.bind("isReadOnly").to(t,"isEnabled",(e=>!e)),i.bind("hasError").to(t,"errorText",(e=>!!e)),i.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused").to(i),i}}function ut(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}var ht=o(333),bt={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(ht.Z,bt);ht.Z.locals;class mt extends ye.View{constructor(e,t={}){super(e);const o=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",o.to("class")],role:o.to("_role"),"aria-labelledby":o.to("_ariaLabelledBy")},children:this.children})}}var gt=o(934),pt={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(gt.Z,pt);gt.Z.locals;var ft=o(686),wt={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(ft.Z,wt);ft.Z.locals;var _t=o(773),vt={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(_t.Z,vt);_t.Z.locals;const kt={left:e.icons.alignLeft,center:e.icons.alignCenter,right:e.icons.alignRight,justify:e.icons.alignJustify,top:e.icons.alignTop,middle:e.icons.alignMiddle,bottom:e.icons.alignBottom};class Ct extends ye.View{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:n,borderColorInput:i,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:l,backgroundInput:s}=this._createBackgroundFields(),{widthInput:a,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:b,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new _.FocusTracker,this.keystrokes=new _.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=n,this.borderColorInput=i,this.backgroundInput=s,this.paddingInput=this._createPaddingField(),this.widthInput=a,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=b;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new ye.ViewCollection,this._focusCycler=new ye.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new ye.FormHeaderView(e,{label:this.t("Cell properties")})),this.children.add(new mt(e,{labelView:r,children:[r,o,i,n],class:"ck-table-form__border-row"})),this.children.add(new mt(e,{labelView:l,children:[l,s],class:"ck-table-form__background-row"})),this.children.add(new mt(e,{children:[new mt(e,{labelView:u,children:[u,a,c,d],class:"ck-table-form__dimensions-row"}),new mt(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new mt(e,{labelView:m,children:[m,h,b],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new mt(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,ye.submitHandler)({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderColorInput.fieldView.dropdownView.buttonView,this.borderWidthInput,this.backgroundInput,this.backgroundInput.fieldView.dropdownView.buttonView,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=dt({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color}),n=this.locale,i=this.t,r=i("Style"),l=new ye.LabelView(n);l.text=i("Border");const s=tt(i),a=new ye.LabeledFieldView(n,ye.createLabeledDropdown);a.set({label:r,class:"ck-table-form__border-style"}),a.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),a.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>s[e||"none"])),a.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),a.bind("isEmpty").to(this,"borderStyle",(e=>!e)),(0,ye.addListToDropdown)(a.fieldView,st(this,t.style),{role:"menu",ariaLabel:r});const c=new ye.LabeledFieldView(n,ye.createLabeledInputText);c.set({label:i("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",yt),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new ye.LabeledFieldView(n,o);return d.set({label:i("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",yt),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,o,n,i)=>{yt(n)||(this.borderColor="",this.borderWidth=""),yt(i)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:l,borderStyleDropdown:a,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new ye.LabelView(e);o.text=t("Background");const n=dt({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor}),i=new ye.LabeledFieldView(e,n);return i.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),i.fieldView.bind("value").to(this,"backgroundColor"),i.fieldView.on("input",(()=>{this.backgroundColor=i.fieldView.value})),{backgroundRowLabel:o,backgroundInput:i}}_createDimensionFields(){const e=this.locale,t=this.t,o=new ye.LabelView(e);o.text=t("Dimensions");const n=new ye.LabeledFieldView(e,ye.createLabeledInputText);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",(()=>{this.width=n.fieldView.element.value}));const i=new ye.View(e);i.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new ye.LabeledFieldView(e,ye.createLabeledInputText);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",(()=>{this.height=r.fieldView.element.value})),{dimensionsLabel:o,widthInput:n,operatorLabel:i,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,o=new ye.LabeledFieldView(e,ye.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 ye.LabelView(e);o.text=t("Table cell text alignment");const n=new ye.ToolbarView(e),i="rtl"===e.contentLanguageDirection;n.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),at({view:this,icons:kt,toolbar:n,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(i){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new ye.ToolbarView(e);return r.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),at({view:this,icons:kt,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:n,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const t=this.locale,o=this.t,n=new ye.ButtonView(t),i=new ye.ButtonView(t),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:o("Save"),icon:e.icons.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(r,"errorText",((...e)=>e.every((e=>!e)))),i.set({label:o("Cancel"),icon:e.icons.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),n=t("Align cell text to the center"),i=t("Align cell text to the right"),r=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:i,center:n,left:o,justify:r}:{left:o,center:n,right:i,justify:r}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function yt(e){return"none"!==e}const Tt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const At="object"==typeof global&&global&&global.Object===Object&&global;var xt="object"==typeof self&&self&&self.Object===Object&&self;const St=At||xt||Function("return this")();const Vt=function(){return St.Date.now()};var Rt=/\s/;const It=function(e){for(var t=e.length;t--&&Rt.test(e.charAt(t)););return t};var Et=/^\s+/;const Pt=function(e){return e?e.slice(0,It(e)+1).replace(Et,""):e};const zt=St.Symbol;var Bt=Object.prototype,Ot=Bt.hasOwnProperty,Lt=Bt.toString,jt=zt?zt.toStringTag:void 0;const Ft=function(e){var t=Ot.call(e,jt),o=e[jt];try{e[jt]=void 0;var n=!0}catch(e){}var i=Lt.call(e);return n&&(t?e[jt]=o:delete e[jt]),i};var Wt=Object.prototype.toString;const Nt=function(e){return Wt.call(e)};var Dt=zt?zt.toStringTag:void 0;const Ht=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Dt&&Dt in Object(e)?Ft(e):Nt(e)};const Mt=function(e){return null!=e&&"object"==typeof e};const Ut=function(e){return"symbol"==typeof e||Mt(e)&&"[object Symbol]"==Ht(e)};var $t=/^[-+]0x[0-9a-f]+$/i,Zt=/^0b[01]+$/i,Kt=/^0o[0-7]+$/i,Gt=parseInt;const qt=function(e){if("number"==typeof e)return e;if(Ut(e))return NaN;if(Tt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Tt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Pt(e);var o=Zt.test(e);return o||Kt.test(e)?Gt(e.slice(2),o?2:8):$t.test(e)?NaN:+e};var Jt=Math.max,Xt=Math.min;const Yt=function(e,t,o){var n,i,r,l,s,a,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var o=n,r=i;return n=i=void 0,c=t,l=e.apply(r,o)}function m(e){var o=e-a;return void 0===a||o>=t||o<0||u&&e-c>=r}function g(){var e=Vt();if(m(e))return p(e);s=setTimeout(g,function(e){var o=t-(e-a);return u?Xt(o,r-(e-c)):o}(e))}function p(e){return s=void 0,h&&n?b(e):(n=i=void 0,l)}function f(){var e=Vt(),o=m(e);if(n=arguments,i=this,a=e,o){if(void 0===s)return function(e){return c=e,s=setTimeout(g,t),d?b(e):l}(a);if(u)return clearTimeout(s),s=setTimeout(g,t),b(a)}return void 0===s&&(s=setTimeout(g,t)),l}return t=qt(t)||0,Tt(o)&&(d=!!o.leading,r=(u="maxWait"in o)?Jt(qt(o.maxWait)||0,t):r,h="trailing"in o?!!o.trailing:h),f.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=a=i=s=void 0},f.flush=function(){return void 0===s?l:p(Vt())},f},Qt=ye.BalloonPanelView.defaultPositions,eo=[Qt.northArrowSouth,Qt.northArrowSouthWest,Qt.northArrowSouthEast,Qt.southArrowNorth,Qt.southArrowNorthWest,Qt.southArrowNorthEast,Qt.viewportStickyNorth];function to(e,t){const o=e.plugins.get("ContextualBalloon");if(Ke(e.editing.view.document.selection)){let n;n="cell"===t?no(e):oo(e),o.updatePosition(n)}}function oo(e){const t=e.model.document.selection.getFirstPosition().findAncestor("table"),o=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(o),positions:eo}}function no(e){const t=e.editing.mapper,o=e.editing.view.domConverter,n=e.model.document.selection;if(n.rangeCount>1)return{target:()=>function(e,t){const o=t.editing.mapper,n=t.editing.view.domConverter,i=Array.from(e).map((e=>{const t=io(e.start),i=o.toViewElement(t);return new _.Rect(n.mapViewToDom(i))}));return _.Rect.getBoundingRect(i)}(n.getRanges(),e),positions:eo};const i=io(n.getFirstPosition()),r=t.toViewElement(i);return{target:o.mapViewToDom(r),positions:eo}}function io(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}var ro=Object.defineProperty,lo=Object.getOwnPropertySymbols,so=Object.prototype.hasOwnProperty,ao=Object.prototype.propertyIsEnumerable,co=(e,t,o)=>t in e?ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;function uo(e){if(!e||!Tt(e))return e;const{top:t,right:o,bottom:n,left:i}=e;return t==o&&o==n&&n==i?t:void 0}function ho(e,t){const o=parseFloat(e);return Number.isNaN(o)||String(o)!==String(e)?e:`${o}${t}`}function bo(e,t={}){const o=((e,t)=>{for(var o in t||(t={}))so.call(t,o)&&co(e,o,t[o]);if(lo)for(var o of lo(t))ao.call(t,o)&&co(e,o,t[o]);return e})({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}const mo={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class go extends e.Plugin{constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:ct,backgroundColors:ct})}static get requires(){return[ye.ContextualBalloon]}static get pluginName(){return"TableCellPropertiesUI"}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=bo(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(ye.ContextualBalloon),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",(o=>{const n=new ye.ButtonView(o);n.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",(()=>this._showView()));const i=Object.values(mo).map((t=>e.commands.get(t)));return n.bind("isEnabled").toMany(i,"isEnabled",((...e)=>e.some((e=>e)))),n}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableCellProperties"),o=(0,ye.normalizeColorOptions)(t.borderColors),n=(0,ye.getLocalizedColorOptions)(e.locale,o),i=(0,ye.normalizeColorOptions)(t.backgroundColors),r=(0,ye.getLocalizedColorOptions)(e.locale,i),l=new Ct(e.locale,{borderColors:n,backgroundColors:r,defaultTableCellProperties:this._defaultTableCellProperties}),s=e.t;l.render(),this.listenTo(l,"submit",(()=>{this._hideView()})),this.listenTo(l,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),l.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),(0,ye.clickOutsideHandler)({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const a=ot(s),c=nt(s);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableCellBorderColor",errorText:a,validator:it})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableCellBorderWidth",errorText:c,validator:lt})),l.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:l.paddingInput,commandName:"tableCellPadding",errorText:c,validator:rt})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableCellWidth",errorText:c,validator:rt})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableCellHeight",errorText:c,validator:rt})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableCellBackgroundColor",errorText:a,validator:it})),l.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),l.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),l}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(mo).map((([t,o])=>{const n=this._defaultTableCellProperties[t]||"";return[t,e.get(o).value||n]})).forEach((([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:no(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;Ke(e.editing.view.document.selection)?this._isViewVisible&&to(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,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:n,errorText:i}=e,r=Yt((()=>{o.errorText=i}),500);return(e,i,l)=>{r.cancel(),this._isReady&&(n(l)?(this.editor.execute(t,{value:l,batch:this._undoStepBatch}),o.errorText=null):r())}}}class po extends e.Command{constructor(e,t,o){super(e),this.attributeName=t,this._defaultValue=o}refresh(){const e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){const{value:t,batch:o}=e,n=this.editor.model,i=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(n.document.selection),r=this._getValueToSet(t);n.enqueueChange(o,(e=>{r?i.forEach((t=>e.setAttribute(this.attributeName,r,t))):i.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 fo extends po{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=ho(e,"px"))!==this._defaultValue)return e}}class wo extends e.Plugin{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[ke]}init(){const e=this.editor,t=bo(e.config.get("table.tableCellProperties.defaultProperties"));w(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new fo(e,t.width))}}class _o extends po{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=ho(e,"px");if(t!==this._defaultValue)return t}}class vo extends po{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=ho(e,"px");if(t!==this._defaultValue)return t}}class ko extends po{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class Co extends po{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class yo extends po{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class To extends po{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Ao extends po{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class xo extends po{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=ho(e,"px");if(t!==this._defaultValue)return t}}const So=/^(top|middle|bottom)$/,Vo=/^(left|center|right|justify)$/;class Ro extends e.Plugin{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[ke,wo]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const n=bo(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(je.addBorderRules),function(e,t,o){const n={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};e.extend("tableCell",{allowAttributes:Object.values(n)}),r(t,"td",n,o),r(t,"th",n,o),l(t,{modelElement:"tableCell",modelAttribute:n.style,styleName:"border-style"}),l(t,{modelElement:"tableCell",modelAttribute:n.color,styleName:"border-color"}),l(t,{modelElement:"tableCell",modelAttribute:n.width,styleName:"border-width"})}(t,o,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableCellBorderStyle",new To(e,n.borderStyle)),e.commands.add("tableCellBorderColor",new Ao(e,n.borderColor)),e.commands.add("tableCellBorderWidth",new xo(e,n.borderWidth)),w(t,o,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:n.height}),e.commands.add("tableCellHeight",new vo(e,n.height)),e.data.addStyleProcessorRules(je.addPaddingRules),w(t,o,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:n.padding}),e.commands.add("tableCellPadding",new _o(e,n.padding)),e.data.addStyleProcessorRules(je.addBackgroundRules),w(t,o,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),e.commands.add("tableCellBackgroundColor",new ko(e,n.backgroundColor)),function(e,t,o){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),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":Vo}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getStyle("text-align");return t===o?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Vo}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getAttribute("align");return t===o?null:t}}})}(t,o,n.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new yo(e,n.horizontalAlignment)),function(e,t,o){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),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":So}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getStyle("vertical-align");return t===o?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:So}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getAttribute("valign");return t===o?null:t}}})}(t,o,n.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Co(e,n.verticalAlignment))}}class Io extends e.Plugin{static get pluginName(){return"TableCellProperties"}static get requires(){return[Ro,go]}}class Eo extends e.Command{constructor(e,t,o){super(e),this.attributeName=t,this._defaultValue=o}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,o=t.document.selection,{value:n,batch:i}=e,r=o.getFirstPosition().findAncestor("table"),l=this._getValueToSet(n);t.enqueueChange(i,(e=>{l?e.setAttribute(this.attributeName,l,r):e.removeAttribute(this.attributeName,r)}))}_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 Po extends Eo{constructor(e,t){super(e,"tableBackgroundColor",t)}}class zo extends Eo{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Bo extends Eo{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Oo extends Eo{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=uo(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=ho(e,"px");if(t!==this._defaultValue)return t}}class Lo extends Eo{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=ho(e,"px"))!==this._defaultValue)return e}}class jo extends Eo{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=ho(e,"px"))!==this._defaultValue)return e}}class Fo extends Eo{constructor(e,t){super(e,"tableAlignment",t)}}var Wo=Object.defineProperty,No=Object.getOwnPropertySymbols,Do=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable,Mo=(e,t,o)=>t in e?Wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Uo=(e,t)=>{for(var o in t||(t={}))Do.call(t,o)&&Mo(e,o,t[o]);if(No)for(var o of No(t))Ho.call(t,o)&&Mo(e,o,t[o]);return e};const $o=/^(left|center|right)$/,Zo=/^(left|none|right)$/;class Ko extends e.Plugin{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[ke]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const n=bo(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(je.addBorderRules),function(e,t,o){const n={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};e.extend("table",{allowAttributes:Object.values(n)}),r(t,"table",n,o),s(t,{modelAttribute:n.color,styleName:"border-color"}),s(t,{modelAttribute:n.style,styleName:"border-style"}),s(t,{modelAttribute:n.width,styleName:"border-width"})}(t,o,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableBorderColor",new zo(e,n.borderColor)),e.commands.add("tableBorderStyle",new Bo(e,n.borderStyle)),e.commands.add("tableBorderWidth",new Oo(e,n.borderWidth)),function(e,t,o){e.extend("table",{allowAttributes:["tableAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:Zo}},model:{key:"tableAlignment",value:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t===o?null:t}}}).attributeToAttribute({view:{attributes:{align:$o}},model:{name:"table",key:"tableAlignment",value:e=>{const t=e.getAttribute("align");return t===o?null:t}}})}(t,o,n.alignment),e.commands.add("tableAlignment",new Fo(e,n.alignment)),Go(t,o,{modelAttribute:"tableWidth",styleName:"width",defaultValue:n.width}),e.commands.add("tableWidth",new Lo(e,n.width)),Go(t,o,{modelAttribute:"tableHeight",styleName:"height",defaultValue:n.height}),e.commands.add("tableHeight",new jo(e,n.height)),e.data.addStyleProcessorRules(je.addBackgroundRules),function(e,t,o){const{modelAttribute:n}=o;e.extend("table",{allowAttributes:[n]}),i(t,Uo({viewElement:"table"},o)),s(t,o)}(t,o,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),e.commands.add("tableBackgroundColor",new Po(e,n.backgroundColor))}}function Go(e,t,o){const{modelAttribute:n}=o;e.extend("table",{allowAttributes:[n]}),i(t,Uo({viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name)},o)),l(t,Uo({modelElement:"table"},o))}var qo=o(99),Jo={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(qo.Z,Jo);qo.Z.locals;const Xo={left:e.icons.objectLeft,center:e.icons.objectCenter,right:e.icons.objectRight};class Yo extends ye.View{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:n,borderColorInput:i,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:l,backgroundInput:s}=this._createBackgroundFields(),{widthInput:a,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new _.FocusTracker,this.keystrokes=new _.KeystrokeHandler,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=n,this.borderColorInput=i,this.backgroundInput=s,this.widthInput=a,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:m,cancelButtonView:g}=this._createActionButtons();this.saveButtonView=m,this.cancelButtonView=g,this._focusables=new ye.ViewCollection,this._focusCycler=new ye.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new ye.FormHeaderView(e,{label:this.t("Table properties")})),this.children.add(new mt(e,{labelView:r,children:[r,o,i,n],class:"ck-table-form__border-row"})),this.children.add(new mt(e,{labelView:l,children:[l,s],class:"ck-table-form__background-row"})),this.children.add(new mt(e,{children:[new mt(e,{labelView:u,children:[u,a,c,d],class:"ck-table-form__dimensions-row"}),new mt(e,{labelView:b,children:[b,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new mt(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,ye.submitHandler)({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderColorInput.fieldView.dropdownView.buttonView,this.borderWidthInput,this.backgroundInput,this.backgroundInput.fieldView.dropdownView.buttonView,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=dt({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color}),n=this.locale,i=this.t,r=i("Style"),l=new ye.LabelView(n);l.text=i("Border");const s=tt(i),a=new ye.LabeledFieldView(n,ye.createLabeledDropdown);a.set({label:r,class:"ck-table-form__border-style"}),a.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),a.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>s[e||"none"])),a.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),a.bind("isEmpty").to(this,"borderStyle",(e=>!e)),(0,ye.addListToDropdown)(a.fieldView,st(this,t.style),{role:"menu",ariaLabel:r});const c=new ye.LabeledFieldView(n,ye.createLabeledInputText);c.set({label:i("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",Qo),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new ye.LabeledFieldView(n,o);return d.set({label:i("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",Qo),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,o,n,i)=>{Qo(n)||(this.borderColor="",this.borderWidth=""),Qo(i)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:l,borderStyleDropdown:a,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new ye.LabelView(e);o.text=t("Background");const n=dt({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor}),i=new ye.LabeledFieldView(e,n);return i.set({label:t("Color"),class:"ck-table-properties-form__background"}),i.fieldView.bind("value").to(this,"backgroundColor"),i.fieldView.on("input",(()=>{this.backgroundColor=i.fieldView.value})),{backgroundRowLabel:o,backgroundInput:i}}_createDimensionFields(){const e=this.locale,t=this.t,o=new ye.LabelView(e);o.text=t("Dimensions");const n=new ye.LabeledFieldView(e,ye.createLabeledInputText);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",(()=>{this.width=n.fieldView.element.value}));const i=new ye.View(e);i.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new ye.LabeledFieldView(e,ye.createLabeledInputText);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",(()=>{this.height=r.fieldView.element.value})),{dimensionsLabel:o,widthInput:n,operatorLabel:i,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new ye.LabelView(e);o.text=t("Alignment");const n=new ye.ToolbarView(e);return n.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),at({view:this,icons:Xo,toolbar:n,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:o,alignmentToolbar:n}}_createActionButtons(){const t=this.locale,o=this.t,n=new ye.ButtonView(t),i=new ye.ButtonView(t),r=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:o("Save"),icon:e.icons.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(r,"errorText",((...e)=>e.every((e=>!e)))),i.set({label:o("Cancel"),icon:e.icons.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left"),n=t("Center table"),i=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:i,center:n,left:o}:{left:o,center:n,right:i}}}function Qo(e){return"none"!==e}const en={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class tn extends e.Plugin{constructor(e){super(e),this.view=null,e.config.define("table.tableProperties",{borderColors:ct,backgroundColors:ct})}static get requires(){return[ye.ContextualBalloon]}static get pluginName(){return"TablePropertiesUI"}init(){const e=this.editor,t=e.t;this._defaultTableProperties=bo(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(ye.ContextualBalloon),e.ui.componentFactory.add("tableProperties",(o=>{const n=new ye.ButtonView(o);n.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",(()=>this._showView()));const i=Object.values(en).map((t=>e.commands.get(t)));return n.bind("isEnabled").toMany(i,"isEnabled",((...e)=>e.some((e=>e)))),n}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),o=(0,ye.normalizeColorOptions)(t.borderColors),n=(0,ye.getLocalizedColorOptions)(e.locale,o),i=(0,ye.normalizeColorOptions)(t.backgroundColors),r=(0,ye.getLocalizedColorOptions)(e.locale,i),l=new Yo(e.locale,{borderColors:n,backgroundColors:r,defaultTableProperties:this._defaultTableProperties}),s=e.t;l.render(),this.listenTo(l,"submit",(()=>{this._hideView()})),this.listenTo(l,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),l.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),(0,ye.clickOutsideHandler)({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const a=ot(s),c=nt(s);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableBorderColor",errorText:a,validator:it})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableBorderWidth",errorText:c,validator:lt})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableBackgroundColor",errorText:a,validator:it})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableWidth",errorText:c,validator:rt})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableHeight",errorText:c,validator:rt})),l.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),l}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(en).map((([t,o])=>{const n=t,i=this._defaultTableProperties[n]||"";return[n,e.get(o).value||i]})).forEach((([e,o])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,o)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:oo(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;Ke(e.editing.view.document.selection)?this._isViewVisible&&to(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,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:o,validator:n,errorText:i}=e,r=Yt((()=>{o.errorText=i}),500);return(e,i,l)=>{r.cancel(),this._isReady&&(n(l)?(this.editor.execute(t,{value:l,batch:this._undoStepBatch}),o.errorText=null):r())}}}class on extends e.Plugin{static get pluginName(){return"TableProperties"}static get requires(){return[Ko,tn]}}function nn(e){e.document.registerPostFixer((t=>function(e,t){const o=t.document.differ.getChanges();let n=!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 i="table"==t.name?t.position.nodeAfter:o,r=Array.from(i.getChildren()).filter((e=>e.is("element","caption"))),l=r.shift();if(!l)continue;for(const t of r)e.move(e.createRangeIn(t),l,"end"),e.remove(t);l.nextSibling&&(e.move(e.createRangeOn(l),i,"end"),n=!0),n=!!r.length||n}}return n}(t,e)))}function rn(e){return!!e&&e.is("element","table")}function ln(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function sn(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}function an(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}class cn extends e.Command{refresh(){const e=an(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?this.value=!!ln(e):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,n=an(o.document.selection),i=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||e.createElement("caption");o.insertContent(i,n,"end"),t&&e.setSelection(i,"in")}_hideTableCaption(e){const t=this.editor.model,o=an(t.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),i=ln(o);n._saveCaption(o,i),t.deleteContent(e.createSelection(i,"on"))}}class dn extends e.Plugin{constructor(e){super(e),this._savedCaptionsMap=new WeakMap}static get pluginName(){return"TableCaptionEditing"}init(){const e=this.editor,o=e.model.schema,n=e.editing.view,i=e.t;o.isRegistered("caption")?o.extend("caption",{allowIn:"table"}):o.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new cn(this.editor)),e.conversion.for("upcast").elementToElement({view:sn,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>rn(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:o})=>{if(!rn(e.parent))return null;const r=o.createEditableElement("figcaption");return o.setCustomProperty("tableCaption",!0,r),(0,je.enablePlaceholder)({view:n,element:r,text:i("Enter table caption"),keepOnFocus:!0}),(0,t.toWidgetEditable)(r,o)}}),nn(e.model)}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?je.Element.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class un extends e.Plugin{static get pluginName(){return"TableCaptionUI"}init(){const t=this.editor,o=t.editing.view,n=t.t;t.ui.componentFactory.add("toggleTableCaption",(i=>{const r=t.commands.get("toggleTableCaption"),l=new ye.ButtonView(i);return l.set({icon:e.icons.caption,tooltip:!0,isToggleable:!0}),l.bind("isOn","isEnabled").to(r,"value","isEnabled"),l.bind("label").to(r,"value",(e=>n(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(l,"execute",(()=>{if(t.execute("toggleTableCaption",{focusCaptionOnShow:!0}),r.value){const e=function(e){const t=an(e);return t?ln(t):null}(t.model.document.selection),n=t.editing.mapper.toViewElement(e);if(!n)return;o.scrollToTheSelection(),o.change((e=>{e.addClass("table__caption_highlighted",n)}))}t.editing.view.focus()})),l}))}}var hn=o(665),bn={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(hn.Z,bn);hn.Z.locals;class mn extends e.Plugin{static get pluginName(){return"TableCaption"}static get requires(){return[dn,un]}}const gn=function(){this.__data__=[],this.size=0};const pn=function(e,t){return e===t||e!=e&&t!=t};const fn=function(e,t){for(var o=e.length;o--;)if(pn(e[o][0],t))return o;return-1};var wn=Array.prototype.splice;const _n=function(e){var t=this.__data__,o=fn(t,e);return!(o<0)&&(o==t.length-1?t.pop():wn.call(t,o,1),--this.size,!0)};const vn=function(e){var t=this.__data__,o=fn(t,e);return o<0?void 0:t[o][1]};const kn=function(e){return fn(this.__data__,e)>-1};const Cn=function(e,t){var o=this.__data__,n=fn(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};function yn(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}yn.prototype.clear=gn,yn.prototype.delete=_n,yn.prototype.get=vn,yn.prototype.has=kn,yn.prototype.set=Cn;const Tn=yn;const An=function(){this.__data__=new Tn,this.size=0};const xn=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o};const Sn=function(e){return this.__data__.get(e)};const Vn=function(e){return this.__data__.has(e)};const Rn=function(e){if(!Tt(e))return!1;var t=Ht(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const In=St["__core-js_shared__"];var En,Pn=(En=/[^.]+$/.exec(In&&In.keys&&In.keys.IE_PROTO||""))?"Symbol(src)_1."+En:"";const zn=function(e){return!!Pn&&Pn in e};var Bn=Function.prototype.toString;const On=function(e){if(null!=e){try{return Bn.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var Ln=/^\[object .+?Constructor\]$/,jn=Function.prototype,Fn=Object.prototype,Wn=jn.toString,Nn=Fn.hasOwnProperty,Dn=RegExp("^"+Wn.call(Nn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Hn=function(e){return!(!Tt(e)||zn(e))&&(Rn(e)?Dn:Ln).test(On(e))};const Mn=function(e,t){return null==e?void 0:e[t]};const Un=function(e,t){var o=Mn(e,t);return Hn(o)?o:void 0};const $n=Un(St,"Map");const Zn=Un(Object,"create");const Kn=function(){this.__data__=Zn?Zn(null):{},this.size=0};const Gn=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var qn=Object.prototype.hasOwnProperty;const Jn=function(e){var t=this.__data__;if(Zn){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return qn.call(t,e)?t[e]:void 0};var Xn=Object.prototype.hasOwnProperty;const Yn=function(e){var t=this.__data__;return Zn?void 0!==t[e]:Xn.call(t,e)};const Qn=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Zn&&void 0===t?"__lodash_hash_undefined__":t,this};function ei(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}ei.prototype.clear=Kn,ei.prototype.delete=Gn,ei.prototype.get=Jn,ei.prototype.has=Yn,ei.prototype.set=Qn;const ti=ei;const oi=function(){this.size=0,this.__data__={hash:new ti,map:new($n||Tn),string:new ti}};const ni=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const ii=function(e,t){var o=e.__data__;return ni(t)?o["string"==typeof t?"string":"hash"]:o.map};const ri=function(e){var t=ii(this,e).delete(e);return this.size-=t?1:0,t};const li=function(e){return ii(this,e).get(e)};const si=function(e){return ii(this,e).has(e)};const ai=function(e,t){var o=ii(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this};function ci(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}ci.prototype.clear=oi,ci.prototype.delete=ri,ci.prototype.get=li,ci.prototype.has=si,ci.prototype.set=ai;const di=ci;const ui=function(e,t){var o=this.__data__;if(o instanceof Tn){var n=o.__data__;if(!$n||n.length<199)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new di(n)}return o.set(e,t),this.size=o.size,this};function hi(e){var t=this.__data__=new Tn(e);this.size=t.size}hi.prototype.clear=An,hi.prototype.delete=xn,hi.prototype.get=Sn,hi.prototype.has=Vn,hi.prototype.set=ui;const bi=hi;const mi=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const gi=function(e){return this.__data__.has(e)};function pi(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new di;++t<o;)this.add(e[t])}pi.prototype.add=pi.prototype.push=mi,pi.prototype.has=gi;const fi=pi;const wi=function(e,t){for(var o=-1,n=null==e?0:e.length;++o<n;)if(t(e[o],o,e))return!0;return!1};const _i=function(e,t){return e.has(t)};const vi=function(e,t,o,n,i,r){var l=1&o,s=e.length,a=t.length;if(s!=a&&!(l&&a>s))return!1;var c=r.get(e),d=r.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,b=2&o?new fi:void 0;for(r.set(e,t),r.set(t,e);++u<s;){var m=e[u],g=t[u];if(n)var p=l?n(g,m,u,t,e,r):n(m,g,u,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(b){if(!wi(t,(function(e,t){if(!_i(b,t)&&(m===e||i(m,e,o,n,r)))return b.push(t)}))){h=!1;break}}else if(m!==g&&!i(m,g,o,n,r)){h=!1;break}}return r.delete(e),r.delete(t),h};const ki=St.Uint8Array;const Ci=function(e){var t=-1,o=Array(e.size);return e.forEach((function(e,n){o[++t]=[n,e]})),o};const yi=function(e){var t=-1,o=Array(e.size);return e.forEach((function(e){o[++t]=e})),o};var Ti=zt?zt.prototype:void 0,Ai=Ti?Ti.valueOf:void 0;const xi=function(e,t,o,n,i,r,l){switch(o){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new ki(e),new ki(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return pn(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Ci;case"[object Set]":var a=1&n;if(s||(s=yi),e.size!=t.size&&!a)return!1;var c=l.get(e);if(c)return c==t;n|=2,l.set(e,t);var d=vi(s(e),s(t),n,i,r,l);return l.delete(e),d;case"[object Symbol]":if(Ai)return Ai.call(e)==Ai.call(t)}return!1};const Si=function(e,t){for(var o=-1,n=t.length,i=e.length;++o<n;)e[i+o]=t[o];return e};const Vi=Array.isArray;const Ri=function(e,t,o){var n=t(e);return Vi(e)?n:Si(n,o(e))};const Ii=function(e,t){for(var o=-1,n=null==e?0:e.length,i=0,r=[];++o<n;){var l=e[o];t(l,o,e)&&(r[i++]=l)}return r};const Ei=function(){return[]};var Pi=Object.prototype.propertyIsEnumerable,zi=Object.getOwnPropertySymbols;const Bi=zi?function(e){return null==e?[]:(e=Object(e),Ii(zi(e),(function(t){return Pi.call(e,t)})))}:Ei;const Oi=function(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n};const Li=function(e){return Mt(e)&&"[object Arguments]"==Ht(e)};var ji=Object.prototype,Fi=ji.hasOwnProperty,Wi=ji.propertyIsEnumerable;const Ni=Li(function(){return arguments}())?Li:function(e){return Mt(e)&&Fi.call(e,"callee")&&!Wi.call(e,"callee")};const Di=function(){return!1};var Hi="object"==typeof exports&&exports&&!exports.nodeType&&exports,Mi=Hi&&"object"==typeof module&&module&&!module.nodeType&&module,Ui=Mi&&Mi.exports===Hi?St.Buffer:void 0;const $i=(Ui?Ui.isBuffer:void 0)||Di;var Zi=/^(?:0|[1-9]\d*)$/;const Ki=function(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&Zi.test(e))&&e>-1&&e%1==0&&e<t};const Gi=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var qi={};qi["[object Float32Array]"]=qi["[object Float64Array]"]=qi["[object Int8Array]"]=qi["[object Int16Array]"]=qi["[object Int32Array]"]=qi["[object Uint8Array]"]=qi["[object Uint8ClampedArray]"]=qi["[object Uint16Array]"]=qi["[object Uint32Array]"]=!0,qi["[object Arguments]"]=qi["[object Array]"]=qi["[object ArrayBuffer]"]=qi["[object Boolean]"]=qi["[object DataView]"]=qi["[object Date]"]=qi["[object Error]"]=qi["[object Function]"]=qi["[object Map]"]=qi["[object Number]"]=qi["[object Object]"]=qi["[object RegExp]"]=qi["[object Set]"]=qi["[object String]"]=qi["[object WeakMap]"]=!1;const Ji=function(e){return Mt(e)&&Gi(e.length)&&!!qi[Ht(e)]};const Xi=function(e){return function(t){return e(t)}};var Yi="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qi=Yi&&"object"==typeof module&&module&&!module.nodeType&&module,er=Qi&&Qi.exports===Yi&&At.process,tr=function(){try{var e=Qi&&Qi.require&&Qi.require("util").types;return e||er&&er.binding&&er.binding("util")}catch(e){}}();var or=tr&&tr.isTypedArray;const nr=or?Xi(or):Ji;var ir=Object.prototype.hasOwnProperty;const rr=function(e,t){var o=Vi(e),n=!o&&Ni(e),i=!o&&!n&&$i(e),r=!o&&!n&&!i&&nr(e),l=o||n||i||r,s=l?Oi(e.length,String):[],a=s.length;for(var c in e)!t&&!ir.call(e,c)||l&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ki(c,a))||s.push(c);return s};var lr=Object.prototype;const sr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||lr)};const ar=function(e,t){return function(o){return e(t(o))}}(Object.keys,Object);var cr=Object.prototype.hasOwnProperty;const dr=function(e){if(!sr(e))return ar(e);var t=[];for(var o in Object(e))cr.call(e,o)&&"constructor"!=o&&t.push(o);return t};const ur=function(e){return null!=e&&Gi(e.length)&&!Rn(e)};const hr=function(e){return ur(e)?rr(e):dr(e)};const br=function(e){return Ri(e,hr,Bi)};var mr=Object.prototype.hasOwnProperty;const gr=function(e,t,o,n,i,r){var l=1&o,s=br(e),a=s.length;if(a!=br(t).length&&!l)return!1;for(var c=a;c--;){var d=s[c];if(!(l?d in t:mr.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var b=!0;r.set(e,t),r.set(t,e);for(var m=l;++c<a;){var g=e[d=s[c]],p=t[d];if(n)var f=l?n(p,g,d,t,e,r):n(g,p,d,e,t,r);if(!(void 0===f?g===p||i(g,p,o,n,r):f)){b=!1;break}m||(m="constructor"==d)}if(b&&!m){var w=e.constructor,_=t.constructor;w==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(b=!1)}return r.delete(e),r.delete(t),b};const pr=Un(St,"DataView");const fr=Un(St,"Promise");const wr=Un(St,"Set");const _r=Un(St,"WeakMap");var vr="[object Map]",kr="[object Promise]",Cr="[object Set]",yr="[object WeakMap]",Tr="[object DataView]",Ar=On(pr),xr=On($n),Sr=On(fr),Vr=On(wr),Rr=On(_r),Ir=Ht;(pr&&Ir(new pr(new ArrayBuffer(1)))!=Tr||$n&&Ir(new $n)!=vr||fr&&Ir(fr.resolve())!=kr||wr&&Ir(new wr)!=Cr||_r&&Ir(new _r)!=yr)&&(Ir=function(e){var t=Ht(e),o="[object Object]"==t?e.constructor:void 0,n=o?On(o):"";if(n)switch(n){case Ar:return Tr;case xr:return vr;case Sr:return kr;case Vr:return Cr;case Rr:return yr}return t});const Er=Ir;var Pr="[object Arguments]",zr="[object Array]",Br="[object Object]",Or=Object.prototype.hasOwnProperty;const Lr=function(e,t,o,n,i,r){var l=Vi(e),s=Vi(t),a=l?zr:Er(e),c=s?zr:Er(t),d=(a=a==Pr?Br:a)==Br,u=(c=c==Pr?Br:c)==Br,h=a==c;if(h&&$i(e)){if(!$i(t))return!1;l=!0,d=!1}if(h&&!d)return r||(r=new bi),l||nr(e)?vi(e,t,o,n,i,r):xi(e,t,a,o,n,i,r);if(!(1&o)){var b=d&&Or.call(e,"__wrapped__"),m=u&&Or.call(t,"__wrapped__");if(b||m){var g=b?e.value():e,p=m?t.value():t;return r||(r=new bi),i(g,p,o,n,r)}}return!!h&&(r||(r=new bi),gr(e,t,o,n,i,r))};const jr=function e(t,o,n,i,r){return t===o||(null==t||null==o||!Mt(t)&&!Mt(o)?t!=t&&o!=o:Lr(t,o,n,i,e,r))};const Fr=function(e,t){return jr(e,t)};const Wr=function(e,t,o){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Tt(o)&&(n="leading"in o?!!o.leading:n,i="trailing"in o?!!o.trailing:i),Yt(e,t,{leading:n,maxWait:t,trailing:i})},Nr=5,Dr=2;function Hr(e,t){return 4e3/Mr(e,t)}function Mr(e,t){const o=Ur(e,"tbody",t)||Ur(e,"thead",t);return $r(t.editing.view.domConverter.mapViewToDom(o))}function Ur(e,t,o){return[...[...o.editing.mapper.toViewElement(e).getChildren()].find((e=>e.is("element","table"))).getChildren()].find((e=>e.is("element",t)))}function $r(e){const t=_.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 Zr(e){const t=Math.pow(10,Dr),o="number"==typeof e?e:parseFloat(e);return Math.round(o*t)/t}function Kr(e){return e.map((e=>"number"==typeof e?e:parseFloat(e))).filter((e=>!Number.isNaN(e))).reduce(((e,t)=>e+t),0)}function Gr(e){let t=function(e){const t=e.filter((e=>"auto"===e)).length;if(0===t)return e.map((e=>Zr(e)));const o=Kr(e),n=Math.max((100-o)/t,Nr);return e.map((e=>"auto"===e?n:e)).map((e=>Zr(e)))}(e.map((e=>"auto"===e?e:parseFloat(e.replace("%","")))));const o=Kr(t);return 100!==o&&(t=t.map((e=>Zr(100*e/o))).map(((e,t,o)=>{if(!(t===o.length-1))return e;return Zr(e+100-Kr(o))}))),t.map((e=>e+"%"))}function qr(e){const t=_.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 Jr(e,t,o,n){for(let i=0;i<Math.max(o.length,e.length);i++){const r=e[i],l=o[i];l?r?n.setAttribute("columnWidth",l,r):n.appendElement("tableColumn",{columnWidth:l},t):n.remove(r)}}function Xr(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find((e=>e.is("element","tableColumnGroup")))}function Yr(e){return Array.from(Xr(e).getChildren())}function Qr(e){return Yr(e).map((e=>e.getAttribute("columnWidth")))}class el extends e.Command{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:o}=this.editor;let{table:n=t.document.selection.getSelectedElement(),columnWidths:i,tableWidth:r}=e;i&&(i=Array.isArray(i)?i:i.split(",")),t.change((e=>{r?e.setAttribute("tableWidth",r,n):e.removeAttribute("tableWidth",n);const t=o.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!i&&!t)return;if(!i)return e.remove(t);const l=Gr(i);if(t)Array.from(t.getChildren()).forEach(((t,o)=>e.setAttribute("columnWidth",l[o],t)));else{const t=e.createElement("tableColumnGroup");l.forEach((o=>e.appendElement("tableColumn",{columnWidth:o},t))),e.append(t,n)}}))}}class tl extends e.Plugin{constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new((0,_.DomEmitterMixin)()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",((t,o,n)=>{const i=n?"removeClass":"addClass";e.editing.view.change((t=>{for(const o of e.editing.view.document.roots)t[i]("ck-column-resize_disabled",e.editing.view.document.getRoot(o.rootName))}))}))}static get requires(){return[ke,J]}static get pluginName(){return"TableColumnResizeEditing"}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 el(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 Xr(e)}getTableColumnElements(e){return Yr(e)}getTableColumnsWidths(e){return Qr(e)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth"],isLimit:!0})}_registerPostFixer(){const e=this.editor.model;function t(e,t,o){const n=o._tableUtilsPlugin.getColumns(t);if(0===n-e.length)return e;const i=e.map((e=>Number(e.replace("%","")))),r=function(e,t){const o=new Set;for(const n of e.getChanges())if("insert"==n.type&&n.position.nodeAfter&&"tableCell"==n.position.nodeAfter.name&&n.position.nodeAfter.getAncestors().includes(t))o.add(n.position.nodeAfter);else if("remove"==n.type){const e=n.position.nodeBefore||n.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&o.add(e)}return o}(o.editor.model.document.differ,t);for(const e of r){const r=n-i.length;if(0===r)continue;const s=r>0,a=o._tableUtilsPlugin.getCellLocation(e).column;if(s){const e=Hr(t,o.editor),n=(l=e,Array(r).fill(l));i.splice(a,0,...n)}else{const e=i.splice(a,Math.abs(r));i[a]+=Kr(e)}}var l;return i.map((e=>e+"%"))}e.document.registerPostFixer((o=>{let n=!1;for(const i of function(e){const t=new Set;for(const o of e.document.differ.getChanges()){let n=null;switch(o.type){case"insert":n=["table","tableRow","tableCell"].includes(o.name)?o.position:null;break;case"remove":n=["tableRow","tableCell"].includes(o.name)?o.position:null;break;case"attribute":o.range.start.nodeAfter&&(n=["table","tableRow","tableCell"].includes(o.range.start.nodeAfter.name)?o.range.start:null)}if(!n)continue;const i=n.nodeAfter&&n.nodeAfter.is("element","table")?n.nodeAfter:n.findAncestor("table");for(const o of e.createRangeOn(i).getItems())o.is("element","table")&&Xr(o)&&t.add(o)}return t}(e)){const e=this.getColumnGroupElement(i),r=this.getTableColumnElements(e),l=this.getTableColumnsWidths(e);let s=Gr(l);s=t(s,i,this),Fr(l,s)||(Jr(r,e,s,o),n=!0)}return n}))}_registerConverters(){const e=this.editor.conversion;var t;e.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:e=>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((e=>e.on("insert:table",((e,t,o)=>{const n=o.writer,i=t.item,r=o.mapper.toViewElement(i),l=r.is("element","table")?r:Array.from(r.getChildren()).find((e=>e.is("element","table")));Xr(i)?n.addClass("ck-table-resized",l):n.removeClass("ck-table-resized",l)}),{priority:"low"}))),e.for("upcast").add((t=this._tableUtilsPlugin,e=>e.on("element:colgroup",((e,o,n)=>{const i=o.modelCursor.findAncestor("table"),r=Xr(i);if(!r)return;const l=Yr(r);let s=Qr(r);const a=t.getColumns(i);s=Array.from({length:a},((e,t)=>s[t]||"auto")),(s.length!=l.length||s.includes("auto"))&&Jr(l,r,Gr(s),n.writer)}),{priority:"low"}))),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&t.endsWith("%")?t:"auto"}}}),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(Fe),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(_.global.window.document,"mousemove",Wr(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(_.global.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(e,t){const o=t.target;if(!o.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const n=this.editor,i=n.editing.mapper.toModelElement(o.findAncestor("figure"));if(!n.model.canEditAt(i))return;t.preventDefault(),e.stop();const r=function(e,t,o){const n=Array(t.getColumns(e)),i=new y(e);for(const e of i){const t=o.editing.mapper.toViewElement(e.cell),i=qr(o.editing.view.domConverter.mapViewToDom(t));(!n[e.column]||i<n[e.column])&&(n[e.column]=Zr(i))}return n}(i,this._tableUtilsPlugin,n),l=o.findAncestor("table"),s=n.editing.view;Array.from(l.getChildren()).find((e=>e.is("element","colgroup")))||s.change((e=>{!function(e,t,o){const n=e.createContainerElement("colgroup");for(let o=0;o<t.length;o++){const i=e.createEmptyElement("col"),r=`${Zr(t[o]/Kr(t)*100)}%`;e.setStyle("width",r,i),e.insert(e.createPositionAt(n,"end"),i)}e.insert(e.createPositionAt(o,0),n)}(e,r,l)})),this._isResizingActive=!0,this._resizingData=this._getResizingData(t,r),s.change((e=>function(e,t,o){const n=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",`${Zr(100*n)}%`,t.findAncestor("figure"))}(e,l,this._resizingData)))}_onMouseMoveHandler(e,t){if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:o,flags:{isRightEdge:n,isTableCentered:i,isLtrContent:r},elements:{viewFigure:l,viewLeftColumn:s,viewRightColumn:a},widths:{viewFigureParentWidth:c,tableWidth:d,leftColumnWidth:u,rightColumnWidth:h}}=this._resizingData,b=40-u,m=n?c-d:h-40,g=(r?1:-1)*(n&&i?2:1),p=(f=(t.clientX-o)*g,w=Math.min(b,0),_=Math.max(m,0),Zr(f<=w?w:f>=_?_:f));var f,w,_;0!==p&&this.editor.editing.view.change((e=>{const t=Zr(100*(u+p)/d);if(e.setStyle("width",`${t}%`,s),n){const t=Zr(100*(d+p)/c);e.setStyle("width",`${t}%`,l)}else{const t=Zr(100*(h-p)/d);e.setStyle("width",`${t}%`,a)}}))}_onMouseUpHandler(){if(!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:o,viewColgroup:n}=this._resizingData.elements,i=this.editor,r=i.editing.view,l=this.getColumnGroupElement(t),s=Array.from(n.getChildren()).filter((e=>e.is("view:element"))),a=l?this.getTableColumnsWidths(l):null,c=s.map((e=>e.getStyle("width"))),d=!Fr(a,c),u=t.getAttribute("tableWidth"),h=o.getStyle("width"),b=u!==h;(d||b)&&(this._isResizingAllowed?i.execute("resizeTableWidth",{table:t,tableWidth:`${Zr(h)}%`,columnWidths:c}):r.change((e=>{if(a)for(const t of s)e.setStyle("width",a.shift(),t);else e.remove(n);b&&(u?e.setStyle("width",u,o):e.removeStyle("width",o)),a||u||e.removeClass("ck-table-resized",[...o.getChildren()].find((e=>"table"===e.name)))}))),r.change((t=>{t.removeClass("ck-table-column-resizer__active",e)})),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const o=this.editor,n=e.domEvent.clientX,i=e.target,r=i.findAncestor("td")||i.findAncestor("th"),l=o.editing.mapper.toModelElement(r),s=l.findAncestor("table"),a=function(e,t){const o=t.getCellLocation(e).column;return{leftEdge:o,rightEdge:o+(e.getAttribute("colspan")||1)-1}}(l,this._tableUtilsPlugin).rightEdge,c=a===this._tableUtilsPlugin.getColumns(s)-1,d=!s.hasAttribute("tableAlignment"),u="rtl"!==o.locale.contentLanguageDirection,h=r.findAncestor("table"),b=h.findAncestor("figure"),m=[...h.getChildren()].find((e=>e.is("element","colgroup"))),g=m.getChild(a),p=c?void 0:m.getChild(a+1);return{columnPosition:n,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:u},elements:{viewResizer:i,modelTable:s,viewFigure:b,viewColgroup:m,viewLeftColumn:g,viewRightColumn:p},widths:{viewFigureParentWidth:$r(o.editing.view.domConverter.mapViewToDom(b.parent)),viewFigureWidth:$r(o.editing.view.domConverter.mapViewToDom(b)),tableWidth:Mr(s,o),leftColumnWidth:t[a],rightColumnWidth:c?void 0:t[a+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add((e=>{e.on("insert:tableCell",((e,t,o)=>{const n=t.item,i=o.mapper.toViewElement(n),r=o.writer;r.insert(r.createPositionAt(i,"end"),r.createUIElement("div",{class:"ck-table-column-resizer"}))}),{priority:"lowest"})}))}}var ol=o(975),nl={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};we()(ol.Z,nl);ol.Z.locals;class il extends e.Plugin{static get requires(){return[tl,wo]}static get pluginName(){return"TableColumnResize"}}})(),(window.CKEditor5=window.CKEditor5||{}).table=n})();
\No newline at end of file