/*! * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ !function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0 of %1","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",Aquamarine:"Aquamarine",Background:"Background",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold",Border:"Border","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"Bulleted list styles toolbar",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Cell properties":"Cell properties","Center table":"Center table","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Circle:"Circle",Code:"Code",Color:"Color","Color picker":"Color picker",Column:"Column",Dashed:"Dashed",Decimal:"Decimal","Decimal with leading zero":"Decimal with leading zero","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions",Disc:"Disc","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","Full size image":"Full size image",Green:"Green",Grey:"Grey",Groove:"Groove","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6",Height:"Height","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar",Huge:"Huge","Image resize list":"Image resize list","Image toolbar":"Image toolbar","image widget":"image widget","Increase indent":"Increase indent","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Inset:"Inset",Italic:"Italic","Justify cell text":"Justify cell text","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link URL":"Link URL","Lower-latin":"Lower-latin","Lower–roman":"Lower–roman","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",Next:"Next",None:"None","Numbered List":"Numbered List","Numbered list styles toolbar":"Numbered list styles toolbar","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Plain text":"Plain text",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","Resize image":"Resize image","Resize image to %0":"Resize image to %0","Resize image to the original size":"Resize image to the original size","Rich Text Editor, %0":"Rich Text Editor, %0",Ridge:"Ridge","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Side image":"Side image",Small:"Small",Solid:"Solid","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Square:"Square",Strikethrough:"Strikethrough",Style:"Style",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alternative":"Text alternative",'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".',"This link has no URL":"This link has no URL",Tiny:"Tiny","To-do List":"To-do List","Toggle the circle list style":"Toggle the circle list style","Toggle the decimal list style":"Toggle the decimal list style","Toggle the decimal with leading zero list style":"Toggle the decimal with leading zero list style","Toggle the disc list style":"Toggle the disc list style","Toggle the lower–latin list style":"Toggle the lower–latin list style","Toggle the lower–roman list style":"Toggle the lower–roman list style","Toggle the square list style":"Toggle the square list style","Toggle the upper–latin list style":"Toggle the upper–latin list style","Toggle the upper–roman list style":"Toggle the upper–roman list style",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Upper-latin":"Upper-latin","Upper-roman":"Upper-roman","Vertical text alignment toolbar":"Vertical text alignment toolbar",White:"White","Widget toolbar":"Widget toolbar",Width:"Width",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BalloonEditor=t():e.BalloonEditor=t()}(window,(function(){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=132)}([function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"c",(function(){return n})),i.d(t,"b",(function(){return r}));class o extends Error{constructor(e,t,i){super(`${e}${i?" "+JSON.stringify(i):""}${s(e)}`),this.name="CKEditorError",this.context=t,this.data=i}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new o(e.message,t);throw i.stack=e.stack,i}}function n(e,t){console.warn(...a(e,t))}function r(e,t){console.error(...a(e,t))}function s(e){return"\nRead more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-"+e}function a(e,t){const i=s(e);return t?[e,t,i]:[e,i]}},function(e,t,i){"use strict";var o,n=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),s=[];function a(e){for(var t=-1,i=0;i*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,t,i){var o=i(1),n=i(30);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);width:100%;height:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}"},function(e,t,i){var o=i(1),n=i(32);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;z-index:var(--ck-z-modal);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{top:100%;bottom:auto}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}.ck.ck-toolbar .ck-dropdown__panel{z-index:calc(var(--ck-z-modal) + 1)}:root{--ck-dropdown-arrow-size:calc(var(--ck-icon-size)*0.5)}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-dropdown__button_label-width_auto .ck-button__label{width:auto}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}"},function(e,t,i){var o=i(1),n=i(34);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-list{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{list-style-type:none;background:var(--ck-color-list-background)}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{min-height:unset;width:100%;text-align:left;border-radius:0;padding:calc(var(--ck-line-height-base)*0.2*var(--ck-font-size-base)) calc(var(--ck-line-height-base)*0.4*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(var(--ck-line-height-base)*1.2*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,t,i){var o=i(1),n=i(36);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:calc(var(--ck-switch-button-toggle-width) - var(--ck-switch-button-toggle-inner-size) - var(--ck-switch-button-toggle-spacing)*2)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(var(--ck-spacing-large)*2)}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(var(--ck-spacing-large)*2)}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{transition:background .4s ease;width:var(--ck-switch-button-toggle-width);background:var(--ck-color-switch-button-off-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(var(--ck-border-radius)*0.5)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{margin:var(--ck-switch-button-toggle-spacing);width:var(--ck-switch-button-toggle-inner-size);height:var(--ck-switch-button-toggle-inner-size);background:var(--ck-color-switch-button-inner-background);transition:all .3s ease}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var(--ck-switch-button-translation))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(var(--ck-switch-button-translation)*-1))}"},function(e,t,i){var o=i(1),n=i(38);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-toolbar-dropdown-max-width:60vw}.ck.ck-toolbar-dropdown .ck-dropdown__panel{width:max-content;max-width:var(--ck-toolbar-dropdown-max-width)}.ck.ck-toolbar-dropdown .ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}"},function(e,t,i){var o=i(1),n=i(40);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,i){var o=i(1),n=i(42);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row nowrap;align-items:center}.ck.ck-toolbar>.ck-toolbar__items{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar .ck-toolbar__line-break{flex-basis:100%}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);padding:0 var(--ck-spacing-small);border:1px solid var(--ck-color-toolbar-border)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;background:var(--ck-color-toolbar-border);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar .ck-toolbar__line-break{height:0}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break){margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break),.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-right:var(--ck-spacing-small)}"},function(e,t,i){var o=i(1),n=i(44);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-placeholder:before,.ck .ck-placeholder:before{content:attr(data-placeholder);pointer-events:none}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-placeholder:before,.ck .ck-placeholder:before{cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(e,t,i){var o=i(1),n=i(46);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-editable-blur-selection:#d9d9d9}.ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0}.ck.ck-editor__editable_inline{overflow:auto;padding:0 var(--ck-spacing-standard);border:1px solid transparent}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-editor__editable_inline.ck-blurred ::selection{background:var(--ck-color-editable-blur-selection)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,t){e.exports=".ck-content code{background-color:hsla(0,0%,78%,.3);padding:.15em;border-radius:2px}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}"},function(e,t,i){var o=i(1),n=i(49);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:5px solid #ccc}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}"},function(e,t){e.exports=".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}"},function(e,t,i){var o=i(1),n=i(52);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck .ck-widget .ck-widget__type-around__button{display:block;position:absolute;overflow:hidden;z-index:var(--ck-z-default)}.ck .ck-widget .ck-widget__type-around__button svg{position:absolute;top:50%;left:50%;z-index:calc(var(--ck-z-default) + 2)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_before{top:calc(var(--ck-widget-outline-thickness)*-0.5);left:min(10%,30px);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(var(--ck-widget-outline-thickness)*-0.5);right:min(10%,30px);transform:translateY(50%)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{content:"";display:block;position:absolute;top:1px;left:1px;z-index:calc(var(--ck-z-default) + 1)}.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:none;position:absolute;left:0;right:0}.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__fake-caret{left:calc(var(--ck-widget-outline-thickness)*-1);right:calc(var(--ck-widget-outline-thickness)*-1)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck.ck-editor__editable.ck-read-only .ck-widget__type-around,.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around,.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around{display:none}:root{--ck-widget-type-around-button-size:20px;--ck-color-widget-type-around-button-active:var(--ck-color-focus-border);--ck-color-widget-type-around-button-hover:var(--ck-color-widget-hover-border);--ck-color-widget-type-around-button-blurred-editable:var(--ck-color-widget-blurred-border);--ck-color-widget-type-around-button-radar-start-alpha:0;--ck-color-widget-type-around-button-radar-end-alpha:.3;--ck-color-widget-type-around-button-icon:var(--ck-color-base-background)}.ck .ck-widget .ck-widget__type-around__button{width:var(--ck-widget-type-around-button-size);height:var(--ck-widget-type-around-button-size);background:var(--ck-color-widget-type-around-button);border-radius:100px;transition:opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);opacity:0;pointer-events:none}.ck .ck-widget .ck-widget__type-around__button svg{width:10px;height:8px;transform:translate(-50%,-50%);transition:transform .5s ease;margin-top:1px}.ck .ck-widget .ck-widget__type-around__button svg *{stroke-dasharray:10;stroke-dashoffset:0;fill:none;stroke:var(--ck-color-widget-type-around-button-icon);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}.ck .ck-widget .ck-widget__type-around__button svg line{stroke-dasharray:7}.ck .ck-widget .ck-widget__type-around__button:hover{animation:ck-widget-type-around-button-sonar 1s ease infinite}.ck .ck-widget .ck-widget__type-around__button:hover svg polyline{animation:ck-widget-type-around-arrow-dash 2s linear}.ck .ck-widget .ck-widget__type-around__button:hover svg line{animation:ck-widget-type-around-arrow-tip-dash 2s linear}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:1;pointer-events:auto}.ck .ck-widget:not(.ck-widget_selected)>.ck-widget__type-around>.ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button-hover)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover{background:var(--ck-color-widget-type-around-button-active)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{width:calc(var(--ck-widget-type-around-button-size) - 2px);height:calc(var(--ck-widget-type-around-button-size) - 2px);border-radius:100px;background:linear-gradient(135deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3))}.ck .ck-widget.ck-widget_with-selection-handle>.ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:20px}.ck .ck-widget .ck-widget__type-around__fake-caret{pointer-events:none;height:1px;animation:ck-widget-type-around-fake-caret-pulse 1s linear infinite normal forwards;outline:1px solid hsla(0,0%,100%,.5);background:var(--ck-color-base-text)}.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_after,.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_before{outline-color:transparent}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected:hover,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:0}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer{opacity:0}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:0;margin-right:20px}.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover){background:var(--ck-color-widget-type-around-button-blurred-editable)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover) svg *{stroke:#999}@keyframes ck-widget-type-around-arrow-dash{0%{stroke-dashoffset:10}20%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-arrow-tip-dash{0%,20%{stroke-dashoffset:7}40%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-button-sonar{0%{box-shadow:0 0 0 0 hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}50%{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-end-alpha))}to{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}}@keyframes ck-widget-type-around-fake-caret-pulse{0%{opacity:1}49%{opacity:1}50%{opacity:0}99%{opacity:0}to{opacity:1}}'},function(e,t,i){var o=i(1),n=i(54);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-resizer-size:10px;--ck-resizer-border-width:1px;--ck-resizer-border-radius:2px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-tooltip-offset:10px;--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2}.ck .ck-widget,.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);color:var(--ck-color-resizer-tooltip-text);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);font-size:var(--ck-font-size-tiny);display:block;padding:var(--ck-spacing-small)}.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{top:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{top:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-width:var(--ck-widget-outline-thickness);outline-style:solid;outline-color:transparent;transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;background-color:var(--ck-color-widget-editable-focus-background)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{padding:4px;box-sizing:border-box;background-color:transparent;opacity:0;transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;transform:translateY(-100%);left:calc(0px - var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{width:var(--ck-widget-handler-icon-size);height:var(--ck-widget-handler-icon-size);color:var(--ck-color-widget-drag-handler-icon-color)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck.ck-editor__editable.ck-read-only .ck-widget{transition:none}.ck.ck-editor__editable.ck-read-only .ck-widget:not(.ck-widget_selected){--ck-widget-outline-thickness:0px}.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle:hover,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}"},function(e,t,i){var o=i(1),n=i(56);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,t,i){var o=i(1),n=i(58);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{display:flex;position:relative}.ck.ck-labeled-field-view .ck.ck-label{display:block;position:absolute}:root{--ck-labeled-field-view-transition:.1s cubic-bezier(0,0,0.24,0.95);--ck-labeled-field-empty-unfocused-max-width:100% - 2 * var(--ck-spacing-medium);--ck-color-labeled-field-label-background:var(--ck-color-base-background)}.ck.ck-labeled-field-view{border-radius:0}.ck-rounded-corners .ck.ck-labeled-field-view,.ck.ck-labeled-field-view.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{width:100%}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{top:0}[dir=ltr] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{left:0}[dir=rtl] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{right:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{pointer-events:none;transform-origin:0 0;transform:translate(var(--ck-spacing-medium),-6px) scale(.75);background:var(--ck-color-labeled-field-label-background);padding:0 calc(var(--ck-font-size-tiny)*0.5);line-height:normal;font-weight:400;text-overflow:ellipsis;overflow:hidden;max-width:100%;transition:transform var(--ck-labeled-field-view-transition),padding var(--ck-labeled-field-view-transition),background var(--ck-labeled-field-view-transition)}.ck.ck-labeled-field-view.ck-error .ck-input:not([readonly])+.ck.ck-label,.ck.ck-labeled-field-view.ck-error>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view .ck-labeled-field-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-field-view .ck-labeled-field-view__status.ck-labeled-field-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-input-disabled-text)}[dir=ltr] .ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=ltr] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(var(--ck-spacing-medium),calc(var(--ck-font-size-base)*0.6)) scale(1)}[dir=rtl] .ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=rtl] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(calc(var(--ck-spacing-medium)*-1),calc(var(--ck-font-size-base)*0.6)) scale(1)}.ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width));background:transparent;padding:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck.ck-button{background:transparent}.ck.ck-labeled-field-view.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck-button>.ck-button__label{opacity:0}.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown+.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width) - var(--ck-dropdown-arrow-size) - var(--ck-spacing-standard))}"},function(e,t,i){var o=i(1),n=i(60);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-input-text-width:18em}.ck.ck-input-text{border-radius:0}.ck-rounded-corners .ck.ck-input-text,.ck.ck-input-text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-text{background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);min-width:var(--ck-input-text-width);min-height:var(--ck-ui-component-min-height);transition:box-shadow .1s ease-in-out,border .1s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),0 0}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,i){var o=i(1),n=i(62);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-field-view{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}"},function(e,t){e.exports='.ck-vertical-form .ck-button:after{content:"";width:0;position:absolute;right:-1px;top:var(--ck-spacing-small);bottom:var(--ck-spacing-small);z-index:1}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{content:"";width:0;position:absolute;right:-1px;top:var(--ck-spacing-small);bottom:var(--ck-spacing-small);z-index:1}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-text-width)*0.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-large);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after,[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}'},function(e,t,i){var o=i(1),n=i(65);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:1em auto}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:50px}"},function(e,t,i){var o=i(1),n=i(67);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}"},function(e,t,i){var o=i(1),n=i(69);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing);max-width:50%}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}"},function(e,t,i){var o=i(1),n=i(71);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-editor__editable .image{position:relative}.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image .ck-progress-bar{height:2px;width:0;background:var(--ck-color-upload-bar-background);transition:width .1s}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"},function(e,t,i){var o=i(1),n=i(73);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:10px;right:10px;border-radius:50%}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20px;--ck-image-upload-icon-width:2px}.ck-image-upload-complete-icon{width:var(--ck-image-upload-icon-size);height:var(--ck-image-upload-icon-size);opacity:0;background:var(--ck-color-image-upload-icon-background);animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;animation-fill-mode:forwards,forwards;animation-duration:.5s,.5s;font-size:var(--ck-image-upload-icon-size);animation-delay:0ms,3s}.ck-image-upload-complete-icon:after{left:25%;top:50%;opacity:0;height:0;width:0;transform:scaleX(-1) rotate(135deg);transform-origin:left top;border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);animation-name:ck-upload-complete-icon-check;animation-duration:.5s;animation-delay:.5s;animation-fill-mode:forwards;box-sizing:border-box}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{opacity:1;width:0;height:0}33%{width:.3em;height:0}to{opacity:1;width:.3em;height:.45em}}'},function(e,t,i){var o=i(1),n=i(75);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck .ck-upload-placeholder-loader{position:absolute;display:flex;align-items:center;justify-content:center;top:0;left:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px}.ck .ck-image-upload-placeholder{width:100%;margin:0}.ck .ck-upload-placeholder-loader{width:100%;height:100%}.ck .ck-upload-placeholder-loader:before{width:var(--ck-upload-placeholder-loader-size);height:var(--ck-upload-placeholder-loader-size);border-radius:50%;border-top:3px solid var(--ck-color-upload-placeholder-loader);border-right:2px solid transparent;animation:ck-upload-placeholder-loader 1s linear infinite}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}'},function(e,t,i){var o=i(1),n=i(77);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-widget_with-resizer{position:relative}.ck .ck-widget__resizer{display:none;position:absolute;pointer-events:none;left:0;top:0;outline:1px solid var(--ck-color-resizer)}.ck-focused .ck-widget_with-resizer.ck-widget_selected>.ck-widget__resizer{display:block}.ck .ck-widget__resizer__handle{position:absolute;pointer-events:all;width:var(--ck-resizer-size);height:var(--ck-resizer-size);background:var(--ck-color-focus-border);border:var(--ck-resizer-border-width) solid #fff;border-radius:var(--ck-resizer-border-radius)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{top:var(--ck-resizer-offset);left:var(--ck-resizer-offset);cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{top:var(--ck-resizer-offset);right:var(--ck-resizer-offset);cursor:nesw-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right{bottom:var(--ck-resizer-offset);right:var(--ck-resizer-offset);cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left{bottom:var(--ck-resizer-offset);left:var(--ck-resizer-offset);cursor:nesw-resize}"},function(e,t,i){var o=i(1),n=i(79);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image.image_resized{max-width:100%;display:block;box-sizing:border-box}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}"},function(e,t,i){var o=i(1),n=i(81);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{height:100%;border-right:1px solid var(--ck-color-base-text);margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}"},function(e,t,i){var o=i(1),n=i(83);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form_layout-vertical .ck-button.ck-button-cancel,.ck.ck-link-form_layout-vertical .ck-button.ck-button-save{margin-top:var(--ck-spacing-medium)}.ck.ck-link-form_layout-vertical{padding:0;min-width:var(--ck-input-text-width)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{padding:var(--ck-spacing-standard);margin:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button,[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin:var(--ck-spacing-standard) var(--ck-spacing-large)}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;padding:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,i){var o=i(1),n=i(85);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{min-width:0;max-width:100%}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview),[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}}"},function(e,t,i){var o=i(1),n=i(87);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-splitbutton{font-size:inherit}.ck.ck-splitbutton .ck-splitbutton__action:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button .ck-tooltip{display:none}:root{--ck-color-split-button-hover-background:#ebebeb;--ck-color-split-button-hover-border:#b3b3b3}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__action{border-top-right-radius:unset;border-bottom-right-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__action{border-top-left-radius:unset;border-bottom-left-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow{min-width:unset}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-radius:0}.ck-rounded-corners [dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow,[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:unset;border-bottom-left-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-right-radius:unset;border-bottom-right-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow svg{width:var(--ck-dropdown-arrow-size)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover),.ck.ck-splitbutton:hover>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover){background:var(--ck-color-split-button-hover-background)}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-left-color:var(--ck-color-split-button-hover-border)}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-right-color:var(--ck-color-split-button-hover-border)}.ck.ck-splitbutton.ck-splitbutton_open{border-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__action{border-bottom-left-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__arrow{border-bottom-right-radius:0}"},function(e,t,i){var o=i(1),n=i(89);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items{display:grid}:root{--ck-list-style-button-size:44px}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar{background:none;padding:0}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items{grid-template-columns:repeat(3,auto);row-gap:var(--ck-spacing-medium);column-gap:var(--ck-spacing-medium);padding:var(--ck-spacing-medium)}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items .ck-button{width:var(--ck-list-style-button-size);height:var(--ck-list-style-button-size);padding:0;margin:0;box-sizing:content-box}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items .ck-button .ck-icon{width:var(--ck-list-style-button-size);height:var(--ck-list-style-button-size)}"},function(e,t,i){var o=i(1),n=i(91);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-todo-list-checkmark-size:16px}.ck-content .todo-list{list-style:none}.ck-content .todo-list li{margin-bottom:5px}.ck-content .todo-list li .todo-list{margin-top:5px}.ck-content .todo-list .todo-list__label>input{-webkit-appearance:none;display:inline-block;position:relative;width:var(--ck-todo-list-checkmark-size);height:var(--ck-todo-list-checkmark-size);vertical-align:middle;border:0;left:-25px;margin-right:-15px;right:0;margin-left:0}.ck-content .todo-list .todo-list__label>input:before{display:block;position:absolute;box-sizing:border-box;content:"";width:100%;height:100%;border:1px solid #333;border-radius:2px;transition:box-shadow .25s ease-in-out,background .25s ease-in-out,border .25s ease-in-out}.ck-content .todo-list .todo-list__label>input:after{display:block;position:absolute;box-sizing:content-box;pointer-events:none;content:"";left:calc(var(--ck-todo-list-checkmark-size)/3);top:calc(var(--ck-todo-list-checkmark-size)/5.3);width:calc(var(--ck-todo-list-checkmark-size)/5.3);height:calc(var(--ck-todo-list-checkmark-size)/2.6);border-left:0 solid transparent;border-bottom:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-right:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-top:0 solid transparent;transform:rotate(45deg)}.ck-content .todo-list .todo-list__label>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-content .todo-list .todo-list__label>input[checked]:after{border-color:#fff}.ck-content .todo-list .todo-list__label .todo-list__label__description{vertical-align:middle}[dir=rtl] .todo-list .todo-list__label>input{left:0;margin-right:0;right:-25px;margin-left:-15px}.ck-editor__editable .todo-list .todo-list__label>input{cursor:pointer}.ck-editor__editable .todo-list .todo-list__label>input:hover:before{box-shadow:0 0 0 5px rgba(0,0,0,.1)}'},function(e,t,i){var o=i(1),n=i(93);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-table-focused-cell-background:rgba(158,207,250,0.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}"},function(e,t,i){var o=i(1),n=i(95);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".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{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);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-color-base-border);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-color-focus-border);background:var(--ck-color-focus-outer-shadow)}"},function(e,t,i){var o=i(1),n=i(97);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-table-selected-cell-background:rgba(158,207,250,0.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{position:relative;caret-color:transparent;outline:unset;box-shadow:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{content:"";pointer-events:none;background-color:var(--ck-table-selected-cell-background);position:absolute;top:0;left:0;right:0;bottom: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_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget_selected{outline:unset}'},function(e,t,i){var o=i(1),n=i(99);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .table{margin:1em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border:1px solid #bfbfbf}.ck-content .table table th{font-weight:700;background:hsla(0,0%,0%,5%)}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}"},function(e,t,i){var o=i(1),n=i(101);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{width:var(--ck-color-grid-tile-size);height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;border:0}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{display:none;color:var(--ck-color-color-grid-check-icon)}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(103);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-input-color{width:100%;display:flex;flex-direction:row-reverse}.ck.ck-input-color>input.ck.ck-input-text{min-width:auto;flex-grow:1}.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 .ck.ck-input-color__button__preview{position:relative;overflow:hidden}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{position:absolute;display:block}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-top-left-radius:0;border-bottom-left-radius: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-left-width:0;border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-right-width:0;border-top-right-radius:0;border-bottom-right-radius:0}.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{width:20px;height:20px;border:1px solid var(--ck-color-input-border)}.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{top:-30%;left:50%;height:150%;width:8%;background:red;border-radius:2px;transform:rotate(45deg);transform-origin:50%}.ck.ck-input-color .ck.ck-input-color__remove-color{width:100%;border-bottom:1px solid var(--ck-color-input-border);padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}[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-right:0;margin-left:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(105);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".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{width:100%;min-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)}"},function(e,t,i){var o=i(1),n=i(107);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-form__header{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:space-between}:root{--ck-form-header-height:38px}.ck.ck-form__header{padding:var(--ck-spacing-small) var(--ck-spacing-large);height:var(--ck-form-header-height);line-height:var(--ck-form-header-height);border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-form__header .ck-form__header__label{font-weight:700}"},function(e,t){e.exports=".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%}"},function(e,t){e.exports='.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{flex-wrap:wrap;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse;align-items:center}.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{position:absolute;left:50%;bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;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{width:80px;min-width:80px;max-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);padding:var(--ck-spacing-small) var(--ck-spacing-medium);min-width:var(--ck-table-properties-min-error-width);text-align:center}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-left:var(--ck-table-properties-error-arrow-size) solid transparent;border-bottom:var(--ck-table-properties-error-arrow-size) solid var(--ck-color-base-error);border-right:var(--ck-table-properties-error-arrow-size) solid transparent;border-top:0 solid transparent}.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}}'},function(e,t,i){var o=i(1),n=i(111);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{flex-wrap:wrap;flex-basis:0;align-content:baseline}.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}"},function(e,t,i){var o=i(1),n=i(113);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".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)}"},function(e,t,i){var o=i(1),n=i(115);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-block-toolbar-button{position:absolute;z-index:var(--ck-z-default)}:root{--ck-color-block-toolbar-button:var(--ck-color-text);--ck-block-toolbar-button-size:var(--ck-font-size-normal)}.ck.ck-block-toolbar-button{color:var(--ck-color-block-toolbar-button);font-size:var(--ck-block-toolbar-size)}"},function(e,t,i){var o=i(1),n=i(117);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-button.ck-color-table__remove-color{display:flex;align-items:center;width:100%}label.ck.ck-color-grid__label{font-weight:unset}.ck .ck-button.ck-color-table__remove-color{padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck .ck-button.ck-color-table__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-base-border)}[dir=ltr] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(119);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}"},function(e,t,i){var o=i(1),n=i(121);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content pre{padding:1em;color:#353535;background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}.ck-content pre code{background:unset;padding:0;border-radius:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{top:-1px;right:10px;background:var(--ck-color-code-block-label-background);font-size:10px;font-family:var(--ck-font-face);line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);color:#fff;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-y:auto;overflow-x:hidden}"},function(e,t,i){var o=i(1),n=i(123);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-mention-list-max-height:300px}.ck.ck-mentions{max-height:var(--ck-mention-list-max-height);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.ck.ck-mentions>.ck-list__item{overflow:hidden;flex-shrink:0}"},function(e,t,i){var o=i(1),n=i(125);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-mention-background:rgba(153,0,48,0.1);--ck-color-mention-text:#990030}.ck-content .mention{background:var(--ck-color-mention-background);color:var(--ck-color-mention-text)}"},function(e,t,i){var o=i(1),n=i(127);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-editor__editable .ck-horizontal-line{display:flow-root}.ck-content hr{margin:15px 0;height:4px;background:#dedede;border:0}"},function(e,t,i){var o=i(1),n=i(129);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-labeled-input .ck-labeled-input__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-input .ck-labeled-input__status_error{color:var(--ck-color-base-error)}"},function(e,t,i){var o=i(1),n=i(131);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-math-form{display:flex;align-items:flex-start;flex-direction:row;flex-wrap:nowrap}@media screen and (max-width:600px){.ck.ck-math-form{flex-wrap:wrap}.ck.ck-math-form .ck-math-view,.ck.ck-math-form .ck-math-view .ck-label,.ck.ck-math-form .ck-math-view .ck-labeled-input{flex-basis:100%}.ck.ck-math-form .ck-button{flex-basis:50%}}.ck-math-tex.ck-placeholder:before{display:none!important}.ck.ck-toolbar-container{z-index:calc(var(--ck-z-modal) + 2)}.ck.ck-math-form{padding:var(--ck-spacing-standard)}.ck.ck-math-form:focus{outline:none}[dir=ltr] .ck.ck-math-form>:not(:first-child),[dir=rtl] .ck.ck-math-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-math-form{padding:0}.ck.ck-math-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-math-form .ck-label,.ck.ck-math-form .ck-math-view .ck-button,.ck.ck-math-form .ck-math-view .ck.ck-math-preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form>.ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-math-form>.ck-button{margin-left:0}[dir=ltr] .ck.ck-math-form>.ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-math-form>.ck-button{margin-left:0}[dir=rtl] .ck.ck-math-form>.ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return Gv}));var o=i(3),n=o.a.Symbol,r=Object.prototype,s=r.hasOwnProperty,a=r.toString,l=n?n.toStringTag:void 0;var c=function(e){var t=s.call(e,l),i=e[l];try{e[l]=void 0;var o=!0}catch(e){}var n=a.call(e);return o&&(t?e[l]=i:delete e[l]),n},d=Object.prototype.toString;var h=function(e){return d.call(e)},u=n?n.toStringTag:void 0;var m=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?c(e):h(e)};var g=function(e,t){return function(i){return e(t(i))}},f=g(Object.getPrototypeOf,Object);var p=function(e){return null!=e&&"object"==typeof e},b=Function.prototype,w=Object.prototype,k=b.toString,_=w.hasOwnProperty,v=k.call(Object);var y=function(e){if(!p(e)||"[object Object]"!=m(e))return!1;var t=f(e);if(null===t)return!0;var i=_.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&k.call(i)==v};var x=function(){this.__data__=[],this.size=0};var C=function(e,t){return e===t||e!=e&&t!=t};var A=function(e,t){for(var i=e.length;i--;)if(C(e[i][0],t))return i;return-1},T=Array.prototype.splice;var P=function(e){var t=this.__data__,i=A(t,e);return!(i<0)&&(i==t.length-1?t.pop():T.call(t,i,1),--this.size,!0)};var S=function(e){var t=this.__data__,i=A(t,e);return i<0?void 0:t[i][1]};var E=function(e){return A(this.__data__,e)>-1};var R=function(e,t){var i=this.__data__,o=A(i,e);return o<0?(++this.size,i.push([e,t])):i[o][1]=t,this};function V(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},He={};He["[object Float32Array]"]=He["[object Float64Array]"]=He["[object Int8Array]"]=He["[object Int16Array]"]=He["[object Int32Array]"]=He["[object Uint8Array]"]=He["[object Uint8ClampedArray]"]=He["[object Uint16Array]"]=He["[object Uint32Array]"]=!0,He["[object Arguments]"]=He["[object Array]"]=He["[object ArrayBuffer]"]=He["[object Boolean]"]=He["[object DataView]"]=He["[object Date]"]=He["[object Error]"]=He["[object Function]"]=He["[object Map]"]=He["[object Number]"]=He["[object Object]"]=He["[object RegExp]"]=He["[object Set]"]=He["[object String]"]=He["[object WeakMap]"]=!1;var je=function(e){return p(e)&&Le(e.length)&&!!He[m(e)]};var We=function(e){return function(t){return e(t)}},qe=i(5),$e=qe.a&&qe.a.isTypedArray,Ue=$e?We($e):je,Ke=Object.prototype.hasOwnProperty;var Ge=function(e,t){var i=Ne(e),o=!i&&Me(e),n=!i&&!o&&Object(Be.a)(e),r=!i&&!o&&!n&&Ue(e),s=i||o||n||r,a=s?Re(e.length,String):[],l=a.length;for(var c in e)!t&&!Ke.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||De(c,l))||a.push(c);return a},Je=Object.prototype;var Ye=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Je)},Qe=g(Object.keys,Object),Xe=Object.prototype.hasOwnProperty;var Ze=function(e){if(!Ye(e))return Qe(e);var t=[];for(var i in Object(e))Xe.call(e,i)&&"constructor"!=i&&t.push(i);return t};var et=function(e){return null!=e&&Le(e.length)&&!D(e)};var tt=function(e){return et(e)?Ge(e):Ze(e)};var it=function(e,t){return e&&Ee(t,tt(t),e)};var ot=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t},nt=Object.prototype.hasOwnProperty;var rt=function(e){if(!B(e))return ot(e);var t=Ye(e),i=[];for(var o in e)("constructor"!=o||!t&&nt.call(e,o))&&i.push(o);return i};var st=function(e){return et(e)?Ge(e,!0):rt(e)};var at=function(e,t){return e&&Ee(t,st(t),e)},lt=i(8);var ct=function(e,t){var i=-1,o=e.length;for(t||(t=Array(o));++i{this._setToTarget(e,o,t[o],i)})}}function ri(e){return ii(e,si)}function si(e){return oi(e)?e:void 0}var ai=function(){return function e(){e.called=!0}};class li{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=ai(),this.off=ai()}}const ci=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function di(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,i=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+ci[e>>0&255]+ci[e>>8&255]+ci[e>>16&255]+ci[e>>24&255]+ci[t>>0&255]+ci[t>>8&255]+ci[t>>16&255]+ci[t>>24&255]+ci[i>>0&255]+ci[i>>8&255]+ci[i>>16&255]+ci[i>>24&255]+ci[o>>0&255]+ci[o>>8&255]+ci[o>>16&255]+ci[o>>24&255]}var hi={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},ui=(i(6),i(0));const mi=Symbol("listeningTo"),gi=Symbol("emitterId");var fi={on(e,t,i={}){this.listenTo(this,e,t,i)},once(e,t,i){let o=!1;this.listenTo(this,e,(function(e,...i){o||(o=!0,e.off(),t.call(this,e,...i))}),i)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,i,o={}){let n,r;this[mi]||(this[mi]={});const s=this[mi];bi(e)||pi(e);const a=bi(e);(n=s[a])||(n=s[a]={emitter:e,callbacks:{}}),(r=n.callbacks[t])||(r=n.callbacks[t]=[]),r.push(i),function(e,t){const i=wi(e);if(i[t])return;let o=t,n=null;const r=[];for(;""!==o&&!i[o];)i[o]={callbacks:[],childEvents:[]},r.push(i[o]),n&&i[o].childEvents.push(n),n=o,o=o.substr(0,o.lastIndexOf(":"));if(""!==o){for(const e of r)e.callbacks=i[o].callbacks.slice();i[o].childEvents.push(n)}}(e,t);const l=ki(e,t),c=hi.get(o.priority),d={callback:i,priority:c};for(const e of l){let t=!1;for(let i=0;i-1?e(t,i.substr(0,i.lastIndexOf(":"))):null;return o.callbacks}(this,o);if(i.path.push(this),n){const e=[i,...t];n=Array.from(n);for(let t=0;t{this._delegations||(this._delegations=new Map),e.forEach(e=>{const o=this._delegations.get(e);o?o.set(t,i):this._delegations.set(e,new Map([[t,i]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const i=this._delegations.get(e);i&&i.delete(t)}else this._delegations.delete(e);else this._delegations.clear()}};function pi(e,t){e[gi]||(e[gi]=t||di())}function bi(e){return e[gi]}function wi(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function ki(e,t){const i=wi(e)[t];if(!i)return[];let o=[i.callbacks];for(let t=0;t{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(i=>{if(i in e.prototype)return;const o=Object.getOwnPropertyDescriptor(t,i);o.enumerable=!1,Object.defineProperty(e.prototype,i,o)})})}class Ci{constructor(e={},t={}){const i=yi(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new ui.a("collection-add-item-invalid-index",this);for(let i=0;i{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(t=>e(t)):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(i,o,n)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(o);if(r&&s)this._bindToExternalToInternalMap.set(o,s),this._bindToInternalToExternalMap.set(s,o);else{const i=e(o);if(!i)return void this._skippedIndexesFromExternal.push(n);let r=n;for(const e of this._skippedIndexesFromExternal)n>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(o,i),this._bindToInternalToExternalMap.set(i,o),this.add(i,r);for(let e=0;e{const o=this._bindToExternalToInternalMap.get(t);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(it&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],"string"!=typeof i)throw new ui.a("collection-add-invalid-id",this);if(this.get(i))throw new ui.a("collection-add-item-already-exists",this)}else e[t]=i=di();return i}_remove(e){let t,i,o,n=!1;const r=this._idProperty;if("string"==typeof e?(i=e,o=this._itemMap.get(i),n=!o,o&&(t=this._items.indexOf(o))):"number"==typeof e?(t=e,o=this._items[t],n=!o,o&&(i=o[r])):(o=e,i=o[r],t=this._items.indexOf(o),n=-1==t||!this._itemMap.get(i)),n)throw new ui.a("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const s=this._bindToInternalToExternalMap.get(o);return this._bindToInternalToExternalMap.delete(o),this._bindToExternalToInternalMap.delete(s),this.fire("remove",o,t),[o,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}xi(Ci,fi);class Ai{constructor(e,t=[],i=[]){this._context=e,this._plugins=new Map,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of i)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new ui.a("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[]){const i=this,o=this._context,n=new Set,r=[],s=u(e),a=u(t),l=function(e){const t=[];for(const i of e)h(i)||t.push(i);return t.length?t:null}(e);if(l){const e="plugincollection-plugin-not-found";return Object(ui.b)(e,{plugins:l}),Promise.reject(new ui.a(e,o,{plugins:l}))}return Promise.all(s.map(c)).then(()=>d(r,"init")).then(()=>d(r,"afterInit")).then(()=>r);function c(e){if(!a.includes(e)&&!i._plugins.has(e)&&!n.has(e))return function(e){return new Promise(s=>{n.add(e),e.requires&&e.requires.forEach(i=>{const n=h(i);if(e.isContextPlugin&&!n.isContextPlugin)throw new ui.a("plugincollection-context-required",null,{plugin:n.name,requiredBy:e.name});if(t.includes(n))throw new ui.a("plugincollection-required",o,{plugin:n.name,requiredBy:e.name});c(n)});const a=i._contextPlugins.get(e)||new e(o);i._add(e,a),r.push(a),s()})}(e).catch(t=>{throw Object(ui.b)("plugincollection-load",{plugin:e}),t})}function d(e,t){return e.reduce((e,o)=>o[t]?i._contextPlugins.has(o)?e:e.then(o[t].bind(o)):e,Promise.resolve())}function h(e){return"function"==typeof e?e:i._availablePlugins.get(e)}function u(e){return e.map(e=>h(e)).filter(e=>!!e)}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new ui.a("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}function Ti(e){return Array.isArray(e)?e:[e]}function Pi(e,t,i=1){if("number"!=typeof i)throw new ui.a("translation-service-quantity-not-a-number",null,{quantity:i});const o=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===o&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const n=t.id||t.string;if(0===o||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,n))return 1!==i?t.plural:t.string;const r=window.CKEDITOR_TRANSLATIONS[e].dictionary,s=window.CKEDITOR_TRANSLATIONS[e].getPluralForm||(e=>1===e?0:1);if("string"==typeof r[n])return r[n];const a=Number(s(i));return r[n][a]}xi(Ai,fi),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const Si=["ar","fa","he","ku","ug"];class Ei{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=Ri(this.uiLanguage),this.contentLanguageDirection=Ri(this.contentLanguage),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=Ti(t),"string"==typeof e&&(e={string:e});const i=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,i)=>ie.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new ui.a("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}function Ii(e,t){const i=Math.min(e.length,t.length);for(let o=0;oe.data.length)throw new ui.a("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new ui.a("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;null!==i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}}function Bi(e){return yi(e)?new Map(e):function(e){const t=new Map;for(const i in e)t.set(i,e[i]);return t}(e)}class Fi{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),t.classes&&("string"==typeof t.classes||t.classes instanceof RegExp)&&(t.classes=[t.classes]),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const i=Di(t,e);if(i)return{element:t,pattern:e,match:i}}return null}matchAll(...e){const t=[];for(const i of e)for(const e of this._patterns){const o=Di(i,e);o&&t.push({element:i,pattern:e,match:o})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function Di(e,t){if("function"==typeof t)return t(e);const i={};return t.name&&(i.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!i.name)||t.attributes&&(i.attributes=function(e,t){const i=[];for(const o in e){const n=e[o];if(!t.hasAttribute(o))return null;{const e=t.getAttribute(o);if(!0===n)i.push(o);else if(n instanceof RegExp){if(!n.test(e))return null;i.push(o)}else{if(e!==n)return null;i.push(o)}}}return i}(t.attributes,e),!i.attributes)?null:!(t.classes&&(i.classes=function(e,t){const i=[];for(const o of e)if(o instanceof RegExp){const e=t.getClassNames();for(const t of e)o.test(t)&&i.push(t);if(0===i.length)return null}else{if(!t.hasClass(o))return null;i.push(o)}return i}(t.classes,e),!i.classes))&&(!(t.styles&&(i.styles=function(e,t){const i=[];for(const o in e){const n=e[o];if(!t.hasStyle(o))return null;{const e=t.getStyle(o);if(n instanceof RegExp){if(!n.test(e))return null;i.push(o)}else{if(e!==n)return null;i.push(o)}}}return i}(t.styles,e),!i.styles))&&i)}var Li=function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==m(e)},Hi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ji=/^\w*$/;var Wi=function(e,t){if(Ne(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Li(e))||(ji.test(e)||!Hi.test(e)||null!=t&&e in Object(t))};function qi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var o=arguments,n=t?t.apply(this,o):o[0],r=i.cache;if(r.has(n))return r.get(n);var s=e.apply(this,o);return i.cache=r.set(n,s)||r,s};return i.cache=new(qi.Cache||_e),i}qi.Cache=_e;var $i=qi;var Ui=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ki=/\\(\\)?/g,Gi=function(e){var t=$i(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ui,(function(e,i,o,n){t.push(o?n.replace(Ki,"$1"):i||e)})),t}));var Ji=function(e,t){for(var i=-1,o=null==e?0:e.length,n=Array(o);++in?0:n+t),(i=i>n?n:i)<0&&(i+=n),n=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(n);++o0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(yo);var Ao=function(e,t){return Co(_o(e,t,bo),e+"")};var To=function(e,t,i){if(!B(i))return!1;var o=typeof t;return!!("number"==o?et(i)&&De(t,i.length):"string"==o&&t in i)&&C(i[t],e)};var Po=function(e){return Ao((function(t,i){var o=-1,n=i.length,r=n>1?i[n-1]:void 0,s=n>2?i[2]:void 0;for(r=e.length>3&&"function"==typeof r?(n--,r):void 0,s&&To(i[0],i[1],s)&&(r=n<3?void 0:r,n=1),t=Object(t);++ot===e);return Array.isArray(t)}set(e,t){if(B(e))for(const[t,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=zo(e);ao(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this._getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!B(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(){if(this.isEmpty)return[];return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const i=t.splice(0,t.length-1).join("."),o=lo(this._styles,i);if(!o)return;!Array.from(Object.keys(o)).length&&this.remove(i)}}class Io{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(B(t))Oo(i,zo(e),t);else if(this._normalizers.has(e)){const o=this._normalizers.get(e),{path:n,value:r}=o(t);Oo(i,n,r)}else Oo(i,e,t)}getNormalized(e,t){if(!e)return So({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if("string"==typeof i)return lo(t,i);const o=i(e,t);if(o)return o}return lo(t,zo(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);if(void 0===i)return[];if(this._reducers.has(e)){return this._reducers.get(e)(i)}return[[e,i]]}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function zo(e){return e.replace("-",".")}function Oo(e,t,i){let o=i;B(i)&&(o=So({},lo(e,t),i)),Ro(e,t,o)}class Mo extends Oi{constructor(e,t,i,o){if(super(e),this.name=t,this._attrs=function(e){e=Bi(e);for(const[t,i]of e)null===i?e.delete(t):"string"!=typeof i&&e.set(t,String(i));return e}(i),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");No(this._classes,e),this._attrs.delete("class")}this._styles=new Vo(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}is(e,t=null){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof Mo))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(){return this._styles.getStyleNames()}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Fi(...e);let i=this.parent;for(;i;){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==i?"":" "+i)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){if("string"==typeof t)return[new Mi(e,t)];yi(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Mi(e,t):t instanceof Ni?new Mi(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of Ti(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of Ti(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of Ti(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function No(e,t){const i=t.split(/\s+/);e.clear(),i.forEach(t=>e.add(t))}class Bo extends Mo{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=Fo}is(e,t=null){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}}function Fo(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}var Do=Po((function(e,t){Ee(t,st(t),e)}));const Lo=Symbol("observableProperties"),Ho=Symbol("boundObservables"),jo=Symbol("boundProperties"),Wo={set(e,t){if(B(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);$o(this);const i=this[Lo];if(e in this&&!i.has(e))throw new ui.a("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>i.get(e),set(t){const o=i.get(e);let n=this.fire("set:"+e,e,t,o);void 0===n&&(n=t),o===n&&i.has(e)||(i.set(e,n),this.fire("change:"+e,e,n,o))}}),this[e]=t},bind(...e){if(!e.length||!Go(e))throw new ui.a("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new ui.a("observable-bind-duplicate-properties",this);$o(this);const t=this[jo];e.forEach(e=>{if(t.has(e))throw new ui.a("observable-bind-rebind",this)});const i=new Map;return e.forEach(e=>{const o={property:e,to:[]};t.set(e,o),i.set(e,o)}),{to:Uo,toMany:Ko,_observable:this,_bindProperties:e,_to:[],_bindings:i}},unbind(...e){if(!this[Lo])return;const t=this[jo],i=this[Ho];if(e.length){if(!Go(e))throw new ui.a("observable-unbind-wrong-properties",this);e.forEach(e=>{const o=t.get(e);if(!o)return;let n,r,s,a;o.to.forEach(e=>{n=e[0],r=e[1],s=i.get(n),a=s[r],a.delete(o),a.size||delete s[r],Object.keys(s).length||(i.delete(n),this.stopListening(n,"change"))}),t.delete(e)})}else i.forEach((e,t)=>{this.stopListening(t,"change")}),i.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new ui.a("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(e,i)=>{e.return=t.apply(this,i)}),this[e]=function(...t){return this.fire(e,t)}}};Do(Wo,fi);var qo=Wo;function $o(e){e[Lo]||(Object.defineProperty(e,Lo,{value:new Map}),Object.defineProperty(e,Ho,{value:new Map}),Object.defineProperty(e,jo,{value:new Map}))}function Uo(...e){const t=function(...e){if(!e.length)throw new ui.a("observable-bind-to-parse-error",null);const t={to:[]};let i;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)i.properties.push(e);else{if("object"!=typeof e)throw new ui.a("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i)}}),t}(...e),i=Array.from(this._bindings.keys()),o=i.length;if(!t.callback&&t.to.length>1)throw new ui.a("observable-bind-to-no-callback",this);if(o>1&&t.callback)throw new ui.a("observable-bind-to-extra-callback",this);var n;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==o)throw new ui.a("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),n=this._observable,this._to.forEach(e=>{const t=n[Ho];let i;t.get(e.observable)||n.listenTo(e.observable,"change",(o,r)=>{i=t.get(e.observable)[r],i&&i.forEach(e=>{Jo(n,e.property)})})}),function(e){let t;e._bindings.forEach((i,o)=>{e._to.forEach(n=>{t=n.properties[i.callback?0:e._bindProperties.indexOf(o)],i.to.push([n.observable,t]),function(e,t,i,o){const n=e[Ho],r=n.get(i),s=r||{};s[o]||(s[o]=new Set);s[o].add(t),r||n.set(i,s)}(e._observable,i,n.observable,t)})})}(this),this._bindProperties.forEach(e=>{Jo(this._observable,e)})}function Ko(e,t,i){if(this._bindings.size>1)throw new ui.a("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map(e=>[e,t]);return Array.prototype.concat.apply([],i)}(e,t),i)}function Go(e){return e.every(e=>"string"==typeof e)}function Jo(e,t){const i=e[jo].get(t);let o;i.callback?o=i.callback.apply(e,i.to.map(e=>e[0][e[1]])):(o=i.to[0],o=o[0][o[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=o:e.set(t,o)}class Yo extends Bo{constructor(e,t,i,o){super(e,t,i,o),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}is(e,t=null){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}destroy(){this.stopListening()}}xi(Yo,qo);const Qo=Symbol("rootName");class Xo extends Yo{constructor(e,t){super(e,t),this.rootName="main"}is(e,t=null){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}get rootName(){return this.getCustomProperty(Qo)}set rootName(e){this._setCustomProperty(Qo,e)}set _name(e){this.name=e}}class Zo{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new ui.a("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new ui.a("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=en._createAt(e.startPosition):this.position=en._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(e){let t,i,o;do{o=this.position,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this.position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&e.offset===i.childCount)return{done:!0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let o;if(i instanceof Mi){if(e.isAtEnd)return this.position=en._createAfter(i),this._next();o=i.data[e.offset]}else o=i.getChild(e.offset);if(o instanceof Mo)return this.shallow?e.offset++:e=new en(o,0),this.position=e,this._formatReturnValue("elementStart",o,t,e,1);if(o instanceof Mi){if(this.singleCharacters)return e=new en(o,0),this.position=e,this._next();{let i,n=o.data.length;return o==this._boundaryEndParent?(n=this.boundaries.end.offset,i=new Ni(o,0,n),e=en._createAfter(i)):(i=new Ni(o,0,o.data.length),e.offset++),this.position=e,this._formatReturnValue("text",i,t,e,n)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{o=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset}const n=new Ni(i,e.offset,o);return e.offset+=o,this.position=e,this._formatReturnValue("text",n,t,e,o)}return e=en._createAfter(i),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&0===e.offset)return{done:!0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let o;if(i instanceof Mi){if(e.isAtStart)return this.position=en._createBefore(i),this._previous();o=i.data[e.offset-1]}else o=i.getChild(e.offset-1);if(o instanceof Mo)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",o,t,e,1)):(e=new en(o,o.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",o,t,e));if(o instanceof Mi){if(this.singleCharacters)return e=new en(o,o.data.length),this.position=e,this._previous();{let i,n=o.data.length;if(o==this._boundaryStartParent){const t=this.boundaries.start.offset;i=new Ni(o,t,o.data.length-t),n=i.data.length,e=en._createBefore(i)}else i=new Ni(o,0,o.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",i,t,e,n)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{const t=i===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-t}e.offset-=o;const n=new Ni(i,e.offset,o);return this.position=e,this._formatReturnValue("text",n,t,e,o)}return e=en._createBefore(i),this.position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,o,n){return t instanceof Ni&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?i=en._createAfter(t.textNode):(o=en._createAfter(t.textNode),this.position=o)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?i=en._createBefore(t.textNode):(o=en._createBefore(t.textNode),this.position=o))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:o,length:n}}}}class en{constructor(e,t){this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof Yo);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=en._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new Zo(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let o=0;for(;t[o]==i[o]&&t[o];)o++;return 0===o?null:t[o-1]}is(e){return"position"===e||"view:position"===e}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const o=Ii(t,i);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]0?new this(i,o):new this(o,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(en._createBefore(e),t)}}function on(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function nn(e){let t=0;for(const i of e)t++;return t}class rn{constructor(e=null,t,i){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,i)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const o of e._ranges)if(t.isEqual(o)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=nn(this.getRanges());if(t!=nn(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let i=!1;for(let o of e.getRanges())if(o=o.getTrimmed(),t.start.isEqual(o.start)&&t.end.isEqual(o.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,i){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof rn||e instanceof sn)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof tn)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof en)this._setRanges([new tn(e)]),this._setFakeOptions(t);else if(e instanceof Oi){const o=!!i&&!!i.backward;let n;if(void 0===t)throw new ui.a("view-selection-setto-required-second-parameter",this);n="in"==t?tn._createIn(e):"on"==t?tn._createOn(e):new tn(en._createAt(e,t)),this._setRanges([n],o),this._setFakeOptions(i)}else{if(!yi(e))throw new ui.a("view-selection-setto-not-selectable",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new ui.a("view-selection-setfocus-no-ranges",this);const i=en._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==i.compareWith(o)?this._addRange(new tn(i,o),!0):this._addRange(new tn(o,i)),this.fire("change")}is(e){return"selection"===e||"view:selection"===e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof tn))throw new ui.a("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new ui.a("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new tn(e.start,e.end))}}xi(rn,fi);class sn{constructor(e=null,t,i){this._selection=new rn,this._selection.delegate("change").to(this),this._selection.setTo(e,t,i)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}is(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e}_setTo(e,t,i){this._selection.setTo(e,t,i)}_setFocus(e,t){this._selection.setFocus(e,t)}}xi(sn,fi);class an{constructor(e){this.selection=new sn,this.roots=new Ci({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(t=i(e),t)break}while(t)}}xi(an,qo);class ln extends Mo{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=cn,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new ui.a("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}is(e,t=null){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function cn(){if(dn(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(dn(e)>1)return null;e=e.parent}return!e||dn(e)>1?null:this.childCount}function dn(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}ln.DEFAULT_PRIORITY=10;class hn extends Mo{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=un}is(e,t=null){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof Oi||Array.from(t).length>0))throw new ui.a("view-emptyelement-cannot-add",[this,t])}}function un(){return null}const mn=navigator.userAgent.toLowerCase();var gn={isMac:function(e){return e.indexOf("macintosh")>-1}(mn),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(mn),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(mn),isAndroid:function(e){return e.indexOf("android")>-1}(mn),isBlink:function(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}(mn),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const fn={"⌘":"ctrl","⇧":"shift","⌥":"alt"},pn={ctrl:"⌘",shift:"⇧",alt:"⌥"},bn=function(){const e={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,cmd:1114112,shift:2228224,alt:4456448};for(let t=65;t<=90;t++){const i=String.fromCharCode(t);e[i.toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return e}();function wn(e){let t;if("string"==typeof e){if(t=bn[e.toLowerCase()],!t)throw new ui.a("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?bn.alt:0)+(e.ctrlKey?bn.ctrl:0)+(e.shiftKey?bn.shift:0);return t}function kn(e){return"string"==typeof e&&(e=Cn(e)),e.map(e=>"string"==typeof e?wn(e):e).reduce((e,t)=>t+e,0)}function _n(e){return gn.isMac?Cn(e).map(e=>pn[e.toLowerCase()]||e).reduce((e,t)=>e.slice(-1)in fn?e+t:e+"+"+t):e}function vn(e){return e==bn.arrowright||e==bn.arrowleft||e==bn.arrowup||e==bn.arrowdown}function yn(e,t){const i="ltr"===t;switch(e){case bn.arrowleft:return i?"left":"right";case bn.arrowright:return i?"right":"left";case bn.arrowup:return"up";case bn.arrowdown:return"down"}}function xn(e,t){const i=yn(e,t);return"down"===i||"right"===i}function Cn(e){return e.split(/\s*\+\s*/)}class An extends Mo{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=Pn}is(e,t=null){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof Oi||Array.from(t).length>0))throw new ui.a("view-uielement-cannot-add",this)}render(e){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function Tn(e){e.document.on("keydown",(t,i)=>function(e,t,i){if(t.keyCode==bn.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),o=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(o||t.shiftKey){const t=e.focusNode,n=e.focusOffset,r=i.domPositionToView(t,n);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(s){const t=i.viewPositionToDom(a);o?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,i,e.domConverter))}function Pn(){return null}class Sn extends Mo{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=En}is(e,t=null){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof Oi||Array.from(t).length>0))throw new ui.a("view-rawelement-cannot-add",[this,t])}}function En(){return null}class Rn{constructor(e,t){this.document=e,this._children=[],t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"view:documentFragment"===e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){if("string"==typeof t)return[new Mi(e,t)];yi(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Mi(e,t):t instanceof Ni?new Mi(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i{}),o}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){y(e)&&void 0===i&&(i=t),i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof en?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new ui.a("view-writer-break-non-container-element",this.document);if(!t.parent)throw new ui.a("view-writer-break-root",this.document);if(e.isAtStart)return en._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(en._createAfter(t),i);const o=new tn(e,en._createAt(t,"end")),n=new en(i,0);this.move(o,n)}return en._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&0===i.childCount){const e=i.parent,t=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new en(e,t))}const o=i.getChild(t-1),n=i.getChild(t);if(!o||!n)return e;if(o.is("$text")&&n.is("$text"))return Nn(o,n);if(o.is("attributeElement")&&n.is("attributeElement")&&o.isSimilar(n)){const e=o.childCount;return o._appendChild(n.getChildren()),n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new en(o,e))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!(t&&i&&t.is("containerElement")&&i.is("containerElement")))throw new ui.a("view-writer-merge-containers-invalid-position",this.document);const o=t.getChild(t.childCount-1),n=o instanceof Mi?en._createAt(o,"end"):en._createAt(t,"end");return this.move(tn._createIn(i),en._createAt(t,"end")),this.remove(tn._createOn(i)),n}insert(e,t){(function e(t,i){for(const o of t){if(!Bn.some(e=>o instanceof e))throw new ui.a("view-writer-insert-invalid-node-type",i);o.is("$text")||e(o.getChildren(),i)}})(t=yi(t)?[...t]:[t],this.document);const i=In(e);if(!i)throw new ui.a("view-writer-invalid-position-container",this.document);const o=this._breakAttributes(e,!0),n=i._insertChild(o.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=o.getShiftedBy(n),s=this.mergeAttributes(o);if(0===n)return new tn(s,s);{s.isEqual(o)||r.offset--;const e=this.mergeAttributes(r);return new tn(s,e)}}remove(e){const t=e instanceof tn?e:tn._createOn(e);if(Dn(t,this.document),t.isCollapsed)return new Rn(this.document);const{start:i,end:o}=this._breakAttributesRange(t,!0),n=i.parent,r=o.offset-i.offset,s=n._removeChildren(i.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new Rn(this.document,s)}clear(e,t){Dn(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const o of i){const i=o.item;let n;if(i.is("element")&&t.isSimilar(i))n=tn._createOn(i);else if(!o.nextPosition.isAfter(e.start)&&i.is("$textProxy")){const e=i.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(n=tn._createIn(e))}n&&(n.end.isAfter(e.end)&&(n.end=e.end),n.start.isBefore(e.start)&&(n.start=e.start),this.remove(n))}}move(e,t){let i;if(t.isAfter(e.end)){const o=(t=this._breakAttributes(t,!0)).parent,n=o.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=o.childCount-n}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof ln))throw new ui.a("view-writer-wrap-invalid-attribute",this.document);if(Dn(e,this.document),e.isCollapsed){let o=e.start;o.parent.is("element")&&(i=o.parent,!Array.from(i.getChildren()).some(e=>!e.is("uiElement")))&&(o=o.getLastMatchingPosition(e=>e.item.is("uiElement"))),o=this._wrapPosition(o,t);const n=this.document.selection;return n.isCollapsed&&n.getFirstPosition().isEqual(e.start)&&this.setSelection(o),new tn(o)}return this._wrapRange(e,t);var i}unwrap(e,t){if(!(t instanceof ln))throw new ui.a("view-writer-unwrap-invalid-attribute",this.document);if(Dn(e,this.document),e.isCollapsed)return e;const{start:i,end:o}=this._breakAttributesRange(e,!0),n=i.parent,r=this._unwrapChildren(n,i.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new tn(s,a)}rename(e,t){const i=new Bo(this.document,e,t.getAttributes());return this.insert(en._createAfter(t),i),this.move(tn._createIn(t),en._createAt(i,0)),this.remove(tn._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return en._createAt(e,t)}createPositionAfter(e){return en._createAfter(e)}createPositionBefore(e){return en._createBefore(e)}createRange(e,t){return new tn(e,t)}createRangeOn(e){return tn._createOn(e)}createRangeIn(e){return tn._createIn(e)}createSelection(e,t,i){return new rn(e,t,i)}_wrapChildren(e,t,i,o){let n=t;const r=[];for(;n!1,e.parent._insertChild(e.offset,i);const o=new tn(e,e.getShiftedBy(1));this.wrap(o,t);const n=new en(i.parent,i.index);i._remove();const r=n.nodeBefore,s=n.nodeAfter;return r instanceof Mi&&s instanceof Mi?Nn(r,s):On(n)}_wrapAttributeElement(e,t){if(!Ln(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&(t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t));for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!Ln(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,o=e.end;if(Dn(e,this.document),e.isCollapsed){const i=this._breakAttributes(e.start,t);return new tn(i,i)}const n=this._breakAttributes(o,t),r=n.parent.childCount,s=this._breakAttributes(i,t);return n.offset+=n.parent.childCount-r,new tn(s,n)}_breakAttributes(e,t=!1){const i=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new ui.a("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new ui.a("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new ui.a("view-writer-cannot-break-raw-element",this.document);if(!t&&o.is("$text")&&Fn(o.parent))return e.clone();if(Fn(o))return e.clone();if(o.is("$text"))return this._breakAttributes(Mn(e),t);if(i==o.childCount){const e=new en(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===i){const e=new en(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,n=o._clone();o.parent._insertChild(e,n),this._addToClonedElementsGroup(n);const r=o.childCount-i,s=o._removeChildren(i,r);n._appendChild(s);const a=new en(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function In(e){let t=e.parent;for(;!Fn(t);){if(!t)return;t=t.parent}return t}function zn(e,t){return e.priorityt.priority)&&e.getIdentity()e.createTextNode(" "),Wn=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},qn=(()=>{let e="";for(let t=0;t<7;t++)e+="​";return e})();function $n(e){return Hn(e)&&e.data.substr(0,7)===qn}function Un(e){return 7==e.data.length&&$n(e)}function Kn(e){return $n(e)?e.data.slice(7):e.data}function Gn(e,t){if(t.keyCode==bn.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,i=e.getRangeAt(0).startOffset;$n(t)&&i<=7&&e.collapse(t,0)}}}function Jn(e,t,i,o=!1){i=i||function(e,t){return e===t},Array.isArray(e)||(e=Array.prototype.slice.call(e)),Array.isArray(t)||(t=Array.prototype.slice.call(t));const n=function(e,t,i){const o=Yn(e,t,i);if(-1===o)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const n=Qn(e,o),r=Qn(t,o),s=Yn(n,r,i),a=e.length-s,l=t.length-s;return{firstIndex:o,lastIndexOld:a,lastIndexNew:l}}(e,t,i);return o?function(e,t){const{firstIndex:i,lastIndexOld:o,lastIndexNew:n}=e;if(-1===i)return Array(t).fill("equal");let r=[];i>0&&(r=r.concat(Array(i).fill("equal")));n-i>0&&(r=r.concat(Array(n-i).fill("insert")));o-i>0&&(r=r.concat(Array(o-i).fill("delete")));n0&&i.push({index:o,type:"insert",values:e.slice(o,r)});n-o>0&&i.push({index:o+(r-o),type:"delete",howMany:n-o});return i}(t,n)}function Yn(e,t,i){for(let o=0;o200||n>200||o+n>300)return Xn.fastDiff(e,t,i,!0);let r,s;if(nc?-1:1;d[o+u]&&(d[o]=d[o+u].slice(0)),d[o]||(d[o]=[]),d[o].push(n>c?r:s);let m=Math.max(n,c),g=m-o;for(;gc;m--)h[m]=u(m);h[c]=u(c),g++}while(h[c]!==l);return d[c].slice(1)}function Zn(e,t,i){e.insertBefore(i,e.childNodes[t]||null)}function er(e){const t=e.parentNode;t&&t.removeChild(e)}function tr(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}Xn.fastDiff=Jn;class ir{constructor(e,t){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=t,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new ui.a("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){let e;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(e){const t=this.domConverter.viewPositionToDom(e),i=t.parent.ownerDocument;$n(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=or(i,t.parent,t.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=this.domConverter.mapViewToDom(e).childNodes,o=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),n=this._diffNodeLists(i,o),r=this._findReplaceActions(n,i,o);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const n of r)if("replace"===n){const n=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(n);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,i[r]),er(o[n]),t.equal++}else t[n]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?en._createBefore(this.selection.getFirstPosition().parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&Hn(t.parent)&&$n(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!$n(e))throw new ui.a("view-renderer-filler-was-lost",this);Un(e)?e.parentNode.removeChild(e):e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;if(i===t.getFillerOffset())return!1;const o=e.nodeBefore,n=e.nodeAfter;return!(o instanceof Mi||n instanceof Mi)}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e),o=this.domConverter.viewToDom(e,i.ownerDocument),n=i.data;let r=o.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=qn+r),n!=r){const e=Jn(n,r);for(const t of e)"insert"===t.type?i.insertData(t.index,t.values.join("")):i.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map(e=>e.name),o=e.getAttributeKeys();for(const i of o)t.setAttribute(i,e.getAttribute(i));for(const o of i)e.hasAttribute(o)||t.removeAttribute(o)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;const o=t.inlineFillerPosition,n=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,i.ownerDocument,{bind:!0,inlineFillerPosition:o}));o&&o.parent===e&&or(i.ownerDocument,r,o.offset);const s=this._diffNodeLists(n,r);let a=0;const l=new Set;for(const e of s)"delete"===e?(l.add(n[a]),er(n[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(Zn(i,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of l)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return Xn(e=function(e,t){const i=Array.from(e);if(0==i.length||!t)return i;i[i.length-1]==t&&i.pop();return i}(e,this._fakeSelectionContainer),t,rr.bind(null,this.domConverter))}_findReplaceActions(e,t,i){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let o=[],n=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(i[s.equal+s.insert]):"delete"===a?n.push(t[s.equal+s.delete]):(o=o.concat(Xn(n,r,nr).map(e=>"equal"===e?"replace":e)),o.push("equal"),n=[],r=[]),s[a]++;return o.concat(Xn(n,r,nr).map(e=>"equal"===e?"replace":e))}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):(this._removeFakeSelection(),this._updateDomSelection(e)))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;i.parentElement&&i.parentElement==e||e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const o=t.getSelection(),n=t.createRange();o.removeAllRanges(),n.selectNodeContents(i),o.addRange(n)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),t.collapse(i.parent,i.offset),t.extend(o.parent,o.offset),gn.isGecko&&function(e,t){const i=e.parent;if(i.nodeType!=Node.ELEMENT_NODE||e.offset!=i.childNodes.length-1)return;const o=i.childNodes[e.offset];o&&"BR"==o.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(i.anchorNode!==t&&!t.contains(i.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,i=this.domConverter.mapDomToView(t);t&&i&&e.getSelection().removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function or(e,t,i){const o=t instanceof Array?t:t.childNodes,n=o[i];if(Hn(n))return n.data=qn+n.data,n;{const n=e.createTextNode(qn);return Array.isArray(t)?o.splice(i,0,n):Zn(t,i,n),n}}function nr(e,t){return tr(e)&&tr(t)&&!Hn(e)&&!Hn(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function rr(e,t,i){return t===i||(Hn(t)&&Hn(i)?t.data===i.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(i)))}xi(ir,qo);var sr={window:window,document:document};function ar(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function lr(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const cr=Wn(document);class dr{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6","li","dd","dt","figcaption","td","th"],this._blockFiller="br"==this.blockFillerMode?Wn:jn,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Fi,this._encounteredRawContentDomNodes=new WeakSet}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new rn(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of e.childNodes)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}viewToDom(e,t,i={}){if(e.is("$text")){const i=this._processDataFromViewText(e);return t.createTextNode(i)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let o;if(e.is("documentFragment"))o=t.createDocumentFragment(),i.bind&&this.bindDocumentFragments(o,e);else{if(e.is("uiElement"))return o=e.render(t),i.bind&&this.bindElements(o,e),o;o=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(o),i.bind&&this.bindElements(o,e);for(const t of e.getAttributeKeys())o.setAttribute(t,e.getAttribute(t))}if(!1!==i.withChildren)for(const n of this.viewChildrenToDom(e,t,i))o.appendChild(n);return o}}*viewChildrenToDom(e,t,i={}){const o=e.getFillerOffset&&e.getFillerOffset();let n=0;for(const r of e.getChildren())o===n&&(yield this._blockFiller(t)),yield this.viewToDom(r,t,i),n++;o===n&&(yield this._blockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),o=document.createRange();return o.setStart(t.parent,t.offset),o.setEnd(i.parent,i.offset),o}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let o=e.offset;return $n(i)&&(o+=7),{parent:i,offset:o}}{let i,o,n;if(0===e.offset){if(i=this.mapViewToDom(t),!i)return null;n=i.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!o)return null;i=o.parentNode,n=o.nextSibling}if(Hn(n)&&$n(n))return{parent:n,offset:7};return{parent:i,offset:o?ar(o)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const i=this.getHostViewElement(e);if(i)return i;if(Hn(e)){if(Un(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new Mi(this.document,t)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let i;if(this.isDocumentFragment(e))i=new Rn(this.document),t.bind&&this.bindDocumentFragments(e,i);else{const o=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();i=new Mo(this.document,o),t.bind&&this.bindElements(e,i);const n=e.attributes;for(let e=n.length-1;e>=0;e--)i._setAttribute(n[e].name,n[e].value);if(!1!==t.withChildren&&this._rawContentElementMatcher.match(i))return i._setCustomProperty("$rawContent",e.innerHTML),this._encounteredRawContentDomNodes.add(e),i}if(!1!==t.withChildren)for(const o of this.domChildrenToView(e,t))i._appendChild(o);return i}}*domChildrenToView(e,t={}){for(let i=0;i{const{scrollLeft:t,scrollTop:i}=e;o.push([t,i])}),t.focus(),ur(t,e=>{const[t,i]=o.shift();e.scrollLeft=t,e.scrollTop=i}),sr.window.scrollTo(e,i)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(e){return e&&e.nodeType==Node.COMMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(cr):!("BR"!==e.tagName||!mr(e,this.blockElements)||1!==e.parentNode.childNodes.length)||function(e,t){return Hn(e)&&" "==e.data&&mr(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=lr(e);for(t.pop();t.length;){const e=t.pop(),i=this._domToViewMapping.get(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return i}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}_isDomSelectionPositionCorrect(e,t){if(Hn(e)&&$n(e)&&t<7)return!1;if(this.isElement(e)&&$n(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!i||!i.is("uiElement")&&!i.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return t;if(" "==t.charAt(0)){const i=this._getTouchingViewTextNode(e,!1);!(i&&this._nodeEndsWithSpace(i))&&i||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const i=this._getTouchingViewTextNode(e,!0);" "!=t.charAt(t.length-2)&&i&&" "!=i.data.charAt(0)||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(hr(e,this.preElements))return Kn(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const i=this._getTouchingInlineDomNode(e,!1),o=this._getTouchingInlineDomNode(e,!0),n=this._checkShouldLeftTrimDomText(e,i),r=this._checkShouldRightTrimDomText(e,o);return n&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=Kn(new Text(t)),t=t.replace(/ \u00A0/g," "),(/( |\u00A0)\u00A0$/.test(t)||!o||o.data&&" "==o.data.charAt(0))&&(t=t.replace(/\u00A0$/," ")),n&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(!!oi(t)||!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!$n(e)}_getTouchingViewTextNode(e,t){const i=new Zo({startPosition:t?en._createAfter(e):en._createBefore(e),direction:t?"forward":"backward"});for(const e of i){if(e.item.is("containerElement"))return null;if(e.item.is("element","br"))return null;if(e.item.is("$textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const i=t?"nextNode":"previousNode",o=e.ownerDocument,n=lr(e)[0],r=o.createTreeWalker(n,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>Hn(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});r.currentNode=e;const s=r[i]();if(null!==s){const t=function(e,t){const i=lr(e),o=lr(t);let n=0;for(;i[n]==o[n]&&i[n];)n++;return 0===n?null:i[n-1]}(e,s);if(t&&!hr(e,this.blockElements,t)&&!hr(s,this.blockElements,t))return s}return null}}function hr(e,t,i){let o=lr(e);return i&&(o=o.slice(o.indexOf(i)+1)),o.some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}function ur(e,t){for(;e&&e!=sr.document;)t(e),e=e.parentNode}function mr(e,t){const i=e.parentNode;return i&&i.tagName&&t.includes(i.tagName.toLowerCase())}function gr(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var fr=Do({},fi,{listenTo(e,...t){if(tr(e)||gr(e)){const i=this._getProxyEmitter(e)||new pr(e);i.attach(...t),e=i}fi.listenTo.call(this,e,...t)},stopListening(e,t,i){if(tr(e)||gr(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}fi.stopListening.call(this,e,t,i),e instanceof pr&&e.detach(t)},_getProxyEmitter(e){return t=this,i=br(e),t[mi]&&t[mi][i]?t[mi][i].emitter:null;var t,i}});class pr{constructor(e){pi(this,br(e)),this._domNode=e}}function br(e){return e["data-ck-expando"]||(e["data-ck-expando"]=di())}Do(pr.prototype,fi,{attach(e,t,i={}){if(this._domListeners&&this._domListeners[e])return;const o={capture:!!i.useCapture,passive:!!i.usePassive},n=this._createDomListener(e,o);this._domNode.addEventListener(e,n,o),this._domListeners||(this._domListeners={}),this._domListeners[e]=n},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const i=t=>{this.fire(e,t)};return i.removeListener=()=>{this._domNode.removeEventListener(e,i,t),delete this._domListeners[e]},i}});class wr{constructor(e){this.view=e,this.document=e.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}xi(wr,fr);var kr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var _r=function(e){return this.__data__.has(e)};function vr(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new _e;++ta))return!1;var c=r.get(e);if(c&&r.get(t))return c==t;var d=-1,h=!0,u=2&i?new yr:void 0;for(r.set(e,t),r.set(t,e);++d{this.listenTo(e,t,(e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,i){this.isEnabled&&this.document.fire(e,new Fr(this.view,t,i))}}class Lr extends Dr{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey,get keystroke(){return wn(this)}})}}var Hr=function(){return o.a.Date.now()},jr=/^\s+|\s+$/g,Wr=/^[-+]0x[0-9a-f]+$/i,qr=/^0b[01]+$/i,$r=/^0o[0-7]+$/i,Ur=parseInt;var Kr=function(e){if("number"==typeof e)return e;if(Li(e))return NaN;if(B(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=B(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(jr,"");var i=qr.test(e);return i||$r.test(e)?Ur(e.slice(2),i?2:8):Wr.test(e)?NaN:+e},Gr=Math.max,Jr=Math.min;var Yr=function(e,t,i){var o,n,r,s,a,l,c=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var i=o,r=n;return o=n=void 0,c=t,s=e.apply(r,i)}function g(e){return c=e,a=setTimeout(p,t),d?m(e):s}function f(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=r}function p(){var e=Hr();if(f(e))return b(e);a=setTimeout(p,function(e){var i=t-(e-l);return h?Jr(i,r-(e-c)):i}(e))}function b(e){return a=void 0,u&&o?m(e):(o=n=void 0,s)}function w(){var e=Hr(),i=f(e);if(o=arguments,n=this,l=e,i){if(void 0===a)return g(l);if(h)return clearTimeout(a),a=setTimeout(p,t),m(l)}return void 0===a&&(a=setTimeout(p,t)),s}return t=Kr(t)||0,B(i)&&(d=!!i.leading,r=(h="maxWait"in i)?Gr(Kr(i.maxWait)||0,t):r,u="trailing"in i?!!i.trailing:u),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=n=a=void 0},w.flush=function(){return void 0===a?s:b(Hr())},w};class Qr extends wr{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Yr(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(t,i)=>{e.selection.isFake&&vn(i.keyCode)&&this.isEnabled&&(i.preventDefault(),this._handleSelectionMove(i.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new rn(t.getRanges(),{backward:t.isBackward,fake:!1});e!=bn.arrowleft&&e!=bn.arrowup||i.setTo(i.getFirstPosition()),e!=bn.arrowright&&e!=bn.arrowdown||i.setTo(i.getLastPosition());const o={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}class Xr extends wr{constructor(e){super(e),this.mutationObserver=e.getObserver(Br),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Yr(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument;this._documents.has(t)||(this.listenTo(t,"selectionchange",(e,i)=>{this._handleSelectionChange(i,t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e,t){if(!this.isEnabled)return;const i=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(i.anchorNode))return;this.mutationObserver.flush();const o=this.domConverter.domSelectionToView(i);if(0!=o.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(o)&&this.domConverter.isDomSelectionCorrect(i)||++this._loopbackCounter>60))if(this.selection.isSimilar(o))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:o,domSelection:i};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class Zr extends Dr{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{t.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.forceRender(),50)}),t.on("blur",(i,o)=>{const n=t.selection.editableElement;null!==n&&n!==o.target||(t.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class es extends Dr{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}class ts extends Dr{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}function is(e){return"[object Range]"==Object.prototype.toString.apply(e)}function os(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}const ns=["top","right","bottom","left","width","height"];class rs{constructor(e){const t=is(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),oi(e)||t)if(t){const t=rs.getDomRangeRects(e);ss(this,rs.getBoundingRect(t))}else ss(this,e.getBoundingClientRect());else if(gr(e)){const{innerWidth:t,innerHeight:i}=e;ss(this,{top:0,right:t,bottom:i,left:0,width:t,height:i})}else ss(this,e)}clone(){return new rs(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left)};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new rs(t)}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(!as(e)){let i=e.parentNode||e.commonAncestorContainer;for(;i&&!as(i);){const e=new rs(i),o=t.getIntersection(e);if(!o)return null;o.getArea()bs(e,o));const s=bs(e,o);if(cs(o,s,t),o.parent!=o){if(n=o.frameElement,o=o.parent,!n)return}else o=null}}function cs(e,t,i){const o=t.clone().moveBy(0,i),n=t.clone().moveBy(0,-i),r=new rs(e).excludeScrollbarsAndBorders();if(![n,o].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;us(n,r)?a-=r.top-t.top+i:hs(o,r)&&(a+=t.bottom-r.bottom+i),ms(t,r)?s-=r.left-t.left+i:gs(t,r)&&(s+=t.right-r.right+i),e.scrollTo(s,a)}}function ds(e,t){const i=fs(e);let o,n;for(;e!=i.document.body;)n=t(),o=new rs(e).excludeScrollbarsAndBorders(),o.contains(n)||(us(n,o)?e.scrollTop-=o.top-n.top:hs(n,o)&&(e.scrollTop+=n.bottom-o.bottom),ms(n,o)?e.scrollLeft-=o.left-n.left:gs(n,o)&&(e.scrollLeft+=n.right-o.right)),e=e.parentNode}function hs(e,t){return e.bottom>t.bottom}function us(e,t){return e.topt.right}function fs(e){return is(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function ps(e){if(is(e)){let t=e.commonAncestorContainer;return Hn(t)&&(t=t.parentNode),t}return e.parentNode}function bs(e,t){const i=fs(e),o=new rs(e);if(i===t)return o;{let e=i;for(;e!=t;){const t=e.frameElement,i=new rs(t).excludeScrollbarsAndBorders();o.moveBy(i.left,i.top),e=e.parent}}return o}Object.assign({},{scrollViewportToShowTarget:ls,scrollAncestorsToShowTarget:function(e){ds(ps(e),()=>new rs(e))}});class ws{constructor(e){this.document=new an(e),this.domConverter=new dr(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new ir(this.domConverter,this.document.selection),this._renderer.bind("isFocused").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new Vn(this.document),this.addObserver(Br),this.addObserver(Xr),this.addObserver(Zr),this.addObserver(Lr),this.addObserver(Qr),this.addObserver(es),gn.isAndroid&&this.addObserver(ts),this.document.on("keydown",Gn),Tn(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const o={};for(const{name:t,value:n}of Array.from(e.attributes))o[t]=n,"class"===t?this._writer.addClass(n.split(" "),i):this._writer.setAttribute(t,n,i);this._initialDomRootAttributes.set(e,o);const n=()=>{this._writer.setAttribute("contenteditable",!i.isReadOnly,i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};n(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),i.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),i.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),i.on("change:isReadOnly",()=>this.change(n)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const i of this._observers.values())i.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const i=this._initialDomRootAttributes.get(t);for(const e in i)t.setAttribute(e,i[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,i]of this.domRoots)t.observe(i,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection(){const e=this.document.selection.getFirstRange();e&&ls({target:this.domConverter.viewRangeToDom(e),viewportOffset:20})}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new ui.a("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){ui.a.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return en._createAt(e,t)}createPositionAfter(e){return en._createAfter(e)}createPositionBefore(e){return en._createBefore(e)}createRange(e,t){return new tn(e,t)}createRangeOn(e){return tn._createOn(e)}createRangeIn(e){return tn._createIn(e)}createSelection(e,t,i){return new rn(e,t,i)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}xi(ws,qo);class ks{constructor(e){this.parent=null,this._attrs=Bi(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new ui.a("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new ui.a("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),o=e.getAncestors(t);let n=0;for(;i[n]==o[n]&&i[n];)n++;return 0===n?null:i[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=Ii(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o](e[t[0]]=t[1],e),{})),e}is(e){return"node"===e||"model:node"===e}_clone(){return new ks(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Bi(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class _s extends ks{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new _s(this.data,this.getAttributes())}static fromJSON(e){return new _s(e.data,e.attributes)}}class vs{constructor(e,t,i){if(this.textNode=e,t<0||t>e.offsetSize)throw new ui.a("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new ui.a("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}is(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}class ys{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce((e,t)=>e+t.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new ui.a("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&ee.toJSON())}}class xs extends ks{constructor(e,t,i){super(t),this.name=e,this._children=new ys,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,t=null){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={includeSelf:!1}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(e=>e._clone(!0)):null;return new xs(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){if("string"==typeof e)return[new _s(e)];yi(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new _s(e):e instanceof vs?new _s(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}static fromJSON(e){let t=null;if(e.children){t=[];for(const i of e.children)i.name?t.push(xs.fromJSON(i)):t.push(_s.fromJSON(i))}return new xs(e.name,e.attributes,t)}}class Cs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new ui.a("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new ui.a("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this.position=e.startPosition.clone():this.position=Ts._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}skip(e){let t,i,o,n;do{o=this.position,n=this._visitedParent,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this.position=o,this._visitedParent=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&t.offset===i.maxOffset)return{done:!0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const o=t.parent,n=Ps(t,o),r=n||Ss(t,o,n);if(r instanceof xs)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,As("elementStart",r,e,t,1);if(r instanceof _s){let o;if(this.singleCharacters)o=1;else{let e=r.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offsete&&(e=this.boundaries.start.offset),o=t.offset-e}const n=t.offset-r.startOffset,s=new vs(r,n-o,o);return t.offset-=o,this.position=t,As("text",s,e,t,o)}return t.path.pop(),this.position=t,this._visitedParent=i.parent,As("elementStart",i,e,t,1)}}function As(e,t,i,o,n){return{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:o,length:n}}}class Ts{constructor(e,t,i="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new ui.a("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new ui.a("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;ti.path.length){if(t.offset!==o.maxOffset)return!1;t.path=t.path.slice(0,-1),o=o.parent,t.offset++}else{if(0!==i.offset)return!1;i.path=i.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==Ii(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=Ts._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let i;return t.containsPosition(this)||t.start.isEqual(this)?(i=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(i=i._getTransformedByDeletion(e.deletionPosition,1))):i=this.isEqual(e.deletionPosition)?Ts._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),i}_getTransformedByDeletion(e,t){const i=Ts._createAt(this);if(this.root!=e.root)return i;if("same"==Ii(e.getParentPath(),this.getParentPath())){if(e.offsetthis.offset)return null;i.offset-=t}}else if("prefix"==Ii(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;if(e.offset<=this.path[o]){if(e.offset+t>this.path[o])return null;i.path[o]-=t}}return i}_getTransformedByInsertion(e,t){const i=Ts._createAt(this);if(this.root!=e.root)return i;if("same"==Ii(e.getParentPath(),this.getParentPath()))(e.offsett+1;){const t=o.maxOffset-i.offset;0!==t&&e.push(new Rs(i,i.getShiftedBy(t))),i.path=i.path.slice(0,-1),i.offset++,o=o.parent}for(;i.path.length<=this.end.path.length;){const t=this.end.path[i.path.length-1],o=t-i.offset;0!==o&&e.push(new Rs(i,i.getShiftedBy(o))),i.offset=t,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Cs(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Cs(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Cs(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new Rs(this.start,this.end)]}getTransformedByOperations(e){const t=[new Rs(this.start,this.end)];for(const i of e)for(let e=0;e0?new this(i,o):new this(o,i)}static _createIn(e){return new this(Ts._createAt(e,0),Ts._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(Ts._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new ui.a("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);const i=e.indexOf(t),o=new this(t.start,t.end);if(i>0)for(let t=i-1;e[t].end.isEqual(o.start);t++)o.start=Ts._createAt(e[t].start);for(let t=i+1;t{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),o=this._viewToModelMapping.get(i),n=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=Ts._createAt(o,n)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e){const t=this.toModelElement(e);if(this._viewToModelMapping.delete(e),this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);this._modelToViewMapping.get(t)==e&&this._modelToViewMapping.delete(t)}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const o=this._elementToMarkerNames.get(e)||new Set;o.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,o)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),0==i.size&&this._markerNameToElements.delete(t));const o=this._elementToMarkerNames.get(e);o&&(o.delete(t),0==o.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new Rs(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new tn(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={isPhantom:!1}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())i.add(t);else i.add(e);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e){return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let o=0;for(let i=0;i1?t[0]+":"+t[1]:t[0]}class Os{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e),this._reconversionEventsMapping=new Map}convertChanges(e,t,i){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,i);const o=this._mapChangesWithAutomaticReconversion(e);for(const e of o)"insert"===e.type?this.convertInsert(Rs._createFromPositionAndShift(e.position,e.length),i):"remove"===e.type?this.convertRemove(e.position,e.length,e.name,i):"reconvert"===e.type?this.reconvertElement(e.element,i):this.convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,i);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const o=t.get(e).getRange();this.convertMarkerRemove(e,o,i),this.convertMarkerAdd(e,o,i)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,i)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of Array.from(e).map(Ns))this._convertInsertWithAttributes(t);this._clearConversionApi()}convertRemove(e,t,i,o){this.conversionApi.writer=o,this.fire("remove:"+i,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,i,o,n){this.conversionApi.writer=n,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const n of e){const e={item:n.item,range:Rs._createFromPositionAndShift(n.previousPosition,n.length),attributeKey:t,attributeOldValue:i,attributeNewValue:o};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}reconvertElement(e,t){const i=Rs._createOn(e);this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(i);const o=this.conversionApi.mapper,n=o.toViewElement(e);t.remove(n),this._convertInsertWithAttributes({item:e,range:i});const r=o.toViewElement(e);for(const i of Rs._createIn(e)){const{item:e}=i,n=Bs(e,o);n?n.root!==r.root&&t.move(t.createRangeOn(n),o.toViewPosition(Ts._createBefore(e))):this._convertInsertWithAttributes(Ns(i))}o.unbindViewElement(n),this._clearConversionApi()}convertSelection(e,t,i){const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=i,this.conversionApi.consumable=this._createSelectionConsumable(e,o),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of o){const i=t.getRange();if(!Ms(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const o={item:e,markerName:t.name,markerRange:i};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,o,this.conversionApi)}for(const t of e.getAttributeKeys()){const i={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+i.attributeKey)&&this.fire("attribute:"+i.attributeKey+":$text",i,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,t,i){if(!t.root.document||"$graveyard"==t.root.rootName)return;this.conversionApi.writer=i;const o="addMarker:"+e,n=new Is;if(n.add(t,o),this.conversionApi.consumable=n,this.fire(o,{markerName:e,markerRange:t},this.conversionApi),n.test(t,o)){this.conversionApi.consumable=this._createConsumableForRange(t,o);for(const i of t.getItems()){if(!this.conversionApi.consumable.test(i,o))continue;const n={item:i,range:Rs._createOn(i),markerName:e,markerRange:t};this.fire(o,n,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,t,i){t.root.document&&"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=i,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_mapReconversionTriggerEvent(e,t){this._reconversionEventsMapping.set(t,e)}_createInsertConsumable(e){const t=new Is;for(const i of e){const e=i.item;t.add(e,"insert");for(const i of e.getAttributeKeys())t.add(e,"attribute:"+i)}return t}_createConsumableForRange(e,t){const i=new Is;for(const o of e.getItems())i.add(o,t);return i}_createSelectionConsumable(e,t){const i=new Is;i.add(e,"selection");for(const o of t)i.add(e,"addMarker:"+o.name);for(const t of e.getAttributeKeys())i.add(e,"attribute:"+t);return i}_testAndFire(e,t){this.conversionApi.consumable.test(t.item,e)&&this.fire(function(e,t){const i=t.item.name||"$text";return`${e}:${i}`}(e,t),t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}_convertInsertWithAttributes(e){this._testAndFire("insert",e);for(const t of e.item.getAttributeKeys())e.attributeKey=t,e.attributeOldValue=null,e.attributeNewValue=e.item.getAttribute(t),this._testAndFire("attribute:"+t,e)}_mapChangesWithAutomaticReconversion(e){const t=new Set,i=[];for(const o of e.getChanges()){const e=o.position||o.range.start,n=e.parent;if(Ps(e,n)){i.push(o);continue}const r="attribute"===o.type?Ss(e,n,null):n;if(r.is("$text")){i.push(o);continue}let s;if(s="attribute"===o.type?`attribute:${o.attributeKey}:${r.name}`:`${o.type}:${o.name}`,this._isReconvertTriggerEvent(s,r.name)){if(t.has(r))continue;t.add(r),i.push({type:"reconvert",element:r})}else i.push(o)}return i}_isReconvertTriggerEvent(e,t){return this._reconversionEventsMapping.get(e)===t}}function Ms(e,t,i){const o=t.getRange(),n=Array.from(e.getAncestors());n.shift(),n.reverse();return!n.some(e=>{if(o.containsItem(e)){return!!i.toViewElement(e).getCustomProperty("addHighlight")}})}function Ns(e){return{item:e.item,range:Rs._createFromPositionAndShift(e.previousPosition,e.length)}}function Bs(e,t){if(e.is("textProxy")){const i=t.toViewPosition(Ts._createBefore(e)).parent;return i.is("$text")?i:null}return t.toViewElement(e)}xi(Os,fi);class Fs{constructor(e,t,i){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,i)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const o of e._ranges)if(t.isEqual(o)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new Rs(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new Rs(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new Rs(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(e,t,i){if(null===e)this._setRanges([]);else if(e instanceof Fs)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof Rs)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof Ts)this._setRanges([new Rs(e)]);else if(e instanceof ks){const o=!!i&&!!i.backward;let n;if("in"==t)n=Rs._createIn(e);else if("on"==t)n=Rs._createOn(e);else{if(void 0===t)throw new ui.a("model-selection-setto-required-second-parameter",[this,e]);n=new Rs(Ts._createAt(e,t))}this._setRanges([n],o)}else{if(!yi(e))throw new ui.a("model-selection-setto-not-selectable",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const i=(e=Array.from(e)).some(t=>{if(!(t instanceof Rs))throw new ui.a("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||i){this._removeAllRanges();for(const t of e)this._pushRange(t);this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0})}}setFocus(e,t){if(null===this.anchor)throw new ui.a("model-selection-setfocus-no-ranges",[this,e]);const i=Ts._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==i.compareWith(o)?(this._pushRange(new Rs(i,o)),this._lastRangeBackward=!0):(this._pushRange(new Rs(o,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}is(e){return"selection"===e||"model:selection"===e}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=Hs(t.start,e);i&&js(i,t)&&(yield i);for(const i of t.getWalker()){const o=i.item;"elementEnd"==i.type&&Ls(o,e,t)&&(yield o)}const o=Hs(t.end,e);o&&!t.end.isTouching(Ts._createAt(o,0))&&js(o,t)&&(yield o)}}containsEntireContent(e=this.anchor.root){const t=Ts._createAt(e,0),i=Ts._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new Rs(e.start,e.end))}_checkRange(e){for(let t=0;t0;)this._popRange()}_popRange(){this._ranges.pop()}}function Ds(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function Ls(e,t,i){return Ds(e,t)&&js(e,i)}function Hs(e,t){const i=e.parent.root.document.model.schema,o=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let n=!1;const r=o.find(e=>!n&&(n=i.isLimit(e),!n&&Ds(e,t)));return o.forEach(e=>t.add(e)),r}function js(e,t){const i=function(e){const t=e.root.document.model.schema;let i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent}}(e);if(!i)return!0;return!t.containsRange(Rs._createOn(i),!0)}xi(Fs,fi);class Ws extends Rs{constructor(e,t){super(e,t),qs.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new Rs(this.start,this.end)}static fromRange(e){return new Ws(e.start,e.end)}}function qs(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&$s.call(this,i)},{priority:"low"})}function $s(e){const t=this.getTransformedByOperation(e),i=Rs._createFromRanges(t),o=!i.isEqual(this),n=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let r=null;if(o){"$graveyard"==i.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",t,{deletionPosition:r})}else n&&this.fire("change:content",this.toRange(),{deletionPosition:r})}xi(Ws,fi);class Us{constructor(e){this._selection=new Ks(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}is(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,i){this._selection.setTo(e,t,i)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return"selection:"+e}static _isStoreAttributeKey(e){return e.startsWith("selection:")}}xi(Us,fi);class Ks extends Fs{constructor(e){super(),this.markers=new Ci({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&"marker"!=i.type&&"rename"!=i.type&&"noop"!=i.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{for(const e of this.getRanges())if(!this._document._validateSelectionRange(e))throw new ui.a("document-selection-wrong-position",this,{range:e})}),this.listenTo(this._model.markers,"update",(e,t,i,o)=>{this._updateMarker(t,o)}),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const i=e.document.differ;for(const o of i.getChanges()){if("insert"!=o.type)continue;const i=o.position.parent;o.length===i.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(i.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const o of t)e.removeAttribute(o,i)})}}(this._model,t)})}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}_updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const t of this._model.markers){const i=t.name.split(":",1)[0];if(!this._observedMarkers.has(i))continue;const o=t.getRange();for(const i of this.getRanges())o.containsRange(i,!i.isCollapsed)&&e.push(t)}const i=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=!0);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let o=!1;const n=Array.from(this.markers),r=this.markers.has(e);if(t){let i=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){i=!0;break}i&&!r?(this.markers.add(e),o=!0):!i&&r&&(this.markers.remove(e),o=!0)}else r&&(this.markers.remove(e),o=!0);o&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){const t=Bi(this._getSurroundingAttributes()),i=Bi(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())i.has(e)&&i.get(e)===t||o.push(e);for(const[e]of i)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,i=!0){const o=i?"normal":"low";if("low"==o&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,o),!0)}_removeAttribute(e,t=!0){const i=t?"normal":"low";return("low"!=i||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,i),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,i]of this.getAttributes())e.get(t)!==i&&this._removeAttribute(t,!1);for(const[i,o]of e){this._setAttribute(i,o,!1)&&t.add(i)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const i=t.substr("selection:".length);yield[i,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let i=null;if(this.isCollapsed){const o=e.textNode?e.textNode:e.nodeBefore,n=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=Gs(o)),i||(i=Gs(n)),!this.isGravityOverridden&&!i){let e=o;for(;e&&!t.isInline(e)&&!i;)e=e.previousSibling,i=Gs(e)}if(!i){let e=n;for(;e&&!t.isInline(e)&&!i;)e=e.nextSibling,i=Gs(e)}i||(i=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const o of e){if(o.item.is("element")&&t.isObject(o.item))break;if("text"==o.type){i=o.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Gs(e){return e instanceof vs||e instanceof _s?e.getAttributes():null}class Js{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Ys=function(e){return ti(e,5)};class Qs extends Js{elementToElement(e){return this.add(function(e){return(e=Ys(e)).view=ea(e.view,"container"),t=>{var i;if(t.on("insert:"+e.model,(i=e.view,(e,t,o)=>{const n=i(t.item,o);if(!n)return;if(!o.consumable.consume(t.item,"insert"))return;const r=o.mapper.toViewPosition(t.range.start);o.mapper.bindElements(t.item,n),o.writer.insert(r,n)}),{priority:e.converterPriority||"normal"}),e.triggerBy){if(e.triggerBy.attributes)for(const i of e.triggerBy.attributes)t._mapReconversionTriggerEvent(e.model,`attribute:${i}:${e.model}`);if(e.triggerBy.children)for(const i of e.triggerBy.children)t._mapReconversionTriggerEvent(e.model,"insert:"+i),t._mapReconversionTriggerEvent(e.model,"remove:"+i)}}}(e))}attributeToElement(e){return this.add(function(e){e=Ys(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=ea(e.view[t],"attribute");else e.view=ea(e.view,"attribute");const i=ta(e);return o=>{o.on(t,function(e){return(t,i,o)=>{const n=e(i.attributeOldValue,o),r=e(i.attributeNewValue,o);if(!n&&!r)return;if(!o.consumable.consume(i.item,t.name))return;const s=o.writer,a=s.document.selection;if(i.item instanceof Fs||i.item instanceof Us)s.wrap(a.getFirstRange(),r);else{let e=o.mapper.toViewRange(i.range);null!==i.attributeOldValue&&n&&(e=s.unwrap(e,n)),null!==i.attributeNewValue&&r&&s.wrap(e,r)}}}(i),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Ys(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=ia(e.view[t]);else e.view=ia(e.view);const i=ta(e);return o=>{var n;o.on(t,(n=i,(e,t,i)=>{const o=n(t.attributeOldValue,i),r=n(t.attributeNewValue,i);if(!o&&!r)return;if(!i.consumable.consume(t.item,e.name))return;const s=i.mapper.toViewElement(t.item),a=i.writer;if(!s)throw new ui.a("conversion-attribute-to-attribute-on-text",[t,i]);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e=Ti(o.value);for(const t of e)a.removeClass(t,s)}else if("style"==o.key){const e=Object.keys(o.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(o.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=Ti(r.value);for(const t of e)a.addClass(t,s)}else if("style"==r.key){const e=Object.keys(r.value);for(const t of e)a.setStyle(t,r.value[t],s)}else a.setAttribute(r.key,r.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Ys(e)).view=ea(e.view,"ui"),t=>{var i;t.on("addMarker:"+e.model,(i=e.view,(e,t,o)=>{t.isOpening=!0;const n=i(t,o);t.isOpening=!1;const r=i(t,o);if(!n||!r)return;const s=t.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,e.name))return;for(const t of s)if(!o.consumable.consume(t.item,e.name))return;const a=o.mapper,l=o.writer;l.insert(a.toViewPosition(s.start),n),o.mapper.bindElementToMarker(n,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),r),o.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,i)=>{const o=i.mapper.markerNameToElements(t.markerName);if(o){for(const e of o)i.mapper.unbindElementFromMarkerName(e,t.markerName),i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var i;t.on("addMarker:"+e.model,(i=e.view,(e,t,o)=>{if(!t.item)return;if(!(t.item instanceof Fs||t.item instanceof Us||t.item.is("$textProxy")))return;const n=oa(i,t,o);if(!n)return;if(!o.consumable.consume(t.item,e.name))return;const r=o.writer,s=Xs(r,n),a=r.document.selection;if(t.item instanceof Fs||t.item instanceof Us)r.wrap(a.getFirstRange(),s,a);else{const e=o.mapper.toViewRange(t.range),i=r.wrap(e,s);for(const e of i.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){o.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,i,o)=>{if(!i.item)return;if(!(i.item instanceof xs))return;const n=oa(e,i,o);if(!n)return;if(!o.consumable.test(i.item,t.name))return;const r=o.mapper.toViewElement(i.item);if(r&&r.getCustomProperty("addHighlight")){o.consumable.consume(i.item,t.name);for(const e of Rs._createIn(i.item))o.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,n,o.writer),o.mapper.bindElementToMarker(r,i.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,i,o)=>{if(i.markerRange.isCollapsed)return;const n=oa(e,i,o);if(!n)return;const r=Xs(o.writer,n),s=o.mapper.markerNameToElements(i.markerName);if(s){for(const e of s)o.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("attributeElement")?o.writer.unwrap(o.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,n.id,o.writer);o.writer.clearClonedElementsGroup(i.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=Ys(e)).model;e.view||(e.view=i=>({group:t,name:i.substr(e.model.length+1)}));return i=>{var o;i.on("addMarker:"+t,(o=e.view,(e,t,i)=>{const n=o(t.markerName,i);if(!n)return;const r=t.markerRange;i.consumable.consume(r,e.name)&&(Zs(r,!1,i,t,n),Zs(r,!0,i,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),i.on("removeMarker:"+t,function(e){return(t,i,o)=>{const n=e(i.markerName,o);if(!n)return;const r=o.mapper.markerNameToElements(i.markerName);if(r){for(const e of r)o.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("containerElement")?(s(`data-${n.group}-start-before`,e),s(`data-${n.group}-start-after`,e),s(`data-${n.group}-end-before`,e),s(`data-${n.group}-end-after`,e)):o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(i.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const i=new Set(t.getAttribute(e).split(","));i.delete(n.name),0==i.size?o.writer.removeAttribute(e,t):o.writer.setAttribute(e,Array.from(i).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Xs(e,t){const i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),t.priority&&(i._priority=t.priority),i._id=t.id,i}function Zs(e,t,i,o,n){const r=t?e.start:e.end;if(i.schema.checkChild(r,"$text")){!function(e,t,i,o,n){const r=`${n.group}-${t?"start":"end"}`,s=n.name?{name:n.name}:null,a=i.writer.createUIElement(r,s);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,o.markerName)}(i.mapper.toViewPosition(r),t,i,o,n)}else{let e,s;t&&r.nodeAfter||!t&&!r.nodeBefore?(e=r.nodeAfter,s=!0):(e=r.nodeBefore,s=!1);!function(e,t,i,o,n,r){const s=`data-${r.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),o.writer.setAttribute(s,a.join(","),e),o.mapper.bindElementToMarker(e,n.markerName)}(i.mapper.toViewElement(e),t,s,i,o,n)}}function ea(e,t){return"function"==typeof e?e:(i,o)=>function(e,t,i){"string"==typeof e&&(e={name:e});let o;const n=t.writer,r=Object.assign({},e.attributes);if("container"==i)o=n.createContainerElement(e.name,r);else if("attribute"==i){const t={priority:e.priority||ln.DEFAULT_PRIORITY};o=n.createAttributeElement(e.name,r,t)}else o=n.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const i of t)n.setStyle(i,e.styles[i],o)}if(e.classes){const t=e.classes;if("string"==typeof t)n.addClass(t,o);else for(const e of t)n.addClass(e,o)}return o}(e,o,t)}function ta(e){return e.model.values?(t,i)=>{const o=e.view[t];return o?o(t,i):null}:e.view}function ia(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function oa(e,t,i){const o="function"==typeof e?e(t,i):e;return o?(o.priority||(o.priority=10),o.id||(o.id=t.markerName),o):null}function na(e){const{schema:t,document:i}=e.model;for(const o of i.getRootNames()){const n=i.getRoot(o);if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),!0}return!1}function ra(e,t,i){const o=i.createContext(e);return!!i.checkChild(o,"paragraph")&&!!i.checkChild(o.push("paragraph"),t)}function sa(e,t){const i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}class aa extends Js{elementToElement(e){return this.add(la(e))}elementToAttribute(e){return this.add(function(e){ha(e=Ys(e));const t=ua(e,!1),i=ca(e.view),o=i?"element:"+i:"element";return i=>{i.on(o,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Ys(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let i;if("class"==t||"style"==t){i={["class"==t?"classes":"styles"]:e.view.value}}else{const o=void 0===e.view.value?/[\s\S]*/:e.view.value;i={attributes:{[t]:o}}}e.view.name&&(i.name=e.view.name);return e.view=i,t}(e));ha(e,t);const i=ua(e,!0);return t=>{t.on("element",i,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return Object(ui.c)("upcast-helpers-element-to-marker-deprecated"),this.add(function(e){return function(e){const t=e.model;e.model=(e,i)=>{const o="string"==typeof t?t:t(e,i);return i.writer.createElement("$marker",{"data-name":o})}}(e=Ys(e)),la(e)}(e))}dataToMarker(e){return this.add(function(e){(e=Ys(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=da(ma(e,"start")),i=da(ma(e,"end"));return o=>{o.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),o.on("element:"+e.view+"-end",i,{priority:e.converterPriority||"normal"});const n=hi.get("low"),r=hi.get("highest"),s=hi.get(e.converterPriority)/r;o.on("element",function(e){return(t,i,o)=>{const n="data-"+e.view;function r(t,n){for(const r of n){const n=e.model(r,o),s=o.writer.createElement("$marker",{"data-name":n});o.writer.insert(s,t),i.modelCursor.isEqual(t)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(t,1),i.modelRange=i.modelRange._getTransformedByInsertion(t,1)[0]}}i.modelRange||(i=Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor))),o.consumable.consume(i.viewItem,{attributes:n+"-end-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-end-after").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-start-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-start-after").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-end-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-end-before").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-start-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-start-before").split(","))}}(e),{priority:n+s})}}(e))}}function la(e){const t=da(e=Ys(e)),i=ca(e.view),o=i?"element:"+i:"element";return i=>{i.on(o,t,{priority:e.converterPriority||"normal"})}}function ca(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function da(e){const t=new Fi(e.view);return(i,o,n)=>{const r=t.match(o.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!n.consumable.test(o.viewItem,s))return;const a=function(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}(e.model,o.viewItem,n);a&&n.safeInsert(a,o.modelCursor)&&(n.consumable.consume(o.viewItem,s),n.convertChildren(o.viewItem,a),n.updateConversionResult(a,o))}}function ha(e,t=null){const i=null===t||(e=>e.getAttribute(t)),o="object"!=typeof e.model?e.model:e.model.key,n="object"!=typeof e.model||void 0===e.model.value?i:e.model.value;e.model={key:o,value:n}}function ua(e,t){const i=new Fi(e.view);return(o,n,r)=>{const s=i.match(n.viewItem);if(!s)return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(n.viewItem,r):e.model.value;if(null===l)return;if(!function(e,t){const i="function"==typeof e?e(t):e;if("object"==typeof i&&!ca(i))return!1;return!i.classes&&!i.attributes&&!i.styles}(e.view,n.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(n.viewItem,s.match))return;n.modelRange||(n=Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor)));(function(e,t,i,o){let n=!1;for(const r of Array.from(e.getItems({shallow:i})))o.schema.checkAttribute(r,t.key)&&(o.writer.setAttribute(t.key,t.value,r),n=!0);return n})(n.modelRange,{key:a,value:l},t,r)&&r.consumable.consume(n.viewItem,s.match)}}function ma(e,t){const i={};return i.view=e.view+"-"+t,i.model=(t,i)=>{const o=t.getAttribute("name"),n=e.model(o,i);return i.writer.createElement("$marker",{"data-name":n})},i}class ga{constructor(e,t){this.model=e,this.view=new ws(t),this.mapper=new Vs,this.downcastDispatcher=new Os({mapper:this.mapper,schema:e.schema});const i=this.model.document,o=i.selection,n=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(i.differ,n,e),this.downcastDispatcher.convertSelection(o,n,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(i,o)=>{const n=o.newSelection,r=[];for(const e of n.getRanges())r.push(t.toModelRange(e));const s=e.createSelection(r,{backward:n.isBackward});s.isEqual(e.document.selection)||e.change(e=>{e.setSelection(s)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,"insert"))return;const o=i.writer,n=i.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(n,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,i)=>{const o=i.mapper.toViewPosition(t.position),n=t.position.getShiftedBy(t.length),r=i.mapper.toViewPosition(n,{isPhantom:!0}),s=i.writer.createRange(o,r),a=i.writer.remove(s.getTrimmed());for(const e of i.writer.createRangeIn(a).getItems())i.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=i.writer,n=o.document.selection;for(const e of n.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);o.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=t.selection;if(o.isCollapsed)return;if(!i.consumable.consume(o,"selection"))return;const n=[];for(const e of o.getRanges()){const t=i.mapper.toViewRange(e);n.push(t)}i.writer.setSelection(n,{backward:o.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=t.selection;if(!o.isCollapsed)return;if(!i.consumable.consume(o,"selection"))return;const n=i.writer,r=o.getFirstPosition(),s=i.mapper.toViewPosition(r),a=n.breakAttributes(s);n.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new Xo(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}xi(ga,qo);class fa{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new ui.a("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class pa{constructor(){this._consumables=new Map}add(e,t){let i;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?i=this._consumables.get(e):(i=new ba(e),this._consumables.set(e,i)),i.add(t))}test(e,t){const i=this._consumables.get(e);return void 0===i?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const i=this._consumables.get(e);void 0!==i&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const e of i)"style"!=e&&"class"!=e&&t.attributes.push(e);const o=e.getClassNames();for(const e of o)t.classes.push(e);const n=e.getStyleNames();for(const e of n)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new pa(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,pa.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=pa.createFrom(i,t);return t}}class ba{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t in this._consumables)if(t in e){const i=this._test(t,e[t]);if(!0!==i)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t in this._consumables)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._revert(t,e[t])}_add(e,t){const i=Ne(t)?t:[t],o=this._consumables[e];for(const t of i){if("attributes"===e&&("class"===t||"style"===t))throw new ui.a("viewconsumable-invalid-attribute",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const i=Ne(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",i=this._test(e,[...this._consumables[e].keys()]);if(!0!==i)return i}return!0}_consume(e,t){const i=Ne(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const i=Ne(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){!1===o.get(t)&&o.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class wa{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new ka(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new ka(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new ui.a("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new ui.a("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:e.is&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!!t&&!(!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!!t&&!(!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!!t&&!(!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(t,e)}checkAttribute(e,t){const i=this.getDefinition(e.last);return!!i&&i.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof Ts){const t=e.nodeBefore,i=e.nodeAfter;if(!(t instanceof xs))throw new ui.a("schema-check-merge-no-element-before",this);if(!(i instanceof xs))throw new ui.a("schema-check-merge-no-element-after",this);return this.checkMerge(t,i)}for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[i,o])=>{if(!o)return;const n=e(i,o);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[i,o])=>{const n=e(i,o);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof Ts)t=e.parent;else{t=(e instanceof Rs?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const i=t.getCommonAncestor();return e?e.getCommonAncestor(i,{includeSelf:!0}):i},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new _s("",e.getAttributes())];return this.checkAttribute(i,t)}{const i=e.getRanges();for(const e of i)for(const i of e)if(this.checkAttribute(i.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new Rs(e);let i,o;const n=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(i=new Cs({boundaries:Rs._createIn(n),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(o=new Cs({boundaries:Rs._createIn(n),startPosition:e}));for(const e of function*(e,t){let i=!1;for(;!i;){if(i=!0,e){const t=e.next();t.done||(i=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(i=!1,yield{walker:t,value:e.value})}}}(i,o)){const t=e.walker==i?"elementEnd":"elementStart",o=e.value;if(o.type==t&&this.isObject(o.item))return Rs._createOn(o.item);if(this.checkChild(o.nextPosition,"$text"))return new Rs(o.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))Ra(this,i,t);else{const e=Rs._createIn(i).getPositions();for(const i of e){Ra(this,i.nodeBefore||i.parent,t)}}}createContext(e){return new ka(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const o of i)e[o]=_a(t[o],o);for(const t of i)va(e,t);for(const t of i)ya(e,t);for(const t of i)xa(e,t),Ca(e,t);for(const t of i)Aa(e,t),Ta(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,i=t.length-1){const o=t.getItem(i);if(e.allowIn.includes(o.name)){if(0==i)return!0;{const e=this.getDefinition(o);return this._checkContextMatch(e,t,i-1)}}return!1}*_getValidRangesForRange(e,t){let i=e.start,o=e.start;for(const n of e.getItems({shallow:!0}))n.is("element")&&(yield*this._getValidRangesForRange(Rs._createIn(n),t)),this.checkAttribute(n,t)||(i.isEqual(o)||(yield new Rs(i,o)),i=Ts._createAfter(n)),o=Ts._createAfter(n);i.isEqual(o)||(yield new Rs(i,o))}}xi(wa,qo);class ka{constructor(e){if(e instanceof ka)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),e[0]&&"string"!=typeof e[0]&&e[0].is("documentFragment")&&e.shift(),this._items=e.map(Ea)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new ka([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function _a(e,t){const i={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,t){for(const i of e){const e=Object.keys(i).filter(e=>e.startsWith("is"));for(const o of e)t[o]=i[o]}}(e,i),Pa(e,i,"allowIn"),Pa(e,i,"allowContentOf"),Pa(e,i,"allowWhere"),Pa(e,i,"allowAttributes"),Pa(e,i,"allowAttributesOf"),Pa(e,i,"inheritTypesFrom"),function(e,t){for(const i of e){const e=i.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,i),i}function va(e,t){for(const i of e[t].allowContentOf)if(e[i]){Sa(e,i).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function ya(e,t){for(const i of e[t].allowWhere){const o=e[i];if(o){const i=o.allowIn;e[t].allowIn.push(...i)}}delete e[t].allowWhere}function xa(e,t){for(const i of e[t].allowAttributesOf){const o=e[i];if(o){const i=o.allowAttributes;e[t].allowAttributes.push(...i)}}delete e[t].allowAttributesOf}function Ca(e,t){const i=e[t];for(const t of i.inheritTypesFrom){const o=e[t];if(o){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const t of e)t in i||(i[t]=o[t])}}delete i.inheritTypesFrom}function Aa(e,t){const i=e[t],o=i.allowIn.filter(t=>e[t]);i.allowIn=Array.from(new Set(o))}function Ta(e,t){const i=e[t];i.allowAttributes=Array.from(new Set(i.allowAttributes))}function Pa(e,t,i){for(const o of e)"string"==typeof o[i]?t[i].push(o[i]):Array.isArray(o[i])&&t[i].push(...o[i])}function Sa(e,t){const i=e[t];return(o=e,Object.keys(o).map(e=>o[e])).filter(e=>e.allowIn.includes(i.name));var o}function Ea(e){return"string"==typeof e?{name:e,*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function Ra(e,t,i){for(const o of t.getAttributeKeys())e.checkAttribute(t,o)||i.removeAttribute(o,t)}class Va{constructor(e={}){this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},e),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.safeInsert=this._safeInsert.bind(this),this.conversionApi.updateConversionResult=this._updateConversionResult.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let i;for(const o of new ka(e)){const e={};for(const t of o.getAttributeKeys())e[t]=o.getAttribute(t);const n=t.createElement(o.name,e);i&&t.append(n,i),i=Ts._createAt(n,0)}return i}(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=pa.createFrom(e),this.conversionApi.store={};const{modelRange:o}=this._convertItem(e,this._modelCursor),n=t.createDocumentFragment();if(o){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,n);n.markers=function(e,t){const i=new Set,o=new Map,n=Rs._createIn(e).getItems();for(const e of n)"$marker"==e.name&&i.add(e);for(const e of i){const i=e.getAttribute("data-name"),n=t.createPositionBefore(e);o.has(i)?o.get(i).end=n.clone():o.set(i,new Rs(n.clone())),t.remove(e)}return o}(n,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,n}_convertItem(e,t){const i=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof Rs))throw new ui.a("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:Ts._createAt(t,0);const o=new Rs(i);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,i);e.modelRange instanceof Rs&&(o.end=e.modelRange.end,i=e.modelCursor)}return{modelRange:o,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return!!i&&(this.conversionApi.writer.insert(e,i.position),!0)}_updateConversionResult(e,t){const i=this._getSplitParts(e),o=this.conversionApi.writer;t.modelRange||(t.modelRange=o.createRange(o.createPositionBefore(e),o.createPositionAfter(i[i.length-1])));const n=this._cursorParents.get(e);t.modelCursor=n?o.createPositionAt(n,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:o}=this.conversionApi;let n=i.findAllowedParent(t,e);if(n){if(n===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(n)&&(n=null)}if(!n)return ra(t,e,i)?{position:sa(t,o)}:null;const r=this.conversionApi.writer.split(t,n),s=[];for(const e of r.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),i=e.item;this._registerSplitPair(t,i)}const a=r.range.end.parent;return this._cursorParents.set(e,a),{position:r.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}xi(Va,fi);class Ia{constructor(e,t){this.model=e,this.stylesProcessor=t,this.processor=void 0,this.mapper=new Vs,this.downcastDispatcher=new Os({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,"insert"))return;const o=i.writer,n=i.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(n,r)},{priority:"lowest"}),this.upcastDispatcher=new Va({schema:e.schema}),this.viewDocument=new an(t),this._viewWriter=new Vn(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:i,consumable:o,writer:n})=>{let r=t.modelCursor;if(!o.test(t.viewItem))return;if(!i.checkChild(r,"$text")){if(!ra(r,"$text",i))return;r=sa(r,n)}o.consume(t.viewItem);const s=n.createText(t.viewItem.data);n.insert(s,r),t.modelRange=n.createRange(r,r.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",na)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new ui.a("datacontroller-get-non-existent-root",this);const o=this.model.document.getRoot(t);return"empty"!==i||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,e):""}stringify(e,t){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t){const i=this.viewDocument,o=this._viewWriter;this.mapper.clearBindings();const n=Rs._createIn(e),r=new Rn(i);if(this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(n,o),!e.is("documentFragment")){const t=function(e){const t=[],i=e.root.document;if(!i)return[];const o=Rs._createIn(e);for(const e of i.model.markers){const i=o.getIntersection(e.getRange());i&&t.push([e.name,i])}return t}(e);for(const[e,i]of t)this.downcastDispatcher.convertMarkerAdd(e,i,o)}return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new ui.a("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new ui.a("datacontroller-init-non-existent-root",this);return this.model.enqueueChange("transparent",e=>{for(const i of Object.keys(t)){const o=this.model.document.getRoot(i);e.insert(this.parse(t[i],o),o,0)}}),Promise.resolve()}set(e){let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new ui.a("datacontroller-set-non-existent-root",this);this.model.enqueueChange("transparent",e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const i of Object.keys(t)){const o=this.model.document.getRoot(i);e.remove(e.createRangeIn(o)),e.insert(this.parse(t[i],o),o,0)}})}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}xi(Ia,qo);class za{constructor(e,t){this._helpers=new Map,this._downcast=Ti(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Ti(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new ui.a("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new ui.a("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of Oa(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of Oa(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of Oa(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new ui.a("conversion-group-exists",this);const o=i?new Qs(t):new aa(t);this._helpers.set(e,o)}}function*Oa(e){if(e.model.values)for(const t of e.model.values){const i={key:e.model.key,value:t},o=e.view[t],n=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Ma(i,o,n)}else yield*Ma(e.model,e.view,e.upcastAlso)}function*Ma(e,t,i){if(yield{model:e,view:t},i)for(const t of Ti(i))yield{model:e,view:t}}class Na{constructor(e="default"){this.operations=[],this.type=e}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class Ba{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e){return new this(e.baseVersion)}}class Fa{constructor(e){this.markers=new Map,this._children=new ys,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"model:documentFragment"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(xs.fromJSON(i)):t.push(_s.fromJSON(i));return new Fa(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){if("string"==typeof e)return[new _s(e)];yi(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new _s(e):e instanceof vs?new _s(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}}function Da(e,t){const i=(t=ja(t)).reduce((e,t)=>e+t.offsetSize,0),o=e.parent;qa(e);const n=e.index;return o._insertChild(n,t),Wa(o,n+t.length),Wa(o,n),new Rs(e,e.getShiftedBy(i))}function La(e){if(!e.isFlat)throw new ui.a("operation-utils-remove-range-not-flat",this);const t=e.start.parent;qa(e.start),qa(e.end);const i=t._removeChildren(e.start.index,e.end.index-e.start.index);return Wa(t,e.start.index),i}function Ha(e,t){if(!e.isFlat)throw new ui.a("operation-utils-move-range-not-flat",this);const i=La(e);return Da(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),i)}function ja(e){const t=[];e instanceof Array||(e=[e]);for(let i=0;ie.maxOffset)throw new ui.a("move-operation-nodes-do-not-exist",this);if(e===t&&i=i&&this.targetPosition.path[e]e._clone(!0))),t=new Ya(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new Ts(e,[0]);return new Ja(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffsete._clone(!0))),Da(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const t of e.nodes)t.name?i.push(xs.fromJSON(t)):i.push(_s.fromJSON(t));const o=new Ya(Ts.fromJSON(e.position,t),i,e.baseVersion);return o.shouldReceiveAttributes=e.shouldReceiveAttributes,o}}class Qa extends Ba{constructor(e,t,i,o,n,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=n,this._markers=o}get type(){return"marker"}clone(){return new Qa(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Qa(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const e=this.newRange?"_set":"_remove";this._markers[e](this.name,this.newRange,!0,this.affectsData)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Qa(e.name,e.oldRange?Rs.fromJSON(e.oldRange,t):null,e.newRange?Rs.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Xa extends Ba{constructor(e,t,i,o){super(o),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}clone(){return new Xa(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Xa(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof xs))throw new ui.a("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new ui.a("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Xa(Ts.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Za extends Ba{constructor(e,t,i,o,n){super(n),this.root=e,this.key=t,this.oldValue=i,this.newValue=o}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Za(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Za(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new ui.a("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new ui.a("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new ui.a("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new ui.a("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Za(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class el extends Ba{constructor(e,t,i,o,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=o.clone()}get type(){return"merge"}get deletionPosition(){return new Ts(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Rs(this.sourcePosition,e)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new Ts(this.sourcePosition.root,t)._getTransformedByMergeOperation(this),o=new tl(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return o.insertionPosition=i,o}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new ui.a("merge-operation-source-position-invalid",this);if(!t.parent)throw new ui.a("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new ui.a("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;Ha(Rs._createIn(e),this.targetPosition),Ha(Rs._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=Ts.fromJSON(e.sourcePosition,t),o=Ts.fromJSON(e.targetPosition,t),n=Ts.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,o,n,e.baseVersion)}}class tl extends Ba{constructor(e,t,i,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=tl.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",this.graveyardPosition=i?i.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new Ts(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Rs(this.splitPosition,e)}clone(){const e=new this.constructor(this.splitPosition,this.howMany,this.graveyardPosition,this.baseVersion);return e.insertionPosition=this.insertionPosition,e}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new Ts(e,[0]);return new el(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof Rs)for(const i of e.getItems())t(i);else t(e)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof Rs))throw new ui.a("writer-move-invalid-range",this);if(!e.isFlat)throw new ui.a("writer-move-range-not-flat",this);const o=Ts._createAt(t,i);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!ll(e.root,o.root))throw new ui.a("writer-move-different-document",this);const n=e.root.document?e.root.document.version:null,r=new Ja(e.start,e.end.offset-e.start.offset,o,n);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof Rs?e:Rs._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),al(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof xs))throw new ui.a("writer-merge-no-element-before",this);if(!(i instanceof xs))throw new ui.a("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(e,t,i){return this.model.createSelection(e,t,i)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(Rs._createIn(i),Ts._createAt(t,"end")),this.remove(i)}_merge(e){const t=Ts._createAt(e.nodeBefore,"end"),i=Ts._createAt(e.nodeAfter,0),o=e.root.document.graveyard,n=new Ts(o,[0]),r=e.root.document.version,s=new el(i,e.nodeAfter.maxOffset,t,n,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof xs))throw new ui.a("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,o=new Xa(Ts._createBefore(e),e.name,t,i);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let i,o,n=e.parent;if(!n.parent)throw new ui.a("writer-split-element-no-parent",this);if(t||(t=n.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new ui.a("writer-split-invalid-limit-element",this);do{const t=n.root.document?n.root.document.version:null,r=n.maxOffset-e.offset,s=new tl(e,r,null,t);this.batch.addOperation(s),this.model.applyOperation(s),i||o||(i=n,o=e.parent.nextSibling),n=(e=this.createPositionAfter(e.parent)).parent}while(n!==t);return{position:e,range:new Rs(Ts._createAt(i,"end"),Ts._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new ui.a("writer-wrap-range-not-flat",this);const i=t instanceof xs?t:new xs(t);if(i.childCount>0)throw new ui.a("writer-wrap-element-not-empty",this);if(null!==i.parent)throw new ui.a("writer-wrap-element-attached",this);this.insert(i,e.start);const o=new Rs(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,Ts._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new ui.a("writer-unwrap-element-no-parent",this);this.move(Rs._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new ui.a("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,o=t.range,n=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new ui.a("writer-addmarker-marker-exists",this);if(!o)throw new ui.a("writer-addmarker-no-range",this);return i?(sl(this,e,null,o,n),this.model.markers.get(e)):this.model.markers._set(e,o,i,n)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i="string"==typeof e?e:e.name,o=this.model.markers.get(i);if(!o)throw new ui.a("writer-updatemarker-marker-not-exists",this);if(!t)return void this.model.markers._refresh(o);const n="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:o.affectsData;if(!n&&!t.range&&!r)throw new ui.a("writer-updatemarker-wrong-options",this);const a=o.getRange(),l=t.range?t.range:a;n&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?sl(this,i,null,l,s):(sl(this,i,a,null,s),this.model.markers._set(i,l,void 0,s)):o.managedUsingOperations?sl(this,i,a,l,s):this.model.markers._set(i,l,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new ui.a("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations)return void this.model.markers._remove(t);sl(this,t,i.getRange(),null,i.affectsData)}setSelection(e,t,i){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,i)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,i]of Bi(e))this._setSelectionAttribute(t,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const o=Us._getStoreAttributeKey(e);this.setAttribute(o,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=Us._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new ui.a("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const o=i.getRange();let n=!1;if("move"===e)n=t.containsPosition(o.start)||t.start.isEqual(o.start)||t.containsPosition(o.end)||t.end.isEqual(o.end);else{const e=t.nodeBefore,i=t.nodeAfter,r=o.start.parent==e&&o.start.isAtEnd,s=o.end.parent==i&&0==o.end.offset,a=o.end.nodeAfter==i,l=o.start.nodeAfter==i;n=r||s||a||l}n&&this.updateMarker(i.name,{range:o})}}}function nl(e,t,i,o){const n=e.model,r=n.document;let s,a,l,c=o.start;for(const e of o.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=i&&d(),c=s),s=e.nextPosition,a=l;function d(){const o=new Rs(c,s),l=o.root.document?r.version:null,d=new Ka(o,t,a,i,l);e.batch.addOperation(d),n.applyOperation(d)}s instanceof Ts&&s!=c&&a!=i&&d()}function rl(e,t,i,o){const n=e.model,r=n.document,s=o.getAttribute(t);let a,l;if(s!=i){if(o.root===o){const e=o.document?r.version:null;l=new Za(o,t,s,i,e)}else{a=new Rs(Ts._createBefore(o),e.createPositionAfter(o));const n=a.root.document?r.version:null;l=new Ka(a,t,s,i,n)}e.batch.addOperation(l),n.applyOperation(l)}}function sl(e,t,i,o,n){const r=e.model,s=r.document,a=new Qa(t,i,o,r.markers,n,s.version);e.batch.addOperation(a),r.applyOperation(a)}function al(e,t,i,o){let n;if(e.root.document){const i=o.document,r=new Ts(i.graveyard,[0]);n=new Ja(e,t,r,i.version)}else n=new Ga(e,t);i.addOperation(n),o.applyOperation(n)}function ll(e,t){return e===t||e instanceof il&&t instanceof il}class cl{constructor(e){this._markerCollection=e,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize);const t=Rs._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}this._cachedChanges=null}bufferOperation(e){switch(e.type){case"insert":if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),i=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),i||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=Rs._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}break}case"split":{const t=e.splitPosition.parent;this._isInInsertedElement(t)||this._markRemove(t,e.splitPosition.offset,e.howMany),this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1);break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const i=e.graveyardPosition.parent;this._markInsert(i,e.graveyardPosition.offset,1);const o=e.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i,o){const n=this._changedMarkers.get(e);n?(n.newRange=i,n.affectsData=o,null==n.oldRange&&null==n.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:i,affectsData:o})}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.oldRange&&e.push({name:t,range:i.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.newRange&&e.push({name:t,range:i.newRange});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(e=>({name:e[0],data:{oldRange:e[1].oldRange,newRange:e[1].newRange}}))}hasDataChanges(){for(const[,e]of this._changedMarkers)if(e.affectsData)return!0;return this._changesInElement.size>0}getChanges(e={includeChangesInGraveyard:!1}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();const t=[];for(const e of this._changesInElement.keys()){const i=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offsete.position.root!=t.position.root?e.position.root.rootNamei.offset){if(o>n){const e={type:"attribute",offset:n,howMany:o-n,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offsetn?(e.nodesToHandle=o-n,e.offset=n):e.nodesToHandle=0);if("remove"==i.type&&e.offseti.offset){const n={type:"attribute",offset:i.offset,howMany:o-i.offset,count:this._changeCount++};this._handleChange(n,t),t.push(n),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==i.type&&(e.offset>=i.offset&&o<=n?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&o>=n&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i){return{type:"insert",position:Ts._createAt(e,t),name:i,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,i){return{type:"remove",position:Ts._createAt(e,t),name:i,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const o=[];i=new Map(i);for(const[n,r]of t){const t=i.has(n)?i.get(n):null;t!==r&&o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:n,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),i.delete(n)}for(const[t,n]of i)o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:n,changeCount:this._changeCount++});return o}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),o=e.startOffset;if(i)for(const e of i)if("insert"==e.type&&o>=e.offset&&oo){for(let t=0;t=e&&o.baseVersion{const i=t[0];if(i.isDocumentOperation&&i.baseVersion!==this.version)throw new ui.a("model-document-applyoperation-wrong-version",this,{operation:i})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&this.differ.bufferOperation(i)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&(this.version++,this.history.addOperation(i))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,i,o)=>{this.differ.bufferMarkerChange(t.name,i,o,t.affectsData),null===i&&t.on("change",(e,i)=>{this.differ.bufferMarkerChange(t.name,i,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new ui.a("model-document-createroot-name-exists",this,{name:t});const i=new il(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(){return Array.from(this.roots,e=>e.rootName).filter(e=>"$graveyard"!=e)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=zi(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,o=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(o)||t.createRange(o)}_validateSelectionRange(e){return bl(e.start)&&bl(e.end)}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break}while(t)}}function bl(e){const t=e.textNode;if(t){const i=t.data,o=e.offset-t.startOffset;return!gl(i,o)&&!fl(i,o)}return!0}xi(pl,fi);class wl{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){return this._markers.has(e)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,o=!1){const n=e instanceof kl?e.name:e;if(n.includes(","))throw new ui.a("markercollection-incorrect-marker-name",this);const r=this._markers.get(n);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(Ws.fromRange(t)),s=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,s=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,s=!0),s&&this.fire("update:"+n,r,e,t),r}const s=Ws.fromRange(t),a=new kl(n,s,i,o);return this._markers.set(n,a),this.fire("update:"+n,a,null,t),a}_remove(e){const t=e instanceof kl?e.name:e,i=this._markers.get(t);return!!i&&(this._markers.delete(t),this.fire("update:"+t,i,i.getRange(),null),this._destroyMarker(i),!0)}_refresh(e){const t=e instanceof kl?e.name:e,i=this._markers.get(t);if(!i)throw new ui.a("markercollection-refresh-marker-not-exists",this);const o=i.getRange();this.fire("update:"+t,i,o,o,i.managedUsingOperations,i.affectsData)}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}xi(wl,fi);class kl{constructor(e,t,i,o){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=o}get managedUsingOperations(){if(!this._liveRange)throw new ui.a("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new ui.a("marker-destroyed",this);return this._affectsData}getStart(){if(!this._liveRange)throw new ui.a("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new ui.a("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new ui.a("marker-destroyed",this);return this._liveRange.toRange()}is(e){return"marker"===e||"model:marker"===e}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}xi(kl,fi);class _l extends Ba{get type(){return"noop"}clone(){return new _l(this.baseVersion)}getReversed(){return new _l(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const vl={};vl[Ka.className]=Ka,vl[Ya.className]=Ya,vl[Qa.className]=Qa,vl[Ja.className]=Ja,vl[_l.className]=_l,vl[Ba.className]=Ba,vl[Xa.className]=Xa,vl[Za.className]=Za,vl[tl.className]=tl,vl[el.className]=el;class yl extends Ts{constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new ui.a("model-liveposition-root-not-rootelement",e);xl.call(this)}detach(){this.stopListening()}is(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e}toPosition(){return new Ts(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function xl(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&Cl.call(this,i)},{priority:"low"})}function Cl(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}xi(yl,fi);class Al{constructor(e,t,i){this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e,t){e=Array.from(e);for(let i=0;i{if(!i.doNotResetEntireContent&&function(e,t){const i=e.getLimitElement(t);if(!t.containsEntireContent(i))return!1;const o=t.getFirstRange();if(o.start.parent==o.end.parent)return!1;return e.checkChild(i,"paragraph")}(n,t))return void function(e,t){const i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),Sl(e,e.createPositionAt(i,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,i=e.start;let o=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const i=function(e){const t=e.parent,i=t.root.document.model.schema,o=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of o){if(i.isLimit(e))return null;if(i.isBlock(e))return e}}(o);if(i&&o.isTouching(t.createPositionAt(i,0))){const i=t.createSelection(e);t.modifySelection(i,{direction:"backward"}),o=i.getLastPosition()}}return[yl.fromPosition(i,"toPrevious"),yl.fromPosition(o,"toNext")]}(o);r.isTouching(s)||e.remove(e.createRange(r,s)),i.leaveUnmerged||(!function(e,t,i){const o=e.model;if(!Pl(e.model.schema,t,i))return;const[n,r]=function(e,t){const i=e.getAncestors(),o=t.getAncestors();let n=0;for(;i[n]&&i[n]==o[n];)n++;return[i[n],o[n]]}(t,i);if(!n||!r)return;!o.hasContent(n,{ignoreMarkers:!0})&&o.hasContent(r,{ignoreMarkers:!0})?function e(t,i,o,n){const r=i.parent,s=o.parent;if(r==n||s==n)return;i=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(i)||t.insert(r,o);for(;i.parent.isEmpty;){const e=i.parent;i=t.createPositionBefore(e),t.remove(e)}if(o=t.createPositionBefore(s),function(e,t){const i=t.nodeBefore,o=t.nodeAfter;i.name!=o.name&&e.rename(i,o.name);e.clearAttributes(i),e.setAttributes(Object.fromEntries(o.getAttributes()),i),e.merge(t)}(t,o),!Pl(t.model.schema,i,o))return;e(t,i,o,n)}(e,t,i,n.parent):function e(t,i,o,n){const r=i.parent,s=o.parent;if(r==n||s==n)return;i=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(i)||t.insert(s,i);t.merge(i);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(!Pl(t.model.schema,i,o))return;e(t,i,o,n)}(e,t,i,n.parent)}(e,r,s),n.removeDisallowedAttributes(r.parent.getChildren(),e)),El(e,t,r),!i.doNotAutoparagraph&&function(e,t){const i=e.checkChild(t,"$text"),o=e.checkChild(t,"paragraph");return!i&&o}(n,r)&&Sl(e,r,t),r.detach(),s.detach()})}function Pl(e,t,i){const o=t.parent,n=i.parent;return o!=n&&(!e.isLimit(o)&&!e.isLimit(n)&&function(e,t,i){const o=new Rs(e,t);for(const e of o.getWalker())if(i.isLimit(e.item))return!1;return!0}(t,i,e))}function Sl(e,t,i){const o=e.createElement("paragraph");e.insert(o,t),El(e,i,e.createPositionAt(o,0))}function El(e,t,i){t instanceof Us?e.setSelection(i):t.setTo(i)}function Rl(e,t){const{isForward:i,walker:o,unit:n,schema:r}=e,{type:s,item:a,nextPosition:l}=t;if("text"==s)return"word"===e.unit?function(e,t){let i=e.position.textNode;if(i){let o=e.position.offset-i.startOffset;for(;!Il(i.data,o,t)&&!zl(i,o,t);){e.next();const n=t?e.position.nodeAfter:e.position.nodeBefore;if(n&&n.is("$text")){const o=n.data.charAt(t?0:n.data.length-1);' ,.?!:;"-()'.includes(o)||(e.next(),i=e.position.textNode)}o=e.position.offset-i.startOffset}}return e.position}(o,i):function(e,t){const i=e.position.textNode;if(i){const o=i.data;let n=e.position.offset-i.startOffset;for(;gl(o,n)||"character"==t&&fl(o,n);)e.next(),n=e.position.offset-i.startOffset}return e.position}(o,n);if(s==(i?"elementStart":"elementEnd")){if(r.isSelectable(a))return Ts._createAt(a,i?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(a))return void o.skip(()=>!0);if(r.checkChild(l,"$text"))return l}}function Vl(e,t){const i=e.root,o=Ts._createAt(i,t?"end":0);return t?new Rs(e,o):new Rs(o,e)}function Il(e,t,i){const o=t+(i?0:-1);return' ,.?!:;"-()'.includes(e.charAt(o))}function zl(e,t,i){return t===(i?e.endOffset:0)}function Ol(e,t){const i=[];Array.from(e.getItems({direction:"backward"})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEach(e=>{i.push(e.start.parent),t.remove(e)}),i.forEach(e=>{let i=e;for(;i.parent&&i.isEmpty;){const e=t.createRangeOn(i);i=i.parent,t.remove(e)}})}function Ml(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.selection,o=t.schema,n=[];let r=!1;for(const e of i.getRanges()){const t=Nl(e,o);t&&!t.isEqual(e)?(n.push(t),r=!0):n.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const i of e){const e=t.pop();if(i.isEqual(e))t.push(e);else if(i.isIntersecting(e)){const o=e.start.isAfter(i.start)?i.start:e.start,n=e.end.isAfter(i.end)?e.end:i.end,r=new Rs(o,n);t.push(r)}else t.push(e),t.push(i)}return t}(n),{backward:i.isBackward})}(t,e))}function Nl(e,t){return e.isCollapsed?function(e,t){const i=e.start,o=t.getNearestSelectionRange(i);if(!o)return null;if(!o.isCollapsed)return o;const n=o.start;if(i.isEqual(n))return null;return new Rs(n)}(e,t):function(e,t){const{start:i,end:o}=e,n=t.checkChild(i,"$text"),r=t.checkChild(o,"$text"),s=t.getLimitElement(i),a=t.getLimitElement(o);if(s===a){if(n&&r)return null;if(function(e,t,i){const o=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),n=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return o||n}(i,o,t)){const e=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),n=o.nodeBefore&&t.isSelectable(o.nodeBefore)?null:t.getNearestSelectionRange(o,"backward"),r=e?e.start:i,s=n?n.end:o;return new Rs(r,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=i.nodeAfter&&o.nodeBefore&&i.nodeAfter.parent===o.nodeBefore.parent,n=l&&(!e||!Fl(i.nodeAfter,t)),r=c&&(!e||!Fl(o.nodeBefore,t));let d=i,h=o;return n&&(d=Ts._createBefore(Bl(s,t))),r&&(h=Ts._createAfter(Bl(a,t))),new Rs(d,h)}return null}(e,t)}function Bl(e,t){let i=e,o=i;for(;t.isLimit(o)&&o.parent;)i=o,o=o.parent;return i}function Fl(e,t){return e&&t.isSelectable(e)}class Dl{constructor(){this.markers=new wl,this.document=new pl(this),this.schema=new wa,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),Ml(this),this.document.registerPostFixer(na)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Na,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){ui.a.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new Na(e):"function"==typeof e&&(t=e,e=new Na),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){ui.a.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,i){return function(e,t,i,o){return e.change(n=>{let r;r=i?i instanceof Fs||i instanceof Us?i:n.createSelection(i,o):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new Al(e,n,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a,{isFirst:!0,isLast:!0});const l=s.getSelectionRange();l&&(r instanceof Us?n.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c})}(this,e,t,i)}deleteContent(e,t){Tl(this,e,t)}modifySelection(e,t){!function(e,t,i={}){const o=e.schema,n="backward"!=i.direction,r=i.unit?i.unit:"character",s=t.focus,a=new Cs({boundaries:Vl(s,n),singleCharacters:!0,direction:n?"forward":"backward"}),l={walker:a,schema:o,isForward:n,unit:r};let c;for(;c=a.next();){if(c.done)return;const i=Rl(l,c.value);if(i)return void(t instanceof Us?e.change(e=>{e.setSelectionFocus(i)}):t.setFocus(i))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const i=e.createDocumentFragment(),o=t.getFirstRange();if(!o||o.isCollapsed)return i;const n=o.start.root,r=o.start.getCommonPath(o.end),s=n.getNodeByPath(r);let a;a=o.start.parent==o.end.parent?o:e.createRange(e.createPositionAt(s,o.start.path[r.length]),e.createPositionAt(s,o.end.path[r.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),i):e.append(e.cloneElement(t,!0),i);if(a!=o){const t=o._getTransformedByMove(a.start,e.createPositionAt(i,0),l)[0],n=e.createRange(e.createPositionAt(i,0),t.start);Ol(e.createRange(t.end,e.createPositionAt(i,"end")),e),Ol(n,e)}return i})}(this,e)}hasContent(e,t={}){const i=e instanceof xs?Rs._createIn(e):e;if(i.isCollapsed)return!1;const{ignoreWhitespaces:o=!1,ignoreMarkers:n=!1}=t;if(!n)for(const e of this.markers.getMarkersIntersectingRange(i))if(e.affectsData)return!0;for(const e of i.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!o)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}createPositionFromPath(e,t,i){return new Ts(e,t,i)}createPositionAt(e,t){return Ts._createAt(e,t)}createPositionAfter(e){return Ts._createAfter(e)}createPositionBefore(e){return Ts._createBefore(e)}createRange(e,t){return new Rs(e,t)}createRangeIn(e){return Rs._createIn(e)}createRangeOn(e){return Rs._createOn(e)}createSelection(e,t,i){return new Fs(e,t,i)}createBatch(e){return new Na(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return vl[e.__className].fromJSON(e,t)}}.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new ol(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}xi(Dl,qo);class Ll{constructor(){this._listener=Object.create(fr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+wn(t),t)})}set(e,t,i={}){const o=kn(e),n=i.priority;this._listener.listenTo(this._listener,"_keydown:"+o,(e,i)=>{t(i,()=>{i.preventDefault(),i.stopPropagation(),e.stop()}),e.return=!0},{priority:n})}press(e){return!!this._listener.fire("_keydown:"+wn(e),e)}destroy(){this._listener.stopListening()}}class Hl extends Ll{constructor(e){super(),this.editor=e}set(e,t,i={}){if("string"==typeof t){const e=t;t=(t,i)=>{this.editor.execute(e),i()}}super.set(e,t,i)}}class jl{constructor(e={}){this._context=e.context||new Vi({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new ni(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new Ai(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new fa,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new Dl;const i=new Io;this.data=new Ia(this.model,i),this.editing=new ga(this.model,i),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new za([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new Hl(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],o=e.get("extraPlugins")||[];return this.plugins.init(t.concat(o),i)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(...e){try{return this.commands.execute(...e)}catch(e){ui.a.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}}xi(jl,qo);class Wl{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class ql{constructor(e){this._domParser=new DOMParser,this._domConverter=new dr(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new Wl}toData(e){const t=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this._domConverter.domToView(t)}registerRawContentMatcher(e){this._domConverter.registerRawContentMatcher(e)}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),o=t.body.childNodes;for(;o.length>0;)i.appendChild(o[0]);return i}}class $l{constructor(e){this.editor=e,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Ul,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Ul),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Ul(e){e.return=!1,e.stop()}xi($l,qo);class Kl extends Ci{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,i)=>{this._renderViewIntoCollectionParent(t,i)}),this.on("remove",(e,t)=>{t.element&&this._parentElement&&t.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every(e=>"string"==typeof e))throw new ui.a("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const o of e)i.delegate(o).to(t);this.on("add",(i,o)=>{for(const i of e)o.delegate(i).to(t)}),this.on("remove",(i,o)=>{for(const i of e)o.stopDelegating(i,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}class Gl{constructor(e){Object.assign(this,nc(oc(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new ui.a("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const i of t.children)cc(i)?yield i:dc(i)&&(yield*e(i))}(this)}static bind(e,t){return{to:(i,o)=>new Yl({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:o}),if:(i,o,n)=>new Ql({observable:e,emitter:t,attribute:i,valueIfTrue:o,callback:n})}}static extend(e,t){if(e._isRendered)throw new ui.a("template-extend-render",[this,e]);!function e(t,i){i.attributes&&(t.attributes||(t.attributes={}),ac(t.attributes,i.attributes));i.eventListeners&&(t.eventListeners||(t.eventListeners={}),ac(t.eventListeners,i.eventListeners));i.text&&t.text.push(...i.text);if(i.children&&i.children.length){if(t.children.length!=i.children.length)throw new ui.a("ui-template-extend-children-mismatch",t);let o=0;for(const n of i.children)e(t.children[o++],n)}}(e,nc(oc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new ui.a("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),Xl(this.text)?this._bindToObservable({schema:this.text,updater:ec(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,i,o,n;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(o=r.getAttribute(t),i=this.attributes[t],s&&(s.attributes[t]=o),n=B(i[0])&&i[0].ns?i[0].ns:null,Xl(i)){const a=n?i[0].value:i;s&&uc(t)&&a.unshift(o),this._bindToObservable({schema:a,updater:tc(r,t,n),data:e})}else"style"==t&&"string"!=typeof i[0]?this._renderStyleAttribute(i[0],e):(s&&o&&uc(t)&&i.unshift(o),i=i.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(sc,""),lc(i)||r.setAttributeNS(n,t,i))}_renderStyleAttribute(e,t){const i=t.node;for(const o in e){const n=e[o];Xl(n)?this._bindToObservable({schema:[n],updater:ic(i,o),data:t}):i.style[o]=n}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let n=0;for(const r of this.children)if(hc(r)){if(!o){r.setParent(t);for(const e of r)i.appendChild(e.element)}}else if(cc(r))o||(r.isRendered||r.render(),i.appendChild(r.element));else if(tr(r))i.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:i.childNodes[n++],isApplying:!0,revertData:t})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(i=>{const[o,n]=t.split("@");return i.activateDomEventListener(o,n,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const o=i.revertData;Zl(e,t,i);const n=e.filter(e=>!lc(e)).filter(e=>e.observable).map(o=>o.activateAttributeListener(e,t,i));o&&o.bindings.push(n)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)e.textContent=t.text;else{for(const i in t.attributes){const o=t.attributes[i];null===o?e.removeAttribute(i):e.setAttribute(i,o)}for(let i=0;iZl(e,t,i);return this.emitter.listenTo(this.observable,"change:"+this.attribute,o),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,o)}}}class Yl extends Jl{activateDomEventListener(e,t,i){const o=(e,i)=>{t&&!i.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(i):this.observable.fire(this.eventNameOrFunction,i))};return this.emitter.listenTo(i.node,e,o),()=>{this.emitter.stopListening(i.node,e,o)}}}class Ql extends Jl{getValue(e){return!lc(super.getValue(e))&&(this.valueIfTrue||!0)}}function Xl(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Xl):e instanceof Jl)}function Zl(e,t,{node:i}){let o=function(e,t){return e.map(e=>e instanceof Jl?e.getValue(t):e)}(e,i);o=1==e.length&&e[0]instanceof Ql?o[0]:o.reduce(sc,""),lc(o)?t.remove():t.set(o)}function ec(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function tc(e,t,i){return{set(o){e.setAttributeNS(i,t,o)},remove(){e.removeAttributeNS(i,t)}}}function ic(e,t){return{set(i){e.style[t]=i},remove(){e.style[t]=null}}}function oc(e){return ii(e,e=>{if(e&&(e instanceof Jl||dc(e)||cc(e)||hc(e)))return e})}function nc(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=Ti(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)rc(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=Ti(e[t].value)),rc(e,t)}(e.attributes);const t=[];if(e.children)if(hc(e.children))t.push(e.children);else for(const i of e.children)dc(i)||cc(i)||tr(i)?t.push(i):t.push(new Gl(i));e.children=t}return e}function rc(e,t){e[t]=Ti(e[t])}function sc(e,t){return lc(t)?e:lc(e)?t:`${e} ${t}`}function ac(e,t){for(const i in t)e[i]?e[i].push(...t[i]):e[i]=t[i]}function lc(e){return!e&&0!==e}function cc(e){return e instanceof mc}function dc(e){return e instanceof Gl}function hc(e){return e instanceof Kl}function uc(e){return"class"==e||"style"==e}i(17);class mc{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Ci,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,i)=>{i.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Gl.bind(this,this)}createCollection(e){const t=new Kl(e);return this._viewCollections.add(t),t}registerChild(e){yi(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){yi(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Gl(e)}extendTemplate(e){Gl.extend(this.template,e)}render(){if(this.isRendered)throw new ui.a("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}function gc({element:e,target:t,positions:i,limiter:o,fitInViewport:n}){D(t)&&(t=t()),D(o)&&(o=o());const r=function(e){return e&&e.parentNode?e.offsetParent===sr.document.body?null:e.offsetParent:null}(e),s=new rs(e),a=new rs(t);let l,c;if(o||n){const e=function(e,t){const{elementRect:i,viewportRect:o}=t,n=i.getArea(),r=function(e,{targetRect:t,elementRect:i,limiterRect:o,viewportRect:n}){const r=[],s=i.getArea();for(const a of e){const e=fc(a,t,i);if(!e)continue;const[l,c]=e;let d=0,h=0;if(o)if(n){const e=o.getIntersection(n);e&&(d=e.getIntersectionArea(c))}else d=o.getIntersectionArea(c);n&&(h=n.getIntersectionArea(c));const u={positionName:l,positionRect:c,limiterIntersectArea:d,viewportIntersectArea:h};if(d===s)return[u];r.push(u)}return r}(e,t);if(o){const e=pc(r.filter(({viewportIntersectArea:e})=>e===n),n);if(e)return e}return pc(r,n)}(i,{targetRect:a,elementRect:s,limiterRect:o&&new rs(o).getVisible(),viewportRect:n&&new rs(sr.window)});[c,l]=e||fc(i[0],a,s)}else[c,l]=fc(i[0],a,s);let d=bc(l);return r&&(d=function({left:e,top:t},i){const o=bc(new rs(i)),n=os(i);return e-=o.left,t-=o.top,e+=i.scrollLeft,t+=i.scrollTop,e-=n.left,t-=n.top,{left:e,top:t}}(d,r)),{left:d.left,top:d.top,name:c}}function fc(e,t,i){const o=e(t,i);if(!o)return null;const{left:n,top:r,name:s}=o;return[s,i.clone().moveTo(n,r)]}function pc(e,t){let i,o,n=0;for(const{positionName:r,positionRect:s,limiterIntersectArea:a,viewportIntersectArea:l}of e){if(a===t)return[r,s];const e=l**2+a**2;e>n&&(n=e,i=s,o=r)}return i?[o,i]:null}function bc({left:e,top:t}){const{scrollX:i,scrollY:o}=sr.window;return{left:e+i,top:t+o}}function wc(e){return t=>t+e}xi(mc,fr),xi(mc,qo);i(19);const kc=wc("px"),_c=sr.document.body;class vc extends mc{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class"),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",e=>"ck-balloon-panel_"+e),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",kc),left:t.to("left",kc)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=vc.defaultPositions,i=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast],limiter:_c,fitInViewport:!0},e),o=vc._getOptimalPosition(i),n=parseInt(o.left),r=parseInt(o.top),s=o.name;Object.assign(this,{top:r,left:n,position:s})}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=yc(e.target),i=e.limiter?yc(e.limiter):_c;this.listenTo(sr.document,"scroll",(o,n)=>{const r=n.target,s=t&&r.contains(t),a=i&&r.contains(i);!s&&!a&&t&&i||this.attachTo(e)},{useCapture:!0}),this.listenTo(sr.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(sr.document,"scroll"),this.stopListening(sr.window,"resize")}}function yc(e){return oi(e)?e:is(e)?e.commonAncestorContainer:"function"==typeof e?yc(e()):null}function xc(e,t){return e.top-t.height-vc.arrowVerticalOffset}function Cc(e){return e.bottom+vc.arrowVerticalOffset}vc.arrowHorizontalOffset=25,vc.arrowVerticalOffset=10,vc._getOptimalPosition=gc,vc.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:xc(e,t),left:e.left-vc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:xc(e,t),left:e.left-.25*t.width-vc.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:xc(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:xc(e,t),left:e.left-.75*t.width+vc.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:xc(e,t),left:e.left-t.width+vc.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:xc(e,t),left:e.left+e.width/2-vc.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:xc(e,t),left:e.left+e.width/2-.25*t.width-vc.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:xc(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:xc(e,t),left:e.left+e.width/2-.75*t.width+vc.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:xc(e,t),left:e.left+e.width/2-t.width+vc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:xc(e,t),left:e.right-vc.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:xc(e,t),left:e.right-.25*t.width-vc.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:xc(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:xc(e,t),left:e.right-.75*t.width+vc.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:xc(e,t),left:e.right-t.width+vc.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:Cc(e),left:e.left-vc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:Cc(e),left:e.left-.25*t.width-vc.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:Cc(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:Cc(e),left:e.left-.75*t.width+vc.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:Cc(e),left:e.left-t.width+vc.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:Cc(e),left:e.left+e.width/2-vc.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:Cc(e),left:e.left+e.width/2-.25*t.width-vc.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:Cc(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:Cc(e),left:e.left+e.width/2-.75*t.width+vc.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:Cc(e),left:e.left+e.width/2-t.width+vc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:Cc(e),left:e.right-vc.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:Cc(e),left:e.right-.25*t.width-vc.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:Cc(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:Cc(e),left:e.right-.75*t.width+vc.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:Cc(e),left:e.right-t.width+vc.arrowHorizontalOffset,name:"arrow_ne"})};i(21);class Ac extends mc{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");for(t&&(this.viewBox=t),this.element.innerHTML="";e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}i(23);class Tc extends mc{constructor(e){super(e),this.set("text",""),this.set("position","s");const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",t.to("position",e=>"ck-tooltip_"+e),t.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:t.to("text")}]}]})}}i(25);class Pc extends mc{constructor(e){super(e);const t=this.bindTemplate,i=di();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(i),this.iconView=new Ac,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",e=>!e),t.if("isVisible","ck-hidden",e=>!e),t.to("isOn",e=>e?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],type:t.to("type",e=>e||"button"),tabindex:t.to("tabindex"),"aria-labelledby":"ck-editor__aria-label_"+i,"aria-disabled":t.if("isEnabled",!0,e=>!e),"aria-pressed":t.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new Tc;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new mc,i=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:i.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new mc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>_n(e))}]}),e}_getTooltipString(e,t,i){return e?"string"==typeof e?e:(i&&(i=_n(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}class Sc{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(e){if(this._elements.has(e))throw new ui.a("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(e),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}xi(Sc,fr),xi(Sc,qo);i(27),i(29);const Ec=wc("px");class Rc extends $l{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.view=new vc(e.locale),e.ui.view.body.add(this.view),e.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this.hasView(e.view))throw new ui.a("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new ui.a("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new ui.a("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(t=>t[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new Vc(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,i)=>{if(i<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,i])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new Ic(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:o=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),o&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&!e.limiter&&(e=Object.assign({},e,{limiter:this.positionLimiter})),e}}class Vc extends mc{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Sc,this.buttonPrevView=this._createButtonView(t("Previous"),''),this.buttonNextView=this._createButtonView(t("Next"),''),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new Pc(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class Ic extends mc{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:i.to("top",Ec),left:i.to("left",Ec),width:i.to("width",Ec),height:i.to("height",Ec)}},children:this.content}),this.on("change:numberOfPanels",(e,t,i,o)=>{i>o?this._addPanels(i-o):this._removePanels(o-i),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new mc;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:o}=new rs(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:o})}}}class zc{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];"string"==typeof i&&(i=[i]);for(const o of i)e.keystrokeHandler.set(o,(e,i)=>{this[t](),i()})}}get first(){return this.focusables.find(Oc)||null}get last(){return this.focusables.filter(Oc).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,i)=>{const o=t.element===this.focusTracker.focusedElement;return o&&(e=i),o}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,i=this.focusables.length;if(!i)return null;if(null===t)return this[1===e?"first":"last"];let o=(t+i+e)%i;do{const t=this.focusables.get(o);if(Oc(t))return t;o=(o+i+e)%i}while(o!==t);return null}}function Oc(e){return!(!e.focus||"none"==sr.window.getComputedStyle(e.element).display)}class Mc extends mc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Nc extends mc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}class Bc{constructor(e,t){Bc._observerInstance||Bc._createObserver(),this._element=e,this._callback=t,Bc._addElementCallback(e,t),Bc._observerInstance.observe(e)}destroy(){Bc._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Bc._elementCallbacks||(Bc._elementCallbacks=new Map);let i=Bc._elementCallbacks.get(e);i||(i=new Set,Bc._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=Bc._getElementCallbacks(e);i&&(i.delete(t),i.size||(Bc._elementCallbacks.delete(e),Bc._observerInstance.unobserve(e))),Bc._elementCallbacks&&!Bc._elementCallbacks.size&&(Bc._observerInstance=null,Bc._elementCallbacks=null)}static _getElementCallbacks(e){return Bc._elementCallbacks?Bc._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof sr.window.ResizeObserver?sr.window.ResizeObserver:Fc,Bc._observerInstance=new e(e=>{for(const t of e){const e=Bc._getElementCallbacks(t.target);if(e)for(const i of e)i(t)}})}}Bc._observerInstance=null,Bc._elementCallbacks=null;class Fc{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(sr.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),this._periodicCheckTimeout=setTimeout(e,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const t of this._elements)this._hasRectChanged(t)&&e.push({target:t,contentRect:this._previousRects.get(t)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const t=new rs(e),i=this._previousRects.get(e),o=!i||!i.isEqual(t);return this._previousRects.set(e,t),o}}xi(Fc,fr);class Dc extends mc{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",e=>"ck-dropdown__panel_"+e),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(e=>e.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}i(31);class Lc extends mc{constructor(e,t,i){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Ll,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",e=>!e)],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=Lc._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)}),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,t())};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set("arrowright",(e,t)=>{this.isOpen&&t()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:i,northWest:o}=Lc.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,t,i,o]:[t,e,o,i]}}Lc.defaultPanelPositions={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.bottom-t.height,left:e.left-t.width+e.width,name:"nw"})},Lc._getOptimalPosition=gc;var Hc='';class jc extends Pc{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new Ac;return e.content=Hc,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}i(33);class Wc extends mc{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Sc,this.keystrokes=new Ll,this._focusCycler=new zc({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class qc extends mc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class $c extends mc{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}i(35);class Uc extends Pc{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new mc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function Kc({emitter:e,activator:t,callback:i,contextElements:o}){e.listenTo(document,"mousedown",(e,n)=>{if(!t())return;const r="function"==typeof n.composedPath?n.composedPath():[];for(const e of o)if(e.contains(n.target)||r.includes(e))return;i()})}i(37),i(39);function Gc(e,t=jc){const i=new t(e),o=new Dc(e),n=new Lc(e,i,o);return i.bind("isEnabled").to(n),i instanceof jc?i.bind("isOn").to(n,"isOpen"):i.arrowView.bind("isOn").to(n,"isOpen"),function(e){(function(e){e.on("render",()=>{Kc({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof Uc||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isOpen&&(e.panelView.focus(),i())}),e.keystrokes.set("arrowup",(t,i)=>{e.isOpen&&(e.panelView.focusLast(),i())})}(e)}(n),n}function Jc(e,t){const i=e.locale,o=i.t,n=e.toolbarView=new Qc(i);n.set("ariaLabel",o("Dropdown toolbar")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>n.items.add(e)),e.panelView.children.add(n),n.items.delegate("execute").to(e)}function Yc(e,t){const i=e.locale,o=e.listView=new Wc(i);o.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new $c(i);if("button"===e||"switchbutton"===e){const o=new qc(i);let n;return n="button"===e?new Pc(i):new Uc(i),n.bind(...Object.keys(t)).to(t),n.delegate("execute").to(o),o.children.add(n),o}}),e.panelView.children.add(o),o.items.delegate("execute").to(e)}i(41);class Qc extends mc{constructor(e,t){super(e);const i=this.bindTemplate,o=this.t;this.options=t||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Sc,this.keystrokes=new Ll,this.set("class"),this.set("isCompact",!1),this.itemsView=new Xc(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new zc({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}});const n=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];var r;this.options.shouldGroupWhenFull&&this.options.isFloating&&n.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:n,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")}},children:this.children,on:{mousedown:(r=this,r.bindTemplate.to(e=>{e.target===r.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new ed(this):new Zc(this)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t){this.items.addMany(e.map(i=>"|"==i?new Mc:"-"==i?(this.options.shouldGroupWhenFull&&Object(ui.c)("toolbarview-line-break-ignored-when-grouping-items",e),new Nc):t.has(i)?t.create(i):void Object(ui.c)("toolbarview-item-unavailable",{name:i})).filter(e=>void 0!==e))}}class Xc extends mc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Zc{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>e),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class ed{constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),e.children.on("add",this._updateFocusCycleableItems.bind(this)),e.children.on("remove",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(e,t)=>{const i=t.index;for(const e of t.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=i;ethis.ungroupedItems.length?this.groupedItems.add(o,e-this.ungroupedItems.length):this.ungroupedItems.add(o,e)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!this.viewElement.offsetParent)return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new rs(e.lastChild),o=new rs(e);if(!this.cachedPadding){const i=sr.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(i[o])}return"ltr"===t?i.right>o.right-this.cachedPadding:i.left{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new Mc),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=Gc(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Jc(i,[]),i.buttonView.set({label:t("Show more items"),tooltip:!0,icon:''}),i.toolbarView.items.bindTo(this.groupedItems).using(e=>e),i}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}function td(e){return Array.isArray(e)?{items:e}:e?Object.assign({items:[]},e):{items:[]}}const id=wc("px");class od extends $l{static get pluginName(){return"BalloonToolbar"}static get requires(){return[Rc]}constructor(e){super(e),this._balloonConfig=td(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new Sc,e.ui.once("ready",()=>{this.focusTracker.add(e.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)}),this._resizeObserver=null,this._balloon=e.plugins.get(Rc),this._fireSelectionChangeDebounced=Yr(()=>this.fire("_selectionChangeDebounced"),200),this.decorate("show")}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",(e,t,i)=>{const o=this._balloon.visibleView===this.toolbarView;!i&&o?this.hide():i&&this.show()}),this.listenTo(t,"change:range",(e,i)=>{(i.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()}),this.listenTo(this,"_selectionChangeDebounced",()=>{this.editor.editing.view.document.isFocused&&this.show()}),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",()=>{const t=e.ui.view.editable.element;this._resizeObserver=new Bc(t,()=>{this.toolbarView.maxWidth=id(.9*new rs(t).width)})}),this.listenTo(this.toolbarView,"groupedItemsUpdate",()=>{this._updatePosition()})}afterInit(){const e=this.editor.ui.componentFactory;this.toolbarView.fillFromConfig(this._balloonConfig.items,e)}_createToolbarView(){const e=!this._balloonConfig.shouldNotGroupWhenFull,t=new Qc(this.editor.locale,{shouldGroupWhenFull:e,isFloating:!0});return t.render(),t}show(){const e=this.editor,t=e.model.document.selection,i=e.model.schema;this._balloon.hasView(this.toolbarView)||t.isCollapsed||function(e,t){if(1===e.rangeCount)return!1;return[...e.getRanges()].every(e=>{const i=e.getContainedElement();return i&&t.isSelectable(i)})}(t,i)||Array.from(this.toolbarView.items).every(e=>void 0!==e.isEnabled&&!e.isEnabled)||(this.listenTo(this.editor.ui,"update",()=>{this._updatePosition()}),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,i=t.selection,o=t.selection.isBackward;return{target:()=>{const t=o?i.getFirstRange():i.getLastRange(),n=rs.getDomRangeRects(e.domConverter.viewRangeToDom(t));return o?n[0]:(n.length>1&&0===n[n.length-1].width&&n.pop(),n[n.length-1])},positions:nd(o)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}}function nd(e){const t=vc.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}class rd{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(sd(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new ui.a("componentfactory-item-missing",this,{name:e});return this._components.get(sd(e)).callback(this.editor.locale)}has(e){return this._components.has(sd(e))}}function sd(e){return String(e).toLowerCase()}class ad{constructor(e){this.editor=e,this.componentFactory=new rd(e),this.focusTracker=new Sc,this._editableElementsMap=new Map,this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}}xi(ad,fi);i(43);const ld=new WeakMap;function cd(e){const{view:t,element:i,text:o,isDirectHost:n=!0}=e,r=t.document;ld.has(r)||(ld.set(r,new Map),r.registerPostFixer(e=>hd(r,e))),ld.get(r).set(i,{text:o,isDirectHost:n}),t.change(e=>hd(r,e))}function dd(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function hd(e,t){const i=ld.get(e);let o=!1;for(const[e,n]of i)ud(t,e,n)&&(o=!0);return o}function ud(e,t,i){const{text:o,isDirectHost:n}=i,r=n?t:function(e){if(1===e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}(t);let s=!1;return!!r&&(i.hostElement=r,r.getAttribute("data-placeholder")!==o&&(e.setAttribute("data-placeholder",o,r),s=!0),!function(e){if(!e.isAttached())return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement")),i=e.document;if(!i.isFocused&&t)return!0;const o=i.selection.anchor;return!(!t||!o||o.parent===e)}(r)?dd(e,r)&&(s=!0):function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0),s)}class md extends ad{constructor(e,t){super(e),this.view=t}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,i=e.plugins.get("BalloonToolbar"),o=e.editing.view,n=t.editable,r=o.document.getRoot();n.name=r.rootName,t.render();const s=n.element;this.setEditableElement(n.name,s),this.focusTracker.add(s),n.bind("isFocused").to(this.focusTracker),o.attachDomRoot(s),function({origin:e,originKeystrokeHandler:t,originFocusTracker:i,toolbar:o,beforeFocus:n,afterBlur:r}){i.add(o.element),t.set("Alt+F10",(e,t)=>{i.isFocused&&!o.focusTracker.isFocused&&(n&&n(),o.focus(),t())}),o.keystrokes.set("Esc",(t,i)=>{o.focusTracker.isFocused&&(e.focus(),r&&r(),i())})}({origin:o,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:i.toolbarView,beforeFocus(){i.show()},afterBlur(){i.hide()}}),this._initPlaceholder(),this.fire("ready")}destroy(){const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),o=e.sourceElement,n=e.config.get("placeholder")||o&&"textarea"===o.tagName.toLowerCase()&&o.getAttribute("placeholder");n&&cd({view:t,element:i,text:n,isDirectHost:!1})}}var gd=function(e){return"string"==typeof e||!Ne(e)&&p(e)&&"[object String]"==m(e)};function fd(e,t,i={},o=[]){const n=i&&i.xmlns,r=n?e.createElementNS(n,t):e.createElement(t);for(const e in i)r.setAttribute(e,i[e]);!gd(o)&&yi(o)||(o=[o]);for(let t of o)gd(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}class pd extends Kl{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new Gl({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=fd(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}i(45);class bd extends mc{constructor(e){super(e),this.body=new pd(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class wd extends mc{constructor(e,t,i){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(i=>{const o=e.document.getRoot(t.name);i.addClass(t.isFocused?"ck-focused":"ck-blurred",o),i.removeClass(t.isFocused?"ck-blurred":"ck-focused",o)})}e.isRenderingInProgress?function i(o){e.once("change:isRenderingInProgress",(e,n,r)=>{r?i(o):t(o)})}(this):t(this)}}class kd extends wd{constructor(e,t,i){super(e,t,i),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(i=>{const o=e.document.getRoot(this.name);i.setAttribute("aria-label",t("Rich Text Editor, %0",this.name),o)})}}class _d extends bd{constructor(e,t,i){super(e),this.editable=new kd(e,t,i)}render(){super.render(),this.registerChild(this.editable)}}function vd(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}var yd={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};var xd={updateSourceElement(){if(!this.sourceElement)throw new ui.a("editor-missing-sourceelement",this);vd(this.sourceElement,this.data.get())}};class Cd extends jl{constructor(e,t){super(t),oi(e)&&(this.sourceElement=e,function(e){const t=e.sourceElement;if(t){if(t.ckeditorInstance)throw new ui.a("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}}(this));const i=this.config.get("plugins");i.push(od),this.config.set("plugins",i),this.config.define("balloonToolbar",this.config.get("toolbar")),this.data.processor=new ql(this.data.viewDocument),this.model.document.createRoot();const o=new _d(this.locale,this.editing.view,this.sourceElement);this.ui=new md(this,o),function(e){if(!D(e.updateSourceElement))throw new ui.a("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(t&&"textarea"===t.tagName.toLowerCase()&&t.form){let i;const o=t.form,n=()=>e.updateSourceElement();D(o.submit)&&(i=o.submit,o.submit=()=>{n(),i.apply(o)}),o.addEventListener("submit",n),e.on("destroy",()=>{o.removeEventListener("submit",n),i&&(o.submit=i)})}}(this)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&vd(this.sourceElement,e)})}static create(e,t={}){return new Promise(i=>{const o=oi(e);if(o&&"TEXTAREA"===e.tagName)throw new ui.a("editor-wrong-element",null);const n=new this(e,t);i(n.initPlugins().then(()=>{n.ui.init()}).then(()=>{if(!o&&t.initialData)throw new ui.a("editor-create-initial-data",null);const i=t.initialData||function(e){return oi(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}(e);return n.data.init(i)}).then(()=>n.fire("ready")).then(()=>n))})}}xi(Cd,yd),xi(Cd,xd);class Ad{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}xi(Ad,qo);class Td extends Ad{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Ci({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new ui.a("pendingactions-add-invalid-message",this);const t=Object.create(qo);return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}class Pd{constructor(){const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,o)=>{t.onload=()=>{const e=t.result;this._data=e,i(e)},t.onerror=()=>{o("error")},t.onabort=()=>{o("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}xi(Pd,qo);class Sd extends $l{static get pluginName(){return"FileRepository"}static get requires(){return[Td]}init(){this.loaders=new Ci,this.loaders.on("add",()=>this._updatePendingAction()),this.loaders.on("remove",()=>this._updatePendingAction()),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return Object(ui.c)("filerepository-no-upload-adapter"),null;const t=new Ed(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(e=>{this._loadersMap.set(e,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e}),t.on("change:uploadTotal",()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e}),t}destroyLoader(e){const t=e instanceof Ed?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,i)=>{e===t&&this._loadersMap.delete(i)})}_updatePendingAction(){const e=this.editor.plugins.get(Td);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}xi(Sd,qo);class Ed{constructor(e,t){this.id=di(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new Pd,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new ui.a("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e}).catch(e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e})}upload(){if("idle"!=this.status)throw new ui.a("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,o)=>{t.rejecter=o,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,i(e)}).catch(e=>{t.isFulfilled=!0,o(e)})}),t}}xi(Ed,qo);function Rd(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const i of t){const t=i.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,i;return e&&40==e.length||(e=function(e){let t="";const i=new Uint8Array(e);window.crypto.getRandomValues(i);for(let e=0;e.5?o.toUpperCase():o}return t}(40),t="ckCsrfToken",i=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(i)+";path=/"),e}class Vd{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const o=this.xhr,n=this.loader,r=(0,this.t)("Cannot upload file:")+` ${i.name}.`;o.addEventListener("error",()=>t(r)),o.addEventListener("abort",()=>t()),o.addEventListener("load",()=>{const i=o.response;if(!i||!i.uploaded)return t(i&&i.error&&i.error.message?i.error.message:r);e({default:i.url})}),o.upload&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&(n.uploadTotal=e.total,n.uploaded=e.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",Rd()),this.xhr.send(t)}}function Id(e){const t=e.next();return t.done?null:t.value}function zd(e,t,i,o){let n,r=null;"function"==typeof o?n=o:(r=e.commands.get(o),n=()=>{e.execute(o)}),e.model.document.on("change:data",(o,s)=>{if(r&&!r.isEnabled||!t.isEnabled)return;const a=Id(e.model.document.selection.getRanges());if(!a.isCollapsed)return;if("transparent"==s.type)return;const l=Array.from(e.model.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=c.position.parent;if(d.is("element","codeBlock"))return;if(r&&!0===r.value)return;const h=d.getChild(0),u=e.model.createRangeOn(h);if(!u.containsRange(a)&&!a.end.isEqual(u.end))return;const m=i.exec(h.data.substr(0,a.end.offset));m&&e.model.enqueueChange(e=>{const t=e.createPositionAt(d,0),i=e.createPositionAt(d,m[0].length),o=new Ws(t,i);!1!==n({match:m})&&e.remove(o),o.detach()})})}function Od(e,t,i,o){let n,r;i instanceof RegExp?n=i:r=i,r=r||(e=>{let t;const i=[],o=[];for(;null!==(t=n.exec(e))&&!(t&&t.length<4);){let{index:e,1:n,2:r,3:s}=t;const a=n+r+s;e+=t[0].length-a.length;const l=[e,e+n.length],c=[e+n.length+r.length,e+n.length+r.length+s.length];i.push(l),i.push(c),o.push([e+n.length,e+n.length+r.length])}return{remove:i,format:o}}),e.model.document.on("change:data",(i,n)=>{if("transparent"==n.type||!t.isEnabled)return;const s=e.model,a=s.document.selection;if(!a.isCollapsed)return;const l=Array.from(s.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=a.focus,h=d.parent,{text:u,range:m}=function(e,t){let i=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(i=t.createPositionAfter(o),""):e+o.data,""),range:t.createRange(i,e.end)}}(s.createRange(s.createPositionAt(h,0),d),s),g=r(u),f=Md(m.start,g.format,s),p=Md(m.start,g.remove,s);f.length&&p.length&&s.enqueueChange(e=>{if(!1!==o(e,f))for(const t of p.reverse())e.remove(t)})})}function Md(e,t,i){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>i.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}function Nd(e,t){return(i,o)=>{if(!e.commands.get(t).isEnabled)return!1;const n=e.model.schema.getValidRanges(o,t);for(const e of n)i.setAttribute(t,!0,e);i.removeSelectionAttribute(t)}}class Bd{constructor(e){this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"}),this.listenTo(e,"change:isReadOnly",(e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Fd,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Fd),this.refresh())}execute(){}destroy(){this.stopListening()}}function Fd(e){e.return=!1,e.stop()}xi(Bd,qo);class Dd extends Bd{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(i.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of n)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}class Ld extends $l{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"bold"}),e.model.schema.setAttributeProperties("bold",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"bold",view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t?"bold"==t||Number(t)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),e.commands.add("bold",new Dd(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class Hd extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",i=>{const o=e.commands.get("bold"),n=new Pc(i);return n.set({label:t("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),n})}}class jd extends $l{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"italic"}),e.model.schema.setAttributeProperties("italic",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"italic",view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add("italic",new Dd(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class Wd extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",i=>{const o=e.commands.get("italic"),n=new Pc(i);return n.set({label:t("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),n})}}class qd extends $l{static get pluginName(){return"SuperscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"superscript"}),e.model.schema.setAttributeProperties("superscript",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"superscript",view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add("superscript",new Dd(e,"superscript"))}}class $d extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("superscript",i=>{const o=e.commands.get("superscript"),n=new Pc(i);return n.set({label:t("Superscript"),icon:'',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("superscript"),e.editing.view.focus()}),n})}}class Ud extends $l{static get pluginName(){return"SubscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"subscript"}),e.model.schema.setAttributeProperties("subscript",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"subscript",view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add("subscript",new Dd(e,"subscript"))}}class Kd extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("subscript",i=>{const o=e.commands.get("subscript"),n=new Pc(i);return n.set({label:t("Subscript"),icon:'',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("subscript"),e.editing.view.focus()}),n})}}class Gd extends $l{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"underline"}),e.model.schema.setAttributeProperties("underline",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"underline",view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add("underline",new Dd(e,"underline")),e.keystrokes.set("CTRL+U","underline")}}class Jd extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("underline",i=>{const o=e.commands.get("underline"),n=new Pc(i);return n.set({label:t("Underline"),icon:'',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("underline"),e.editing.view.focus()}),n})}}class Yd extends $l{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"strikethrough"}),e.model.schema.setAttributeProperties("strikethrough",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"strikethrough",view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add("strikethrough",new Dd(e,"strikethrough")),e.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}class Qd extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("strikethrough",i=>{const o=e.commands.get("strikethrough"),n=new Pc(i);return n.set({label:t("Strikethrough"),icon:'',keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("strikethrough"),e.editing.view.focus()}),n})}}class Xd extends $l{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,o=e.locale,n=t.document.selection;this.listenTo(i.document,"keydown",(e,t)=>{if(!n.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==bn.arrowright,r=t.keyCode==bn.arrowleft;if(!i&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&i||"rtl"===s&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{priority:hi.get("high")+1}),this._isNextGravityRestorationSkipped=!1,this.listenTo(n,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&ih(n.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model.document.selection,o=i.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!Zd(i,t))&&(ih(o,t)?(th(e),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,o=i.document.selection,n=o.getFirstPosition();return this._isGravityOverridden?(th(e),this._restoreGravity(),eh(i,t,n),!0):n.isAtStart?!!Zd(o,t)&&(th(e),eh(i,t,n),!0):function(e,t){return ih(e.getShiftedBy(-1),t)}(n,t)?n.isAtEnd&&!Zd(o,t)&&ih(n,t)?(th(e),eh(i,t,n),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function Zd(e,t){for(const i of t)if(e.hasAttribute(i))return!0;return!1}function eh(e,t,i){const o=i.nodeBefore;e.change(e=>{o?e.setSelectionAttribute(o.getAttributes()):e.removeSelectionAttribute(t)})}function th(e){e.preventDefault()}function ih(e,t){const{nodeBefore:i,nodeAfter:o}=e;for(const e of t){const t=i?i.getAttribute(e):void 0;if((o?o.getAttribute(e):void 0)!==t)return!0}return!1}function oh(e,t,i,o){return o.createRange(nh(e,t,i,!0,o),nh(e,t,i,!1,o))}function nh(e,t,i,o,n){let r=e.textNode||(o?e.nodeBefore:e.nodeAfter),s=null;for(;r&&r.getAttribute(t)==i;)s=r,r=o?r.previousSibling:r.nextSibling;return s?n.createPositionAt(s,o?"before":"after"):e}function rh(e,t,i,o){const n=e.editing.view,r=new Set;n.document.registerPostFixer(n=>{const s=e.model.document.selection;let a=!1;if(s.hasAttribute(t)){const l=oh(s.getFirstPosition(),t,s.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(o)&&(n.addClass(o,e),r.add(e),a=!0)}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){n.change(e=>{for(const t of r.values())e.removeClass(o,t),r.delete(t)})}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})})}const sh="code";class ah extends $l{static get pluginName(){return"CodeEditing"}static get requires(){return[Xd]}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:sh}),e.model.schema.setAttributeProperties(sh,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:sh,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(sh,new Dd(e,sh)),e.plugins.get(Xd).registerAttribute(sh),rh(e,sh,"code","ck-code_selected")}}i(12);class lh extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("code",i=>{const o=e.commands.get("code"),n=new Pc(i);return n.set({label:t("Code"),icon:'',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("code"),e.editing.view.focus()}),n})}}class ch extends Bd{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,o=t.document.selection,n=Array.from(o.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=n.filter(e=>dh(e)||uh(i,e));this._applyQuote(e,t)}else this._removeQuote(e,n.filter(dh))})}_getValue(){const e=Id(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!dh(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Id(e.getSelectedBlocks());return!!i&&uh(t,i)}_removeQuote(e,t){hh(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i)})}_applyQuote(e,t){const i=[];hh(e,t).reverse().forEach(t=>{let o=dh(t.start);o||(o=e.createElement("blockQuote"),e.wrap(t,o)),i.push(o)}),i.reverse().reduce((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i)}}function dh(e){return"blockQuote"==e.parent.name?e.parent:null}function hh(e,t){let i,o=0;const n=[];for(;o{if(e.endsWith("blockQuote")&&"blockQuote"==t.name)return!1}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(i=>{const o=e.model.document.differ.getChanges();for(const e of o)if("insert"==e.type){const o=e.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return i.remove(o),!0;if(o.is("element","blockQuote")&&!t.checkChild(e.position,o))return i.unwrap(o),!0;if(o.is("element")){const e=i.createRangeIn(o);for(const o of e.getItems())if(o.is("element","blockQuote")&&!t.checkChild(i.createPositionBefore(o),o))return i.unwrap(o),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return i.remove(t),!0}return!1})}afterInit(){const e=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(t,i)=>{const o=this.editor.model.document,n=o.selection.getLastPosition().parent;o.selection.isCollapsed&&n.isEmpty&&e.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())})}}i(48);class gh extends $l{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const o=e.commands.get("blockQuote"),n=new Pc(i);return n.set({label:t("Block quote"),icon:'',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),n})}}class fh extends Bd{refresh(){const e=this.editor.model,t=Id(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&ph(t,e.schema)}execute(e={}){const t=this.editor.model,i=t.document;t.change(o=>{const n=(e.selection||i.selection).getSelectedBlocks();for(const e of n)!e.is("element","paragraph")&&ph(e,t.schema)&&o.rename(e,"paragraph")})}}function ph(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class bh extends Bd{execute(e){const t=this.editor.model;let i=e.position;t.change(e=>{const o=e.createElement("paragraph");if(!t.schema.checkChild(i.parent,o)){const n=t.schema.findAllowedParent(i,o);if(!n)return;i=e.split(i,n).position}t.insertContent(o,i),e.setSelection(o,"in")})}}class wh extends $l{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new fh(e)),e.commands.add("insertParagraph",new bh(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>wh.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}wh.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class kh extends Bd{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=Id(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>_h(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,o=e.value;t.change(e=>{const n=Array.from(i.selection.getSelectedBlocks()).filter(e=>_h(e,o,t.schema));for(const t of n)t.is("element",o)||e.rename(t,o)})}}function _h(e,t,i){return i.checkChild(e.parent,t)&&!i.isObject(e)}class vh extends $l{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[wh]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const o of t)"paragraph"!==o.model&&(e.model.schema.register(o.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(o),i.push(o.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new kh(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,o)=>{const n=e.model.document.selection.getFirstPosition().parent;i.some(e=>n.is("element",e.model))&&!n.is("element","paragraph")&&0===n.childCount&&o.writer.rename(n,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:hi.get("low")+1})}}class yh{constructor(e,t){t&&Do(this,t),e&&this.set(e)}}function xh(e){const t=e.t,i={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map(e=>{const t=i[e.title];return t&&t!=e.title&&(e.title=t),e})}xi(yh,qo);i(13);class Ch extends $l{init(){const e=this.editor,t=e.t,i=xh(e),o=t("Choose heading"),n=t("Heading");e.ui.componentFactory.add("heading",t=>{const r={},s=new Ci,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of i){const t={type:"button",model:new yh({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(l,"value"),t.model.set("commandName","paragraph"),c.push(l)):(t.model.bind("isOn").to(a,"value",t=>t===e.model),t.model.set({commandName:"heading",commandValue:e.model})),s.add(t),r[e.model]=e.title}const d=Gc(t);return Yc(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:n}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(c,"isEnabled",(...e)=>e.some(e=>e)),d.buttonView.bind("label").to(a,"value",l,"value",(e,t)=>{const i=e||t&&"paragraph";return r[i]?r[i]:o}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}class Ah extends wr{observe(e){this.listenTo(e,"load",(e,t)=>{const i=t.target;this.checkShouldIgnoreEventFromTarget(i)||"IMG"==i.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class Th{constructor(){this._stack=[]}add(e,t){const i=this._stack,o=i[0];this._insertDescriptor(e);const n=i[0];o===n||Ph(o,n)||this.fire("change:top",{oldDescriptor:o,newDescriptor:n,writer:t})}remove(e,t){const i=this._stack,o=i[0];this._removeDescriptor(e);const n=i[0];o===n||Ph(o,n)||this.fire("change:top",{oldDescriptor:o,newDescriptor:n,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e.id);if(Ph(e,t[i]))return;i>-1&&t.splice(i,1);let o=0;for(;t[o]&&Sh(t[o],e);)o++;t.splice(o,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e);i>-1&&t.splice(i,1)}}function Ph(e,t){return e&&t&&e.priority==t.priority&&Eh(e.classes)==Eh(t.classes)}function Sh(e,t){return e.priority>t.priority||!(e.priorityEh(t.classes)}function Eh(e){return Array.isArray(e)?e.sort().join(","):e}xi(Th,fi);function Rh(e,t,i){return e&&Ih(e)&&!i.isInline(t)}function Vh(e){return e.getAttribute("widget-type-around")}function Ih(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function zh(e,t,i={}){if(!e.is("containerElement"))throw new ui.a("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=Lh,i.label&&function(e,t,i){i.setCustomProperty("widgetLabel",t,e)}(e,i.label,t),i.hasSelectionHandle&&function(e,t){const i=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),i=new Ac;return i.set("content",''),i.render(),t.appendChild(i.element),t}));t.insert(t.createPositionAt(e,0),i),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),Oh(e,t,(e,t,i)=>i.addClass(Ti(t.classes),e),(e,t,i)=>i.removeClass(Ti(t.classes),e)),e}function Oh(e,t,i,o){const n=new Th;n.on("change:top",(t,n)=>{n.oldDescriptor&&o(e,n.oldDescriptor,n.writer),n.newDescriptor&&i(e,n.newDescriptor,n.writer)}),t.setCustomProperty("addHighlight",(e,t,i)=>n.add(t,i),e),t.setCustomProperty("removeHighlight",(e,t,i)=>n.remove(t,i),e)}function Mh(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function Nh(e,t){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(i,o,n)=>{t.setAttribute("contenteditable",n?"false":"true",e)}),e.on("change:isFocused",(i,o,n)=>{n?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),e}function Bh(e,t){const i=e.getSelectedElement();if(i){const o=Vh(e);if(o)return t.createPositionAt(i,o);if(t.schema.isBlock(i))return t.createPositionAfter(i)}const o=e.getSelectedBlocks().next().value;if(o){if(o.isEmpty)return t.createPositionAt(o,0);const i=t.createPositionAfter(o);return e.focus.isTouching(i)?i:t.createPositionBefore(o)}return e.focus}function Fh(e,t){return(i,o)=>{const{mapper:n,viewPosition:r}=o,s=n.findMappedViewAncestor(r);if(!t(s))return;const a=n.toModelElement(s);o.modelPosition=e.createPositionAt(a,r.isAtStart?"before":"after")}}function Dh(e,t){const i=new rs(sr.window),o=i.getIntersection(e),n=t.height+vc.arrowVerticalOffset;if(e.top-n>i.top||e.bottom+n{const n=o.createElement("image",t),r=i||Bh(e.document.selection,e);e.insertContent(n,r),n.parent&&o.setSelection(n,"on")})}function qh(e){const t=e.schema,i=e.document.selection;return function(e,t,i){const o=function(e,t){const i=Bh(e,t).parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,i);return t.checkChild(o,"image")}(i,t,e)&&!function(e,t){const i=e.getSelectedElement();return i&&t.isObject(i)}(i,t)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("element","image"))}(i)}function $h(e){const t=[];for(const i of e.getChildren())t.push(i),i.is("element")&&t.push(...i.getChildren());return t.find(e=>e.is("element","img"))}function Uh(e){return i=>{i.on(`attribute:${e}:image`,t)};function t(e,t,i){if(!i.consumable.consume(t.item,e.name))return;const o=i.writer,n=$h(i.mapper.toViewElement(t.item));o.setAttribute(t.attributeKey,t.attributeNewValue||"",n)}}class Kh extends Bd{refresh(){this.isEnabled=qh(this.editor.model)}execute(e){const t=this.editor.model;for(const i of Ti(e.source))Wh(t,{src:i})}}class Gh extends $l{static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,o=e.conversion;e.editing.view.addObserver(Ah),t.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),o.for("dataDowncast").elementToElement({model:"image",view:(e,{writer:t})=>Jh(t)}),o.for("editingDowncast").elementToElement({model:"image",view:(e,{writer:t})=>function(e,t,i){return t.setCustomProperty("image",!0,e),zh(e,t,{label:function(){const t=$h(e).getAttribute("alt");return t?`${t} ${i}`:i}})}(Jh(t),t,i("image widget"))}),o.for("downcast").add(Uh("src")).add(Uh("alt")).add(function(){return t=>{t.on("attribute:srcset:image",e)};function e(e,t,i){if(!i.consumable.consume(t.item,e.name))return;const o=i.writer,n=$h(i.mapper.toViewElement(t.item));if(null===t.attributeNewValue){const e=t.attributeOldValue;e.data&&(o.removeAttribute("srcset",n),o.removeAttribute("sizes",n),e.width&&o.removeAttribute("width",n))}else{const e=t.attributeNewValue;e.data&&(o.setAttribute("srcset",e.data,n),o.setAttribute("sizes","100vw",n),e.width&&o.setAttribute("width",e.width,n))}}}()),o.for("upcast").elementToElement({view:{name:"img",attributes:{src:!0}},model:(e,{writer:t})=>t.createElement("image",{src:e.getAttribute("src")})}).attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:e=>{const t={data:e.getAttribute("srcset")};return e.hasAttribute("width")&&(t.width=e.getAttribute("width")),t}}}).add(function(){return t=>{t.on("element:figure",e)};function e(e,t,i){if(!i.consumable.test(t.viewItem,{name:!0,classes:"image"}))return;const o=$h(t.viewItem);if(!o||!o.hasAttribute("src")||!i.consumable.test(o,{name:!0}))return;const n=Id(i.convertItem(o,t.modelCursor).modelRange.getItems());n&&(i.convertChildren(t.viewItem,n),i.updateConversionResult(n,t))}}()),e.commands.add("imageInsert",new Kh(e))}}function Jh(e){const t=e.createEmptyElement("img"),i=e.createContainerElement("figure",{class:"image"});return e.insert(e.createPositionAt(i,0),t),i}class Yh extends Dr{constructor(e){super(e),this.domEventType="mousedown"}onDomEvent(e){this.fire(e.type,e)}}const Qh=[wn("arrowUp"),wn("arrowRight"),wn("arrowDown"),wn("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let e=112;e<=135;e++)Qh.push(e);function Xh(e){return!!e.ctrlKey||Qh.includes(e.keyCode)}i(51);const Zh=["before","after"],eu=(new DOMParser).parseFromString('',"image/svg+xml").firstChild;class tu extends $l{static get pluginName(){return"WidgetTypeAround"}constructor(e){super(e),this._currentFakeCaretModelElement=null}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,o,n)=>{t.change(e=>{for(const i of t.document.roots)n?e.removeClass("ck-widget__type-around_disabled",i):e.addClass("ck-widget__type-around_disabled",i)}),n||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,o=i.editing.view;i.execute("insertParagraph",{position:i.model.createPositionAt(e,t)}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(e,t,i,o){this.listenTo(e,t,(...e)=>{this.isEnabled&&i(...e)},o)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Vh(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,o={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,i,n)=>{const r=n.mapper.toViewElement(i.item);Rh(r,i.item,t)&&function(e,t,i){const o=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const i=this.toDomElement(e);return function(e,t){for(const i of Zh){const o=new Gl({tag:"div",attributes:{class:["ck","ck-widget__type-around__button","ck-widget__type-around__button_"+i],title:t[i]},children:[e.ownerDocument.importNode(eu,!0)]});e.appendChild(o.render())}}(i,t),function(e){const t=new Gl({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(i),i}));e.insert(e.createPositionAt(i,"end"),o)}(n.writer,o,r)},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,o=t.schema,n=e.editing.view;function r(e){return"ck-widget_type-around_show-fake-caret_"+e}this._listenToIfEnabled(n.document,"keydown",(e,t)=>{vn(t.keyCode)&&this._handleArrowKeyPress(e,t)},{priority:hi.get("high")+10}),this._listenToIfEnabled(i,"change:range",(t,i)=>{i.directChange&&e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=i.getSelectedElement();if(t){if(Rh(e.editing.mapper.toViewElement(t),t,o))return}e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,i)=>{const n=i.writer;if(this._currentFakeCaretModelElement){const e=i.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(n.removeClass(Zh.map(r),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=i.mapper.toViewElement(s);if(!Rh(a,s,o))return;const l=Vh(t.selection);l&&(n.addClass(r(l),a),this._currentFakeCaretModelElement=s)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,i,o)=>{o||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})})}_handleArrowKeyPress(e,t){const i=this.editor,o=i.model,n=o.document.selection,r=o.schema,s=i.editing.view,a=xn(t.keyCode,i.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;Rh(l,i.editing.mapper.toModelElement(l),r)?c=this._handleArrowKeyPressOnSelectedWidget(a):n.isCollapsed&&(c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=Vh(t.document.selection);return t.change(t=>{if(!i)return t.setSelectionAttribute("widget-type-around",e?"after":"before"),!0;if(!(i===(e?"after":"before")))return t.removeSelectionAttribute("widget-type-around"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,o=i.schema,n=t.plugins.get("Widget"),r=n._getObjectElementNextToSelection(e);return!!Rh(t.editing.mapper.toViewElement(r),r,o)&&(i.change(t=>{n._setSelectionOverElement(r),t.setSelectionAttribute("widget-type-around",e?"before":"after")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,o)=>{const n=o.domTarget.closest(".ck-widget__type-around__button");if(!n)return;const r=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(n),s=function(e,t){const i=e.closest(".ck-widget");return t.mapDomToView(i)}(n,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"enter",(i,o)=>{const n=t.document.selection.getSelectedElement(),r=e.editing.mapper.toModelElement(n),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Rh(n,r,s)&&(this._insertParagraph(r,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),i.stop())})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view,t=[bn.enter,bn.delete,bn.backspace];this._listenToIfEnabled(e.document,"keydown",(e,i)=>{t.includes(i.keyCode)||Xh(i)||this._insertParagraphAccordingToFakeCaretPosition()},{priority:hi.get("high")+1})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,o=i.schema;this._listenToIfEnabled(t.document,"delete",(t,n)=>{const r=Vh(i.document.selection);if(!r)return;const s=n.direction,a=i.document.selection.getSelectedElement(),l="forward"==s;if("before"===r===l)e.execute("delete",{selection:i.createSelection(a,"on")});else{const t=o.getNearestSelectionRange(i.createPositionAt(a,r),s);if(t)if(t.isCollapsed){const n=i.createSelection(t.start);if(i.modifySelection(n,{direction:s}),n.focus.isEqual(t.start)){const e=function(e,t){let i=t;for(const o of t.getAncestors({parentFirst:!0})){if(o.childCount>1||e.isLimit(o))break;i=o}return i}(o,t.start.parent);i.deleteContent(i.createSelection(e,"on"),{doNotAutoparagraph:!0})}else i.change(i=>{i.setSelection(t),e.execute(l?"forwardDelete":"delete")})}else i.change(i=>{i.setSelection(t),e.execute(l?"forwardDelete":"delete")})}n.preventDefault(),t.stop()},{priority:hi.get("high")+1})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[o,n])=>{if(n&&!n.is("documentSelection"))return;const r=Vh(i);return r?(e.stop(),t.change(e=>{const n=i.getSelectedElement(),s=t.createPositionAt(n,r),a=e.createSelection(s),l=t.insertContent(o,a);return e.setSelection(a),l})):void 0},{priority:"high"})}}i(53);function iu(e){const t=e.model;return(i,o)=>{const n=o.keyCode==bn.arrowup,r=o.keyCode==bn.arrowdown,s=o.shiftKey,a=t.document.selection;if(!n&&!r)return;const l=r;if(s&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,i){const o=e.model;if(i){const e=t.isCollapsed?t.focus:t.getLastPosition(),i=ou(o,e,"forward");if(!i)return null;const n=o.createRange(e,i),r=nu(o.schema,n,"backward");return r&&e.isBefore(r)?o.createRange(e,r):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),i=ou(o,e,"backward");if(!i)return null;const n=o.createRange(i,e),r=nu(o.schema,n,"forward");return r&&e.isAfter(r)?o.createRange(r,e):null}}(e,a,l);c&&!c.isCollapsed&&function(e,t,i){const o=e.model,n=e.view.domConverter;if(i){const e=o.createSelection(t.start);o.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=o.createRange(e.focus,t.end))}const r=e.mapper.toViewRange(t),s=n.viewRangeToDom(r),a=rs.getDomRangeRects(s);let l;for(const e of a)if(void 0!==l){if(Math.round(e.top)>=l)return!1;l=Math.max(l,Math.round(e.bottom))}else l=Math.round(e.bottom);return!0}(e,c,l)&&(t.change(e=>{const i=l?c.end:c.start;if(s){const o=t.createSelection(a.anchor);o.setFocus(i),e.setSelection(o)}else e.setSelection(i)}),i.stop(),o.preventDefault(),o.stopPropagation())}}function ou(e,t,i){const o=e.schema,n=e.createRangeIn(t.root),r="forward"==i?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of n.getWalker({startPosition:t,direction:i})){if(o.isLimit(s)&&!o.isInline(s))return e;if(a==r&&o.isBlock(s))return null}return null}function nu(e,t,i){const o="backward"==i?t.end:t.start;if(e.checkChild(o,"$text"))return o;for(const{nextPosition:o}of t.getWalker({direction:i}))if(e.checkChild(o,"$text"))return o}class ru extends $l{static get pluginName(){return"Widget"}static get requires(){return[tu]}init(){const e=this.editor.editing.view,t=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(e,t,i)=>{this._clearPreviouslySelectedWidgets(i.writer);const o=i.writer,n=o.document.selection,r=n.getSelectedElement();let s=null;for(const e of n.getRanges())for(const t of e){const e=t.item;Ih(e)&&!su(e,s)&&(o.addClass("ck-widget_selected",e),this._previouslySelected.add(e),s=e,e==r&&o.setSelection(n.getRanges(),{fake:!0,label:Mh(r)}))}},{priority:"low"}),e.addObserver(Yh),this.listenTo(t,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(t,"keydown",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{priority:"high"}),this.listenTo(t,"keydown",(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{priority:hi.get("high")-20}),this.listenTo(t,"keydown",iu(this.editor.editing)),this.listenTo(t,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{priority:"high"})}_onMousedown(e,t){const i=this.editor,o=i.editing.view,n=o.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(Ih(e))return!1;e=e.parent}return!1}(r)){if((gn.isSafari||gn.isGecko)&&t.domEvent.detail>=3){const e=i.editing.mapper,o=r.is("attributeElement")?r.findAncestor(e=>!e.is("attributeElement")):r,n=e.toModelElement(o);t.preventDefault(),this.editor.model.change(e=>{e.setSelection(n,"in")})}return}if(!Ih(r)&&(r=r.findAncestor(Ih),!r))return;t.preventDefault(),n.isFocused||o.focus();const s=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode;if(!vn(i))return;const o=this.editor.model,n=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=xn(i,this.editor.locale.contentLanguageDirection);if(s&&n.isObject(s)){const i=a?r.getLastPosition():r.getFirstPosition(),s=n.getNearestSelectionRange(i,a?"forward":"backward");return void(s&&(o.change(e=>{e.setSelection(s)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed)return;const l=this._getObjectElementNextToSelection(a);l&&n.isObject(l)&&(this._setSelectionOverElement(l),t.preventDefault(),e.stop())}_preventDefaultOnArrowKeyPress(e,t){if(!vn(t.keyCode))return;const i=this.editor.model,o=i.schema,n=i.document.selection.getSelectedElement();n&&o.isObject(n)&&(t.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change(e=>{let o=t.anchor.parent;for(;o.isEmpty;){const t=o;o=t.parent,e.remove(t)}this._setSelectionOverElement(i)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,o=t.document.selection,n=t.createSelection(o);t.modifySelection(n,{direction:e?"forward":"backward"});const r=e?n.focus.nodeBefore:n.focus.nodeAfter;return r&&i.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function su(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class au extends Bd{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=jh(e),jh(e)&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor.model,i=t.document.selection.getSelectedElement();t.change(t=>{t.setAttribute("alt",e.newValue,i)})}}class lu extends $l{static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new au(this.editor))}}i(55);class cu extends mc{constructor(e){super(e),this.set("text"),this.set("for"),this.id="ck-editor__label_"+di();const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}i(57);class du extends mc{constructor(e,t){super(e);const i="ck-labeled-field-view-"+di(),o="ck-labeled-field-view-status-"+di();this.fieldView=t(this,i,o),this.set("label"),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.set("placeholder"),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const n=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e),n.if("isEmpty","ck-labeled-field-view_empty"),n.if("isFocused","ck-labeled-field-view_focused"),n.if("placeholder","ck-labeled-field-view_placeholder"),n.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:[this.fieldView,this.labelView]},this.statusView]})}_createLabelView(e){const t=new cu(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new mc(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",e=>!e)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}i(59);class hu extends mc{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById"),this.focusTracker=new Sc,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to("input"),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()})}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}function uu(e,t,i){const o=new hu(e.locale);return o.set({id:t,ariaDescribedById:i}),o.bind("isReadOnly").to(e,"isEnabled",e=>!e),o.bind("hasError").to(e,"errorText",e=>!!e),o.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused","placeholder").to(o),o}function mu(e,t,i){const o=Gc(e.locale);return o.set({id:t,ariaDescribedById:i}),o.bind("isEnabled").to(e),o}function gu(e){e.set("_isCssTransitionsDisabled",!1),e.disableCssTransitions=()=>{e._isCssTransitionsDisabled=!0},e.enableCssTransitions=()=>{e._isCssTransitionsDisabled=!1},e.extendTemplate({attributes:{class:[e.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}function fu({view:e}){e.listenTo(e.element,"submit",(t,i)=>{i.preventDefault(),e.fire("submit")},{useCapture:!0})}var pu='',bu='';i(61),i(10);class wu extends mc{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new Sc,this.keystrokes=new Ll,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),pu,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),bu,"ck-button-cancel","cancel"),this._focusables=new Kl,this._focusCycler=new zc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),gu(this)}render(){super.render(),this.keystrokes.listenTo(this.element),fu({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,i,o){const n=new Pc(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createLabeledInputView(){const e=this.locale.t,t=new du(this.locale,uu);return t.label=e("Text alternative"),t}}function ku(e){const t=e.editing.view,i=vc.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast]}}class _u extends $l{static get requires(){return[Rc]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const o=e.commands.get("imageTextAlternative"),n=new Pc(i);return n.set({label:t("Change image text alternative"),icon:'',tooltip:!0}),n.bind("isEnabled").to(o,"isEnabled"),this.listenTo(n,"execute",()=>{this._showForm()}),n})}_createForm(){const e=this.editor,t=e.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new wu(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(e,t)=>{this._hideForm(!0),t()}),this.listenTo(e.ui,"update",()=>{Hh(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(Hh(e.editing.view.document.selection)){const i=ku(e);t.updatePosition(i)}}(e):this._hideForm(!0)}),Kc({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:ku(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class vu extends $l{static get requires(){return[lu,_u]}static get pluginName(){return"ImageTextAlternative"}}i(64);function yu(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}function xu(e){const t=e.parent;return"figcaption"==e.name&&t&&"figure"==t.name&&t.hasClass("image")?{name:!0}:null}class Cu extends $l{static get pluginName(){return"ImageCaptionEditing"}init(){const e=this.editor,t=e.editing.view,i=e.model.schema,o=e.data,n=e.editing,r=e.t;i.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),e.model.document.registerPostFixer(e=>this._insertMissingModelCaptionElement(e)),e.conversion.for("upcast").elementToElement({view:xu,model:"caption"});o.downcastDispatcher.on("insert:caption",Au(e=>e.createContainerElement("figcaption"),!1));const s=function(e,t){return i=>{const o=i.createEditableElement("figcaption");return i.setCustomProperty("imageCaption",!0,o),cd({view:e,element:o,text:t}),Nh(o,i)}}(t,r("Enter image caption"));n.downcastDispatcher.on("insert:caption",Au(s)),n.downcastDispatcher.on("insert",this._fixCaptionVisibility(e=>e.item),{priority:"high"}),n.downcastDispatcher.on("remove",this._fixCaptionVisibility(e=>e.position.parent),{priority:"high"}),t.document.registerPostFixer(e=>this._updateCaptionVisibility(e))}_updateCaptionVisibility(e){const t=this.editor.editing.mapper,i=this._lastSelectedCaption;let o;const n=this.editor.model.document.selection,r=n.getSelectedElement();if(r&&r.is("element","image")){const e=yu(r);o=t.toViewElement(e)}const s=Tu(n.getFirstPosition().parent);if(s&&(o=t.toViewElement(s)),o)return i?(i===o||(Pu(i,e),this._lastSelectedCaption=o),Su(o,e)):(this._lastSelectedCaption=o,Su(o,e));if(i){const t=Pu(i,e);return this._lastSelectedCaption=null,t}return!1}_fixCaptionVisibility(e){return(t,i,o)=>{const n=Tu(e(i)),r=this.editor.editing.mapper,s=o.writer;if(n){const e=r.toViewElement(n);e&&(n.childCount?s.removeClass("ck-hidden",e):s.addClass("ck-hidden",e))}}}_insertMissingModelCaptionElement(e){const t=this.editor.model,i=t.document.differ.getChanges(),o=[];for(const e of i)if("insert"==e.type&&"$text"!=e.name){const i=e.position.nodeAfter;if(i.is("element","image")&&!yu(i)&&o.push(i),!i.is("element","image")&&i.childCount)for(const e of t.createRangeIn(i).getItems())e.is("element","image")&&!yu(e)&&o.push(e)}for(const t of o)e.appendElement("caption",t);return!!o.length}}function Au(e,t=!0){return(i,o,n)=>{const r=o.item;if((r.childCount||t)&&jh(r.parent)){if(!n.consumable.consume(o.item,"insert"))return;const t=n.mapper.toViewElement(o.range.start.parent),i=e(n.writer),s=n.writer;r.childCount||s.addClass("ck-hidden",i),function(e,t,i,o){const n=o.writer.createPositionAt(i,"end");o.writer.insert(n,e),o.mapper.bindElements(t,e)}(i,o.item,t,n)}}}function Tu(e){const t=e.getAncestors({includeSelf:!0}).find(e=>"caption"==e.name);return t&&t.parent&&"image"==t.parent.name?t:null}function Pu(e,t){return!e.childCount&&!e.hasClass("ck-hidden")&&(t.addClass("ck-hidden",e),!0)}function Su(e,t){return!!e.hasClass("ck-hidden")&&(t.removeClass("ck-hidden",e),!0)}i(66);class Eu extends Bd{constructor(e,t){super(e),this.defaultStyle=!1,this.styles=t.reduce((e,t)=>(e[t.name]=t,t.isDefault&&(this.defaultStyle=t.name),e),{})}refresh(){const e=this.editor.model.document.selection.getSelectedElement();if(this.isEnabled=jh(e),e)if(e.hasAttribute("imageStyle")){const t=e.getAttribute("imageStyle");this.value=!!this.styles[t]&&t}else this.value=this.defaultStyle;else this.value=!1}execute(e){const t=e.value,i=this.editor.model,o=i.document.selection.getSelectedElement();i.change(e=>{this.styles[t].isDefault?e.removeAttribute("imageStyle",o):e.setAttribute("imageStyle",t,o)})}}function Ru(e,t){for(const i of t)if(i.name===e)return i}var Vu='',Iu='',zu='',Ou='';const Mu={full:{name:"full",title:"Full size image",icon:Vu,isDefault:!0},side:{name:"side",title:"Side image",icon:Ou,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:Iu,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:zu,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:Ou,className:"image-style-align-right"}},Nu={full:Vu,left:Iu,right:Ou,center:zu};function Bu(e=[]){return e.map(Fu)}function Fu(e){if("string"==typeof e){const t=e;Mu[t]?e=Object.assign({},Mu[t]):(Object(ui.c)("image-style-not-found",{name:t}),e={name:t})}else if(Mu[e.name]){const t=Mu[e.name],i=Object.assign({},e);for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);e=i}return"string"==typeof e.icon&&Nu[e.icon]&&(e.icon=Nu[e.icon]),e}class Du extends $l{static get pluginName(){return"ImageStyleEditing"}init(){const e=this.editor,t=e.model.schema,i=e.data,o=e.editing;e.config.define("image.styles",["full","side"]);const n=Bu(e.config.get("image.styles"));t.extend("image",{allowAttributes:"imageStyle"});const r=function(e){return(t,i,o)=>{if(!o.consumable.consume(i.item,t.name))return;const n=Ru(i.attributeNewValue,e),r=Ru(i.attributeOldValue,e),s=o.mapper.toViewElement(i.item),a=o.writer;r&&a.removeClass(r.className,s),n&&a.addClass(n.className,s)}}(n);o.downcastDispatcher.on("attribute:imageStyle:image",r),i.downcastDispatcher.on("attribute:imageStyle:image",r),i.upcastDispatcher.on("element:figure",function(e){const t=e.filter(e=>!e.isDefault);return(e,i,o)=>{if(!i.modelRange)return;const n=i.viewItem,r=Id(i.modelRange.getItems());if(o.schema.checkAttribute(r,"imageStyle"))for(const e of t)o.consumable.consume(n,{classes:e.className})&&o.writer.setAttribute("imageStyle",e.name,r)}}(n),{priority:"low"}),e.commands.add("imageStyle",new Eu(e,n))}}i(68);class Lu extends $l{static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=function(e,t){for(const i of e)t[i.title]&&(i.title=t[i.title]);return e}(Bu(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const t of e)this._createButton(t)}_createButton(e){const t=this.editor,i="imageStyle:"+e.name;t.ui.componentFactory.add(i,i=>{const o=t.commands.get("imageStyle"),n=new Pc(i);return n.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(o,"isEnabled"),n.bind("isOn").to(o,"value",t=>t===e.name),this.listenTo(n,"execute",()=>{t.execute("imageStyle",{value:e.name}),t.editing.view.focus()}),n})}}class Hu extends $l{static get requires(){return[Rc]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",t=>{(function(e){const t=e.getSelectedElement();return!(!t||!Ih(t))})(e.editing.view.document.selection)&&t.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:o,balloonClassName:n="ck-toolbar-container"}){if(!i.length)return void Object(ui.c)("widget-toolbar-no-items",{toolbarId:e});const r=this.editor,s=r.t,a=new Qc(r.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new ui.a("widget-toolbar-duplicated",this,{toolbarId:e});a.fillFromConfig(i,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:o,balloonClassName:n})}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const o of this._toolbarDefinitions.values()){const n=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&n)if(this.editor.ui.focusTracker.isFocused){const r=n.getAncestors().length;r>e&&(e=r,t=n,i=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?ju(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:Wu(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);ju(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function ju(e,t){const i=e.plugins.get("ContextualBalloon"),o=Wu(e,t);i.updatePosition(o)}function Wu(e,t){const i=e.editing.view,o=vc.defaultPositions;return{target:i.domConverter.mapViewToDom(t),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,Dh]}}class qu extends mc{constructor(e){super(e),this.buttonView=new Pc(e),this._fileInputView=new $u(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class $u extends mc{constructor(e){super(e),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}function Uu(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}class Ku extends $l{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageUpload",i=>{const o=new qu(i),n=e.commands.get("imageUpload"),r=e.config.get("image.upload.types"),s=Uu(r);return o.set({acceptedType:r.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:t("Insert image"),icon:'',tooltip:!0}),o.buttonView.bind("isEnabled").to(n),o.on("done",(t,i)=>{const o=Array.from(i).filter(e=>s.test(e.type));o.length&&e.execute("imageUpload",{file:o})}),o})}}i(70),i(72),i(74);class Gu extends $l{constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('')}init(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,i){const o=this.editor,n=t.item,r=n.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const s=o.plugins.get(Sd),a=r?t.attributeNewValue:null,l=this.placeholder,c=o.editing.mapper.toViewElement(n),d=i.writer;if("reading"==a)return Ju(c,d),void Yu(l,c,d);if("uploading"==a){const e=s.loaders.get(r);return Ju(c,d),void(e?(Qu(c,d),function(e,t,i,o){const n=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),n),i.on("change:uploadedPercent",(e,t,i)=>{o.change(e=>{e.setStyle("width",i+"%",n)})})}(c,d,e,o.editing.view),function(e,t,i){if(i.data){const o=$h(e);t.setAttribute("src",i.data,o)}}(c,d,e)):Yu(l,c,d))}"complete"==a&&s.loaders.get(r)&&function(e,t,i){const o=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),o),setTimeout(()=>{i.change(e=>e.remove(e.createRangeOn(o)))},3e3)}(c,d,o.editing.view),function(e,t){Zu(e,t,"progressBar")}(c,d),Qu(c,d),function(e,t){t.removeClass("ck-appear",e)}(c,d)}}function Ju(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function Yu(e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);const o=$h(t);o.getAttribute("src")!==e&&i.setAttribute("src",e,o),Xu(t,"placeholder")||i.insert(i.createPositionAfter(o),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(i))}function Qu(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Zu(e,t,"placeholder")}function Xu(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function Zu(e,t,i){const o=Xu(e,i);o&&t.remove(t.createRangeOn(o))}class em extends Ad{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t="show:"+e.type+(e.namespace?":"+e.namespace:"");this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class tm{constructor(e){this.files=function(e){const t=e.files?Array.from(e.files):[],i=e.items?Array.from(e.items):[];if(t.length)return t;return i.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}(e),this._native=e}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}}class im extends Dr{constructor(e){super(e);const t=this.document;function i(e,i){i.preventDefault();const o=i.dropRange?[i.dropRange]:Array.from(t.selection.getRanges()),n=new li(t,"clipboardInput");t.fire(n,{dataTransfer:i.dataTransfer,targetRanges:o}),n.stop.called&&i.stopPropagation()}this.domEventType=["paste","copy","cut","drop","dragover"],this.listenTo(t,"paste",i,{priority:"low"}),this.listenTo(t,"drop",i,{priority:"low"})}onDomEvent(e){const t={dataTransfer:new tm(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"==e.type&&(t.dropRange=function(e,t){const i=t.target.ownerDocument,o=t.clientX,n=t.clientY;let r;i.caretRangeFromPoint&&i.caretRangeFromPoint(o,n)?r=i.caretRangeFromPoint(o,n):t.rangeParent&&(r=i.createRange(),r.setStart(t.rangeParent,t.rangeOffset),r.collapse(!0));return r?e.domConverter.domRangeToView(r):e.document.selection.getFirstRange()}(this.view,e)),this.fire(e.type,e,t)}}class om extends $l{static get pluginName(){return"PastePlainText"}init(){const e=this.editor.editing.view,t=e.document;let i=!1;e.addObserver(im),this.listenTo(t,"keydown",(e,t)=>{i=t.shiftKey}),this.listenTo(t,"clipboardInput",(e,t)=>{i&&(t.asPlainText=!0)},{priority:"high"})}}const nm=["figcaption","li"];class rm extends $l{static get pluginName(){return"Clipboard"}static get requires(){return[om]}init(){const e=this.editor,t=e.model.document,i=e.editing.view,o=i.document;function n(i,n){const r=n.dataTransfer;n.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));o.fire("clipboardOutput",{dataTransfer:r,content:s,method:i.name})}this._htmlDataProcessor=new ql(o),i.addObserver(im),this.listenTo(o,"clipboardInput",t=>{e.isReadOnly&&t.stop()},{priority:"highest"}),this.listenTo(o,"clipboardInput",(e,t)=>{const o=t.dataTransfer;let n="";var r;o.getData("text/html")?n=function(e){return e.replace(/(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t)}(o.getData("text/html")):o.getData("text/plain")&&(((r=(r=o.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"

").replace(/\r?\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).includes("

")||r.includes("
"))&&(r=`

${r}

`),n=r),n=this._htmlDataProcessor.toView(n);const s=new li(this,"inputTransformation");this.fire(s,{content:n,dataTransfer:o,asPlainText:t.asPlainText}),s.stop.called&&e.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,t)=>{if(!t.content.isEmpty){const i=this.editor.data,o=this.editor.model,n=i.toModel(t.content,"$clipboardHolder");if(0==n.childCount)return;o.change(e=>{const i=o.document.selection;if(t.asPlainText||function(e,t){if(e.childCount>1)return!1;const i=e.getChild(0);if(t.isObject(i))return!1;return 0==[...i.getAttributeKeys()].length}(n,o.schema)){const t=Array.from(i.getAttributes()).filter(([e])=>o.schema.getAttributeProperties(e).isFormatting);i.isCollapsed||o.deleteContent(i,{doNotAutoparagraph:!0}),t.push(...i.getAttributes());const r=e.createRangeIn(n);for(const i of r.getItems())(i.is("$text")||i.is("$textProxy"))&&e.setAttributes(t,i)}o.insertContent(n)}),e.stop()}},{priority:"low"}),this.listenTo(o,"copy",n,{priority:"low"}),this.listenTo(o,"cut",(t,i)=>{e.isReadOnly?i.preventDefault():n(t,i)},{priority:"low"}),this.listenTo(o,"clipboardOutput",(i,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",function e(t){let i="";if(t.is("$text")||t.is("$textProxy"))i=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))i=t.getAttribute("alt");else if(t.is("element","br"))i="\n";else{let o=null;for(const n of t.getChildren()){const t=e(n);o&&(o.is("containerElement")||n.is("containerElement"))&&(nm.includes(o.name)||nm.includes(n.name)?i+="\n":i+="\n\n"),i+=t,o=n}}return i}(o.content))),"cut"==o.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}class sm{constructor(e){this.document=e}createDocumentFragment(e){return new Rn(this.document,e)}createElement(e,t,i){return new Mo(this.document,e,t,i)}createText(e){return new Mi(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const o=i.getChildIndex(e);return this.removeChildren(o,1,i),this.insertChild(o,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new Mo(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){y(e)&&void 0===i&&(i=t),i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return en._createAt(e,t)}createPositionAfter(e){return en._createAfter(e)}createPositionBefore(e){return en._createBefore(e)}createRange(e,t){return new tn(e,t)}createRangeOn(e){return tn._createOn(e)}createRangeIn(e){return tn._createIn(e)}createSelection(e,t,i){return new rn(e,t,i)}}class am extends Bd{refresh(){const e=this.editor.model.document.selection.getSelectedElement(),t=e&&"image"===e.name||!1;this.isEnabled=qh(this.editor.model)||t}execute(e){const t=this.editor,i=t.model,o=t.plugins.get(Sd);for(const t of Ti(e.file))lm(i,o,t)}}function lm(e,t,i){const o=t.createLoader(i);o&&Wh(e,{uploadId:o.id})}class cm extends $l{static get requires(){return[Sd,em,rm]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}})}init(){const e=this.editor,t=e.model.document,i=e.model.schema,o=e.conversion,n=e.plugins.get(Sd),r=Uu(e.config.get("image.upload.types"));i.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),e.commands.add("imageUpload",new am(e)),o.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,i)=>{if(o=i.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const n=Array.from(i.dataTransfer.files).filter(e=>!!e&&r.test(e.type)),s=i.targetRanges.map(t=>e.editing.mapper.toModelRange(t));e.model.change(i=>{i.setSelection(s),n.length&&(t.stop(),e.model.enqueueChange("default",()=>{e.execute("imageUpload",{file:n})}))})}),this.listenTo(e.plugins.get(rm),"inputTransformation",(t,i)=>{const o=Array.from(e.editing.view.createRangeIn(i.content)).filter(e=>{return!(!(t=e.item).is("element","img")||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))&&!e.item.getAttribute("uploadProcessed");var t}).map(e=>{return{promise:(t=e.item,new Promise((e,i)=>{const o=t.getAttribute("src");fetch(o).then(e=>e.blob()).then(t=>{const i=function(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}(t,o),n=i.replace("image/",""),r=new File([t],"image."+n,{type:i});e(r)}).catch(i)})),imageElement:e.item};var t});if(!o.length)return;const r=new sm(e.editing.view.document);for(const e of o){r.setAttribute("uploadProcessed",!0,e.imageElement);const t=n.createLoader(e.promise);t&&(r.setAttribute("src","",e.imageElement),r.setAttribute("uploadId",t.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault()}),t.on("change",()=>{const i=t.differ.getChanges({includeChangesInGraveyard:!0});for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,o="$graveyard"==t.position.root.rootName;for(const t of dm(e,i)){const e=t.getAttribute("uploadId");if(!e)continue;const i=n.loaders.get(e);i&&(o?i.abort():"idle"==i.status&&this._readAndUpload(i,t))}}})}_readAndUpload(e,t){const i=this.editor,o=i.model,n=i.locale.t,r=i.plugins.get(Sd),s=i.plugins.get(em);return o.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","reading",t)}),e.read().then(()=>{const n=e.upload();if(gn.isSafari){const e=$h(i.editing.mapper.toViewElement(t));i.editing.view.once("render",()=>{if(!e.parent)return;const t=i.editing.view.domConverter.mapViewToDom(e.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o})}return o.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",t)}),n}).then(e=>{o.enqueueChange("transparent",i=>{i.setAttributes({uploadStatus:"complete",src:e.default},t),this._parseAndSetSrcsetAttributeOnImage(e,t,i)}),a()}).catch(i=>{if("error"!==e.status&&"aborted"!==e.status)throw i;"error"==e.status&&i&&s.showWarning(i,{title:n("Upload failed"),namespace:"upload"}),a(),o.enqueueChange("transparent",e=>{e.remove(t)})});function a(){o.enqueueChange("transparent",e=>{e.removeAttribute("uploadId",t),e.removeAttribute("uploadStatus",t)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let o=0;const n=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return o=Math.max(o,t),!0}).map(t=>`${e[t]} ${t}w`).join(", ");""!=n&&i.setAttribute("srcset",{data:n,width:o},t)}}function dm(e,t){return Array.from(e.model.createRangeOn(t)).filter(e=>e.item.is("element","image")).map(e=>e.item)}class hm extends Bd{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=jh(e),e&&e.hasAttribute("width")?this.value={width:e.getAttribute("width"),height:null}:this.value=null}execute(e){const t=this.editor.model,i=t.document.selection.getSelectedElement();this.value={width:e.width,height:null},i&&t.change(t=>{t.setAttribute("width",e.width,i)})}}class um extends $l{static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"imageResize:original",value:null,icon:"original"},{name:"imageResize:25",value:"25",icon:"small"},{name:"imageResize:50",value:"50",icon:"medium"},{name:"imageResize:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new hm(e);this._registerSchema(),this._registerConverters(),e.commands.add("imageResize",t)}_registerSchema(){this.editor.model.schema.extend("image",{allowAttributes:"width"}),this.editor.model.schema.setAttributeProperties("width",{isFormatting:!0})}_registerConverters(){const e=this.editor;e.conversion.for("downcast").add(e=>e.on("attribute:width:image",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=i.writer,n=i.mapper.toViewElement(t.item);null!==t.attributeNewValue?(o.setStyle("width",t.attributeNewValue,n),o.addClass("image_resized",n)):(o.removeStyle("width",n),o.removeClass("image_resized",n))})),e.conversion.for("upcast").attributeToAttribute({view:{name:"figure",styles:{width:/.+/}},model:{key:"width",value:e=>e.getStyle("width")}})}}var mm='';const gm={small:'',medium:mm,large:'',original:''};class fm extends $l{static get requires(){return[um]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("imageResize");this.bind("isEnabled").to(i);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:o,icon:n}=e,r=o?o+this._resizeUnit:null;t.ui.componentFactory.add(i,i=>{const o=new Pc(i),s=t.commands.get("imageResize"),a=this._getOptionLabelValue(e,!0);if(!gm[n])throw new ui.a("imageresizebuttons-missing-icon",t,e);return o.set({label:a,icon:gm[n],tooltip:a,isToggleable:!0}),o.bind("isEnabled").to(this),o.bind("isOn").to(s,"value",pm(r)),this.listenTo(o,"execute",()=>{t.execute("imageResize",{width:r})}),o})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,o=e.find(e=>!e.value);t.ui.componentFactory.add("imageResize",n=>{const r=t.commands.get("imageResize"),s=Gc(n,jc),a=s.buttonView;return a.set({tooltip:i("Resize image"),commandValue:o.value,icon:mm,isToggleable:!0,label:this._getOptionLabelValue(o),withText:!0,class:"ck-resize-image-button"}),a.bind("label").to(r,"value",e=>e&&e.width?e.width:this._getOptionLabelValue(o)),s.bind("isOn").to(r),s.bind("isEnabled").to(this),Yc(s,this._getResizeDropdownListItemDefinitions(e,r)),s.listView.ariaLabel=i("Image resize list"),this.listenTo(s,"execute",e=>{t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus()}),s})}_getOptionLabelValue(e,t){const i=this.editor.t;return e.label?e.label:t?e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const i=new Ci;return e.map(e=>{const o=e.value?e.value+this._resizeUnit:null,n={type:"button",model:new yh({commandName:"imageResize",commandValue:o,label:this._getOptionLabelValue(e),withText:!0,icon:null})};n.model.bind("isOn").to(t,"value",pm(o)),i.add(n)}),i}}function pm(e){return t=>null===e&&t===e||t&&t.width===e}class bm{constructor(e){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}begin(e,t,i){const o=new rs(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)if(e.classList.contains("ck-widget__resizer__handle-"+i))return i}(e),this._referenceCoordinates=function(e,t){const i=new rs(e),o=t.split("-"),n={x:"right"==o[1]?i.right:i.left,y:"bottom"==o[0]?i.bottom:i.top};return n.x+=e.ownerDocument.defaultView.scrollX,n.y+=e.ownerDocument.defaultView.scrollY,n}(t,function(e){const t=e.split("-"),i={top:"bottom",bottom:"top",left:"right",right:"left"};return`${i[t[0]]}-${i[t[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const n=i.style.width;n&&n.match(/^\d+\.?\d*%$/)?this.originalWidthPercents=parseFloat(n):this.originalWidthPercents=function(e,t){const i=e.parentElement,o=parseFloat(i.ownerDocument.defaultView.getComputedStyle(i).width);return t.width/o*100}(i,o)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}xi(bm,qo);class wm{constructor(e){this._options=e,this._domResizerWrapper=null,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop())},{priority:"high"}),this.on("change:isEnabled",()=>{this.isEnabled&&this.redraw()})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(i=>{const o=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const i=this.toDomElement(t);return e._appendHandles(i),e._appendSizeUI(i),e._domResizerWrapper=i,e.on("change:isEnabled",(e,t,o)=>{i.style.display=o?"":"none"}),i.style.display=e.isEnabled?"":"none",i}));i.insert(i.createPositionAt(t,"end"),o),i.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=o})}begin(e){this.state=new bm(this._options),this._sizeUI.bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(e=>{const i=this._options.unit||"%",o=("%"===i?t.widthPercents:t.width)+i;e.setStyle("width",o,this._options.viewElement)});const i=this._getHandleHost(),o=new rs(i);t.handleHostWidth=Math.round(o.width),t.handleHostHeight=Math.round(o.height);const n=new rs(i);t.width=Math.round(n.width),t.height=Math.round(n.height),this.redraw(o),this.state.update(t)}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!((i=t)&&i.ownerDocument&&i.ownerDocument.contains(i)))return;var i;const o=t.parentElement,n=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(n)){const t=e||new rs(n);a=[t.width+"px",t.height+"px",void 0,void 0]}else a=[n.offsetWidth+"px",n.offsetHeight+"px",n.offsetLeft+"px",n.offsetTop+"px"];"same"!==Ii(s,a)&&this._options.editor.editing.view.change(e=>{e.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeUI.dismiss(),this._sizeUI.isVisible=!1;this._options.editor.editing.view.change(e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,i={x:(o=e).pageX,y:o.pageY};var o;const n=!this._options.isCentered||this._options.isCentered(this),r={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};n&&t.activeHandlePosition.endsWith("-right")&&(r.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),n&&(r.x*=2);const s={width:Math.abs(t.originalWidth+r.x),height:Math.abs(t.originalHeight+r.y)};s.dominant=s.width/t.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/t.aspectRatio:a.width=a.height*t.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const o of t)e.appendChild(new Gl({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(i=o,"ck-widget__resizer__handle-"+i)}}).render());var i}_appendSizeUI(e){const t=new km;t.render(),this._sizeUI=t,e.appendChild(t.element)}}xi(wm,qo);class km extends mc{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("activeHandlePosition",e=>e?"ck-orientation-"+e:"")],style:{display:e.if("isVisible","none",e=>!e)}},children:[{text:e.to("label")}]})}bindToState(e,t){this.bind("isVisible").to(t,"proposedWidth",t,"proposedHeight",(e,t)=>null!==e&&null!==t),this.bind("label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(t,i,o)=>"px"===e.unit?`${t}×${i}`:o+"%"),this.bind("activeHandlePosition").to(t)}dismiss(){this.unbind(),this.isVisible=!1}}var _m=function(e,t,i){var o=!0,n=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return B(i)&&(o="leading"in i?!!i.leading:o,n="trailing"in i?!!i.trailing:n),Yr(e,t,{leading:o,maxWait:t,trailing:n})};i(76);class vm extends $l{static get pluginName(){return"WidgetResize"}init(){this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map;const e=sr.window.document;this.editor.model.schema.setAttributeProperties("width",{isFormatting:!0}),this.editor.editing.view.addObserver(Yh),this._observer=Object.create(fr),this.listenTo(this.editor.editing.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const t=()=>{this.visibleResizer&&this.visibleResizer.redraw()},i=_m(t,200);this.on("change:visibleResizer",t),this.editor.ui.on("update",i),this._observer.listenTo(sr.window,"resize",i);const o=this.editor.editing.view.document.selection;o.on("change",()=>{const e=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(e)||null})}destroy(){this._observer.stopListening();for(const e of this._resizers.values())e.destroy()}attachTo(e){const t=new wm(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const e=i.get("WidgetToolbarRepository");t.on("begin",()=>{e.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{e.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{e.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==t&&(this.visibleResizer=t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;wm.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i),this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}xi(vm,qo);class ym extends $l{static get requires(){return[vm]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("imageResize");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view;t.addObserver(Ah),this.listenTo(t.document,"imageLoaded",(i,o)=>{if(!o.target.matches("figure.image.ck-widget > img"))return;const n=e.editing.view.domConverter.domToView(o.target).findAncestor("figure");let r=this.editor.plugins.get(vm).getResizerByViewElement(n);if(r)return void r.redraw();const s=e.editing.mapper.toModelElement(n);r=e.plugins.get(vm).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:s,viewElement:n,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:e=>e,isCentered(){const e=s.getAttribute("imageStyle");return!e||"full"==e||"alignCenter"==e},onCommit(t){e.execute("imageResize",{width:t})}}),r.on("updateSize",()=>{n.hasClass("image_resized")||t.change(e=>{e.addClass("image_resized",n)})}),r.bind("isEnabled").to(this)})}}i(78);class xm{constructor(e,t=20){this.model=e,this.size=0,this.limit=t,this.isLocked=!1,this._changeCallback=(e,t)=>{"transparent"!=t.type&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(e){this.size+=e,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e){this.isLocked&&!e||(this._batch=null,this.size=0)}}class Cm extends Bd{constructor(e,t){super(e),this._buffer=new xm(e.model,t),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,o=e.text||"",n=o.length,r=e.range?t.createSelection(e.range):i.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),this._batches.add(this._buffer.batch),t.deleteContent(r),o&&t.insertContent(e.createText(o,i.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(n)})}}function Am(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const i=[];let o,n=0;return e.forEach(e=>{"equal"==e?(r(),n++):"insert"==e?(s("insert")?o.values.push(t[n]):(r(),o={type:"insert",index:n,values:[t[n]]}),n++):s("delete")?o.howMany++:(r(),o={type:"delete",index:n,howMany:1})}),r(),i;function r(){o&&(i.push(o),o=null)}function s(e){return o&&o.type==e}}(Xn(e.oldChildren,e.newChildren,Tm),e.newChildren);if(t.length>1)return;const i=t[0];return i.values[0]&&i.values[0].is("$text")?i:void 0}function Tm(e,t){return e&&e.is("$text")&&t&&t.is("$text")?e.data===t.data:e===t}class Pm{constructor(e){this.editor=e,this.editing=this.editor.editing}handle(e,t){if(function(e){if(0==e.length)return!1;for(const t of e)if("children"===t.type&&!Am(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const i of e)this._handleTextMutation(i,t),this._handleTextNodeInsertion(i)}_handleContainerChildrenMutations(e,t){const i=function(e){const t=e.map(e=>e.node).reduce((e,t)=>e.getCommonAncestor(t,{includeSelf:!0}));if(!t)return;return t.getAncestors({includeSelf:!0,parentFirst:!0}).find(e=>e.is("containerElement")||e.is("rootElement"))}(e);if(!i)return;const o=this.editor.editing.view.domConverter.mapViewToDom(i),n=new dr(this.editor.editing.view.document),r=this.editor.data.toModel(n.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(i);if(!s)return;const a=Array.from(r.getChildren()),l=Array.from(s.getChildren()),c=a[a.length-1],d=l[l.length-1],h=c&&c.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const m=this.editor.model.schema;if(!Sm(a,m)||!Sm(l,m))return;const g=a.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," "),f=l.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," ");if(f===g)return;const p=Xn(f,g),{firstChangeAt:b,insertions:w,deletions:k}=Em(p);let _=null;t&&(_=this.editing.mapper.toModelRange(t.getFirstRange()));const v=g.substr(b,w),y=this.editor.model.createRange(this.editor.model.createPositionAt(s,b),this.editor.model.createPositionAt(s,b+k));this.editor.execute("input",{text:v,range:y,resultRange:_})}_handleTextMutation(e,t){if("text"!=e.type)return;const i=e.newText.replace(/\u00A0/g," "),o=e.oldText.replace(/\u00A0/g," ");if(o===i)return;const n=Xn(o,i),{firstChangeAt:r,insertions:s,deletions:a}=Em(n);let l=null;t&&(l=this.editing.mapper.toModelRange(t.getFirstRange()));const c=this.editing.view.createPositionAt(e.node,r),d=this.editing.mapper.toModelPosition(c),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=i.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:l})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=Am(e),i=this.editing.view.createPositionAt(e.node,t.index),o=this.editing.mapper.toModelPosition(i),n=t.values[0].data;this.editor.execute("input",{text:n.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Sm(e,t){return e.every(e=>t.isInline(e))}function Em(e){let t=null,i=null;for(let o=0;o{i.deleteContent(i.document.selection)}),e.unlock()}gn.isAndroid?o.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):o.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),o.document.on("compositionstart",(function(){const e=i.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),o.document.on("compositionend",()=>{t=i.createSelection(i.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(t,i,o)=>{new Pm(e).handle(i,o)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class Vm{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(e=>this._definitions.add(e)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;const o=i.writer,n=o.document.selection;for(const e of this._definitions){const r=o.createAttributeElement("a",e.attributes,{priority:5});o.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?o.wrap(n.getFirstRange(),r):o.wrap(i.mapper.toViewRange(t.range),r):o.unwrap(i.mapper.toViewRange(t.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:image",(e,t,i)=>{const o=i.mapper.toViewElement(t.item),n=Array.from(o.getChildren()).find(e=>"a"===e.name);for(const e of this._definitions){const o=Bi(e.attributes);if(e.callback(t.attributeNewValue))for(const[e,t]of o)"class"===e?i.writer.addClass(t,n):i.writer.setAttribute(e,t,n);else for(const[e,t]of o)"class"===e?i.writer.removeClass(t,n):i.writer.removeAttribute(e,n)}})}}}var Im=function(e,t,i){var o=e.length;return i=void 0===i?o:i,!t&&i>=o?e:no(e,t,i)},zm=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Om=function(e){return zm.test(e)};var Mm=function(e){return e.split("")},Nm="[\\ud800-\\udfff]",Bm="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Fm="\\ud83c[\\udffb-\\udfff]",Dm="[^\\ud800-\\udfff]",Lm="(?:\\ud83c[\\udde6-\\uddff]){2}",Hm="[\\ud800-\\udbff][\\udc00-\\udfff]",jm="(?:"+Bm+"|"+Fm+")"+"?",Wm="[\\ufe0e\\ufe0f]?"+jm+("(?:\\u200d(?:"+[Dm,Lm,Hm].join("|")+")[\\ufe0e\\ufe0f]?"+jm+")*"),qm="(?:"+[Dm+Bm+"?",Bm,Lm,Hm,Nm].join("|")+")",$m=RegExp(Fm+"(?="+Fm+")|"+qm+Wm,"g");var Um=function(e){return e.match($m)||[]};var Km=function(e){return Om(e)?Um(e):Mm(e)};var Gm=function(e){return function(t){t=Zi(t);var i=Om(t)?Km(t):void 0,o=i?i[0]:t.charAt(0),n=i?Im(i,1).join(""):t.slice(1);return o[e]()+n}}("toUpperCase");const Jm=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Ym=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,Qm=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Xm=/^((\w+:(\/{2,})?)|(\W))/i;function Zm(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function eg(e){return function(e){return e.replace(Jm,"").match(Ym)}(e=String(e))?e:"#"}function tg(e,t){return!!e&&(e.is("element","image")&&t.checkAttribute("image","linkHref"))}function ig(e,t){const i=(o=e,Qm.test(o)?"mailto:":t);var o;const n=!!i&&!Xm.test(e);return e&&n?i+e:e}class og extends Bd{constructor(e){super(e),this.manualDecorators=new Ci,this.automaticDecorators=new Vm}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document,i=Id(t.selection.getSelectedBlocks());tg(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.selection.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,o=i.document.selection,n=[],r=[];for(const e in t)t[e]?n.push(e):r.push(e);i.change(t=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=oh(s,"linkHref",o.getAttribute("linkHref"),i);t.setAttribute("linkHref",e,a),n.forEach(e=>{t.setAttribute(e,!0,a)}),r.forEach(e=>{t.removeAttribute(e,a)}),t.setSelection(t.createPositionAfter(a.end.nodeBefore))}else if(""!==e){const r=Bi(o.getAttributes());r.set("linkHref",e),n.forEach(e=>{r.set(e,!0)});const{end:a}=i.insertContent(t.createText(e,r),s);t.setSelection(a)}["linkHref",...n,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=i.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const e of o.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const l=a.slice();for(const e of s)this._isRangeToUpdate(e,a)&&l.push(e);for(const i of l)t.setAttribute("linkHref",e,i),n.forEach(e=>{t.setAttribute(e,!0,i)}),r.forEach(e=>{t.removeAttribute(e,i)})}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document,o=Id(i.selection.getSelectedBlocks());return tg(o,t.schema)?o.getAttribute(e):i.selection.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}class ng extends Bd{refresh(){const e=this.editor.model,t=e.document,i=Id(t.selection.getSelectedBlocks());tg(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,o=e.commands.get("link");t.change(e=>{const n=i.isCollapsed?[oh(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of n)if(e.removeAttribute("linkHref",t),o)for(const i of o.manualDecorators)e.removeAttribute(i.id,t)})}}class rg{constructor({id:e,label:t,attributes:i,defaultValue:o}){this.id=e,this.set("value"),this.defaultValue=o,this.label=t,this.attributes=i}}xi(rg,qo);i(80);const sg=/^(https?:)?\/\//;class ag extends $l{static get pluginName(){return"LinkEditing"}static get requires(){return[Xd,Rm,rm]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Zm}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>Zm(eg(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new og(e)),e.commands.add("unlink",new ng(e));const t=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>(e.label&&i[e.label]&&(e.label=i[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[i,o]of Object.entries(e)){const e=Object.assign({},o,{id:"link"+Gm(i)});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(e=>"automatic"===e.mode)),this._enableManualDecorators(t.filter(e=>"manual"===e.mode));e.plugins.get(Xd).registerAttribute("linkHref"),rh(e,"linkHref","a","ck-link_selected"),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:"automatic",callback:e=>sg.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),i.add(new rg(e)),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,{writer:o})=>{if(t){const t=i.get(e.id).attributes,n=o.createAttributeElement("a",t,{priority:5});return o.setCustomProperty("link",!0,n),n}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:i.get(e.id).attributes},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor,t=e.model,i=t.document.selection,o=e.commands.get("link");this.listenTo(t,"insertContent",()=>{const e=i.anchor.nodeBefore,n=i.anchor.nodeAfter;i.hasAttribute("linkHref")&&e&&e.hasAttribute("linkHref")&&(n&&n.hasAttribute("linkHref")||t.change(e=>{lg(e,o.manualDecorators)}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.commands.get("link");e.editing.view.addObserver(Yh);let i=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{i=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!i)return;i=!1;const o=e.model.document.selection;if(!o.isCollapsed)return;if(!o.hasAttribute("linkHref"))return;const n=o.getFirstPosition(),r=oh(n,"linkHref",o.getAttribute("linkHref"),e.model);(n.isTouching(r.start)||n.isTouching(r.end))&&e.model.change(e=>{lg(e,t.manualDecorators)})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i,o;this.listenTo(t.document,"delete",()=>{o=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const t=e.model.document.selection;t.isCollapsed||(o?o=!1:cg(e)&&function(e){const t=e.document.selection,i=t.getFirstPosition(),o=t.getLastPosition(),n=i.nodeAfter;if(!n)return!1;if(!n.is("$text"))return!1;if(!n.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(n===r)return!0;return oh(i,"linkHref",n.getAttribute("linkHref"),e).containsRange(e.createRange(i,o),!0)}(e.model)&&(i=t.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(t,[n])=>{o=!1,cg(e)&&i&&(e.model.change(e=>{for(const[t,o]of i)e.setAttribute(t,o,n)}),i=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,o=e.editing.view,n=e.commands.get("link");let r=!1,s=!1;this.listenTo(o.document,"delete",(e,t)=>{s=t.domEvent.keyCode===bn.backspace},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const e=i.getFirstPosition(),o=i.getAttribute("linkHref");if(!o)return;const n=oh(e,"linkHref",o,t);r=n.containsPosition(e)||n.end.isEqual(e)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,r||e.model.enqueueChange(e=>{lg(e,n.manualDecorators)}))},{priority:"low"})}}function lg(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i.id)}function cg(e){return e.plugins.get("Input").isInput(e.model.change(e=>e.batch))}class dg extends Dr{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}i(82);class hg extends mc{constructor(e,t){super(e);const i=e.t;this.focusTracker=new Sc,this.keystrokes=new Ll,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),pu,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),bu,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusables=new Kl,this._focusCycler=new zc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),gu(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),fu({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new du(this.locale,uu);return t.label=e("Link URL"),t}_createButton(e,t,i,o){const n=new Pc(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const o=new Uc(this.locale);o.set({name:i.id,label:i.label,withText:!0}),o.bind("isOn").toMany([i,e],"value",(e,t)=>void 0===t&&void 0===e?i.defaultValue:e),o.on("execute",()=>{i.set("value",!o.isOn)}),t.add(o)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new mc;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}i(84);class ug extends mc{constructor(e){super(e);const t=e.t;this.focusTracker=new Sc,this.keystrokes=new Ll,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'',"unlink"),this.editButtonView=this._createButton(t("Edit link"),'',"edit"),this.set("href"),this._focusables=new Kl,this._focusCycler=new zc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const o=new Pc(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.delegate("execute").to(this,i),o}_createPreviewButton(){const e=new Pc(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&eg(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||i("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}class mg extends $l{static get requires(){return[Rc]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(dg),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(Rc),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),e.conversion.for("editingDowncast").markerToHighlight({model:"link-ui",view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:"link-ui",view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const e=this.editor,t=new ug(e.locale),i=e.commands.get("link"),o=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t()}),t.keystrokes.set("Ctrl+K",(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),o=new hg(e.locale,t);return o.urlInputView.fieldView.bind("value").to(t,"value"),o.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),o.saveButtonView.bind("isEnabled").to(t),this.listenTo(o,"submit",()=>{const{value:t}=o.urlInputView.fieldView.element,n=ig(t,i);e.execute("link",n,o.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),o}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.keystrokes.set("Ctrl+K",(e,i)=>{i(),t.isEnabled&&this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const o=new Pc(e);return o.isEnabled=!0,o.label=i("Link"),o.icon='',o.keystroke="Ctrl+K",o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",e=>!!e),this.listenTo(o,"execute",()=>this._showUI(!0)),o})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Kc({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),o=r();const n=()=>{const e=this._getSelectedLinkElement(),t=r();i&&!e||!i&&t!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,o=t};function r(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let o=null;if(t.markers.has("link-ui")){const t=Array.from(this.editor.editing.mapper.markerNameToElements("link-ui")),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));o=e.domConverter.viewRangeToDom(i)}else{const t=this._getSelectedLinkElement(),n=i.selection.getFirstRange();o=t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(n)}return{target:o}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection;if(t.isCollapsed)return gg(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),o=gg(i.start),n=gg(i.end);return o&&o==n&&e.createRangeIn(o).getTrimmed().isEqual(i)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has("link-ui"))t.updateMarker("link-ui",{range:i});else if(i.start.isAtEnd){const o=function e(t,i,o){const n=[t.start.path[0]+1,0],r=o.createPositionFromPath(t.start.root,n,"toNext"),s=o.createRange(r,t.end);if(s.start.path[0]>t.end.path[0])return o.createRange(i);if(r.isAtStart&&r.isAtEnd)return e(s,i,o);return s}(i,e.document.selection.focus,t);t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:o})}else t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has("link-ui")&&e.change(e=>{e.removeMarker("link-ui")})}}function gg(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}function fg(e,t){let i=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>o.is("$text")||o.is("$textProxy")?e+o.data:(i=t.createPositionAfter(o),""),""),range:t.createRange(i,e.end)}}class pg{constructor(e,t){this.model=e,this.testCallback=t,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))}),this.listenTo(e,"change:data",(e,t)=>{"transparent"!=t.type&&this._evaluateTextBeforeSelection("data",{batch:t})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,o=i.document.selection,n=i.createRange(i.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=fg(n,i),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const i=Object.assign(t,{text:r,range:s});"object"==typeof a&&Object.assign(i,a),this.fire("matched:"+e,i)}}}xi(pg,qo);const bg=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.))+(?:[a-z\\u00a1-\\uffff]{2,})))$","i");class wg extends $l{static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new pg(e.model,e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=kg(e.substr(0,e.length-1));return t?{url:t}:void 0}),i=e.plugins.get("Input");t.on("matched:data",(t,o)=>{const{batch:n,range:r,url:s}=o;if(!i.isInput(n))return;const a=r.end.getShiftedBy(-1),l=a.getShiftedBy(-s.length),c=e.model.createRange(l,a);this._applyAutoLink(s,c)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:o}=fg(e,t),n=kg(i);if(n){const e=t.createRange(o.end.getShiftedBy(-n.length),o.end);this._applyAutoLink(n,e)}}_applyAutoLink(e,t){const i=this.editor.model;this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&i.enqueueChange(i=>{const o=this.editor.config.get("link.defaultProtocol"),n=ig(e,o);i.setAttribute("linkHref",n,t)})}}function kg(e){const t=bg.exec(e);return t?t[2]:null}class _g extends Bd{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document,i=Array.from(t.selection.getSelectedBlocks()).filter(t=>yg(t,e.schema)),o=!0===this.value;e.change(e=>{if(o){let t=i[i.length-1].nextSibling,o=Number.POSITIVE_INFINITY,n=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e=i;)r>n.getAttribute("listIndent")&&(r=n.getAttribute("listIndent")),n.getAttribute("listIndent")==r&&e[t?"unshift":"push"](n),n=n[t?"previousSibling":"nextSibling"]}}function yg(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class xg extends Bd{constructor(e,t){super(e),this._indentBy="forward"==t?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=i[i.length-1];let o=t.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>t.getAttribute("listIndent");)i.push(o),o=o.nextSibling;this._indentBy<0&&(i=i.reverse());for(const t of i){const i=t.getAttribute("listIndent")+this._indentBy;i<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",i,t)}this.fire("_executeCleanup",i)})}_checkEnabled(){const e=Id(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let o=e.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=t;){if(o.getAttribute("listIndent")==t)return o.getAttribute("listType")==i;o=o.previousSibling}return!1}return!0}}function Cg(e,t){const i=t.mapper,o=t.writer,n="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=Ig,t}(o),s=o.createContainerElement(n,null);return o.insert(o.createPositionAt(s,0),r),i.bindElements(e,r),r}function Ag(e,t,i,o){const n=t.parent,r=i.mapper,s=i.writer;let a=r.toViewPosition(o.createPositionBefore(e));const l=Sg(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(e))}else if(c&&"listItem"==c.name){a=r.toViewPosition(o.createPositionAt(c,"end"));const e=r.findMappedViewAncestor(a),t=Rg(e);a=t?s.createPositionBefore(t):s.createPositionAt(e,"end")}else a=r.toViewPosition(o.createPositionBefore(e));if(a=Pg(a),s.insert(a,n),c&&"listItem"==c.name){const e=r.toViewElement(c),i=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of i)if(e.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(e.item)),n=e.item.parent,r=s.createPositionAt(t,"end");Tg(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(n),r),i.position=o}}else{const i=n.nextSibling;if(i&&(i.is("element","ul")||i.is("element","ol"))){let o=null;for(const t of i.getChildren()){const i=r.toModelElement(t);if(!(i&&i.getAttribute("listIndent")>e.getAttribute("listIndent")))break;o=t}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(t,"end")))}}Tg(s,n,n.nextSibling),Tg(s,n.previousSibling,n)}function Tg(e,t,i){return!t||!i||"ul"!=t.name&&"ol"!=t.name||t.name!=i.name||t.getAttribute("class")!==i.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function Pg(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function Sg(e,t){const i=!!t.sameIndent,o=!!t.smallerIndent,n=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(i&&n==e||o&&n>e)return r;r="forward"===t.direction?r.nextSibling:r.previousSibling}return null}function Eg(e,t,i,o){e.ui.componentFactory.add(t,n=>{const r=e.commands.get(t),s=new Pc(n);return s.set({label:i,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function Rg(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}function Vg(e,t){const i=[],o=e.parent,n={ignoreElementEnd:!0,startPosition:e,shallow:!0,direction:t},r=o.getAttribute("listIndent"),s=[...new Cs(n)].filter(e=>e.item.is("element")).map(e=>e.item);for(const e of s){if(!e.is("element","listItem"))break;if(e.getAttribute("listIndent")r)){if(e.getAttribute("listType")!==o.getAttribute("listType"))break;if(e.getAttribute("listStyle")!==o.getAttribute("listStyle"))break;"backward"===t?i.unshift(e):i.push(e)}}return i}function Ig(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Fo.call(this)}function zg(e){return(t,i,o)=>{const n=o.consumable;if(!n.test(i.item,"insert")||!n.test(i.item,"attribute:listType")||!n.test(i.item,"attribute:listIndent"))return;n.consume(i.item,"insert"),n.consume(i.item,"attribute:listType"),n.consume(i.item,"attribute:listIndent");const r=i.item;Ag(r,Cg(r,o),o,e)}}function Og(e,t,i){if(!i.consumable.consume(t.item,"attribute:listType"))return;const o=i.mapper.toViewElement(t.item),n=i.writer;n.breakContainer(n.createPositionBefore(o)),n.breakContainer(n.createPositionAfter(o));const r=o.parent,s="numbered"==t.attributeNewValue?"ol":"ul";n.rename(s,r)}function Mg(e,t,i){const o=i.mapper.toViewElement(t.item).parent,n=i.writer;Tg(n,o,o.nextSibling),Tg(n,o.previousSibling,o);for(const e of t.item.getChildren())i.consumable.consume(e,"insert")}function Ng(e,t,i){if("listItem"!=t.item.name){let e=i.mapper.toViewPosition(t.range.start);const o=i.writer,n=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=o.breakContainer(e),"li"==e.parent.name);){const t=e,i=o.createPositionAt(e.parent,"end");if(!t.isEqual(i)){const e=o.remove(o.createRange(t,i));n.push(e)}e=o.createPositionAfter(e.parent)}if(n.length>0){for(let t=0;t0){const t=Tg(o,i,i.nextSibling);t&&t.parent==i&&e.offset--}}Tg(o,e.nodeBefore,e.nodeAfter)}}}function Bg(e,t,i){const o=i.mapper.toViewPosition(t.position),n=o.nodeBefore,r=o.nodeAfter;Tg(i.writer,n,r)}function Fg(e,t,i){if(i.consumable.consume(t.viewItem,{name:!0})){const e=i.writer,o=e.createElement("listItem"),n=function(e){let t=0,i=e.parent;for(;i;){if(i.is("element","li"))t++;else{const e=i.previousSibling;e&&e.is("element","li")&&t++}i=i.parent}return t}(t.viewItem);e.setAttribute("listIndent",n,o);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",r,o),!i.safeInsert(o,t.modelCursor))return;const s=function(e,t,i){const{writer:o,schema:n}=i;let r=o.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=i.convertItem(s,r).modelCursor;else{const t=i.convertItem(s,o.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!n.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:Wg(t.modelCursor),r=o.createPositionAfter(e))}return r}(o,t.viewItem.getChildren(),i);t.modelRange=e.createRange(t.modelCursor,s),i.updateConversionResult(o,t)}}function Dg(e,t,i){if(i.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||$g(t))&&t._remove()}}}function Lg(e,t,i){if(i.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let i=!1,o=!0;for(const t of e)i&&!$g(t)&&t._remove(),t.is("$text")?(o&&(t._data=t.data.replace(/^\s+/,"")),t.nextSibling&&!$g(t.nextSibling)||(t._data=t.data.replace(/\s+$/,""))):$g(t)&&(i=!0),o=!1}}function Hg(e){return(t,i)=>{if(i.isPhantom)return;const o=i.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const t=i.mapper.toViewElement(o),n=t.getAncestors().find($g),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("element","li")){i.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==n){i.viewPosition=e.nextPosition;break}}}}}function jg(e,[t,i]){let o,n=t.is("documentFragment")?t.getChild(0):t;if(o=i?this.createSelection(i):this.document.selection,n&&n.is("element","listItem")){const e=o.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;n&&n.is("element","listItem");)n._setAttribute("listIndent",n.getAttribute("listIndent")+e),n=n.nextSibling}}}function Wg(e){const t=new Cs({startPosition:e});let i;do{i=t.next()}while(!i.value.item.is("element","listItem"));return i.value.item}function qg(e,t,i,o,n,r){const s=Sg(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),a=n.mapper,l=n.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==e){const e=a.toViewElement(s).parent;d=l.createPositionAfter(e)}else{const e=r.createPositionAt(s,"end");d=a.toViewPosition(e)}else d=i;d=Pg(d);for(const e of[...o.getChildren()])$g(e)&&(d=l.move(l.createRangeOn(e),d).end,Tg(l,e,e.nextSibling),Tg(l,e.previousSibling,e))}function $g(e){return e.is("element","ol")||e.is("element","ul")}class Ug extends $l{static get pluginName(){return"ListEditing"}static get requires(){return[wh]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var o;e.model.document.registerPostFixer(t=>function(e,t){const i=e.document.differ.getChanges(),o=new Map;let n=!1;for(const o of i)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const i=o.position.nodeAfter;i.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",i),n=!0),i.hasAttribute("listType")&&(t.removeAttribute("listType",i),n=!0),i.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",i),n=!0);for(const t of Array.from(e.createRangeIn(i)).filter(e=>e.item.is("element","listItem")))r(t.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const e of o.values())s(e),a(e);return n;function r(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(o.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,o.has(e))return;o.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&o.set(t,t)}}function s(e){let i=0,o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(r>i){let s;null===o?(o=r-i,s=i):(o>r&&(o=r),s=r-o),t.setAttribute("listIndent",s,e),n=!0}else o=null,i=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let i=[],o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(i=i.slice(0,r+1)),0!=r)if(i[r]){const o=i[r];e.getAttribute("listType")!=o&&(t.setAttribute("listType",o,e),n=!0)}else i[r]=e.getAttribute("listType");o=e,e=e.nextSibling}}}(e.model,t)),i.mapper.registerViewToModelLength("li",Kg),t.mapper.registerViewToModelLength("li",Kg),i.mapper.on("modelToViewPosition",Hg(i.view)),i.mapper.on("viewToModelPosition",(o=e.model,(e,t)=>{const i=t.viewPosition,n=i.parent,r=t.mapper;if("ul"==n.name||"ol"==n.name){if(i.isAtEnd){const e=r.toModelElement(i.nodeBefore),n=r.getModelLength(i.nodeBefore);t.modelPosition=o.createPositionBefore(e).getShiftedBy(n)}else{const e=r.toModelElement(i.nodeAfter);t.modelPosition=o.createPositionBefore(e)}e.stop()}else if("li"==n.name&&i.nodeBefore&&("ul"==i.nodeBefore.name||"ol"==i.nodeBefore.name)){const s=r.toModelElement(n);let a=1,l=i.nodeBefore;for(;l&&$g(l);)a+=r.getModelLength(l),l=l.previousSibling;t.modelPosition=o.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",Hg(i.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",Ng,{priority:"high"}),t.on("insert:listItem",zg(e.model)),t.on("attribute:listType:listItem",Og,{priority:"high"}),t.on("attribute:listType:listItem",Mg,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,i,o)=>{if(!o.consumable.consume(i.item,"attribute:listIndent"))return;const n=o.mapper.toViewElement(i.item),r=o.writer;r.breakContainer(r.createPositionBefore(n)),r.breakContainer(r.createPositionAfter(n));const s=n.parent,a=s.previousSibling,l=r.createRangeOn(s);r.remove(l),a&&a.nextSibling&&Tg(r,a,a.nextSibling),qg(i.attributeOldValue+1,i.range.start,l.start,n,o,e),Ag(i.item,n,o,e);for(const e of i.item.getChildren())o.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,i,o)=>{const n=o.mapper.toViewPosition(i.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(n)),r.breakContainer(r.createPositionAfter(n));const s=n.parent,a=s.previousSibling,l=r.createRangeOn(s),c=r.remove(l);a&&a.nextSibling&&Tg(r,a,a.nextSibling);qg(o.mapper.toModelElement(n).getAttribute("listIndent")+1,i.position,l.start,n,o,e);for(const e of r.createRangeIn(c).getItems())o.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",Bg,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",Ng,{priority:"high"}),t.on("insert:listItem",zg(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",Dg,{priority:"high"}),e.on("element:ol",Dg,{priority:"high"}),e.on("element:li",Lg,{priority:"high"}),e.on("element:li",Fg)}),e.model.on("insertContent",jg,{priority:"high"}),e.commands.add("numberedList",new _g(e,"numbered")),e.commands.add("bulletedList",new _g(e,"bulleted")),e.commands.add("indentList",new xg(e,"forward")),e.commands.add("outdentList",new xg(e,"backward"));const n=i.view.document;this.listenTo(n,"enter",(e,t)=>{const i=this.editor.model.document,o=i.selection.getLastPosition().parent;i.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),this.listenTo(n,"delete",(e,t)=>{if("backward"!==t.direction)return;const i=this.editor.model.document.selection;if(!i.isCollapsed)return;const o=i.getFirstPosition();if(!o.isAtStart)return;const n=o.parent;if("listItem"!==n.name)return;n.previousSibling&&"listItem"===n.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{priority:"high"});const r=e=>(t,i)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),i())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function Kg(e){let t=1;for(const i of e.getChildren())if("ul"==i.name||"ol"==i.name)for(const e of i.getChildren())t+=Kg(e);return t}var Gg='',Jg='';class Yg extends $l{init(){const e=this.editor.t;Eg(this.editor,"numberedList",e("Numbered List"),Gg),Eg(this.editor,"bulletedList",e("Bulleted List"),Jg)}}class Qg extends Bd{constructor(e,t){super(e),this._defaultType=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model;let i=[...t.document.selection.getSelectedBlocks()].filter(e=>e.is("element","listItem")).map(e=>{const i=t.change(t=>t.createPositionAt(e,0));return[...Vg(i,"backward"),...Vg(i,"forward")]}).flat();i=[...new Set(i)],i.length&&t.change(t=>{for(const o of i)t.setAttribute("listStyle",e.type||this._defaultType,o)})}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}}class Xg extends $l{static get requires(){return[Ug]}static get pluginName(){return"ListStyleEditing"}init(){const e=this.editor,t=e.model;t.schema.extend("listItem",{allowAttributes:["listStyle"]}),e.commands.add("listStyle",new Qg(e,"default")),this.listenTo(e.commands.get("indentList"),"_executeCleanup",function(e){return(t,i)=>{let o;const n=i[0],r=n.getAttribute("listIndent"),s=i.filter(e=>e.getAttribute("listIndent")===r);if(n.previousSibling.getAttribute("listIndent")+1===r)o="default";else{const e=Sg(n.previousSibling,{sameIndent:!0,direction:"backward",listIndent:r});o=e.getAttribute("listStyle")}e.model.change(e=>{for(const t of s)e.setAttribute("listStyle",o,t)})}}(e)),this.listenTo(e.commands.get("outdentList"),"_executeCleanup",function(e){return(t,i)=>{if(!(i=i.reverse().filter(e=>e.is("element","listItem"))).length)return;const o=i[0].getAttribute("listIndent"),n=i[0].getAttribute("listType");let r=i[0].previousSibling;if(r.is("element","listItem"))for(;r.getAttribute("listIndent")!==o;)r=r.previousSibling;else r=null;r||(r=i[i.length-1].nextSibling),r&&r.is("element","listItem")&&r.getAttribute("listType")===n&&e.model.change(e=>{const t=i.filter(e=>e.getAttribute("listIndent")===o);for(const i of t)e.setAttribute("listStyle",r.getAttribute("listStyle"),i)})}}(e)),this.listenTo(e.commands.get("bulletedList"),"_executeCleanup",tf(e)),this.listenTo(e.commands.get("numberedList"),"_executeCleanup",tf(e)),t.document.registerPostFixer(function(e){return t=>{let i=!1;const o=of(e.model.document.differ.getChanges()).filter(e=>"todo"!==e.getAttribute("listType"));if(!o.length)return i;let n=o[o.length-1].nextSibling;if((!n||!n.is("element","listItem"))&&(n=o[o.length-1].previousSibling,n)){const e=o[0].getAttribute("listIndent");for(;n.is("element","listItem")&&n.getAttribute("listIndent")!==e&&(n=n.previousSibling,n););}for(const e of o)if(e.hasAttribute("listStyle")){const o=e.previousSibling;ef(o,e)&&(t.setAttribute("listStyle",o.getAttribute("listStyle"),e),i=!0)}else Zg(n,e)?t.setAttribute("listStyle",n.getAttribute("listStyle"),e):t.setAttribute("listStyle","default",e),i=!0;return i}}(e)),e.conversion.for("upcast").add(e=>{e.on("element:li",(e,t,i)=>{const o=t.viewItem.parent.getStyle("list-style-type")||"default",n=t.modelRange.start.nodeAfter||t.modelRange.end.nodeBefore;i.writer.setAttribute("listStyle",o,n)},{priority:"low"})}),e.conversion.for("downcast").add(e=>{e.on("attribute:listStyle:listItem",(e,t,i)=>{const o=i.writer,n=t.item,r=Sg(n.previousSibling,{sameIndent:!0,listIndent:n.getAttribute("listIndent"),direction:"backward"}),s=i.mapper.toViewElement(n);var a,l,c,d,h;a=n,(l=r)&&a.getAttribute("listType")===l.getAttribute("listType")&&a.getAttribute("listIndent")===l.getAttribute("listIndent")&&a.getAttribute("listStyle")===l.getAttribute("listStyle")||o.breakContainer(o.createPositionBefore(s)),c=o,d=t.attributeNewValue,h=s.parent,d&&"default"!==d?c.setStyle("list-style-type",d,h):c.removeStyle("list-style-type",h)},{priority:"low"})}),this._mergeListStyleAttributeWhileMergingLists()}afterInit(){const e=this.editor;e.commands.get("todoList")&&e.model.document.registerPostFixer(function(e){return t=>{const i=of(e.model.document.differ.getChanges()).filter(e=>"todo"===e.getAttribute("listType")&&e.hasAttribute("listStyle"));if(!i.length)return!1;for(const e of i)t.removeAttribute("listStyle",e);return!0}}(e))}_mergeListStyleAttributeWhileMergingLists(){const e=this.editor.model;let t;this.listenTo(e,"deleteContent",(e,[i])=>{const o=i.getFirstPosition(),n=i.getLastPosition();if(o.parent===n.parent)return;if(!o.parent.is("element","listItem"))return;const r=n.parent.nextSibling;if(!r||!r.is("element","listItem"))return;const s=Sg(o.parent,{sameIndent:!0,listIndent:r.getAttribute("listIndent")});s&&s.getAttribute("listType")===r.getAttribute("listType")&&(t=s)},{priority:"high"}),this.listenTo(e,"deleteContent",()=>{t&&(e.change(e=>{const i=Sg(t.nextSibling,{sameIndent:!0,listIndent:t.getAttribute("listIndent"),direction:"forward"}),o=[i,...Vg(e.createPositionAt(i,0),"forward")];for(const i of o)e.setAttribute("listStyle",t.getAttribute("listStyle"),i)}),t=null)},{priority:"low"})}}function Zg(e,t){if(!e)return!1;const i=e.getAttribute("listStyle");return!!i&&("default"!==i&&e.getAttribute("listType")===t.getAttribute("listType"))}function ef(e,t){if(!e||!e.is("element","listItem"))return!1;if(t.getAttribute("listType")!==e.getAttribute("listType"))return!1;const i=e.getAttribute("listIndent");if(i<1||i!==t.getAttribute("listIndent"))return!1;const o=e.getAttribute("listStyle");return!(!o||o===t.getAttribute("listStyle"))}function tf(e){return(t,i)=>{i=i.filter(e=>e.is("element","listItem")),e.model.change(e=>{for(const t of i)e.removeAttribute("listStyle",t)})}}function of(e){const t=[];for(const i of e){const e=nf(i);e&&e.is("element","listItem")&&t.push(e)}return t}function nf(e){return"attribute"===e.type?e.range.start.nodeAfter:"insert"===e.type?e.position.nodeAfter:null}i(86);class rf extends mc{constructor(e){super(e);const t=this.bindTemplate;this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new Ll,this.focusTracker=new Sc,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.if("isVisible","ck-hidden",e=>!e),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}focus(){this.actionView.focus()}_createActionView(){const e=new Pc;return e.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),e.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),e.delegate("execute").to(this),e}_createArrowView(){const e=new Pc,t=e.bindTemplate;return e.icon=Hc,e.extendTemplate({attributes:{class:"ck-splitbutton__arrow","aria-haspopup":!0,"aria-expanded":t.to("isOn",e=>String(e))}}),e.bind("isEnabled").to(this),e.delegate("execute").to(this,"open"),e}}i(88);class sf extends $l{static get pluginName(){return"ListStyleUI"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("bulletedList",af({editor:e,parentCommandName:"bulletedList",buttonLabel:t("Bulleted List"),buttonIcon:Jg,toolbarAriaLabel:t("Bulleted list styles toolbar"),styleDefinitions:[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:''},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:''},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:''}]})),e.ui.componentFactory.add("numberedList",af({editor:e,parentCommandName:"numberedList",buttonLabel:t("Numbered List"),buttonIcon:Gg,toolbarAriaLabel:t("Numbered list styles toolbar"),styleDefinitions:[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:''},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:''},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:''},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:''},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:''},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:''}]}))}}function af({editor:e,parentCommandName:t,buttonLabel:i,buttonIcon:o,toolbarAriaLabel:n,styleDefinitions:r}){const s=e.commands.get(t),a=e.commands.get("listStyle");return l=>{const c=Gc(l,rf),d=c.buttonView,h=function({editor:e,listStyleCommand:t,parentCommandName:i}){const o=e.locale,n=e.commands.get(i);return({label:r,type:s,icon:a,tooltip:l})=>{const c=new Pc(o);return c.set({label:r,icon:a,tooltip:l}),t.on("change:value",()=>{c.isOn=t.value===s}),c.on("execute",()=>{n.value?t.value!==s?e.execute("listStyle",{type:s}):e.execute("listStyle",{type:t._defaultType}):e.model.change(()=>{e.execute(i),e.execute("listStyle",{type:s})}),e.editing.view.focus()}),c}}({editor:e,parentCommandName:t,listStyleCommand:a});return Jc(c,r.map(h)),c.bind("isEnabled").to(s),c.toolbarView.ariaLabel=n,c.class="ck-list-styles-dropdown",d.on("execute",()=>{e.execute(t),e.editing.view.focus()}),d.set({label:i,icon:o,tooltip:!0,isToggleable:!0}),d.bind("isOn").to(s,"value",e=>!!e),c}}class lf extends Bd{constructor(e){super(e),this._selectedElements=[],this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every(e=>!!e.getAttribute("todoListChecked")),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),o=i.start.parent,n=[];t.checkAttribute(o,"todoListChecked")&&n.push(o);for(const e of i.getItems())t.checkAttribute(e,"todoListChecked")&&!n.includes(e)&&n.push(e);return n}execute(e={}){this.editor.model.change(t=>{for(const i of this._selectedElements){(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute("todoListChecked",!0,i):t.removeAttribute("todoListChecked",i)}})}}function cf(e,t,i){const o=t.modelCursor,n=o.parent,r=t.viewItem;if("checkbox"!=r.getAttribute("type")||"listItem"!=n.name||!o.isAtStart)return;if(!i.consumable.consume(r,{name:!0}))return;const s=i.writer;s.setAttribute("listType","todo",n),t.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,n),t.modelRange=s.createRange(o)}function df(e){return(t,i)=>{const o=i.modelPosition,n=o.parent;if(!n.is("element","listItem")||"todo"!=n.getAttribute("listType"))return;const r=uf(i.mapper.toViewElement(n),e);r&&(i.viewPosition=i.mapper.findPositionIn(r,o.offset))}}function hf(e,t,i,o){return t.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(t){const n=fd(document,"input",{type:"checkbox"});i&&n.setAttribute("checked","checked"),n.addEventListener("change",()=>o(e));const r=this.toDomElement(t);return r.appendChild(n),r}))}function uf(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("containerElement","span")&&e.item.hasClass("todo-list__label__description"))return e.item}class mf extends $l{static get pluginName(){return"TodoListEditing"}static get requires(){return[Ug]}init(){const e=this.editor,{editing:t,data:i,model:o}=e;var n,r;o.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),o.schema.addAttributeCheck((e,t)=>{const i=e.last;if("todoListChecked"==t&&"listItem"==i.name&&"todo"!=i.getAttribute("listType"))return!1}),e.commands.add("todoList",new _g(e,"todo")),e.commands.add("todoListCheck",new lf(e)),i.downcastDispatcher.on("insert:listItem",function(e){return(t,i,o)=>{const n=o.consumable;if(!n.test(i.item,"insert")||!n.test(i.item,"attribute:listType")||!n.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const r=i.item;n.consume(r,"insert"),n.consume(r,"attribute:listType"),n.consume(r,"attribute:listIndent"),n.consume(r,"attribute:todoListChecked");const s=o.writer,a=Cg(r,o);s.addClass("todo-list",a.parent);const l=s.createContainerElement("label",{class:"todo-list__label"}),c=s.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=s.createContainerElement("span",{class:"todo-list__label__description"});r.getAttribute("todoListChecked")&&s.setAttribute("checked","checked",c),s.insert(s.createPositionAt(a,0),l),s.insert(s.createPositionAt(l,0),c),s.insert(s.createPositionAfter(c),d),Ag(r,a,o,e)}}(o),{priority:"high"}),i.upcastDispatcher.on("element:input",cf,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return(i,o,n)=>{const r=n.consumable;if(!r.test(o.item,"insert")||!r.test(o.item,"attribute:listType")||!r.test(o.item,"attribute:listIndent"))return;if("todo"!=o.item.getAttribute("listType"))return;const s=o.item;r.consume(s,"insert"),r.consume(s,"attribute:listType"),r.consume(s,"attribute:listIndent"),r.consume(s,"attribute:todoListChecked");const a=n.writer,l=Cg(s,n),c=!!s.getAttribute("todoListChecked"),d=hf(s,a,c,t),h=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),d),a.insert(a.createPositionAfter(d),h),Ag(s,l,n,e)}}(o,e=>this._handleCheckmarkChange(e)),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(n=e=>this._handleCheckmarkChange(e),r=t.view,(e,t,i)=>{const o=i.mapper.toViewElement(t.item),s=i.writer,a=function(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("uiElement","label"))return e.item}(o,r);if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),i=hf(t.item,s,e,n),r=s.createContainerElement("span",{class:"todo-list__label__description"}),a=s.createRangeIn(o),l=Rg(o),c=Pg(a.start),d=l?s.createPositionBefore(l):a.end,h=s.createRange(c,d);s.addClass("todo-list",o.parent),s.move(h,s.createPositionAt(r,0)),s.insert(s.createPositionAt(o,0),i),s.insert(s.createPositionAfter(i),r)}else if("todo"==t.attributeOldValue){const e=uf(o,r);s.removeClass("todo-list",o.parent),s.remove(a),s.move(s.createRangeIn(e),s.createPositionBefore(e)),s.remove(e)}})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return(t,i,o)=>{if("todo"!=i.item.getAttribute("listType"))return;if(!o.consumable.consume(i.item,"attribute:todoListChecked"))return;const{mapper:n,writer:r}=o,s=!!i.item.getAttribute("todoListChecked"),a=n.toViewElement(i.item).getChild(0),l=hf(i.item,r,s,e);r.insert(r.createPositionAfter(a),l),r.remove(a)}}(e=>this._handleCheckmarkChange(e))),t.mapper.on("modelToViewPosition",df(t.view)),i.mapper.on("modelToViewPosition",df(t.view)),this.listenTo(t.view.document,"keydown",function(e,t){return(i,o)=>{if("left"!=yn(o.keyCode,t.contentLanguageDirection))return;const n=e.schema,r=e.document.selection;if(!r.isCollapsed)return;const s=r.getFirstPosition(),a=s.parent;if("listItem"===a.name&&"todo"==a.getAttribute("listType")&&s.isAtStart){const t=n.getNearestSelectionRange(e.createPositionBefore(a),"backward");t&&e.change(e=>e.setSelection(t)),o.preventDefault(),o.stopPropagation(),i.stop()}}}(o,e.locale)),e.keystrokes.set("Ctrl+space",()=>e.execute("todoListCheck"));const s=new Set;this.listenTo(o,"applyOperation",(e,t)=>{const i=t[0];if("rename"==i.type&&"listItem"==i.oldName){const e=i.position.nodeAfter;e.hasAttribute("todoListChecked")&&s.add(e)}else if("changeAttribute"==i.type&&"listType"==i.key&&"todo"===i.oldValue)for(const e of i.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&s.add(e)}),o.document.registerPostFixer(e=>{let t=!1;for(const i of s)e.removeAttribute("todoListChecked",i),t=!0;return s.clear(),t})}_handleCheckmarkChange(e){const t=this.editor,i=t.model,o=Array.from(i.document.selection.getRanges());i.change(i=>{i.setSelection(e,"end"),t.execute("todoListCheck"),i.setSelection(o)})}}class gf extends $l{init(){const e=this.editor.t;Eg(this.editor,"todoList",e("To-do List"),'')}}i(90);function ff(e,t){if(!e.childCount)return;const i=new sm(e.document),o=function(e,t){const i=t.createRangeIn(e),o=new Fi({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),n=[];for(const e of i)if("elementStart"===e.type&&o.match(e.item)){const t=wf(e.item);n.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return n}(e,i);if(!o.length)return;let n=null,r=1;o.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return t.indent-e.indent!=1;const i=t.element.previousSibling;if(!i)return!0;return o=i,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],e),l=a?null:o[s-1],c=(h=e,(d=l)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(n=null,r=1),!n||0!==c){const o=function(e,t){const i=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]*);/gi,n=i.exec(t);let r="decimal",s="ol";if(n&&n[1]){const t=o.exec(n[1]);if(t&&t[1]&&(r=t[1].trim(),s="bullet"!==r&&"image"!==r?"ol":"ul"),"bullet"===r){const t=function(e){const t=function(e){if(e.getChild(0).is("$text"))return null;const t=e.getChild(0).getChild(0);if(t.is("$text"))return t;return t.getChild(0)}(e);if(!t)return null;const i=t._data;if("o"===i)return"circle";if("·"===i)return"disc";if("§"===i)return"square";return null}(e.element);t&&(r=t)}}return{type:s,style:pf(r)}}(e,t);if(n){if(e.indent>r){const e=n.getChild(n.childCount-1),t=e.getChild(e.childCount-1);n=bf(o,t,i),r+=1}else if(e.indent(\s+)<\/span>/g,(e,t)=>1===t.length?" ":Array(t.length+1).join("  ").substr(0,t.length))}function yf(e,t){const i=new DOMParser,o=function(e){return vf(vf(e)).replace(/([\s]*?)[\r\n]+(\s*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>(\s*[\r\n]\s*)<")}(function(e){const t=e.match(/<\/body>(.*?)(<\/html>|$)/);t&&t[1]&&(e=e.slice(0,t.index)+e.slice(t.index).replace(t[1],""));return e}(e=e.replace(/