(\s+)<\/span>/g,((t,e)=>1==e.length?" ":e)).replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((s=(s=i.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||s.includes("
"))&&(s=`
${s}
`),t=s),r=this.editor.data.htmlProcessor.toView(t)}var s;const a=new o.M3(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:i,targetRanges:e.targetRanges,method:e.method}),a.stop.called&&t.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(t.stop(),e.change((()=>{this.fire("contentInsertion",{content:i,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,n)=>{n.resultRange=e.insertContent(n.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,i=(i,o)=>{const r=o.dataTransfer;o.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:i.name})};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.isReadOnly?n.preventDefault():i(e,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",yf(i.content))),"cut"==i.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class Tf extends((0,o.ln)()){constructor(){super(),this._stack=[]}add(t,e){const n=this._stack,i=n[0];this._insertDescriptor(t);const o=n[0];i===o||Df(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}remove(t,e){const n=this._stack,i=n[0];this._removeDescriptor(t);const o=n[0];i===o||Df(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(Df(t,e[n]))return;n>-1&&e.splice(n,1);let i=0;for(;e[i]&&Sf(e[i],t);)i++;e.splice(i,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function Df(t,e){return t&&e&&t.priority==e.priority&&If(t.classes)==If(e.classes)}function Sf(t,e){return t.priority>e.priority||!(t.priorityIf(e.classes)}function If(t){return Array.isArray(t)?t.sort().join(","):t}const Bf='',Mf="ck-widget_selected";function Nf(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function Of(t,e,n={}){if(!t.is("containerElement"))throw new o.Bb("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=jf,e.setCustomProperty("widgetLabel",[],t),n.label&&function(t,e){const n=t.getCustomProperty("widgetLabel");n.push(e)}(t,n.label),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new L;return n.set("content",Bf),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),Lf(t,e),t}function Rf(t,e,n){if(e.classes&&n.addClass((0,o.qo)(e.classes),t),e.attributes)for(const i in e.attributes)n.setAttribute(i,e.attributes[i],t)}function Pf(t,e,n){if(e.classes&&n.removeClass((0,o.qo)(e.classes),t),e.attributes)for(const i in e.attributes)n.removeAttribute(i,t)}function Lf(t,e,n=Rf,i=Pf){const o=new Tf;o.on("change:top",((e,o)=>{o.oldDescriptor&&i(t,o.oldDescriptor,o.writer),o.newDescriptor&&n(t,o.newDescriptor,o.writer)}));e.setCustomProperty("addHighlight",((t,e,n)=>o.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>o.remove(e,n)),t)}function zf(t,e,n={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("role","textbox",t),n.label&&e.setAttribute("aria-label",n.label,t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,i,o)=>{e.setAttribute("contenteditable",o?"false":"true",t)})),t.on("change:isFocused",((n,i,o)=>{o?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),Lf(t,e),t}function Ff(t,e){const n=t.getSelectedElement();if(n){const i=Hf(t);if(i)return e.createRange(e.createPositionAt(n,i))}return aa(t,e)}function jf(){return null}const Vf="widget-type-around";function Uf(t,e,n){return!!t&&Nf(t)&&!n.isInline(e)}function Hf(t){return t.getAttribute(Vf)}var qf=__webpack_require__(5137),Wf={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(qf.Z,Wf);qf.Z.locals;const Gf=["before","after"],Zf=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,Kf="ck-widget__type-around_disabled";class $f extends gt{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[rh,Ud]}constructor(t){super(t),this._currentFakeCaretModelElement=null}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,i,o)=>{e.change((t=>{for(const n of e.document.roots)o?t.removeClass(Kf,n):t.addClass(Kf,n)})),o||t.model.change((t=>{t.removeSelectionAttribute(Vf)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,i=n.editing.view,o=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:o}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(t,e,n,i){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),i)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=Hf(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,o,r)=>{const s=r.mapper.toViewElement(o.item);if(s&&Uf(s,o.item,e)){!function(t,e,n){const i=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of Gf){const i=new m({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n],"aria-hidden":"true"},children:[t.ownerDocument.importNode(Zf,!0)]});t.appendChild(i.render())}}(n,e),function(t){const e=new m({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),i)}(r.writer,i,s);s.getCustomProperty("widgetLabel").push((()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))}}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,i=e.schema,o=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(o.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[Nf,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(Vf)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(Uf(t.editing.mapper.toViewElement(e),e,i))return}t.model.change((t=>{t.removeSelectionAttribute(Vf)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const o=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(o.removeClass(Gf.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!Uf(a,s,i))return;const c=Hf(e.selection);c&&(o.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,i)=>{i||t.model.change((t=>{t.removeSelectionAttribute(Vf)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,i=n.model,r=i.document.selection,s=i.schema,a=n.editing.view,c=e.keyCode,l=(0,o.Zt)(c,n.locale.contentLanguageDirection),d=a.document.selection.getSelectedElement();let u;Uf(d,n.editing.mapper.toModelElement(d),s)?u=this._handleArrowKeyPressOnSelectedWidget(l):r.isCollapsed?u=this._handleArrowKeyPressWhenSelectionNextToAWidget(l):e.shiftKey||(u=this._handleArrowKeyPressWhenNonCollapsedSelection(l)),u&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=Hf(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(Vf,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(Vf),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,i=n.schema,o=e.plugins.get("Widget"),r=o._getObjectElementNextToSelection(t);return!!Uf(e.editing.mapper.toViewElement(r),r,i)&&(n.change((e=>{o._setSelectionOverElement(r),e.setSelectionAttribute(Vf,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,i=n.schema,o=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!Uf(o.toViewElement(s),s,i)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(Vf,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,i)=>{const o=i.domTarget.closest(".ck-widget__type-around__button");if(!o)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(o),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(o,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),i.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,i)=>{if("atTarget"!=n.eventPhase)return;const o=e.getSelectedElement(),r=t.editing.mapper.toViewElement(o),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Uf(r,o,s)&&(this._insertParagraph(o,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:Nf})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",((e,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=t.selection)}),{priority:"high"}),o.OB.isAndroid?this._listenToIfEnabled(t,"keydown",((t,e)=>{229==e.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(t,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,i=n.schema;this._listenToIfEnabled(e.document,"delete",((e,o)=>{if("atTarget"!=e.eventPhase)return;const r=Hf(n.document.selection);if(!r)return;const s=o.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=i.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const o=n.createSelection(e.start);if(n.modifySelection(o,{direction:s}),o.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||t.isLimit(i))break;n=i}return n}(i,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}o.preventDefault(),e.stop()}),{context:Nf})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[i,o])=>{if(o&&!o.is("documentSelection"))return;const r=Hf(n);return r?(t.stop(),e.change((t=>{const o=n.getSelectedElement(),s=e.createPositionAt(o,r),a=t.createSelection(s),c=e.insertContent(i,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,i,,o={}]=n;if(i&&!i.is("documentSelection"))return;const r=Hf(e);r&&(o.findOptimalPosition=r,n[3]=o)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;Hf(e)&&t.stop()}),{priority:"high"})}}function Yf(t){const e=t.model;return(n,i)=>{const r=i.keyCode==o.Do.arrowup,s=i.keyCode==o.Do.arrowdown,a=i.shiftKey,c=e.document.selection;if(!r&&!s)return;const l=s;if(a&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(c,l))return;const d=function(t,e,n){const i=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=Jf(i,t,"forward");if(!n)return null;const o=i.createRange(t,n),r=Qf(i.schema,o,"backward");return r?i.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=Jf(i,t,"backward");if(!n)return null;const o=i.createRange(n,t),r=Qf(i.schema,o,"forward");return r?i.createRange(r,t):null}}(t,c,l);if(d){if(d.isCollapsed){if(c.isCollapsed)return;if(a)return}(d.isCollapsed||function(t,e,n){const i=t.model,r=t.view.domConverter;if(n){const t=i.createSelection(e.start);i.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=i.createRange(t.focus,e.end))}const s=t.mapper.toViewRange(e),a=r.viewRangeToDom(s),c=o.UL.getDomRangeRects(a);let l;for(const t of c)if(void 0!==l){if(Math.round(t.top)>=l)return!1;l=Math.max(l,Math.round(t.bottom))}else l=Math.round(t.bottom);return!0}(t,d,l))&&(e.change((t=>{const n=l?d.end:d.start;if(a){const i=e.createSelection(c.anchor);i.setFocus(n),t.setSelection(i)}else t.setSelection(n)})),n.stop(),i.preventDefault(),i.stopPropagation())}}}function Jf(t,e,n){const i=t.schema,o=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of o.getWalker({startPosition:e,direction:n})){if(i.isLimit(s)&&!i.isInline(s))return t;if(a==r&&i.isBlock(s))return null}return null}function Qf(t,e,n){const i="backward"==n?e.end:e.start;if(t.checkChild(i,"$text"))return i;for(const{nextPosition:i}of e.getWalker({direction:n}))if(t.checkChild(i,"$text"))return i;return null}var Xf=__webpack_require__(6507),tb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Xf.Z,tb);Xf.Z.locals;class eb extends gt{static get pluginName(){return"Widget"}static get requires(){return[$f,Ud]}init(){const t=this.editor,e=t.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",((e,n,i)=>{const o=i.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);var c;Nf(a)&&(i.consumable.consume(r,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:(c=a,c.getCustomProperty("widgetLabel").reduce(((t,e)=>"function"==typeof e?t?t+". "+e():e():t?t+". "+e:e),""))}))})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const i=n.writer,o=i.document.selection;let r=null;for(const t of o.getRanges())for(const e of t){const t=e.item;Nf(t)&&!nb(t,r)&&(i.addClass(Mf,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(pa),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[Nf,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",Yf(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,i=n.editing.view,r=i.document;let s=e.target;if(function(t){let e=t;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(Nf(e))return!1;e=e.parent}return!1}(s)){if((o.OB.isSafari||o.OB.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,i=s.is("attributeElement")?s.findAncestor((t=>!t.is("attributeElement"))):s,o=t.toModelElement(i);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(o,"in")}))}return}if(!Nf(s)&&(s=s.findAncestor(Nf),!s))return;o.OB.isAndroid&&e.preventDefault(),r.isFocused||i.focus();const a=n.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,i=this.editor.model,r=i.schema,s=i.document.selection,a=s.getSelectedElement(),c=(0,o.mA)(n,this.editor.locale.contentLanguageDirection),l="down"==c||"right"==c,d="up"==c||"down"==c;if(a&&r.isObject(a)){const n=l?s.getLastPosition():s.getFirstPosition(),o=r.getNearestSelectionRange(n,l?"forward":"backward");return void(o&&(i.change((t=>{t.setSelection(o)})),e.preventDefault(),t.stop()))}if(!s.isCollapsed&&!e.shiftKey){const n=s.getFirstPosition(),o=s.getLastPosition(),a=n.nodeAfter,c=o.nodeBefore;return void((a&&r.isObject(a)||c&&r.isObject(c))&&(i.change((t=>{t.setSelection(l?o:n)})),e.preventDefault(),t.stop()))}if(!s.isCollapsed)return;const u=this._getObjectElementNextToSelection(l);if(u&&r.isObject(u)){if(r.isInline(u)&&d)return;this._setSelectionOverElement(u),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,i=n.schema,o=n.document.selection.getSelectedElement();o&&i.isObject(o)&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let i=e.anchor.parent;for(;i.isEmpty;){const e=i;i=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,i=e.document.selection,o=e.createSelection(i);if(e.modifySelection(o,{direction:t?"forward":"backward"}),o.isEqual(i))return null;const r=t?o.focus.nodeBefore:o.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(Mf,e);this._previouslySelected.clear()}}function nb(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}class ib extends gt{static get requires(){return[Sl]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!Nf(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:i,balloonClassName:r="ck-toolbar-container"}){if(!n.length)return void(0,o.KE)("widget-toolbar-no-items",{toolbarId:t});const s=this.editor,a=s.t,c=new xc(s.locale);if(c.ariaLabel=e||a("Widget toolbar"),this._toolbarDefinitions.has(t))throw new o.Bb("widget-toolbar-duplicated",this,{toolbarId:t});const l={view:c,getRelatedElement:i,balloonClassName:r,itemsConfig:n,initialized:!1};s.ui.addToolbar(c,{isContextual:!0,beforeFocus:()=>{const t=i(s.editing.view.document.selection);t&&this._showToolbar(l,t)},afterBlur:()=>{this._hideToolbar(l)}}),this._toolbarDefinitions.set(t,l)}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const i of this._toolbarDefinitions.values()){const o=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&o)if(this.editor.ui.focusTracker.isFocused){const r=o.getAncestors().length;r>t&&(t=r,e=o,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?ob(this.editor,e):this._isToolbarInBalloon(t)||(t.initialized||(t.initialized=!0,t.view.fillFromConfig(t.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:t.view,position:rb(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);ob(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function ob(t,e){const n=t.plugins.get("ContextualBalloon"),i=rb(t,e);n.updatePosition(i)}function rb(t,e){const n=t.editing.view,i=Uc.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class sb extends((0,o.Re)()){constructor(t){super(),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=t,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(t,e,n){const i=new o.UL(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(ab(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new o.UL(t),i=e.split("-"),r={x:"right"==i[1]?n.right:n.left,y:"bottom"==i[0]?n.bottom:n.top};return r.x+=t.ownerDocument.defaultView.scrollX,r.y+=t.ownerDocument.defaultView.scrollY,r}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this._originalWidth=i.width,this._originalHeight=i.height,this._aspectRatio=i.width/i.height;const r=n.style.width;r&&r.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(r):this._originalWidthPercents=function(t,e){const n=t.parentElement,i=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);return e.width/i*100}(n,i)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function ab(t){return`ck-widget__resizer__handle-${t}`}class cb extends d{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,i)=>"px"===t.unit?`${e}×${n}`:`${i}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class lb extends((0,o.Re)()){constructor(t){super(),this._options=t,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((t,e)=>t&&e)),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change((t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)}))}hide(){this._options.editor.editing.view.change((t=>{t.addClass("ck-hidden",this._viewResizerWrapper)}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),n}));n.insert(n.createPositionAt(e,"end"),i),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=i,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(t){this._state=new sb(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",i=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",i,this._options.viewElement)}));const n=this._getHandleHost(),i=new o.UL(n),r=Math.round(i.width),s=Math.round(i.height),a=new o.UL(n);e.width=Math.round(a.width),e.height=Math.round(a.height),this.redraw(i),this.state.update({...e,handleHostWidth:r,handleHostHeight:s})}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const i=e.parentElement,r=this._getHandleHost(),s=this._viewResizerWrapper,a=[s.getStyle("width"),s.getStyle("height"),s.getStyle("left"),s.getStyle("top")];let c;if(i.isSameNode(r)){const e=t||new o.UL(r);c=[e.width+"px",e.height+"px",void 0,void 0]}else c=[r.offsetWidth+"px",r.offsetHeight+"px",r.offsetLeft+"px",r.offsetTop+"px"];"same"!==(0,o.Rt)(a,c)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:c[0],height:c[1],left:c[2],top:c[3]},s)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(i=t).pageX,y:i.pageY};var i;const o=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};o&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),o&&(r.x*=2);let s=Math.abs(e.originalWidth+r.x),a=Math.abs(e.originalHeight+r.y);return"width"==(s/e.aspectRatio>a?"width":"height")?a=s/e.aspectRatio:s=a*e.aspectRatio,{width:Math.round(s),height:Math.round(a),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*s*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const i of e)t.appendChild(new m({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new cb,this._sizeView.render(),t.appendChild(this._sizeView.element)}}const db=function(t,e,n){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return(0,h.Z)(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Pi(t,e,{leading:i,maxWait:e,trailing:o})};var ub=__webpack_require__(2263),hb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(ub.Z,hb);ub.Z.locals;class mb extends gt{static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=o.CO.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),this._resizers=new Map,t.view.addObserver(pa),this._observer=new((0,o.Xu)()),this.listenTo(t.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)),this._redrawSelectedResizerThrottled=db((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(o.CO.window,"resize",this._redrawSelectedResizerThrottled);const n=this.editor.editing.view.document.selection;n.on("change",(()=>{const t=n.getSelectedElement(),e=this.getResizerByViewElement(t)||null;e?this.select(e):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawSelectedResizerThrottled.cancel()}select(t){this.deselect(),this.selectedResizer=t,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(t){const e=new lb(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const i=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(i)==e&&this.select(e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;lb.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n)||null,this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}var gb=__webpack_require__(390),pb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(gb.Z,pb);gb.Z.locals;class fb extends gt{static get pluginName(){return"DragDrop"}static get requires(){return[Ef,eb]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=db((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=kb((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=kb((()=>this._clearDraggableAttributes()),40),e.addObserver(vf),e.addObserver(pa),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),o.OB.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,i=t.editing.view,r=i.document;this.listenTo(r,"dragstart",((i,s)=>{const a=n.selection;if(s.target&&s.target.is("editableElement"))return void s.preventDefault();const c=s.target?wb(s.target):null;if(c){const n=t.editing.mapper.toModelElement(c);this._draggedRange=Wo.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!r.selection.isCollapsed){const t=r.selection.getSelectedElement();t&&Nf(t)||(this._draggedRange=Wo.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void s.preventDefault();this._draggingUid=(0,o.hQ)(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(l));r.fire("clipboardOutput",{dataTransfer:s.dataTransfer,content:d,method:"dragstart"}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(r,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(r,"dragenter",(()=>{this.isEnabled&&i.focus()})),this.listenTo(r,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(r,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const i=bb(t,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),o.OB.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),i&&this._updateDropMarkerThrottled(i)}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const i=bb(t,n.targetRanges,n.target);if(this._removeDropMarker(),!i)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==xb(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(i,!0))return this._finalizeDragging(!1),void e.stop();n.targetRanges=[t.editing.mapper.toViewRange(i)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(Ef);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==xb(e.dataTransfer),i=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(i&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((i,r)=>{if(o.OB.isAndroid||!r)return;this._clearDraggableAttributesDelayed.cancel();let s=wb(r.target);if(o.OB.isBlink&&!t.isReadOnly&&!s&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&Nf(t)||(s=n.selection.editableElement)}s&&(e.change((t=>{t.setAttribute("draggable","true",s)})),this._draggableElement=t.editing.mapper.toModelElement(s))})),this.listenTo(n,"mouseup",(()=>{o.OB.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const t=this.editor;t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.append("",t.createElement("span"),""),e}))}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function bb(t,e,n){const i=t.model,r=t.editing.mapper;let s=null;const a=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),s=function(t,e){const n=t.model,i=t.editing.mapper;if(Nf(e))return n.createRangeOn(i.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>Nf(t)||t.is("editableElement")));if(Nf(t))return n.createRangeOn(i.toModelElement(t))}return null}(t,n),s)return s;const c=function(t,e){const n=t.editing.mapper,i=t.editing.view,o=n.toModelElement(e);if(o)return o;const r=i.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),l=a?r.toModelPosition(a):null;return l?(s=function(t,e,n){const i=t.model;if(!i.schema.checkChild(n,"$block"))return null;const o=i.createPositionAt(n,0),r=e.path.slice(0,o.path.length),s=i.createPositionFromPath(e.root,r),a=s.nodeAfter;if(a&&i.schema.isObject(a))return i.createRangeOn(a);return null}(t,l,c),s||(s=i.schema.getNearestSelectionRange(l,o.OB.isGecko?"forward":"backward"),s||function(t,e){const n=t.model;let i=e;for(;i;){if(n.schema.isObject(i))return n.createRangeOn(i);i=i.parent}return null}(t,l.parent))):function(t,e){const n=t.model,i=n.schema,o=n.createPositionAt(e,0);return i.getNearestSelectionRange(o,"forward")}(t,c)}function xb(t){return o.OB.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function kb(t,e){let n;function i(...o){i.cancel(),n=setTimeout((()=>t(...o)),e)}return i.cancel=()=>{clearTimeout(n)},i}function wb(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(Nf);if(Nf(t))return t;const e=t.findAncestor((t=>Nf(t)||t.is("editableElement")));return Nf(e)?e:null}class _b extends gt{static get pluginName(){return"PastePlainText"}static get requires(){return[Ef]}init(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=e.document.selection;let r=!1;n.addObserver(vf),this.listenTo(i,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(Ef).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==Array.from(n.getAttributeKeys()).length}(n.content,e.schema))&&e.change((t=>{const i=Array.from(o.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0}),i.push(...o.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(i,e)}))}))}}class Ab extends gt{static get pluginName(){return"Clipboard"}static get requires(){return[Ef,fb,_b]}}class vb extends ft{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!Cb(t.schema,n))do{if(n=n.parent,!n)return}while(!Cb(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function Cb(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const yb=(0,o.Zz)("Ctrl+A");class Eb extends gt{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new vb(t)),this.listenTo(e,"keydown",((e,n)=>{(0,o.Cq)(n)===yb&&(t.execute("selectAll"),n.preventDefault())}))}}class Tb extends gt{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),i=new j(e),o=e.t;return i.set({label:o("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),i}))}}class Db extends gt{static get requires(){return[Eb,Tb]}static get pluginName(){return"SelectAll"}}class Sb extends ft{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const i=this.editor.model,o=i.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=o.graveyard)).filter((t=>!Bb(t,a)));e.length&&(Ib(e),r.push(e[0]))}r.length&&i.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,i=n.document;this._createdBatches.add(e);const o=t.operations.slice().filter((t=>t.isDocumentOperation));o.reverse();for(const t of o){const o=t.baseVersion+1,r=Array.from(i.history.getOperations(o)),s=ks([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const o of s)e.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(t,o)}}}function Ib(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class Mb extends Sb{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,(()=>{this._undo(n.batch,i);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,i)})),this.refresh()}}class Nb extends Sb{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,i),this._undo(t.batch,e)})),this.refresh()}}class Ob extends gt{static get pluginName(){return"UndoEditing"}constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new Mb(t),this._redoCommand=new Nb(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const i=n.batch,o=this._redoCommand._createdBatches.has(i),r=this._undoCommand._createdBatches.has(i);this._batchRegistry.has(i)||(this._batchRegistry.add(i),i.isUndoable&&(o?this._undoCommand.addBatch(i):r||(this._undoCommand.addBatch(i),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}const Rb='',Pb='';class Lb extends gt{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?Rb:Pb,o="ltr"==e.uiLanguageDirection?Pb:Rb;this._addButton("undo",n("Undo"),"CTRL+Z",i),this._addButton("redo",n("Redo"),"CTRL+Y",o)}_addButton(t,e,n,i){const o=this.editor;o.ui.componentFactory.add(t,(r=>{const s=o.commands.get(t),a=new j(r);return a.set({label:e,icon:i,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{o.execute(t),o.editing.view.focus()})),a}))}}class zb extends gt{static get requires(){return[Ob,Lb]}static get pluginName(){return"Undo"}}class Fb extends ft{refresh(){const t=this.editor.model,e=t.document,n=(0,o.Ps)(e.selection.getSelectedBlocks());this.value=!!n&&n.is("element","paragraph"),this.isEnabled=!!n&&jb(n,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change((i=>{const o=(t.selection||n.selection).getSelectedBlocks();for(const t of o)!t.is("element","paragraph")&&jb(t,e.schema)&&i.rename(t,"paragraph")}))}}function jb(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class Vb extends ft{execute(t){const e=this.editor.model,n=t.attributes;let i=t.position;e.change((t=>{const o=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(o,n,t),!e.schema.checkChild(i.parent,o)){const n=e.schema.findAllowedParent(i,o);if(!n)return;i=t.split(i,n).position}e.insertContent(o,i),t.setSelection(o,"in")}))}}class Ub extends gt{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new Fb(t)),t.commands.add("insertParagraph",new Vb(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>Ub.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}Ub.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);const Hb=["placeholderElement","config","placeholder","data","assign","plugins","_updatePlaceholder","setSelection","destroy","childCount","model","get","getChild","getRoot","then","document","focus","fire","defaultPlugins","set","init","create","initialData","change","low","editing","name","initPlugins","view"];var qb,Wb;qb=Hb,Wb=235,function(t){for(;--t;)qb.push(qb.shift())}(++Wb);const Gb=function(t,e){return Hb[t-=0]};class Zb extends oc{constructor(t={}){(t=Object[Gb("0x1")]({},t))[Gb("0x2")]||(t.plugins=Zb[Gb("0xf")]),super(t),this.ui=new Af(this),this[Gb("0x10")]("placeholder",""),this[Gb("0x7")][Gb("0xc")].on(Gb("0x14"),(()=>this[Gb("0x3")]()),{priority:Gb("0x15")}),this.on("change:placeholder",(()=>this[Gb("0x3")]())),this[Gb("0x7")][Gb("0xc")].createRoot()}[Gb("0x12")](){const t=this[Gb("0x1b")][Gb("0x8")](Gb("0x13"))||"";return this[Gb("0x18")]()[Gb("0xb")]((()=>this.ui[Gb("0x11")]()))[Gb("0xb")]((()=>this[Gb("0x0")].init(t))).then((()=>this[Gb("0xe")]("ready")))}[Gb("0x5")](){return super[Gb("0x5")]()[Gb("0xb")]((()=>this.ui[Gb("0x5")]()))}[Gb("0xd")](){this[Gb("0x7")][Gb("0x14")]((t=>{const e=this.model[Gb("0xc")].getRoot(),n=e[Gb("0x9")](e[Gb("0x6")]-1);t[Gb("0x4")](n,"end"),this[Gb("0x16")].view[Gb("0xd")]()}))}[Gb("0x3")](){const t=this.editing[Gb("0x19")],e=t[Gb("0xc")][Gb("0xa")](),n=e[Gb("0x9")](0);e[Gb("0x6")]>1||!n||"p"!=n[Gb("0x17")]?this[Gb("0x1a")]&&(function(t,e){const n=e.document;t.change((t=>{if(!Ct.has(n))return;const i=Ct.get(n),o=i.get(e);t.removeAttribute("data-placeholder",o.hostElement),Et(t,o.hostElement),i.delete(e)}))}(t,this.placeholderElement),this[Gb("0x1a")]=void 0):(yt({view:t,element:n,text:this[Gb("0x1c")],keepOnFocus:!0}),this[Gb("0x1a")]=n)}}(0,Vl.mix)(Zb,Vl.ObservableMixin),(0,Vl.mix)(Zb,sc),Zb[Gb("0xf")]=[Ab,rh,lh,Db,Hd,zb,Ub];const Kb=["isEnabled","createEditor","length","_editorConfig","_createCancelButton","listenTo","ck-comment__input-actions--active","fire","editor","TOO_LONG_COMMENT_ALERT","placeholder","getData","_editorCreationPromise","Submit","destroy","label","bindTemplate","focus","document","render","model","Esc","then","value","trim","initialData","stop","div","bind","_createSubmitButton","focusNext","create","extendTemplate","check","add","keystrokes","forEach","insertBefore","cancelButtonView","setData","icon","focusPrevious","element","low","set","_initializeFocusCycling","ck-comment__input-actions--cancel","focusTracker","execute","submit","submitButtonView","_isDestroyed","view","showButtons","ck-comment__input-wrapper","cancel","firstChild","disabledSubmit"];var $b,Yb;$b=Kb,Yb=246,function(t){for(;--t;)$b.push($b.shift())}(++Yb);const Jb=function(t,e){return Kb[t-=0]};class Qb extends d{constructor(t,e={}){super(t),this[Jb("0x34")]=null,this[Jb("0x2f")]=e,this[Jb("0x15")]=new Vl.KeystrokeHandler,this[Jb("0x21")]=new Vl.FocusTracker,this.set("value",e[Jb("0xb")]||""),this[Jb("0x1e")](Jb("0x2b"),!1),this[Jb("0x1e")]("showButtons",!0),this[Jb("0x1e")](Jb("0x36"),hf(t,"Reply...")),this[Jb("0x24")]=this[Jb("0xf")](),this[Jb("0x18")]=this[Jb("0x30")](),this.setTemplate({tag:Jb("0xd"),attributes:{class:[Jb("0x28")]},children:[{tag:Jb("0xd"),attributes:{class:["ck-comment__input-actions",this[Jb("0x2")].if(Jb("0x27"),Jb("0x32"))]},children:[this[Jb("0x24")],this[Jb("0x18")]]}]}),this[Jb("0x15")][Jb("0x1e")](Jb("0x7"),((t,e)=>{this.cancelButtonView[Jb("0x33")](Jb("0x22")),e()})),this.on(Jb("0x23"),((e,n)=>{n.length>65e3?(alert(hf(t,Jb("0x35"),[n[Jb("0x2e")],65e3])),e[Jb("0xc")]()):this[Jb("0x34")][Jb("0x19")]("")}),{priority:"high"})}[Jb("0x5")](){super[Jb("0x5")](),this[Jb("0x15")][Jb("0x31")](this[Jb("0x1c")]),this[Jb("0x21")].add(this[Jb("0x1c")])}[Jb("0x2d")](){return this.editor||(this.editor=new Zb(this[Jb("0x2f")]),this[Jb("0x38")]=this.editor[Jb("0x11")]()[Jb("0x8")]((()=>{this[Jb("0x25")]||(this[Jb("0x1c")][Jb("0x17")](this[Jb("0x34")].ui[Jb("0x1c")],this[Jb("0x1c")][Jb("0x2a")]),this[Jb("0x34")][Jb("0x6")][Jb("0x4")].on("change",(()=>this[Jb("0x9")]=this[Jb("0x34")][Jb("0x37")]())),this[Jb("0x34")][Jb("0xe")](Jb("0x36")).to(this),this[Jb("0x1f")](this[Jb("0x34")]),this[Jb("0x33")]("editorReady"))}))),this._editorCreationPromise}focus(){this[Jb("0x34")]&&this[Jb("0x34")][Jb("0x3")]()}async destroy(){this[Jb("0x25")]||(this[Jb("0x25")]=!0,this[Jb("0x34")]&&(await this[Jb("0x38")],await this[Jb("0x34")][Jb("0x0")]()),await super[Jb("0x0")]())}[Jb("0xf")](){const{locale:t}=this,e=new j(t);return e[Jb("0x12")]({attributes:{class:["ck-comment__input-actions--submit"]}}),e.label=hf(t,Jb("0x39")),e[Jb("0x1a")]=mc[Jb("0x13")],e.on(Jb("0x22"),(()=>{this.fire(Jb("0x23"),this.value)})),e[Jb("0xe")](Jb("0x2c")).to(this,Jb("0x9"),this,Jb("0x2b"),((t,e)=>!e&&!!t[Jb("0xa")]())),e}[Jb("0x30")](){const{locale:t}=this,e=new j(t);return e[Jb("0x12")]({attributes:{class:[Jb("0x20")]}}),e[Jb("0x1")]=hf(t,"Cancel"),e[Jb("0x1a")]=mc[Jb("0x29")],e.on("execute",(()=>{this[Jb("0x34")][Jb("0x19")](""),this.fire(Jb("0x29"))})),e}[Jb("0x1f")](t){const e=this[Jb("0x21")],n=new r;[t.ui[Jb("0x26")],this[Jb("0x24")],this[Jb("0x18")]][Jb("0x16")]((t=>{n.add(t),e[Jb("0x14")](t.element)}));const i=new lt({focusables:n,focusTracker:e});this.keystrokes[Jb("0x1e")]("tab",((t,e)=>{i[Jb("0x10")](),e()}),{priority:Jb("0x1d")}),this[Jb("0x15")][Jb("0x1e")]("shift + tab",((t,e)=>{i[Jb("0x1b")](),e()}),{priority:Jb("0x1d")})}}var Xb,tx,ex=["commentInputView","editor","userView","bind","ck-thread__input","extendTemplate","ck-comment__input-container","createEditor","set","change:showInput","showButtons","isFocused","value","then","showInput","div","setTemplate","destroy","bindTemplate","focusTracker"];Xb=ex,tx=249,function(t){for(;--t;)Xb.push(Xb.shift())}(++tx);var nx=function(t,e){return ex[t-=0]};class ix extends d{constructor(t,e,n){super(t),this[nx("0xb")]=new Qb(t,n),this.commentInputView[nx("0xe")](nx("0x1")).to(this.commentInputView[nx("0xa")],nx("0x2"),this[nx("0xb")],nx("0x3"),((t,e)=>t||!!e)),this[nx("0x13")](nx("0x5"),!1),this.on(nx("0x0"),(()=>{this.showInput&&!this.commentInputView[nx("0xc")]&&this.commentInputView[nx("0x12")]()})),this[nx("0xd")]=new Rm(t,e),this.userView[nx("0x10")]({attributes:{class:"ck-thread__user"}}),this[nx("0xb")][nx("0x10")]({attributes:{class:nx("0xf")}}),this[nx("0x7")]({tag:nx("0x6"),attributes:{class:[nx("0x11"),this[nx("0x9")].if(nx("0x5"),"ck-comment__input-container--active")]},children:[this.userView,this.commentInputView]})}destroy(){return this.commentInputView[nx("0x8")]()[nx("0x4")]((()=>super[nx("0x8")]()))}}const ox=["setTemplate"];var rx,sx;rx=ox,sx=485,function(t){for(;--t;)rx.push(rx.shift())}(++sx);class ax extends d{constructor(t){super(t);const e=this.bindTemplate;this.set("count"),this[function(t,e){return ox[t-=0]}("0x0")]({tag:"li",attributes:{class:"ck-thread__comment-count"},children:[{text:e.to("count",(e=>hf(t,"NUMBER_OF_COMMENTS",e)))}]})}}const cx=["from","formatDateTime","element","createCollection","_collapsedCommentsView","_config","render","maxCommentCharsWhenCollapsed","destroy","delete","stopListening","equal","removeComment","_handleRemoveCommentModel","comments","change:isActive","focus","count","set","commentViews","listenTo","refreshVisibleViews","get","length","updateComment","hasDirtyComment","remove","maxThreadTotalWeight","add","_shouldCollapse","insert","_rearrangeCollapse","_updateHasDirtyComment","_handleNewCommentModel","_model","visibleViews","setTemplate","ck-thread__comments","delegate","maxCommentsWhenCollapsed","expand","collapse","isEditMode","editorConfig"];var lx,dx;lx=cx,dx=482,function(t){for(;--t;)lx.push(lx.shift())}(++dx);const ux=function(t,e){return cx[t-=0]};class hx extends d{constructor(t,e,n){super(t),this.set("hasDirtyComment",!1),this[ux("0x14")](ux("0x19"),e[ux("0x10")][ux("0x19")]),this[ux("0x14")]("isActive",!1),this[ux("0x24")]=e,this[ux("0x7")]=n,this[ux("0x15")]=this[ux("0x5")](),this[ux("0x25")]=this.createCollection(),this._collapsedCommentsView=new ax(t),this[ux("0x6")].bind("count").to(this,ux("0x19"),(t=>t-this[ux("0x7")][ux("0x29")]));for(const t of e[ux("0x10")])this[ux("0x23")](t);this[ux("0x16")](e[ux("0x10")],ux("0x1e"),((t,e)=>{this[ux("0x19")]++,this[ux("0x23")](e),this.refreshVisibleViews()})),this.listenTo(e[ux("0x10")],"remove",((t,e)=>{this[ux("0x19")]--,this[ux("0xf")](e),this.refreshVisibleViews()})),this[ux("0x16")](e,"commentUpdated",(()=>this[ux("0x17")]())),this.on(ux("0x11"),(()=>this.refreshVisibleViews())),this.on("change:hasDirtyComment",(()=>this[ux("0x17")]())),this[ux("0x26")]({tag:"ul",attributes:{class:[ux("0x27")]},children:this[ux("0x25")]})}get[ux("0x1f")](){return this._model.weight>this[ux("0x7")][ux("0x1d")]&&!this.isActive&&!this[ux("0x1b")]}[ux("0x8")](){super[ux("0x8")](),this[ux("0x17")]()}[ux("0x12")](){this[ux("0x4")][ux("0x12")]()}[ux("0xa")](){this[ux("0x6")].destroy();for(const t of this.commentViews)t[ux("0xa")]();super[ux("0xa")]()}refreshVisibleViews(){this._shouldCollapse?this[ux("0x21")]():this._rearrangeExpand()}_handleNewCommentModel(t){const e=new(this[ux("0x7")].CommentView)(this.locale,t,{maxCommentCharsWhenCollapsed:this._config[ux("0x9")],formatDateTime:this[ux("0x7")][ux("0x3")],editorConfig:this._config[ux("0x1")]});e.viewUid=t.id,e.delegate(ux("0xe")).to(this),e[ux("0x28")](ux("0x1a")).to(this),this.listenTo(e,"change:isEditMode",(()=>this._updateHasDirtyComment())),this[ux("0x15")][ux("0x1e")](e)}_handleRemoveCommentModel(t){const e=this[ux("0x15")].remove(t.id);this[ux("0xc")](e),e[ux("0x0")]&&this[ux("0x22")](),e[ux("0xa")]()}[ux("0x22")](){this.hasDirtyComment=Array.from(this[ux("0x15")]).some((t=>t.isEditMode))}[ux("0x21")](){const t=function(t){const e=new Vl.Collection;for(const n of t)e[ux("0x1e")](n);return e}(this[ux("0x15")]),e=this[ux("0x6")][ux("0x13")];for(let n=1;n<=e;n++)t[ux("0x1c")](1);for(const e of t)e[ux("0x2b")]();e>0&&t[ux("0x1e")](this[ux("0x6")],1),mx((0,Vl.diff)(Array[ux("0x2")](this.visibleViews),Array[ux("0x2")](t)),this.visibleViews,t)}_rearrangeExpand(){mx((0,Vl.diff)(Array.from(this[ux("0x25")]),Array[ux("0x2")](this[ux("0x15")])),this[ux("0x25")],this[ux("0x15")]);for(const t of this[ux("0x25")])t[ux("0x2a")]()}}function mx(t,e,n){let i=0;for(const o of t)switch(o){case ux("0x20"):e[ux("0x1e")](n[ux("0x18")](i),i),i++;break;case ux("0xb"):e[ux("0x1c")](i);break;case ux("0xd"):i++}}const gx=["change:isActive","Write a comment...","fire","locale","commentInputView","commentsListView","element","disabledSubmit","cancel","length","bind","hasDirtyComment","addComment","value","_createCommentThreadInputView","isDirty","delegate","placeholder","stop","_config","destroy","focus","commentThreadInputView","set","CommentView","isActive","isReadOnly","_model","showInput","removeCommentThread","updateComment","_localUser","Reply...","removeComment","assign"];var px,fx;px=gx,fx=210,function(t){for(;--t;)px.push(px.shift())}(++fx);const bx=function(t,e){return gx[t-=0]};class xx extends d{constructor(t,e,n,i){super(t),this[bx("0x17")](bx("0x19"),!1),this[bx("0x17")](bx("0xf"),!1),this[bx("0x1b")]=e,this[bx("0x1f")]=n,this._config=i,this.commentsListView=new hx(t,e,Object[bx("0x22")]({CommentView:this[bx("0x13")][bx("0x18")]},i)),this[bx("0x5")][bx("0x10")](bx("0x21")).to(this),this.commentsListView[bx("0x10")](bx("0x1e")).to(this),this[bx("0x5")][bx("0xa")](bx("0x19")).to(this),this[bx("0x17")](bx("0x9"),this.commentsListView[bx("0x9")]),this[bx("0xa")](bx("0x9")).to(this[bx("0x5")],bx("0x9")),this[bx("0x16")]=this[bx("0xe")](),this.on(bx("0x21"),(()=>this[bx("0x15")]())),this[bx("0xa")](bx("0xf")).to(this[bx("0x5")],bx("0xb"),this[bx("0x16")][bx("0x4")],"value",((t,e)=>t||!!e))}[bx("0x15")](){this[bx("0x6")].focus()}destroy(){this[bx("0xf")]=!1,this.commentsListView[bx("0x14")](),this[bx("0x16")].destroy(),super[bx("0x14")]()}_createCommentThreadInputView(){const t=new ix(this.locale,this[bx("0x1f")],this[bx("0x13")].editorConfig),e=t[bx("0x4")];return t[bx("0xa")](bx("0x1c")).to(this,bx("0x19"),this._model,bx("0x1a"),e,bx("0xd"),((t,e,n)=>!!n||t&&!e)),e[bx("0xa")](bx("0x11")).to(this,bx("0x9"),(t=>hf(this[bx("0x3")],bx(t?"0x20":"0x1")))),e.on("submit",((t,e)=>{this.fire(bx("0xc"),e)})),e.on(bx("0x8"),(()=>{this.focus()})),e[bx("0xa")](bx("0x7")).to(this[bx("0x1b")],"isReadOnly"),e.on(bx("0x8"),(t=>{0==this[bx("0x9")]&&(this[bx("0x2")](bx("0x1d")),t[bx("0x12")]())})),this.on(bx("0x0"),((t,n,i)=>{i||this[bx("0x9")]||e.value||this[bx("0x2")]("removeCommentThread")})),t}}const kx=["actionIndicator","ck-thread__container","commentsListView","remove","locale","unbind","_model","fire","ck-thread","commentViews","ck-thread--","execute","change:isActive","Write a comment...","cancelConfirm","placeholder","querySelector","containerElement","stop","element","_boundFirstCommentView","Delete comment thread?","_cancelAllConfirms","bindTemplate","change:isReadOnly","listenTo","set","then","getTemplate","get","ck-thread--remove-confirmation","removeButton","ck-thread--active","div","showConfirm","length","commentThreadInputView","_bindFirstCommentView","render","add","removeCommentThread"];var wx,_x;wx=kx,_x=190,function(t){for(;--t;)wx.push(wx.shift())}(++_x);const Ax=function(t,e){return kx[t-=0]};class vx extends xx{constructor(t,e,n,i){super(t,e,n,i),this[Ax("0x0")](Ax("0xf"),null),this[Ax("0x20")]=null,this[Ax("0x23")]=null,this[Ax("0x13")]=t,this.setTemplate(this[Ax("0x2")]()),this.on(Ax("0x1b"),((t,e,n)=>{n||this._cancelAllConfirms()})),this[Ax("0x28")](this[Ax("0x15")],Ax("0x27"),((t,e,n)=>{n&&this[Ax("0x25")]()})),this[Ax("0x9")]>0&&this[Ax("0xb")](),this[Ax("0x28")](this[Ax("0x11")][Ax("0x18")],Ax("0xd"),(()=>{this._bindFirstCommentView()}))}getTemplate(){const t=this[Ax("0x26")];return{tag:Ax("0x7"),attributes:{class:[Ax("0x17"),t.if("isActive",Ax("0x6")),t.if("isConfirm",Ax("0x4")),t.to(Ax("0xf"),(t=>t?Ax("0x19")+t:""))],"data-thread-id":this._model.id,tabindex:-1},children:[{tag:Ax("0x7"),attributes:{class:Ax("0x10")},children:[this.commentsListView,this[Ax("0xa")]]}]}}[Ax("0xc")](){super.render(),this.containerElement=this[Ax("0x22")][Ax("0x1f")](".ck-thread__container")}_cancelAllConfirms(){this.cancelConfirm();for(const t of this[Ax("0x11")][Ax("0x18")])t[Ax("0x1d")]()}[Ax("0xb")](){const{locale:t}=this,e=this[Ax("0x11")][Ax("0x18")][Ax("0x3")](0);e!==this[Ax("0x23")]&&(this[Ax("0x23")]=e,this[Ax("0x14")](Ax("0xf")),this.bind(Ax("0xf")).to(e,"actionIndicator",(t=>"remove"===t?Ax("0x12"):null)),e[Ax("0x1e")]=hf(t,Ax("0x1c")),e[Ax("0x5")].on(Ax("0x1a"),(e=>{e[Ax("0x21")](),this[Ax("0x8")](hf(t,Ax("0x24")),this[Ax("0x20")])[Ax("0x1")]((()=>{this[Ax("0x16")](Ax("0xe"))}))}),{priority:"high"}))}}(0,Vl.mix)(vx,Np);var Cx,yx,Ex=["ck-comment__content","setTemplate","ck-annotation__content","set","render","content","innerHTML","div","element","change:content"];Cx=Ex,yx=469,function(t){for(;--t;)Cx.push(Cx.shift())}(++yx);var Tx=function(t,e){return Ex[t-=0]};class Dx extends d{constructor(t){super(t),this[Tx("0x4")](Tx("0x6"),""),this[Tx("0x2")]({tag:Tx("0x8"),attributes:{class:[Tx("0x1"),Tx("0x3")]}})}[Tx("0x5")](){super[Tx("0x5")](),this.on(Tx("0x0"),((t,e,n)=>{this.element.innerHTML=n})),this[Tx("0x9")][Tx("0x7")]=this.content}}const Sx=["add","maxCommentCharsWhenCollapsed","editorReady","submit","switchToEditMode","visibleView","_model","expand","createCollection","_config","locale","_createCommentInputView","switchToDisplayMode","isCollapsed","createEditor","focus","fire","bind","destroy","isEditMode","content","updateComment","collapse","editorConfig","remove","disabledSubmit"];var Ix,Bx;Ix=Sx,Bx=123,function(t){for(;--t;)Ix.push(Ix.shift())}(++Bx);const Mx=function(t,e){return Sx[t-=0]};class Nx extends d{constructor(t,e,n){super(t),this[Mx("0xd")]=e,this[Mx("0x10")]=n,this.set(Mx("0x0"),!1),this.set(Mx("0x14"),!0),this[Mx("0xc")]=this[Mx("0xf")](),this[Mx("0xc")][Mx("0x7")](this._createCommentContentView())}[Mx("0xe")](){this[Mx("0x14")]=!1}[Mx("0x3")](){this.isEditMode||(this[Mx("0x14")]=!0)}[Mx("0x16")](){this.element[Mx("0x16")]()}async[Mx("0x19")](){await this[Mx("0xc")].get(0).destroy(),super[Mx("0x19")]()}[Mx("0xb")](){this[Mx("0x0")]||(this.isEditMode=!0,this[Mx("0xc")][Mx("0x5")](0)[Mx("0x19")](),this.visibleView[Mx("0x7")](this._createCommentInputView()))}[Mx("0x13")](){this.isEditMode&&(this.isEditMode=!1,this[Mx("0xc")][Mx("0x5")](0)[Mx("0x19")](),this[Mx("0xc")][Mx("0x7")](this._createCommentContentView()))}_createCommentContentView(){const t=new Dx(this[Mx("0x11")]);return t[Mx("0x18")](Mx("0x1")).to(this[Mx("0xd")],"content",this,Mx("0x14"),((t,e)=>e?Ap(t,{limit:this._config[Mx("0x8")]}):t)),t}[Mx("0x12")](){this._config.editorConfig||(this[Mx("0x10")].editorConfig={}),this._config[Mx("0x4")].initialData=this[Mx("0xd")][Mx("0x1")];const t=new Qb(this[Mx("0x11")],this[Mx("0x10")][Mx("0x4")]);return t.value=this[Mx("0xd")][Mx("0x1")],t[Mx("0x18")](Mx("0x6")).to(this[Mx("0xd")],"isReadOnly"),t.on(Mx("0xa"),((t,e)=>{this[Mx("0x17")](Mx("0x2"),this._model.id,e),this[Mx("0x13")](),this[Mx("0x16")]()})),t.on("cancel",(()=>{this[Mx("0x13")](),this.focus()})),t.once(Mx("0x9"),(()=>{t[Mx("0x16")]()})),t[Mx("0x15")](),t}}const Ox=["ck-comment__info-time","isEditMode","editButton","ck-comment__actions--hidden","ck-annotation__content-wrapper","ck-annotation","ck-annotation__info","push","source","time","extendTemplate","isVisible","@external","_model","ck-comment--edit","locale","div","ck-comment--","EXTERNAL_IMPORT_WORD_AVATAR","removeButton","Reply...","_config","ck-annotation__main","Edit","listenTo","placeholder","bindTemplate","isRemovable","ck-annotation__actions--hidden","ck-comment__info","author","isExternal","pencil","_createCommentInputView","isEnabled","ck-comment--remove","focus","userView","element","Delete comment?","getTemplate","_createEditButton","formatDateTime","isReadOnly","creator","set","showConfirm","change:isRemovable","isEditable","getExternalCommentNote","_attachActions","actionIndicator","then","Remove","cancelConfirm","visibleView","remove","span","ck-comment__user","ck-comment--remove-confirmation","_createRemoveButton","execute","name","importWord","icon","isConfirm","ck-comment__external","ck-comment__wrapper","authoredAt","bind","label","attributes","fire"];var Rx,Px;Rx=Ox,Px=117,function(t){for(;--t;)Rx.push(Rx.shift())}(++Px);const Lx=function(t,e){return Ox[t-=0]};class zx extends Nx{constructor(t,e,n){super(t,e,n),this.set(Lx("0x7"),null),this[Lx("0x1")](Lx("0x36"),hf(t,Lx("0x31"))),this.set(Lx("0x18"),null),this[Lx("0x19")](Lx("0x18")).to(e),this[Lx("0x1f")]=this[Lx("0x46")](),this[Lx("0x30")]=this[Lx("0x10")](),this.userView=new Rm(t,e[Lx("0x3b")],this.getUserViewNotificationText()),this[Lx("0x42")][Lx("0x27")]({attributes:{class:[Lx("0xe"),"ck-annotation__user"]}}),this[Lx("0x35")](e,Lx("0x3"),(()=>this[Lx("0xa")]())),this.setTemplate(this[Lx("0x45")]())}getTemplate(){const t=this[Lx("0x37")],e=[{tag:Lx("0x2d"),attributes:{class:[Lx("0x3a"),Lx("0x23")]},children:[{tag:Lx("0xd"),children:[{text:this.userView[Lx("0x12")]}],attributes:{class:["ck-comment__info-name","ck-annotation__info-name"]}},{tag:Lx("0x26"),attributes:{datetime:t.to(Lx("0x18")),class:[Lx("0x1d"),"ck-annotation__info-time"]},children:[{text:t.to(Lx("0x18"),(t=>this[Lx("0x32")][Lx("0x47")](t)))}]}]},{tag:Lx("0x2d"),attributes:{class:["ck-comment__actions","ck-annotation__actions",t.if(Lx("0x1e"),Lx("0x20")),t.if(Lx("0x1e"),Lx("0x39"))]},children:[this[Lx("0x1f")],this[Lx("0x30")]]},{tag:Lx("0x2d"),attributes:{class:[Lx("0x21")]},children:this[Lx("0xb")]}];return this[Lx("0x2a")].isExternal&&e[Lx("0x24")]({tag:"div",attributes:{class:[Lx("0x16")]},children:[{text:this[Lx("0x5")]()}]}),{tag:"li",attributes:{class:[Lx("0x17"),t.if(Lx("0x15"),Lx("0xf"))],tabindex:-1},children:[{tag:Lx("0x2d"),attributes:{class:["ck-comment",Lx("0x22"),t.if("isEditMode",Lx("0x2b")),t.to(Lx("0x7"),(t=>t?Lx("0x2e")+t:""))],"data-author-id":this[Lx("0x2a")][Lx("0x3b")].id,"data-comment-id":this[Lx("0x2a")].id},children:[this[Lx("0x42")],{tag:Lx("0x2d"),attributes:{class:["ck-comment__main",Lx("0x33")]},children:e}]}]}}[Lx("0x46")](){const t=new j(this[Lx("0x2c")]);return t[Lx("0x1a")]=hf(this[Lx("0x2c")],Lx("0x34")),t[Lx("0x14")]=mc[Lx("0x3d")],t[Lx("0x27")]({attributes:{class:"ck-comment--edit"}}),t[Lx("0x19")](Lx("0x3f")).to(this[Lx("0x2a")],"isReadOnly",(t=>!t)),t.bind(Lx("0x28")).to(this[Lx("0x2a")],Lx("0x4")),t.on(Lx("0x11"),(()=>this.switchToEditMode())),t}[Lx("0x10")](){const t=new j(this[Lx("0x2c")]);return t[Lx("0x1a")]=hf(this[Lx("0x2c")],Lx("0x9")),t[Lx("0x14")]='\x3c!--\n\n What you\'re currently looking at is the source code of a legally protected, proprietary software.\n CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,\n all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.\n\n Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n\n!--\x3e\n\n\n',t[Lx("0x27")]({attributes:{class:Lx("0x40")}}),t[Lx("0x19")](Lx("0x3f")).to(this[Lx("0x2a")],Lx("0x48"),(t=>!t)),t.bind(Lx("0x28")).to(this._model,Lx("0x38")),t.on(Lx("0x11"),(()=>{this[Lx("0x2")](hf(this[Lx("0x2c")],Lx("0x44")),this.element)[Lx("0x8")]((()=>{this[Lx("0x1c")]("removeComment",this[Lx("0x2a")].id)}))})),t}[Lx("0x6")](t,e){this[Lx("0x35")](t,"mouseenter",(()=>this.actionIndicator=e)),this[Lx("0x35")](t,Lx("0x41"),(()=>this[Lx("0x7")]=e)),this[Lx("0x35")](t,"mouseleave",(()=>this[Lx("0x7")]=null)),this[Lx("0x35")](t,"blur",(()=>this.actionIndicator=null))}[Lx("0x3e")](){const t=super._createCommentInputView();return t[Lx("0x19")]("placeholder").to(this),t}[Lx("0x5")](){return Lx("0x13")===this[Lx("0x2a")][Lx("0x1b")]["@external"][Lx("0x25")]?hf(this[Lx("0x2c")],"EXTERNAL_IMPORT_WORD_COMMENT"):hf(this[Lx("0x2c")],"EXTERNAL_COMMENT")}getUserViewNotificationText(){return this[Lx("0x2a")][Lx("0x3c")]?Lx("0x13")===this[Lx("0x2a")][Lx("0x1b")][Lx("0x29")].source?hf(this[Lx("0x2c")],Lx("0x2f"),this[Lx("0x2a")].creator.name):hf(this[Lx("0x2c")],"EXTERNAL_AVATAR",this[Lx("0x2a")][Lx("0x0")][Lx("0x12")]):null}render(){super.render(),this[Lx("0x6")](this[Lx("0x1f")][Lx("0x43")],"edit"),this[Lx("0x6")](this[Lx("0x30")][Lx("0x43")],Lx("0xc"))}}(0,Vl.mix)(zx,Np);var Fx=__webpack_require__(1556),jx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Fx.Z,jx);Fx.Z.locals;var Vx=__webpack_require__(4342),Ux={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Vx.Z,Ux);Vx.Z.locals;var Hx=__webpack_require__(4964),qx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Hx.Z,qx);Hx.Z.locals;const Wx=["observe","childList","cancel","attributeName"];var Gx,Zx;Gx=Wx,Zx=231,function(t){for(;--t;)Gx.push(Gx.shift())}(++Zx);const Kx=function(t,e){return Wx[t-=0]};function $x(t){const e=db(t,30),n=new MutationObserver((t=>{for(const n of t)("attributes"==n.type&&"class"==n[Kx("0x0")]||Kx("0x2")==n.type)&&e()}));return{attach(t){n[Kx("0x1")](t,{attributes:!0,childList:!0,subtree:!0})},detach(){n.disconnect(),e[Kx("0x3")]()}}}var Yx=__webpack_require__(5899),Jx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Yx.Z,Jx);Yx.Z.locals;const Qx=["ck-annotation-wrapper","focusTracker","type","mainView","render","setTemplate","Esc","bindTemplate","keystrokes","div","_mutationObserver","isActive","detach","height","element","set","attach","content","length","add","focus","ck-rounded-corners","targetRect","ck-annotation-wrapper--active","destroy","_updateHeight","clientHeight","listenTo"];var Xx,tk;Xx=Qx,tk=250,function(t){for(;--t;)Xx.push(Xx.shift())}(++tk);const ek=function(t,e){return Qx[t-=0]};class nk extends d{constructor(t,e){super(t),this.id=(0,Vl.uid)(),this[ek("0x3")]=new Vl.FocusTracker,this[ek("0xa")]=new Vl.KeystrokeHandler,this[ek("0xa")][ek("0x11")](ek("0x8"),((t,e)=>this.fire("Esc",e))),this[ek("0x11")](ek("0x18"),{top:0,right:0,bottom:0,left:0}),this[ek("0x11")](ek("0xf"),0),this[ek("0x11")]("isActive",!1),this[ek("0x11")]("isDirty",!1),this.set(ek("0x14"),0),this[ek("0x11")](ek("0x4"),""),this[ek("0xc")]=$x((()=>this[ek("0x1b")]())),this[ek("0x13")]=this.createCollection(),this[ek("0x13")][ek("0x15")](e),this[ek("0x5")]=e;const n=this[ek("0x9")];this[ek("0x7")]({tag:ek("0xb"),attributes:{class:["ck",ek("0x2"),ek("0x17"),n.if(ek("0xd"),ek("0x19"))],tabindex:-1},children:this[ek("0x13")]})}render(){super[ek("0x6")](),this.focusTracker[ek("0x15")](this.element),this[ek("0xa")][ek("0x1")](this.element),this[ek("0xc")][ek("0x12")](this[ek("0x10")])}destroy(){this[ek("0x13")].clear(),this.keystrokes.destroy(),this[ek("0x3")][ek("0x1a")](),this._mutationObserver[ek("0xe")](),super[ek("0x1a")]()}focus(){this[ek("0x10")][ek("0x16")]()}[ek("0x1b")](){const t=this[ek("0x10")][ek("0x0")];t&&(this[ek("0xf")]=t)}}const ik=["render","focusTracker","_target","getClientRects","targetRect","isVisible","focusableElements","refreshVisibility","type","annotation-invalid-target","nodeType","isActive","remove","offsetParent","add","object","length","_assertCorrectTarget","view","destroy","target","stopListening","set","_getNormalizedTarget","innerView","item","filter","_type","function"];var ok,rk;ok=ik,rk=202,function(t){for(;--t;)ok.push(ok.shift())}(++rk);const sk=function(t,e){return ik[t-=0]};class ak{constructor({view:t,target:e,type:n,isVisible:i=!0}){this.view=t,this[sk("0x13")].element||this[sk("0x13")][sk("0x1")](),this._type=n,this[sk("0x3")]=e,ak._assertCorrectTarget(this[sk("0x18")]()),this.focusableElements=new Vl.Collection([this[sk("0x13")].element],{idProperty:"_id"}),this.focusableElements.on(sk("0xf"),((t,e)=>{this[sk("0x13")][sk("0x2")][sk("0xf")](e)})),this[sk("0x7")].on(sk("0xd"),((t,e)=>{this.view[sk("0x2")].remove(e)})),this[sk("0x17")]("isVisible",i)}get[sk("0x9")](){return sk("0x0")==typeof this[sk("0x1c")]?this[sk("0x1c")]():this[sk("0x1c")]}get[sk("0x19")](){return this[sk("0x13")].mainView}get[sk("0x15")](){const t=this[sk("0x18")]();return ak[sk("0x12")](t),t}get[sk("0x5")](){const t=this.target;if(null===t)return null;if(t instanceof Vl.Rect)return t;const e=t[sk("0x1b")]((t=>function(t){if(t[sk("0xe")])return!0;return!!t[sk("0x4")]()[sk("0x1a")](0)}(t)));return 0===e[sk("0x11")]?null:new Vl.Rect(e[0][sk("0x4")]()[sk("0x1a")](0))}get[sk("0xc")](){return this[sk("0x13")][sk("0xc")]}set[sk("0xc")](t){this[sk("0x13")][sk("0xc")]=t,this[sk("0x13")].mainView[sk("0xc")]=t}updateTargetRect(){this[sk("0x13")][sk("0x5")]=this[sk("0x5")]}[sk("0x14")](){this[sk("0x7")].stopListening(),this[sk("0x7")].clear(),this[sk("0x16")]()}[sk("0x8")](){this[sk("0x6")]=!!this.targetRect}static[sk("0x12")](t){if(!(null===t||t instanceof Vl.Rect||Array.isArray(t)&&t.every((t=>ck(t)))))throw new Vl.CKEditorError(sk("0xa"),null,{target:t})}[sk("0x18")](){let t=sk("0x0")==typeof this[sk("0x3")]?this._target():this[sk("0x3")];return t=ck(t)?[t]:t,t}}function ck(t){return null!==t&&sk("0x10")==typeof t&&1===t[sk("0xb")]}(0,Vl.mix)(ak,Vl.ObservableMixin);const lk=["focusTracker","getByView","from","change:isFocused","updateTargetRect","focus","_viewToAnnotation","getIndex","annotationcollection-not-existing-item","view","destroy","_innerViewToAnnotation","getByInnerView","targetRect","get","add","_focusTracker","_getOrderInContent","fire","top","length","sort","refreshPositioning","delete","focusableElements","stopListening","set","left","isFocused","clear","has","innerView","listenTo","remove"];var dk,uk;dk=lk,uk=493,function(t){for(;--t;)dk.push(dk.shift())}(++uk);const hk=function(t,e){return lk[t-=0]};class mk extends Vl.Collection{constructor(t=[]){super(),this[hk("0x1c")]=new Map,this[hk("0x17")]=new Map,this[hk("0x21")]=new Vl.FocusTracker,this._focusTracker.on(hk("0x14"),((t,e,n)=>{n||this[hk("0x1")]("blur")}));for(const e of t)this[hk("0x20")](e)}get[hk("0xb")](){return this[hk("0x21")].isFocused}[hk("0x20")](t){if(this[hk("0xd")](t))throw new Vl.CKEditorError("annotationcollection-duplicated-item",null);this[hk("0x1c")][hk("0x9")](t[hk("0xe")],t),this[hk("0x17")][hk("0x9")](t.view,t);for(const e of t[hk("0x7")])this[hk("0x21")][hk("0x20")](e);this[hk("0xf")](t[hk("0x7")],"add",((t,e)=>{this[hk("0x21")][hk("0x20")](e)})),this.listenTo(t.focusableElements,hk("0x10"),((t,e)=>{this[hk("0x21")][hk("0x10")](e)})),this[hk("0xf")](t[hk("0x1a")].focusTracker,hk("0x14"),((e,n,i)=>{i&&this[hk("0x1")](hk("0x16"),t)})),t[hk("0x15")]();const e=this[hk("0x0")](t[hk("0x1a")][hk("0x1e")]);super[hk("0x20")](t,e)}[hk("0x10")](t){if(!this[hk("0xd")](t))throw new Vl.CKEditorError(hk("0x19"),null);this[hk("0x8")](t[hk("0x1a")][hk("0x11")]),this[hk("0x8")](t.focusableElements);for(const e of t[hk("0x7")])this[hk("0x21")][hk("0x10")](e);this[hk("0x17")].delete(t.view),this[hk("0x1c")][hk("0x6")](t[hk("0xe")]),super[hk("0x10")](t)}[hk("0x1d")](t){return this[hk("0x1c")][hk("0x1f")](t)}[hk("0x12")](t){return this[hk("0x17")][hk("0x1f")](t)}[hk("0x1b")](){super[hk("0xc")](),this.stopListening(),this[hk("0x1c")][hk("0xc")](),this[hk("0x17")][hk("0xc")](),this[hk("0x21")][hk("0x1b")]()}[hk("0x5")](){for(const t of this)t.updateTargetRect();this._sort()}_sort(){const t=Array[hk("0x13")](this)[hk("0x4")](((t,e)=>gk(t[hk("0x1a")][hk("0x1e")],e[hk("0x1a")][hk("0x1e")])));for(let e=t[hk("0x3")]-1;e>0;e--){const n=t[e];e!==this[hk("0x18")](n)&&(this[hk("0x10")](n),this[hk("0x20")](n,e))}}[hk("0x0")](t){let e=0;if(!t)return this._items[hk("0x3")];for(const n of this){const i=n[hk("0x1a")][hk("0x1e")];if(i){if(gk(t,i)<0)return e;e++}}return e}}function gk(t,e){if(null===t&&null===e)return 0;if(null===t)return-1;if(null===e)return 1;const n=t[hk("0x2")]-e[hk("0x2")];return 0==n?t[hk("0xa")]-e[hk("0xa")]:n}const pk=["remove","deactivateAll","has","_visibleAnnotations","refreshVisibility","collection","destroy","pluginName","source","getByInnerView","_bindAnnotationsToVisibleAnnotations","delete","stopListening","set","fire","_addActiveAnnotation","activeAnnotations","refreshPositioning","change:isVisible","isVisible","createAnnotationView","_deactivateAllAnnotations","listenTo","add"];var fk,bk;fk=pk,bk=482,function(t){for(;--t;)fk.push(fk.shift())}(++bk);const xk=function(t,e){return pk[t-=0]};class kk extends _t{static get[xk("0x5")](){return"Annotations"}constructor(t){super(t),this[xk("0x3")]=new mk,this[xk("0x1")]=new mk,this[xk("0xb")](xk("0xe"),new Set),this[xk("0x8")]()}add(t){this[xk("0x3")][xk("0x15")](t)}remove(t){this.collection[xk("0x16")](t),t[xk("0x4")]()}[xk("0x2")](){for(const t of this[xk("0x3")])t.refreshVisibility()}refreshPositioning(){this[xk("0x1")][xk("0xf")]()}[xk("0x7")](t){return this[xk("0x3")].getByInnerView(t)}[xk("0x17")](){this[xk("0xc")](xk("0x13"))}destroy(){for(const t of this[xk("0x3")])t[xk("0x4")]();this._visibleAnnotations.destroy(),this[xk("0x3")][xk("0x4")](),super[xk("0x4")]()}activate(t){this[xk("0xc")]("_activateAnnotation",t)}createAnnotation(t){return new ak(t)}[xk("0x12")](t,e){return new nk(t,e)}[xk("0xd")](t){const e=new Set(this[xk("0xe")]);e[xk("0x15")](t),this.activeAnnotations=e}_removeActiveAnnotation(t){const e=new Set(this.activeAnnotations);e[xk("0x9")](t),this[xk("0xe")]=e}[xk("0x8")](){const t=this[xk("0x3")],e=this[xk("0x1")];function n(t){const n=t[xk("0x6")];n[xk("0x11")]&&!e[xk("0x0")](n)?e.add(n):!n.isVisible&&e[xk("0x0")](n)&&e.remove(n)}this.listenTo(t,xk("0x15"),((t,i)=>{i.isVisible&&e[xk("0x15")](i),this[xk("0x14")](i,xk("0x10"),n)})),this[xk("0x14")](t,xk("0x16"),((t,i)=>{e[xk("0x0")](i)&&e[xk("0x16")](i),this[xk("0xa")](i,xk("0x10"),n)}))}}const wk=["commentsrepository-missing-target","has","once","max","commentsrepository-update-missing-comment","type","set","Users","_createCommentThreadView","createdAt","delete","map","isAttached","commentsrepository-invalid-comment-thread-id","change:activeAnnotations","_attachCommentThread","view","openNewCommentThread","fire","destroy","getCommentThread","@external","removeCommentThread","addCommentThread","Missing comments editor configuration (`comments.editorConfig`). Default configuration will be used instead.","innerView","hasCommentThread","commentsrepository-invalid-comment-authorid","_add","commentsrepository-remove-comment-internal-error","substring","locale","_nonAdminChannels","config","_updateComment","creator","resolve","length","updateComment","warn","filter","requires","threadId","removeComment","switchReadOnly","isActive","attachTo","trim","model","getTime","fetchCommentThread","join","content","_viewToController","isDirty","textContent","commentInputView","noChannel","commentsrepository-fetch-comment-thread","getUser","afterInit","activeCommentThread","addComment","bind","_getExternalAuthor","_findOptimalIndex","authoredAt","_threads","from","change:isDirty","innerHTML","focus","comments.maxCommentCharsWhenCollapsed","_remove","commentsrepository-update-comment-invalid-content","commentsrepository-add-comment-internal-error","pluginName","stopListening","comments.editorConfig","toJSON","commentsrepository-remove-missing-comment-thread","getIndex","error","define","comment","_addComment","push","comments.maxCommentsWhenCollapsed","div","isExternal","commentsrepository-add-comment-user-not-exists","PendingActions","isReadOnly","removeAttribute","charCodeAt","external:","add","pop","channelId","_removeComment","isRemovable","_readOnlyChannels","commentsrepository-missing-thread-and-adapter","getCommentThreads","get","weight","catch","commentsrepository-remove-comment-thread-internal-error","CommentThreadView","comments.CommentView","slice","commentsrepository-add-comment-to-missing-comment-thread","_detachCommentThread","_addCommentThread","_threadToController","adapter","PENDING_ACTION_COMMENT_THREAD","commentsrepository-remove-missing-comment","attributes","author","addUser","comments.maxThreadTotalWeight","getByInnerView","isEditable","commentsrepository-update-comment-missing-comment-thread","deactivateAll","remove","commentsrepository-invalid-commentid","values","createCommentThreadController","_adapter","commentsrepository-update-comment-internal-error","comments","_repository","CommentView","fromCharCode","parse","init","then","update","commentsrepository-duplicated-comment-thread-id","_removeCommentThread","listenTo","string","context","plugins","authorName","licenseKey","function","getComment","commentsrepository-get-comment-invalid-id","assign","_isAttached","commentThreadInputView","reduce"];var _k,Ak;_k=wk,Ak=401,function(t){for(;--t;)_k.push(_k.shift())}(++Ak);const vk=function(t,e){return wk[t-=0]},Ck=Symbol(vk("0x79"));class yk extends _t{static get[vk("0x69")](){return[kk,lc,Em]}static get[vk("0x8c")](){return"CommentsRepository"}constructor(t){super(t),this[vk("0x83")]=new Map,this[vk("0x17")]=new Map,this._viewToController=new Map,this[vk("0xa")]=new Set,this[vk("0x46")](vk("0x60"),new Set),this.licenseKey=this[vk("0x35")].config[vk("0xd")](vk("0x38"));const e=this[vk("0x35")][vk("0x61")];e[vk("0x93")](vk("0x97"),2),e.define(vk("0x1e"),500),e[vk("0x93")]("comments.maxCommentCharsWhenCollapsed",140),e[vk("0x93")]("comments.CommentThreadView",vx),e[vk("0x93")](vk("0x12"),zx),e.get(vk("0x8e"))||console[vk("0x67")](vk("0x58"))}[vk("0x2e")](){const t=this.context[vk("0x36")][vk("0xd")](kk);this[vk("0x46")]("activeCommentThread",null),this.on(vk("0x57"),((t,e)=>this._addCommentThread(e))),this.on("removeCommentThread",((t,e)=>this[vk("0x32")](e))),this.on("addComment",((t,e)=>this[vk("0x95")](e))),this.on("updateComment",((t,e)=>this._updateComment(e))),this.on(vk("0x6b"),((t,e)=>this[vk("0x8")](e))),this.on("addComment",((t,{threadId:e,isFromAdapter:n})=>{if(n)return;const i=this[vk("0x54")](e),o=this._threadToController[vk("0xd")](i);o&&o[vk("0x50")][vk("0x87")]()}),{priority:"lowest"}),this[vk("0x33")](t,vk("0x4e"),((t,e,n)=>{const i=Array[vk("0x84")](n)[vk("0x4b")]((t=>this[vk("0x75")][vk("0xd")](t[vk("0x59")])))[vk("0x68")](Boolean)[0];this.activeCommentThread=i?i[vk("0x70")]:null}))}[vk("0x7c")](){!function(t){const e=t instanceof wt,n=[1,85,78,115,198,255,50,112,83,87,161],i=u([52,48,52,54,48,50,53,48]),o=[127,34,6,211,167,86,146,199,132,160,18],r=u([65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57]),s=function(e){if(t[u([112,108,117,103,105,110,115])][u([104,97,115])](u([87,101,98,83,111,99,107,101,116,71,97,116,101,119,97,121]))&&t[u([112,108,117,103,105,110,115])][u([103,101,116])](u([87,101,98,83,111,99,107,101,116,71,97,116,101,119,97,121]))[u([115,116,97,116,101])]==u([99,111,110,110,101,99,116,101,100]))return a(u([108,105,99,101,110,115,101,75,101,121,86,97,108,105,100]));if(t[u([112,108,117,103,105,110,115])][u([104,97,115])](u([84,114,97,99,107,67,104,97,110,103,101,115,68,97,116,97,71,101,116,116,101,114]))&&t[u([112,108,117,103,105,110,115])][u([103,101,116])](u([84,114,97,99,107,67,104,97,110,103,101,115,68,97,116,97,71,101,116,116,101,114]))[u([114,101,115,117,108,116])]==u([101,110,100]))return a(u([108,105,99,101,110,115,101,75,101,121,86,97,108,105,100]));try{const r=function(t){const e=[29,221,175,90,231,133,239,240,75,180];return function(t,e){const n=atob(t),i=Array[vk("0x84")](function(t){const e=new Uint8Array(t[vk("0x65")]);for(let n=0;n=0;--t)o[t]=n%256,n=parseInt(n/256);let r=null,s=16;const a=new Uint8Array(e),c=[],l=[];g();for(let e=0;e=0;e--){if(255!==t[e]){t[e]++;break}t[e]=0}}function m(t){const e=c[vk("0x65")]-1,n=[0,0,0,0];let o=d(t);for(let t=0;t<4;t++)o[t]^=c[0][t];for(let t=1;t>24&255]^i[u([84,50])][o[(e+1)%4]>>16&255]^i[u([84,51])][o[(e+2)%4]>>8&255]^i[u([84,52])][255&o[(e+3)%4]]^c[t][e];o=n[vk("0x13")]()}const r=new Uint8Array(16);let s;for(let t=0;t<4;t++)s=c[e][t],r[4*t]=255&(i[u([83])][o[t]>>24&255]^s>>24),r[4*t+1]=255&(i[u([83])][o[(t+1)%4]>>16&255]^s>>16),r[4*t+2]=255&(i[u([83])][o[(t+2)%4]>>8&255]^s>>8),r[4*t+3]=255&(i[u([83])][255&o[(t+3)%4]]^s);return r}function g(){const t=i[u([110,117,109,98,101,114,79,102,82,111,117,110,100,115])][a.length];for(let e=0;e<=t;e++)c[vk("0x96")]([0,0,0,0]),l[vk("0x96")]([0,0,0,0]);const e=4*(t+1),n=a.length/4,o=d(a);let r;for(let e=0;e>2,c[r][e%4]=o[e],l[t-r][e%4]=o[e];let s,h=0,m=n;for(;m>16&255]<<24^i[u([83])][s>>8&255]<<16^i[u([83])][255&s]<<8^i[u([83])][s>>24&255]^i[u([114,99,111,110])][h]<<24,h+=1;for(let t=1;t>8&255]<<8^i[u([83])][s>>16&255]<<16^i[u([83])][s>>24&255]<<24;for(let t=n/2+1;t>2,a=m%4,c[r][a]=o[d],l[t-r][a]=o[d++],m++}for(let e=1;e>24&255]^i[u([85,50])][s>>16&255]^i[u([85,51])][s>>8&255]^i[u([85,52])][255&s]}}(i,e,r+256*o))}(t,new(window[u([85,105,110,116,56,65,114,114,97,121])])([...n,...e,...o]))}(e),s=JSON[vk("0x2d")](r),c=parseInt(s[u([49])]),l=parseInt(s[u([51])]),d=parseInt(s[u([52])])||0,h=parseInt(s[u([53])])||0,m=2;if(!(1&d)||t[u([112,108,117,103,105,110,115])][u([104,97,115])](u([84,114,97,99,107,67,104,97,110,103,101,115,69,100,105,116,105,110,103]))&&!(d&m))return a(u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100]));if(h&&!window[u([111,112,101,110])][u([99,108,111,115,101,100])])return a(u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100]));if(parseInt(i)/2>c)return a(u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100]));if(t[u([112,108,117,103,105,110,115])][u([104,97,115])](u([84,114,97,99,107,67,104,97,110,103,101,115,69,100,105,116,105,110,103]))){const e=t[u([112,108,117,103,105,110,115])][u([103,101,116])](u([84,114,97,99,107,67,104,97,110,103,101,115,69,100,105,116,105,110,103]));if(parseInt(e[u([95,101,120,101,99,117,116,101,83,117,103,103,101,115,116,105,111,110])])/2>c)return a(u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100]))}return a(u(l?[108,105,99,101,110,115,101,75,101,121,84,114,105,97,108]:[108,105,99,101,110,115,101,75,101,121,86,97,108,105,100]))}catch(t){return a(u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100]))}}(t[vk("0x61")][vk("0xd")](u([108,105,99,101,110,115,101,75,101,121])));function a(e){const n=function(){const t=String(window[u([112,101,114,102,111,114,109,97,110,99,101])][u([110,111,119])]()).replace(u([46]),"");let e="";for(let n=0;n=r.length&&(i-=r[vk("0x65")]),e+=r[i]}return e}();return t[n]=e,e}function c(t){for(const e of t[u([101,100,105,116,111,114,115])])l(e);t[u([112,108,117,103,105,110,115])][u([103,101,116])](u([67,111,109,109,101,110,116,115,82,101,112,111,115,105,116,111,114,121]))[u([115,119,105,116,99,104,82,101,97,100,79,110,108,121])](!0),t[u([112,108,117,103,105,110,115])][u([103,101,116])](u([67,111,109,109,101,110,116,115,82,101,112,111,115,105,116,111,114,121]))[u([115,119,105,116,99,104,82,101,97,100,79,110,108,121])]=d}function l(t){function e(){t[u([109,111,100,101,108])][u([99,104,97,110,103,101])]=d,t[u([109,111,100,101,108])][u([101,110,113,117,101,117,101,67,104,97,110,103,101])]=d,t[u([101,110,97,98,108,101,82,101,97,100,79,110,108,121,77,111,100,101])](u([109,111,100,101,108]))}t[u([115,116,97,116,101])]==u([114,101,97,100,121])?e():t[u([111,110,99,101])](u([114,101,97,100,121]),(()=>e()))}function d(){return null}function u(t){return t[vk("0x4b")]((t=>String[vk("0x2c")](t)))[vk("0x73")]("")}e?(s==u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100])?c(t):s==u([108,105,99,101,110,115,101,75,101,121,84,114,105,97,108])&&window[u([115,101,116,84,105,109,101,111,117,116])]((()=>{c(t),a(u([108,105,99,101,110,115,101,75,101,121,84,114,105,97,108,76,105,109,105,116,58,116,105,109,101]))}),o[6]*n[8]*n[6]),t[u([101,100,105,116,111,114,115])][u([111,110])](u([97,100,100]),((t,e)=>{s!=u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100])&&s!=u([108,105,99,101,110,115,101,75,101,121,84,114,105,97,108,76,105,109,105,116,58,116,105,109,101])&&s!=u([108,105,99,101,110,115,101,75,101,121,84,114,105,97,108,76,105,109,105,116,58,111,112,101,114,97,116,105,111,110,115])||l(e)}))):s==u([108,105,99,101,110,115,101,75,101,121,73,110,118,97,108,105,100])?l(t):s==u([108,105,99,101,110,115,101,75,101,121,84,114,105,97,108])&&t[u([111,110])](u([114,101,97,100,121]),(()=>{let e=0;t[u([109,111,100,101,108])][u([111,110])](u([97,112,112,108,121,79,112,101,114,97,116,105,111,110]),((n,i)=>{i[0][u([105,115,68,111,99,117,109,101,110,116,79,112,101,114,97,116,105,111,110])]&&e++,504===e&&(l(t),a(u([108,105,99,101,110,115,101,75,101,121,84,114,105,97,108,76,105,109,105,116,58,111,112,101,114,97,116,105,111,110,115])),n[u([111,102,102])]())}),{priority:u([104,105,103,104,101,115,116])})}))}(this[vk("0x35")])}set[vk("0x18")](t){if(this[vk("0x27")])throw new Vl.CKEditorError("commentsrepository-adapter-already-set");this._adapter=t}get[vk("0x18")](){return this._adapter}addCommentThread({channelId:t=Ck,threadId:e=(0,Vl.uid)(),comments:n=[],target:i,isFromAdapter:o}={}){return this[vk("0x52")](Dk(vk("0x57"),t),{channelId:t,threadId:e,comments:n,target:i,isFromAdapter:o}),this[vk("0x54")](e)}[vk("0x51")]({channelId:t=Ck,threadId:e=(0,Vl.uid)(),target:n}){if(this[vk("0xa")][vk("0x41")](t)||this[vk("0xa")][vk("0x41")](void 0))return;if(!n)throw new Vl.CKEditorError(vk("0x40"));const i=this[vk("0x57")]({channelId:t,threadId:e,target:n});if(!i)return null;const o=this[vk("0x17")][vk("0xd")](i),r=o[vk("0x50")][vk("0x3e")][vk("0x78")],s=this[vk("0x35")][vk("0x36")][vk("0xd")](kk),a=s[vk("0x1f")](o.view);return s.activate(a),r[vk("0x42")]("editorReady",(()=>r[vk("0x87")]())),i}[vk("0x5a")](t){if(vk("0x34")!=typeof t)throw new Vl.CKEditorError(vk("0x4d"));return this._threads.has(t)}[vk("0x54")](t){if(vk("0x34")!=typeof t)throw new Vl.CKEditorError("commentsrepository-invalid-comment-thread-id");return this[vk("0x83")][vk("0xd")](t)}[vk("0x72")]({channelId:t,threadId:e}={}){const n=this.getCommentThread(e);if(n)return Promise[vk("0x64")](n);if(!this.adapter)throw new Vl.CKEditorError(vk("0xb"),this[vk("0x35")]);if(vk("0x39")!=typeof this[vk("0x18")][vk("0x54")])throw new Vl.CKEditorError("commentsrepository-missing-thread-and-adapter-method",this[vk("0x35")]);return this.adapter[vk("0x54")]({channelId:t,threadId:e})[vk("0x2f")]((n=>this[vk("0x5a")](e)?this.getCommentThread(e):n?this[vk("0x57")](Object[vk("0x3c")]({isFromAdapter:!0,channelId:t},n)):void 0))[vk("0xf")]((t=>{throw console[vk("0x92")](t),new Vl.CKEditorError(vk("0x7a"),this[vk("0x35")])}))}getCommentThreads({channelId:t,skipNotAttached:e=!1,skipEmpty:n=!1,toJSON:i=!1}={}){const o=[];for(const i of this[vk("0x83")][vk("0x25")]())t&&i[vk("0x7")]!==t||e&&!i[vk("0x4c")]||n&&0===i.length||o[vk("0x96")](i);return i?o[vk("0x4b")]((t=>t.toJSON())):o}setActiveCommentThread(t){const e=this[vk("0x35")][vk("0x36")][vk("0xd")](kk);if(!t)return void(this[vk("0x7d")]&&e[vk("0x22")]());const n=this[vk("0x54")](t);if(!n)throw new Vl.CKEditorError("commentsrepository-active-missing-comment-thread",null,{threadId:t});if(!this[vk("0x17")].has(n))throw new Vl.CKEditorError("commentsrepository-active-not-attached",null,{threadId:t});const i=e[vk("0x1f")](this[vk("0x17")].get(n)[vk("0x50")]);e.activate(i)}[vk("0x6c")](t,e){t?this[vk("0xa")][vk("0x5")](e):this[vk("0xa")][vk("0x4a")](e);for(const n of this[vk("0xc")]({channelId:e}))n[vk("0x1")]=!!t}isReadOnly(t){return this[vk("0xa")][vk("0x41")](t)||this[vk("0xa")][vk("0x41")](void 0)}[vk("0x26")](t,e){return new uf(t,e)}setAdminPermissions(t,e=Ck){const n=!this[vk("0x60")][vk("0x41")](e),i=new Set(this[vk("0x60")]);n&&!t&&(i[vk("0x5")](e),this[vk("0x60")]=i),!n&&t&&(i.delete(e),this._nonAdminChannels=i)}[vk("0x16")]({channelId:t,threadId:e,comments:n,target:i,isFromAdapter:o}){if(vk("0x34")!=typeof e)throw new Vl.CKEditorError(vk("0x4d"),null,{threadId:e});if(this[vk("0x5a")](e))throw new Vl.CKEditorError(vk("0x31"),null,{threadId:e});const r=new Ek(this,{channelId:t,id:e});(this._readOnlyChannels[vk("0x41")](t)||this[vk("0xa")].has(void 0))&&(r[vk("0x1")]=!0),this[vk("0x83")][vk("0x46")](e,r);for(const t of n)r[vk("0x7e")](Object[vk("0x3c")]({isFromAdapter:o},t));i&&r[vk("0x6e")](i)}[vk("0x4f")]({threadId:t,target:e}){const n=this[vk("0x54")](t);if(!n)throw new Vl.CKEditorError("commentsrepository-attach-missing-comment-thread",this);const i=this[vk("0x35")].plugins.get("PendingActions"),o=this[vk("0x35")].plugins[vk("0xd")](kk),r=this._createCommentThreadView(n),s=new uf(n,r);let a=null;r.on(vk("0x85"),((t,e,n)=>{n?a=i.add(hf(this[vk("0x35")].locale,vk("0x19"))):(i.remove(a),a=null)})),this[vk("0x17")][vk("0x46")](n,s),this._viewToController[vk("0x46")](r,s);const c=new nk(this.context[vk("0x5f")],r);c[vk("0x7f")](vk("0x65")).to(r),c[vk("0x7f")]("isDirty").to(r,vk("0x76"),r,vk("0x65"),((t,e)=>t||!e)),c.bind(vk("0x6d")).to(r),c[vk("0x45")]=vk("0x94");const l=new ak({view:c,target:e,type:"comment"});return o[vk("0x5")](l),l}[vk("0x48")](t){const e=this[vk("0x35")].plugins[vk("0xd")](vk("0x47")),{config:n,locale:i}=this.context,o=hp(n[vk("0xd")](vk("0x5f")));return new(0,n[vk("0xd")](vk("0x29"))[vk("0x11")])(i,t,e.me,{editorConfig:n[vk("0xd")]("comments.editorConfig"),maxCommentsWhenCollapsed:n[vk("0xd")]("comments.maxCommentsWhenCollapsed"),maxThreadTotalWeight:n[vk("0xd")](vk("0x1e")),maxCommentCharsWhenCollapsed:n[vk("0xd")](vk("0x88")),formatDateTime:o,CommentView:n.get(vk("0x29"))[vk("0x2b")]})}[vk("0x32")]({threadId:t,isFromAdapter:e}){const n=this[vk("0x54")](t);if(!n)throw new Vl.CKEditorError(vk("0x90"),this);if(this[vk("0x15")](t),this[vk("0x83")].delete(t),!n[vk("0x65")]||e||!this[vk("0x18")]||vk("0x39")!=typeof this.adapter[vk("0x56")])return Promise[vk("0x64")]();const i=this[vk("0x35")][vk("0x36")].get(vk("0x0")),{channelId:o}=n,r=i.add(hf(this.context.locale,vk("0x19")));return this[vk("0x18")][vk("0x56")]({channelId:o,threadId:t})[vk("0x2f")]((()=>i[vk("0x23")](r)))[vk("0xf")]((t=>{throw console[vk("0x92")](t),new Vl.CKEditorError(vk("0x10"),this)}))}[vk("0x15")](t){const e=this[vk("0x35")].plugins[vk("0xd")](kk),n=this.getCommentThread(t);if(this[vk("0x17")].has(n)){const t=this[vk("0x17")][vk("0xd")](n),i=t.view,o=e[vk("0x1f")](i);this[vk("0x17")][vk("0x4a")](n),this[vk("0x75")][vk("0x4a")](i),o&&e[vk("0x23")](o),t.destroy(),i.destroy()}}[vk("0x80")](t){const e=this[vk("0x35")][vk("0x36")][vk("0xd")](Em),n=zp(vk("0x4")+t);return e[vk("0x7b")](n)||e[vk("0x1d")]({id:n,name:t})}[vk("0x95")]({threadId:t,commentId:e=(0,Vl.uid)(),content:n,authorId:i,createdAt:o,attributes:r,isFromAdapter:s}){if("string"!=typeof e)throw new Vl.CKEditorError(vk("0x24"));if(vk("0x34")!=typeof i)throw new Vl.CKEditorError(vk("0x5b"));if("string"!=typeof n||!n[vk("0x6f")]())throw new Vl.CKEditorError("commentsrepository-invalid-comment-content");const a=this[vk("0x54")](t);if(!a)throw new Vl.CKEditorError(vk("0x14"),this);const c=this[vk("0x35")][vk("0x36")][vk("0xd")](Em).getUser(i);if(!c)throw new Vl.CKEditorError(vk("0x9a"),null,{authorId:i});let l=null,d=o;r&&r[vk("0x55")]&&(l=this._getExternalAuthor(r[vk("0x55")][vk("0x37")]),d=r[vk("0x55")][vk("0x49")]);const u=new Tk(this,{threadId:t,id:e,author:l||c,creator:c,content:n,createdAt:o,authoredAt:d,attributes:r});if(a._add(u),s||!this[vk("0x18")]||vk("0x39")!=typeof this.adapter[vk("0x7e")])return Promise.resolve();const h=this[vk("0x35")][vk("0x36")].get(vk("0x0")),{channelId:m}=a,g=h[vk("0x5")](hf(this[vk("0x35")].locale,vk("0x19")));return r||(r={}),this.adapter[vk("0x7e")]({channelId:m,threadId:t,commentId:e,content:n,attributes:r})[vk("0x2f")]((i=>{if(h[vk("0x23")](g),this[vk("0x5a")](t))i&&i.createdAt&&this[vk("0x62")]({threadId:t,commentId:e,createdAt:i.createdAt,isFromAdapter:!0});else{const s={threadId:t,commentId:e,content:n,attributes:r,createdAt:i&&i[vk("0x49")]?i.createdAt:o,authorId:c.id};this[vk("0x57")]({channelId:m,threadId:t,comments:[s],isFromAdapter:!0})}}))[vk("0xf")]((t=>{throw console[vk("0x92")](t),new Vl.CKEditorError(vk("0x8b"),this)}))}[vk("0x62")]({threadId:t,commentId:e,content:n,createdAt:i,attributes:o,isFromAdapter:r}){if(void 0!==n&&(vk("0x34")!=typeof n||!n[vk("0x6f")]().length))throw new Vl.CKEditorError(vk("0x8a"));const s=this.getCommentThread(t),a=s[vk("0x3a")](e);if(!a)throw new Vl.CKEditorError(vk("0x44"),this);let c=!1;if(n&&n!==a[vk("0x74")]&&(a[vk("0x20")]||r)&&(a[vk("0x74")]=n,c=!0),i&&i!==a[vk("0x49")]&&(a.createdAt=i,a[vk("0x1b")]&&a.attributes[vk("0x55")]||(a[vk("0x82")]=i),c=!0),o&&!ss(o,a[vk("0x1b")])&&(a[vk("0x1b")]=o,c=!0),!c)return Promise[vk("0x64")]();if(s.fire("commentUpdated"),r||!this[vk("0x18")]||vk("0x39")!=typeof this[vk("0x18")][vk("0x66")])return Promise.resolve();const l=this[vk("0x35")][vk("0x36")].get(vk("0x0")),{channelId:d}=this[vk("0x54")](a[vk("0x6a")]),u=l[vk("0x5")](hf(this.context[vk("0x5f")],vk("0x19")));return this.adapter[vk("0x66")]({channelId:d,threadId:t,commentId:e,content:n,attributes:o})[vk("0x2f")]((()=>l[vk("0x23")](u))).catch((t=>{throw console[vk("0x92")](t),new Vl.CKEditorError(vk("0x28"),this)}))}[vk("0x8")]({threadId:t,commentId:e,isFromAdapter:n}){const i=this[vk("0x54")](t),o=i[vk("0x3a")](e);if(!o)throw new Vl.CKEditorError(vk("0x1a"),this);if(i[vk("0x89")](o),n||!this[vk("0x18")]||vk("0x39")!=typeof this[vk("0x18")].removeComment)return Promise[vk("0x64")]();const r=this[vk("0x35")][vk("0x36")][vk("0xd")](vk("0x0")),{channelId:s}=i,a=r.add(hf(this[vk("0x35")].locale,vk("0x19")));return this[vk("0x18")].removeComment({channelId:s,threadId:t,commentId:e})[vk("0x2f")]((()=>r[vk("0x23")](a)))[vk("0xf")]((t=>{throw console.error(t),new Vl.CKEditorError(vk("0x5d"),this)}))}}class Ek{constructor(t,e){this[vk("0x7")]=e[vk("0x7")],this.id=e.id,this[vk("0x46")](vk("0x1"),!1),this.bind(vk("0x9")).to(t,vk("0x60"),(t=>!t.has(this[vk("0x7")]))),this[vk("0x29")]=new Vl.Collection,this[vk("0x2a")]=t,this[vk("0x3d")]=!1}get[vk("0xe")](){return Array[vk("0x84")](this[vk("0x29")])[vk("0x3f")](((t,e)=>t+e[vk("0xe")]),0)}get length(){return this[vk("0x29")][vk("0x65")]}get[vk("0x4c")](){return this[vk("0x3d")]}[vk("0x23")]({isFromAdapter:t=!1}={}){const{channelId:e,id:n}=this;this._repository.fire(Dk(vk("0x56"),e),{channelId:e,threadId:n,isFromAdapter:t})}[vk("0x6e")](t){return this[vk("0x2a")][vk("0x4f")]({threadId:this.id,target:t})}[vk("0x7e")](t){const{channelId:e,id:n}=this;this[vk("0x2a")].fire(Dk(vk("0x7e"),e,n),Object[vk("0x3c")]({channelId:e,threadId:n},t))}[vk("0x3a")](t){if(vk("0x34")!=typeof t)throw new Vl.CKEditorError(vk("0x3b"),null,{commentId:t});return this[vk("0x29")][vk("0xd")](t)}toJSON(){return{threadId:this.id,comments:this[vk("0x29")][vk("0x4b")]((t=>t[vk("0x8f")]()))}}[vk("0x5c")](t){return this[vk("0x33")](t,"change:authoredAt",(()=>{const e=this[vk("0x81")](t),n=this[vk("0x29")];e-1!=n[vk("0x91")](t)&&e+1!=n[vk("0x91")](t)&&(this._remove(t),this._add(t))})),t[vk("0x49")]?this.comments[vk("0x5")](t,this[vk("0x81")](t)):this[vk("0x29")][vk("0x5")](t)}[vk("0x89")](t){return this[vk("0x8d")](t),t[vk("0x53")](),this.comments[vk("0x23")](t)}[vk("0x81")](t){const e=this[vk("0x29")].find((e=>new Date(e[vk("0x82")])[vk("0x71")]()>new Date(t[vk("0x82")])[vk("0x71")]()));return e?this[vk("0x29")][vk("0x91")](e):this[vk("0x65")]}}(0,Vl.mix)(Ek,Vl.ObservableMixin);class Tk{constructor(t,e){const n=t.context[vk("0x36")].get(vk("0x47")).me,i=t.getCommentThread(e.threadId),o=0===i[vk("0x29")][vk("0x65")],r=n===e[vk("0x1c")];this.id=e.id,this[vk("0x6a")]=e.threadId,this[vk("0x1c")]=e[vk("0x1c")],this.creator=e[vk("0x63")],this[vk("0x99")]=Boolean(e[vk("0x1b")]&&e.attributes[vk("0x55")]),this[vk("0x46")](vk("0x74"),e[vk("0x74")]),this.createdAt=e[vk("0x49")]||new Date,this.set(vk("0x82"),e[vk("0x82")]||new Date),this[vk("0x46")](vk("0x1b"),e[vk("0x1b")]||{}),this[vk("0x46")]("isEditable",r),this[vk("0x7f")](vk("0x9")).to(i,vk("0x9"),(t=>t&&o||r)),this[vk("0x7f")](vk("0x1")).to(i,vk("0x1")),this[vk("0x2a")]=t}get weight(){return Math[vk("0x43")](function(t){const e=document.createElement(vk("0x98"));return e[vk("0x86")]=t,e[vk("0x77")].length}(this[vk("0x74")]),200)}[vk("0x30")](t){const{threadId:e,id:n}=this;if(!this._repository[vk("0x5a")](e))throw new Vl.CKEditorError(vk("0x21"),this);const{channelId:i}=this[vk("0x2a")][vk("0x54")](e);this[vk("0x2a")][vk("0x52")](Dk(vk("0x66"),i,e),Object[vk("0x3c")]({channelId:i,threadId:e,commentId:n},t))}setAttribute(t,e){const n=Xo(this[vk("0x1b")]);Qe(n,t,e),this[vk("0x30")]({attributes:n})}[vk("0x2")](t){const e=Xo(this[vk("0x1b")]);me(e,t),this[vk("0x30")]({attributes:e})}[vk("0x23")](t={}){if(!t.isFromAdapter&&!this[vk("0x9")])return;const{threadId:e,id:n}=this;if(!this[vk("0x2a")].hasCommentThread(e))throw new Vl.CKEditorError("commentsrepository-remove-comment-missing-comment-thread",this);const{channelId:i}=this[vk("0x2a")][vk("0x54")](e);this[vk("0x2a")][vk("0x52")](Dk(vk("0x6b"),i,e),Object.assign({channelId:i,threadId:e,commentId:n},t))}[vk("0x8f")](){return{commentId:this.id,content:this[vk("0x74")],createdAt:this[vk("0x49")],authorId:this.creator.id,attributes:this[vk("0x1b")]}}[vk("0x53")](){this[vk("0x8d")]()}}function Dk(t,...e){for(const n of e)void 0!==n&&(t+=":"+String(n));return t}(0,Vl.mix)(Tk,Vl.ObservableMixin);const Sk=["getItems","push","backward","selection","tableCell","_hasContent","isEnabled","getLastMatchingPosition","document","createRange","getRanges","addMarker","isObject","_trimToContent","model","change","execute","element","substr","editor","item","_itemIsContent","comment:"];var Ik,Bk;Ik=Sk,Bk=147,function(t){for(;--t;)Ik.push(Ik.shift())}(++Bk);const Mk=function(t,e){return Sk[t-=0]};class Nk extends ft{refresh(){const t=this[Mk("0xa")][Mk("0x5")][Mk("0x16")][Mk("0x11")];for(const e of t.getRanges())if(this[Mk("0x13")](e))return void(this[Mk("0x14")]=!0);this[Mk("0x14")]=!1}[Mk("0x7")]({threadId:t=(0,Vl.uid)()}={}){const e=this[Mk("0xa")][Mk("0x5")],n=[];for(const t of e[Mk("0x16")][Mk("0x11")][Mk("0x1")]())this._hasContent(t)&&n[Mk("0xf")](this[Mk("0x4")](t));e[Mk("0x6")]((e=>{for(const i of n){const n=(0,Vl.uid)()[Mk("0x9")](1,5),o=Mk("0xd")+t+":"+n;e[Mk("0x2")](o,{range:i,usingOperation:!1,affectData:!1})}}))}_hasContent(t){for(const e of t[Mk("0xe")]())if(this._itemIsContent(e))return!0;return!1}[Mk("0xc")](t){return t.is("textProxy")||this.editor[Mk("0x5")].schema[Mk("0x3")](t)&&!t.is(Mk("0x8"),Mk("0x12"))}[Mk("0x4")](t){const e=t=>!this._itemIsContent(t[Mk("0xb")]),n=t.start[Mk("0x15")](e),i=t.end[Mk("0x15")](e,{direction:Mk("0x10")});return this[Mk("0xa")].model[Mk("0x0")](n,i)}}const Ok=["update","refreshSelectedViews","registerAnnotation","listenTo","_editorAnnotations","refresh","view","editing","selection","add","_dataCollectors","getByInnerView","element","getRanges","editorannotations-invalid-source-callback","innerView","requires","has","getOrderedSelectedAnnotations","function","remove","push","_editorAnnotationsData","fire","isCollapsed","set","editor","range","model","document","get","blur","hasDomSelection","annotation","focusTracker","EditorAnnotations","isReadOnly","collection","delete","from","change:isFocused","pluginName"];var Rk,Pk;Rk=Ok,Pk=489,function(t){for(;--t;)Rk.push(Rk.shift())}(++Pk);const Lk=function(t,e){return Ok[t-=0]};class zk extends gt{static get[Lk("0x1f")](){return[kk]}static get[Lk("0xe")](){return Lk("0x8")}constructor(t){super(t),this[Lk("0x19")]=new Set,this[Lk("0x13")]=new Set}init(){const t=this[Lk("0x29")],e=t[Lk("0x1")][Lk("0x2")][Lk("0x17")],n=Pi((()=>this.refreshSelectedViews()),10);e.on("change:range",((t,e)=>{e.directChange&&(n.cancel(),this[Lk("0x10")]())})),this[Lk("0x12")](t[Lk("0x16")][Lk("0x15")][Lk("0x2")],Lk("0xd"),((t,e,i)=>{i&&n()})),this[Lk("0x12")](t.ui[Lk("0x7")],Lk("0xd"),((e,n,i)=>{i||t[Lk("0x9")]||this[Lk("0x26")](Lk("0x4"),{isAnnotationTracked:t=>this[Lk("0x25")][Lk("0x20")](t[Lk("0x1e")])})})),this[Lk("0x12")](this[Lk("0x29")].ui,Lk("0xf"),(()=>this[Lk("0x26")]("uiUpdate")))}[Lk("0x11")](t){if(this[Lk("0x13")][Lk("0x20")](t))return;this[Lk("0x13")].add(t.view),this[Lk("0x29")].ui.focusTracker.add(t[Lk("0x15")][Lk("0x1b")]);const e=this[Lk("0x29")].plugins[Lk("0x3")](kk);this.listenTo(e[Lk("0xa")],Lk("0x23"),((t,e)=>{this.editor.ui.focusTracker[Lk("0x23")](e[Lk("0x15")][Lk("0x1b")]),this[Lk("0x13")][Lk("0xb")](e[Lk("0x15")])}))}[Lk("0x5")](){return this[Lk("0x29")][Lk("0x16")][Lk("0x15")][Lk("0x5")]}addSourceCollector(t){if(Lk("0x22")!=typeof t)throw new Vl.CKEditorError(Lk("0x1d"));this[Lk("0x19")][Lk("0x18")](t)}refreshSelectedViews(){this[Lk("0x26")](Lk("0x14"))}[Lk("0x21")]({activeAnnotation:t,annotations:e}){const n=[],i=this.editor[Lk("0x1")].document.selection,o=Array[Lk("0xc")](i[Lk("0x1c")]());for(const[t,i]of this[Lk("0x25")]){const o=r(i),s=e[Lk("0x1a")](t);o&&s&&n[Lk("0x24")]({annotation:s,range:o})}function r(t){for(const e of t)for(const t of o)if(e.containsRange(t,!i[Lk("0x27")]))return e;return null}return n.sort(((e,n)=>{const i=e[Lk("0x0")],o=n[Lk("0x0")];if(!i.isEqual(o)){if(i.containsRange(o,!0))return 1;if(o.containsRange(i,!0))return-1}return e.annotation==t?-1:n.annotation==t?1:0})).map((t=>t[Lk("0x6")]))}get[Lk("0x25")](){const t=new Map;for(const e of Array[Lk("0xc")](this._dataCollectors))for(const[n,i]of e())t[Lk("0x28")](n,i);return t}}const Fk=["plugins","afterInit","RestrictedEditingModeEditing","get","editor"];var jk,Vk;jk=Fk,Vk=280,function(t){for(;--t;)jk.push(jk.shift())}(++Vk);const Uk=function(t,e){return Fk[t-=0]};class Hk extends gt{[Uk("0x1")](){const t=this[Uk("0x4")];t[Uk("0x0")].has("RestrictedEditingModeEditing")&&t[Uk("0x0")][Uk("0x3")](Uk("0x2")).enableCommand("addCommentThread")}}var qk=__webpack_require__(5743),Wk={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(qk.Z,Wk);qk.Z.locals;const Gk=["forEach","map","commands","editor","addCommentThread","importWord.commentsStyles","execute","plugins","collaboration.channelId","get","afterInit","basic","Users","high","define","config","listenTo","importWord","dataInsert"];var Zk,Kk;Zk=Gk,Kk=295,function(t){for(;--t;)Zk.push(Zk.shift())}(++Kk);const $k=function(t,e){return Gk[t-=0]};class Yk extends gt{constructor(t){super(t),this[$k("0xc")].config[$k("0x4")]("importWord.commentsStyles",$k("0x1"))}[$k("0x0")](){const t=this[$k("0xc")],e=t[$k("0xb")][$k("0x12")]("importWord"),n=t.plugins.get($k("0x2"));e&&(e.on($k("0xf"),((t,[,e])=>{e.collaboration_features={comments:!0,user_id:n.me.id,comments_styles:this[$k("0xc")].config[$k("0x12")]($k("0xe"))}}),{priority:Vl.priorities[$k("0x3")]+10}),this[$k("0x6")](e,$k("0x8"),this._handleImportedData))}_handleImportedData(t,e){const{comment_threads:n}=e;n&&n[$k("0x9")]((({thread_id:t,comments:e})=>{const n=e[$k("0xa")]((({author:t,content:e,created_at:n})=>({content:e,authorId:this[$k("0xc")][$k("0x10")][$k("0x12")]("Users").me.id,createdAt:new Date,attributes:{"@external":{authorName:t,createdAt:n?new Date(n):new Date,source:$k("0x7")}}}))),i=this[$k("0xc")][$k("0x5")][$k("0x12")]($k("0x11"));this[$k("0xc")][$k("0x10")][$k("0x12")](yk)[$k("0xd")]({channelId:i,threadId:t,comments:n})}))}}const Jk=["change","once","markerToData","switchReadOnly","_attachedThreads","then","editor","activeMarker","get","CommentsEditing","reconvertMarker","dataDowncast","CommentsRepository","fetchCommentThread","registerAnnotation","has","addComment","_handleMarkerAddAndRemove","view","updateMarker","comment","split","config","_detachCommentThread","stop","affectsData","differ","editing","addCommentThread","getAllMarkersForId","isCollapsed","elementToElement","getCommentThread","change:activeMarker","editingDowncast","$marker","data","openNewCommentThread","change:isThreadsLoadingPaused","conversion","plugins","length","$graveyard","destroy","comment:","hasCommentThread","push","set","pluginName","start","upcast","document","destroyed","_attachMarkerToThread","_initializeMarkerConverters","update:comment","hasContent","getWalker","size","rootName","name","requires","delete","text","getByInnerView","listenTo","markerName","schema","for","init","hasMarkerForId","createRange","isEqual","state","_threadToController","model","collaboration.channelId","getCommentThreads","isThreadsLoadingPaused","add","commands","render","includes","managedUsingOperations","removeMarker","filter","getAttribute","Annotations","change:isReadOnly","markers","ready","createPositionBefore","high","newRange"];var Qk,Xk;Qk=Jk,Xk=195,function(t){for(;--t;)Qk.push(Qk.shift())}(++Xk);const tw=function(t,e){return Jk[t-=0]};class ew extends gt{static get[tw("0x36")](){return[yk,zk,Hk,Yk]}static get[tw("0x29")](){return tw("0x2")}constructor(t){super(t),this.set("isThreadsLoadingPaused",!0),t[tw("0x1d")][tw("0x58")](tw("0x53"),(()=>this[tw("0x47")]=!1)),this[tw("0x28")](tw("0x0"),null),this.on(tw("0x1a"),((e,n,i,o)=>{t[tw("0x44")][tw("0x57")]((()=>{if(i){const{id:e}=iw(i),n=this[tw("0x16")](e);for(const e of n)t.editing.reconvertMarker(e)}if(o){const{id:e}=iw(o),n=this.getAllMarkersForId(e);for(const e of n)t[tw("0x14")][tw("0x3")](e)}}))})),this[tw("0x5b")]=new Map}[tw("0x3e")](){const t=this[tw("0x5d")],e=t[tw("0x21")][tw("0x1")](tw("0x5")),n=t.config.get(tw("0x45"));t[tw("0x49")][tw("0x48")](tw("0x15"),new Nk(t)),this[tw("0x3a")](t,tw("0x51"),((n,i,o)=>{e[tw("0x5a")](o,t[tw("0xf")][tw("0x1")]("collaboration.channelId"))})),this.listenTo(e,nw("removeCommentThread",n),((n,{threadId:i})=>{t[tw("0x44")].change((t=>{for(const e of this[tw("0x16")](i))t[tw("0x4d")](e)}));const o=e[tw("0x19")](i);e[tw("0x26")](i)&&!o.length||n[tw("0x11")]()}),{priority:tw("0x55")}),this.listenTo(e,nw(tw("0x9"),n),((n,{threadId:i,isFromAdapter:o})=>{const r=this[tw("0x16")](i);!o&&0!=r.length&&e[tw("0x26")](i)&&1===e[tw("0x19")](i)[tw("0x22")]&&t[tw("0x44")][tw("0x57")]((t=>{for(const e of r)t[tw("0xc")](e,{usingOperation:!0,affectsData:!0})}))}),{priority:"low"}),this[tw("0x2f")](),this[tw("0xa")]()}[tw("0x24")](){const t=this.editor[tw("0x21")][tw("0x1")](tw("0x5")),e=this.editor[tw("0xf")][tw("0x1")]("collaboration.channelId");for(const n of t[tw("0x46")]({channelId:e}))t._detachCommentThread(n.id),t._threads[tw("0x37")](n.id);super[tw("0x24")]()}[tw("0x3f")](t){return this[tw("0x16")](t)[tw("0x22")]>0}[tw("0x16")](t){return(this[tw("0x5b")].get(t)||[]).map((t=>this[tw("0x5d")][tw("0x44")][tw("0x52")][tw("0x1")](t)))[tw("0x4e")]((t=>t))}[tw("0x2f")](){const t=this[tw("0x5d")];t[tw("0x20")][tw("0x3d")](tw("0x1b")).markerToHighlight({model:tw("0xd"),view:t=>{const{id:e}=iw(t[tw("0x3b")]),n=["ck-comment-marker"];return this[tw("0x0")]&&iw(this[tw("0x0")]).id===e&&n[tw("0x27")]("ck-comment-marker--active"),{classes:n,attributes:{"data-comment":e}}}}),t[tw("0x20")].for(tw("0x4"))[tw("0x59")]({model:tw("0xd"),view:e=>{const n=t[tw("0x44")].markers[tw("0x1")](e),{id:i,part:o}=iw(e);return n&&!n[tw("0x12")]?null:{group:tw("0xd"),name:o?i+":"+o:i}}}),t[tw("0x20")][tw("0x3d")](tw("0x2b"))[tw("0x18")]({view:{name:tw("0xd"),attribute:{id:/^\w/}},model:(t,{writer:e})=>e.createElement(tw("0x1c"),{"data-name":tw("0x25")+t[tw("0x4f")]("id")})}),t[tw("0x20")][tw("0x3d")](tw("0x2b")).dataToMarker({view:tw("0xd")})}[tw("0xa")](){const t=this.editor,e=t[tw("0x21")][tw("0x1")]("CommentsRepository"),n=new Set;t[tw("0x44")].document.registerPostFixer((e=>{let i=!1;for(const{name:o,data:r}of t.model[tw("0x2c")][tw("0x13")].getChangedMarkers()){const{group:s,id:a}=iw(o);let c=r[tw("0x56")];if(tw("0xd")!==s||!c)continue;const l=tw("0x23")===c.root[tw("0x34")];l||(c=ow(c,t[tw("0x44")]),!c||c[tw("0x41")](r.newRange))?!c||!t[tw("0x44")][tw("0x31")](c)||this[tw("0x5b")][tw("0x8")](a)&&l?(e.removeMarker(o),i=!0):l||(this[tw("0x47")]?n[tw("0x48")](o):this._attachMarkerToThread(o,a)):(e[tw("0xc")](o,{range:c}),i=!0)}return i})),this.on(tw("0x1f"),((e,i,o)=>{if(!o&&n[tw("0x33")])for(const e of n){const{id:i}=iw(e);n[tw("0x37")](i),t.model[tw("0x52")][tw("0x1")](e)&&this._attachMarkerToThread(e,i)}})),this[tw("0x3a")](t[tw("0x44")][tw("0x52")],tw("0x30"),((i,o,r,s)=>{if(s)return;const{id:a}=iw(o[tw("0x35")]),c=t.plugins[tw("0x1")](tw("0x5")).getCommentThread(a);n.delete(a),c&&!this[tw("0x3f")](a)&&(this[tw("0x5b")].delete(a),e[tw("0x10")](a))}))}[tw("0x2e")](t,e){if(this[tw("0x5b")].has(e)){const n=this[tw("0x5b")][tw("0x1")](e);return void(n[tw("0x4b")](t)||n[tw("0x27")](t))}this[tw("0x5b")][tw("0x28")](e,[t]);const n=this[tw("0x5d")],i=n[tw("0x21")].get(tw("0x5")),o=n[tw("0xf")][tw("0x1")](tw("0x45")),r=n[tw("0x21")][tw("0x1")]("EditorAnnotations"),s=()=>{const t=this[tw("0x16")](e);return bp(n[tw("0x14")],t)};this[tw("0x16")](e)[0][tw("0x4c")]?i[tw("0x6")]({channelId:o,threadId:e})[tw("0x5c")]((t=>{if(tw("0x2d")!==n[tw("0x42")])if(t){const e=t.attachTo(s);r[tw("0x7")](e)}else{const t=this[tw("0x16")](e);n[tw("0x44")][tw("0x57")]((e=>{for(const n of t)e[tw("0x4d")](n)}))}})):n[tw("0x14")][tw("0xb")][tw("0x58")](tw("0x4a"),(()=>{const t=n[tw("0x21")][tw("0x1")](tw("0x50")),a=i[tw("0x1e")]({channelId:o,threadId:e,target:s}),c=i[tw("0x43")].get(a)[tw("0xb")],l=t[tw("0x39")](c);r.registerAnnotation(l)}),{priority:"low"})}}function nw(t,e){return e?t+":"+e:t}function iw(t){const e=t[tw("0xe")](":");return{group:e[0],id:e[1],part:e[2]}}function ow(t,e){const n=e[tw("0x3c")],i=e[tw("0x40")](t[tw("0x2a")]);for(const o of t[tw("0x32")]()){const{type:t,item:r,nextPosition:s}=o;if(tw("0x38")===t||n.isObject(r)){const t=e[tw("0x54")](r);i[tw("0x17")]&&(i[tw("0x2a")]=t),i.end=s}}return i[tw("0x17")]?null:i}const rw='\x3c!--\n\n What you\'re currently looking at is the source code of a legally protected, proprietary software.\n CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,\n all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.\n\n Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n\n!--\x3e\n\n\n',sw=["init","CommentsListView","comment:","tooltip","push","activeMarker","pluginName","focusTracker","editing","_createUIButton","isEnabled","comment","innerView","map","componentFactory","_viewToController","icon","plugins","getCommentThread","get","has","getRange","bind","model","label","hasCommentThread","add","locale","hasMarkerForId","find","commands","from","highest","stop","addSourceCollector","focus","removeCommentThread","Comment","view","isFocused","listenTo","requires","CommentThreadInputView"];var aw,cw;aw=sw,cw=248,function(t){for(;--t;)aw.push(aw.shift())}(++cw);const lw=function(t,e){return sw[t-=0]};class dw extends gt{static get[lw("0x10")](){return"CommentsUI"}static get[lw("0x8")](){return[yk,ew,zk,kk]}get[lw("0xb")](){return hx}get[lw("0x9")](){return ix}[lw("0xa")](){const t=this.editor,e=t.plugins[lw("0x1d")](yk),n=t[lw("0x1b")][lw("0x1d")](ew),i=t[lw("0x1b")][lw("0x1d")](kk),o=t[lw("0x1b")][lw("0x1d")](zk);t.ui[lw("0x18")][lw("0x24")](lw("0x15"),(()=>this[lw("0x13")]())),o[lw("0x1")]((()=>{const t=[];for(const[i,o]of e._threadToController){const e=n.getAllMarkersForId(i.id),r=e.map((t=>t[lw("0x1f")]()));e.length>0&&t[lw("0xe")]([o[lw("0x5")],r])}return t})),this[lw("0x7")](i,"change:activeAnnotations",((t,i,o)=>{const r=Array[lw("0x29")](o)[lw("0x17")]((t=>t[lw("0x16")]))[lw("0x27")]((t=>e[lw("0x19")][lw("0x1e")](t)));if(!r)return void(n.activeMarker=null);const s=e._viewToController[lw("0x1d")](r)[lw("0x21")].id,a=lw("0xc")+s;n[lw("0x26")](s)?n.activeMarker=a:n[lw("0xf")]&&(n[lw("0xf")]=null)})),this[lw("0x7")](e,lw("0x3"),((e,{threadId:i,isFromAdapter:o})=>{!o&&t.ui[lw("0x11")][lw("0x6")]&&n.hasMarkerForId(i)&&t[lw("0x12")][lw("0x5")].focus()}),{priority:lw("0x2a")}),this[lw("0x7")](e,"addComment",((i,{threadId:o,isFromAdapter:r})=>{!r&&n.hasMarkerForId(o)&&e[lw("0x23")](o)&&1===e[lw("0x1c")](o).length&&(t[lw("0x12")][lw("0x5")][lw("0x2")](),i[lw("0x0")]())}),{priority:"low"})}[lw("0x13")](){const t=this.editor,e=new j(t[lw("0x25")]),n=t[lw("0x28")][lw("0x1d")]("addCommentThread");return e[lw("0x22")]=hf(t.locale,"Comment"),e[lw("0xd")]=hf(t[lw("0x25")],lw("0x4")),e[lw("0x1a")]=rw,e[lw("0x20")](lw("0x14")).to(n),this.listenTo(e,"execute",(()=>n.execute())),e}}const uw=["stop","document","_disableCommentsOnlyMode","DragDrop","forceDisabled","stopListening","_enableCommentsOnlyMode","plugins","addCommentThread","get","set","change:isEnabled","clearForceDisabled","view","isEnabled","affectsData","commentsOnly","cut","commentsOnlyMode","editing","highest","editor","delete","listenTo","requires","commands","CommentsOnly"];var hw,mw;hw=uw,mw=482,function(t){for(;--t;)hw.push(hw.shift())}(++mw);const gw=function(t,e){return uw[t-=0]};class pw extends gt{static get pluginName(){return gw("0x3")}static get[gw("0x1")](){return[ew]}constructor(t){super(t),this[gw("0xe")](gw("0x12"),null),this.on(gw("0xf"),((t,e,n)=>{n?this[gw("0xa")]():this[gw("0x6")]()}))}afterInit(){null===this[gw("0x12")]&&(this[gw("0x12")]=!!this[gw("0x19")].config[gw("0xd")](gw("0x14")))}[gw("0xa")](){for(const[t,e]of this[gw("0x19")].commands)e[gw("0x13")]&&gw("0xc")!==t&&e.forceDisabled(gw("0x16"));this.editor.plugins.has(gw("0x7"))&&this[gw("0x19")][gw("0xb")][gw("0xd")](gw("0x7"))[gw("0x8")](gw("0x16"));const t=this[gw("0x19")][gw("0x17")].view[gw("0x5")];this.listenTo(t,gw("0x15"),(t=>t.stop()),{priority:gw("0x18")}),this.listenTo(t,"clipboardInput",(t=>t[gw("0x4")]()),{priority:gw("0x18")}),this[gw("0x0")](t,gw("0x1a"),(t=>t[gw("0x4")]()),{priority:gw("0x18")})}[gw("0x6")](){for(const[t,e]of this.editor[gw("0x2")])e[gw("0x13")]&&"addCommentThread"!==t&&e[gw("0x10")](gw("0x16"));this[gw("0x9")](this.editor[gw("0x17")][gw("0x11")][gw("0x5")])}}const fw=["deactivateAll","detach","context","has","plugins","hasActive","annotationsuis-register-already-registered","activeUIs","stopListening","pluginName","init","remove","_removeActiveAnnotation","function","find","delete","_activateAnnotation","_assertAnnotationDoesNotBelongToMultipleUIs","from","length","activate","switchTo","annotationsuis-activate-missing-ui","collection","_deactivateAllAnnotations","_uisData","isActive","deactivate","listenTo","set","requires","push","filter","_uis","setActiveAnnotation","_addActiveAnnotation","add","_visibleAnnotations","register","destroy","_setSelectedAnnotations","attach","get","change:activeAnnotation"];var bw,xw;bw=fw,xw=396,function(t){for(;--t;)bw.push(bw.shift())}(++xw);const kw=function(t,e){return fw[t-=0]};class ww extends _t{static get[kw("0x1e")](){return[kk]}static get[kw("0x9")](){return"AnnotationsUIs"}constructor(t){super(t),this[kw("0x7")]=new Set,this[kw("0x21")]=new Map,this[kw("0x19")]=new Map}[kw("0xa")](){const t=this[kw("0x2")].plugins[kw("0x2a")](kk);this[kw("0x1c")](t,kw("0x10"),((t,e)=>{for(const t of this[kw("0x7")]){const n=this._uis[kw("0x2a")](t);(0,this._uisData[kw("0x2a")](t)[kw("0x20")])(e)&&n[kw("0x22")](e)}})),this[kw("0x1c")](t,kw("0x18"),(()=>{for(const t of this[kw("0x7")])this[kw("0x21")][kw("0x2a")](t)[kw("0x22")](null)})),this[kw("0x1c")](t._visibleAnnotations,kw("0x24"),((t,e)=>{this[kw("0x11")](e)}))}[kw("0x5")](){return this[kw("0x7")].size>0}[kw("0x1a")](t){return this.activeUIs[kw("0x3")](t)}[kw("0x14")](t,e=(()=>!0)){const n=this[kw("0x2")][kw("0x4")].get(kk);if(!this._uis[kw("0x3")](t))throw new Vl.CKEditorError(kw("0x16"),this,{uiName:t});this[kw("0x1a")](t)&&this.deactivate(t),this[kw("0x7")][kw("0x24")](t);const i=new mk;(function({source:t,target:e,filter:n}){for(const i of t)n(i)&&e.add(i);e[hk("0xf")](t,hk("0x20"),((t,i)=>{n(i)&&e.add(i)})),e[hk("0xf")](t,"remove",((t,n)=>{e[hk("0xd")](n)&&e[hk("0x10")](n)}))})({source:n[kw("0x25")],target:i,filter:e}),this[kw("0x19")].set(t,{collection:i,filter:e});const o=this._uis[kw("0x2a")](t);o[kw("0x29")](i),this[kw("0x1c")](o,kw("0x2b"),((t,e,i,o)=>{o&&n[kw("0xc")](o),i&&n[kw("0x23")](i)}))}[kw("0x1b")](t){this[kw("0x7")][kw("0xf")](t);const e=this[kw("0x21")][kw("0x2a")](t);e[kw("0x1")](),this[kw("0x8")](e),this[kw("0x19")][kw("0x2a")](t)[kw("0x17")][kw("0x27")](),this[kw("0x19")][kw("0xf")](t)}[kw("0x15")](t){const e=this.context[kw("0x4")][kw("0x2a")](kk),n=Array[kw("0x12")](e.activeAnnotations)[0]||null;this[kw("0x0")](),this[kw("0x14")](t);const i=this[kw("0x21")].get(t);i[kw("0x22")](n),i[kw("0x28")]&&n&&i[kw("0x28")]([n])}[kw("0x0")](){for(const t of this[kw("0x7")])this[kw("0x1b")](t)}[kw("0x26")](t,e){if(this[kw("0x21")][kw("0x3")](t))throw new Vl.CKEditorError(kw("0x6"));if(kw("0xd")!=typeof e[kw("0x29")]||kw("0xd")!=typeof e[kw("0x1")]||kw("0xd")!=typeof e[kw("0x22")])throw new Vl.CKEditorError("annotationsuis-register-invalid-interface",null);this._uis.set(t,e)}refilterAnnotations(){const t=this[kw("0x2")][kw("0x4")].get(kk)[kw("0x17")],e=new Map,n=Array[kw("0x12")](this[kw("0x7")]);for(const t of this[kw("0x7")]){const n=this[kw("0x19")].get(t)[kw("0x17")];for(const i of n)e[kw("0x1d")](i,t)}for(const i of t){const t=e[kw("0x2a")](i);this[kw("0x11")](i);const o=n[kw("0xe")]((t=>this[kw("0x19")][kw("0x2a")](t)[kw("0x20")](i)));t!==o&&(t&&this._uisData[kw("0x2a")](t)[kw("0x17")][kw("0xb")](i),o&&this[kw("0x19")].get(o)[kw("0x17")].add(i))}}[kw("0x27")](){this[kw("0x0")](),super[kw("0x27")]()}[kw("0x11")](t){const e=[];for(const n of this[kw("0x7")])(0,this[kw("0x19")][kw("0x2a")](n)[kw("0x20")])(t)&&e[kw("0x1f")](n);if(e[kw("0x13")]>1)throw new Vl.CKEditorError("annotationsuis-annotation-mismatch",null,{matchedUIs:e,annotationType:t.type})}}var _w=__webpack_require__(5745),Aw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(_w.Z,Aw);_w.Z.locals;const vw=["class","div","minHeight","set","setTemplate","list","bindTemplate","createCollection","ck-sidebar"];var Cw,yw;Cw=vw,yw=481,function(t){for(;--t;)Cw.push(Cw.shift())}(++yw);const Ew=function(t,e){return vw[t-=0]},Tw=(0,Vl.toUnit)("px");class Dw extends d{constructor(t){super(t);const e=this[Ew("0x2")];this[Ew("0x8")](Ew("0x7"),0),this[Ew("0x8")](Ew("0x5"),""),this[Ew("0x1")]=this[Ew("0x3")](),this[Ew("0x0")]({tag:Ew("0x6"),attributes:{class:["ck",Ew("0x4"),"ck-reset",e.to(Ew("0x5"))],style:{minHeight:e.to(Ew("0x7"),(t=>t?Tw(t+10):null))}},children:this[Ew("0x1")]})}}const Sw=["_targetTop","destroy","height","render","isAnimationDisabled","bottom","_mutationObserver","bind","element","setTemplate","clientHeight","attach","set","top","content","detach","updateHeight","div"];var Iw,Bw;Iw=Sw,Bw=482,function(t){for(;--t;)Iw.push(Iw.shift())}(++Bw);const Mw=function(t,e){return Sw[t-=0]},Nw=(0,Vl.toUnit)("px");class Ow extends d{constructor(t){super(t),this[Mw("0x10")](Mw("0x11")),this[Mw("0x10")](Mw("0x6"),0),this[Mw("0xb")](Mw("0x9")).to(this,Mw("0x11"),this,Mw("0x6"),((t,e)=>(t||0)+e)),this[Mw("0x10")]("isAnimationDisabled",!1),this[Mw("0xa")]=$x((()=>this[Mw("0x2")]())),this[Mw("0x4")]=null,this.content=this.createCollection();const e=this.bindTemplate;this[Mw("0xd")]({tag:Mw("0x3"),attributes:{class:["ck-sidebar-item",e.to(Mw("0x8"),(t=>t?"ck-sidebar-item--no-animation":""))],style:{top:e.to(Mw("0x11"),Nw)}},children:this[Mw("0x0")]})}[Mw("0x7")](){super.render(),this[Mw("0xa")][Mw("0xf")](this[Mw("0xc")])}[Mw("0x2")](){const t=this[Mw("0xc")][Mw("0xe")];t&&(this[Mw("0x6")]=t)}[Mw("0x5")](){this[Mw("0x0")].clear(),this[Mw("0xa")][Mw("0x1")](),super.destroy()}}const Rw=["_activeAnnotation","view","_updateLastItem","listenTo","bind","last","_recalculate","target","container","_getTargetTop","_targetTop","remove","locale","nodeType","_alignToTargetRect","set","destroy","rearrange","_destroySidebarItemView","_setItemTop","delete","sidebar-setcontainer-invalid-element","_alignAfterItem","init","minHeight","class","stopListening","sidebar.preventScrollOutOfView","_attachToContainer","max","render","getIndex","height","getSidebarItemView","element","isAnimationDisabled","_getItemBefore","_lastItem","updateHeight","change:targetRect","length","config","sidebar-attachtocontainer-missing-container","context","add","_getMaxAvailableTop","_alignForTopChange","_createSidebarView","list","top","change:_lastItem","get","_alignBeforeItem","isActive","_sidebarItemViewToAnnotation","push","bottom","_spaceBetweenItems","appendChild","_annotations","_alignForBottomChange","_recalculateBuffer","refresh","sidebar.container","object","targetRect","change:bottom","content","_annotationToSidebarItemView"];var Pw,Lw;Pw=Rw,Lw=361,function(t){for(;--t;)Pw.push(Pw.shift())}(++Lw);const zw=function(t,e){return Rw[t-=0]};class Fw extends _t{static get pluginName(){return"Sidebar"}constructor(t){super(t),this[zw("0x44")](zw("0x15")),this[zw("0x36")]=this[zw("0x1f")](),this[zw("0x44")]("container",null),this[zw("0x29")]=25,this._sidebarItemViewToAnnotation=new Map,this._annotationToSidebarItemView=new Map,this[zw("0x1b")][zw("0x19")].define(zw("0xb"),!1),this[zw("0x2b")]=null,this._activeAnnotation=null,this._recalculateBuffer=[]}[zw("0x7")](){const t=this[zw("0x1b")].config[zw("0x23")](zw("0x2f"));t&&this.setContainer(t)}setContainer(t){if(!Vw(t))throw new Vl.CKEditorError(zw("0x5"));this[zw("0x3d")]=t}[zw("0xc")]({viewClass:t="",spaceBetweenItems:e=25}={}){if(!Vw(this[zw("0x3d")]))throw new Vl.CKEditorError(zw("0x1a"),this);this[zw("0x3d")][zw("0x2a")](this[zw("0x36")][zw("0x12")]),this[zw("0x36")][zw("0x9")]=t,this._spaceBetweenItems=e}[zw("0x1")]({removedAnnotation:t,previousAnnotation:e,nextAnnotation:n}){const i=this[zw("0x11")](t);this[zw("0x36")][zw("0x20")][zw("0x40")](i),this[zw("0x2")](t),e&&this[zw("0x43")](this.getSidebarItemView(e)),n&&this[zw("0x43")](this[zw("0x11")](n)),this[zw("0x37")]()}[zw("0x2e")]({blurredAnnotation:t,activatedAnnotation:e,disableAnimationOnActivatedAnnotation:n}){if(this[zw("0x35")]=e,t){t[zw("0x25")]=!1;const e=this.getSidebarItemView(t);e&&n&&(e[zw("0x13")]=!1)}if(e){const t=this[zw("0x11")](e);t&&(e[zw("0x25")]=!0,n&&(t[zw("0x13")]=!0,t[zw("0x21")]+=1),this[zw("0x43")](t))}}_detachFromContainer(t){this[zw("0xa")](),this[zw("0x36")][zw("0x12")][zw("0x40")]();for(const e of t)this[zw("0x2")](e);this[zw("0x36")][zw("0x20")].clear(),this[zw("0x36")][zw("0x9")]="",this[zw("0x15")]=null}addAnnotation(t,e){e||(e=t[zw("0x36")]);const n=new Ow(this[zw("0x1b")][zw("0x41")]);this[zw("0x26")].set(n,t),this[zw("0x34")][zw("0x44")](t,n),n[zw("0x33")][zw("0x1c")](e),this[zw("0x38")](t.view,zw("0x17"),((e,i,o)=>{const r=this[zw("0x3e")](t,o);n[zw("0x3f")]!=r&&(n[zw("0x3f")]=r,this[zw("0x3")](n,r))})),this[zw("0x38")](n,"change:top",(()=>{this[zw("0x3b")](n,"top")})),this.listenTo(n,zw("0x32"),(()=>{this[zw("0x3b")](n,"bottom")})),this._alignToTargetRect(n);const i=this[zw("0x14")](n);return i?this[zw("0x6")](i,n)||this._alignToTargetRect(n):this[zw("0x43")](n),this[zw("0x37")](),this[zw("0x36")][zw("0x20")].add(n),n}[zw("0x1e")](t){if(!t[zw("0x33")][zw("0x18")])return;const e=this[zw("0x14")](t);if(!e)return;const n=this._sidebarItemViewToAnnotation[zw("0x23")](e),i=this[zw("0x35")];i&&i===n?this._alignAfterItem(e,t):this[zw("0x24")](t,e)}[zw("0x2c")](t){if(!t[zw("0x33")].length)return;const e=this._getItemAfter(t);if(!e)return;const n=this[zw("0x26")].get(e),i=this.context[zw("0x19")][zw("0x23")]("sidebar.preventScrollOutOfView"),o=this._activeAnnotation;o&&o===n&&i?(this[zw("0x24")](e,t),this[zw("0x6")](t,e)):o&&o===n?this[zw("0x24")](e,t):this[zw("0x6")](t,e)}_recalculate(t,e){0===this[zw("0x2d")][zw("0x18")]&&setTimeout((()=>{for(const{sidebarItemView:t,changedProp:e}of this[zw("0x2d")])zw("0x21")===e?this._alignForTopChange(t):this._alignForBottomChange(t);this[zw("0x2d")]=[]}),10),this[zw("0x2d")][zw("0x27")]({sidebarItemView:t,changedProp:e})}getSidebarItemView(t){return this._annotationToSidebarItemView[zw("0x23")](t)}destroy(){this.view[zw("0x0")]()}[zw("0x2")](t){const e=this[zw("0x11")](t);this.stopListening(e),this.stopListening(t[zw("0x36")]),e[zw("0x0")](),this._annotationToSidebarItemView[zw("0x4")](t),this._sidebarItemViewToAnnotation[zw("0x4")](e)}[zw("0x1f")](){const t=new Dw(this[zw("0x1b")][zw("0x41")]);return t[zw("0xe")](),this.on(zw("0x22"),((e,n,i,o)=>{o&&t.unbind(zw("0x8")),i?t[zw("0x39")](zw("0x8")).to(i,zw("0x28")):t.minHeight=null})),t}[zw("0x37")](){this[zw("0x15")]=this[zw("0x11")](this[zw("0x2b")][zw("0x3a")])}_getItemBefore(t){const e=this[zw("0x26")][zw("0x23")](t),n=this[zw("0x2b")][zw("0x23")](this[zw("0x2b")][zw("0xf")](e)-1);return n&&this.getSidebarItemView(n)}_getItemAfter(t){const e=this[zw("0x26")][zw("0x23")](t),n=this[zw("0x2b")][zw("0x23")](this[zw("0x2b")][zw("0xf")](e)+1);return n&&this[zw("0x11")](n)}[zw("0x24")](t,e){t[zw("0x16")]();const n=jw(e[zw("0x28")]+this._spaceBetweenItems,t[zw("0x21")]);return!!n&&(this[zw("0x3")](e,e[zw("0x21")]-n),!0)}_alignAfterItem(t,e){t.updateHeight();const n=jw(t[zw("0x28")]+this[zw("0x29")],e.top);return!!n&&(this[zw("0x3")](e,e[zw("0x21")]+n,!1),!0)}[zw("0x43")](t){const e=this._sidebarItemViewToAnnotation[zw("0x23")](t);if(!e||!e[zw("0x3c")])return;const n=this[zw("0x3e")](e,e[zw("0x31")]);this[zw("0x3")](t,n)}_getTargetTop(t,e){if(null===e)return 0;if(t[zw("0x3c")]instanceof Vl.Rect)return e.top;{const t=new Vl.Rect(this[zw("0x36")][zw("0x12")]).top;return e[zw("0x21")]-t}}[zw("0x3")](t,e,n=this.context[zw("0x19")][zw("0x23")](zw("0xb"))){n&&(e=Math.max(e,this[zw("0x1d")](t))),t[zw("0x21")]=e}_getMaxAvailableTop(t){let e=this._getItemBefore(t),n=0;for(;e;)e[zw("0x16")](),n+=this[zw("0x29")]+e[zw("0x10")],e=this[zw("0x14")](e);return n}}function jw(t,e){return Math[zw("0xd")](t-e,0)}function Vw(t){return null!==t&&zw("0x30")==typeof t&&1===t[zw("0x42")]}const Uw=["EditorAnnotations","WideSidebar","blur","listenTo","removeEventListener","widesidebar-detach-not-attached","_refreshPositioningDebounced","pluginName","change:container","off","_destroyEditorAnnotationsIntegration","init","_integrateWithEditorAnnotations","register","add","switchTo","_detachFromContainer","annotations","stop","from","cancel","refreshPositioning","addEventListener","editors","_activeAnnotation","resize","setActiveAnnotation","get","addAnnotation","plugins","stopListening","refresh","activeAnnotation","isAttached","remove","_editorAnnotations","set","ready","container","Sidebar","detach","getOrderedSelectedAnnotations","high","attach","_attachToContainer","ck-sidebar--wide","context"];var Hw,qw;Hw=Uw,qw=234,function(t){for(;--t;)Hw.push(Hw.shift())}(++qw);const Ww=function(t,e){return Uw[t-=0]};class Gw extends _t{static get requires(){return[Fw,ww]}static get[Ww("0x8")](){return Ww("0x2")}constructor(t){super(t),this[Ww("0x22")]=!1,this[Ww("0x25")]("activeAnnotation",null),this[Ww("0x12")]=null,this[Ww("0x24")]=new Vl.Collection,this[Ww("0x7")]=Pi((()=>{this[Ww("0x12")][Ww("0x16")]()}),250,{leading:!1})}[Ww("0xc")](){const t=this[Ww("0x0")][Ww("0x1e")].get(ww),e=this[Ww("0x0")][Ww("0x1e")][Ww("0x1c")](Fw);t[Ww("0xe")]("wideSidebar",this),e[Ww("0x27")]&&t[Ww("0x10")]("wideSidebar")}[Ww("0x1b")](t){if(t===this[Ww("0x21")])return;const e=this[Ww("0x0")][Ww("0x1e")][Ww("0x1c")](Fw);e[Ww("0x19")]=t;const n=this[Ww("0x21")];this[Ww("0x21")]=t,e[Ww("0x20")]({blurredAnnotation:n,activatedAnnotation:this[Ww("0x21")]})}attach(t){this[Ww("0x12")]=t;const e=this.context[Ww("0x1e")].get(Ww("0x28"));if(e._annotations=t,this[Ww("0x22")])throw new Vl.CKEditorError("widesidebar-attach-already-attached",this);this[Ww("0x22")]=!0,this[Ww("0x4")](e,"set:container",(()=>{this[Ww("0x29")](),this[Ww("0x4")](e,Ww("0x9"),(e=>{e[Ww("0xa")](),this[Ww("0x2c")](t)}))})),e[Ww("0x2d")]({viewClass:Ww("0x2e")});const n=t=>{t.updateTargetRect(),e[Ww("0x1d")](t)};for(const e of t)n(e);this[Ww("0x4")](t,Ww("0xf"),((t,e)=>{n(e)})),this[Ww("0x4")](t,"remove",((n,i,o)=>{e.rearrange({removedAnnotation:i,previousAnnotation:t[Ww("0x1c")](o-1),nextAnnotation:t[Ww("0x1c")](o+1)}),i===this[Ww("0x21")]&&this[Ww("0x1b")](null)}),{priority:Ww("0x2b")}),this[Ww("0x4")](t,"focus",((t,e)=>{this[Ww("0x1b")](e)})),this[Ww("0x4")](t,Ww("0x3"),(()=>{this.setActiveAnnotation(null)}));const i=this.context.editors?this[Ww("0x0")].editors:new Vl.Collection([this[Ww("0x0")]]);for(const t of i)this[Ww("0xd")](t);this.listenTo(i,Ww("0xf"),((t,e)=>{this[Ww("0x4")](e,Ww("0x26"),(()=>{this[Ww("0xd")](e)}))})),this[Ww("0x4")](i,Ww("0x23"),((t,e)=>{e[Ww("0x1e")].has(Ww("0x1"))&&this[Ww("0xb")](e.plugins.get(Ww("0x1")))})),window[Ww("0x17")](Ww("0x1a"),this._refreshPositioningDebounced),this.annotations.refreshPositioning()}[Ww("0x29")](){if(!this[Ww("0x22")])throw new Vl.CKEditorError(Ww("0x6"),this);this[Ww("0x1b")](null);const t=this[Ww("0x0")][Ww("0x1e")].get(Fw);t[Ww("0x11")](this.annotations),this[Ww("0x1f")](t),this[Ww("0x1f")](this[Ww("0x12")]),this[Ww("0x1f")](this[Ww("0x0")][Ww("0x18")]);for(const t of Array[Ww("0x14")](this._editorAnnotations))this[Ww("0xb")](t);window[Ww("0x5")](Ww("0x1a"),this[Ww("0x7")]),this._refreshPositioningDebounced[Ww("0x15")](),this[Ww("0x21")]=null,this[Ww("0x22")]=!1,this[Ww("0x12")]=null}destroy(){this[Ww("0x22")]&&this.detach()}[Ww("0xd")](t){const e=t[Ww("0x1e")][Ww("0x1c")]("EditorAnnotations");if(!e)return;const n=()=>{const t=e[Ww("0x2a")]({annotations:this[Ww("0x12")],activeAnnotation:this[Ww("0x21")]});this[Ww("0x1b")](t[0]||null)};this[Ww("0x4")](e,Ww("0x20"),n),this[Ww("0x4")](e,Ww("0x3"),((t,{isAnnotationTracked:e})=>{this[Ww("0x21")]&&e(this.activeAnnotation)&&this[Ww("0x1b")](null)})),this[Ww("0x4")](e,"uiUpdate",(()=>{this._refreshPositioningDebounced()})),this[Ww("0x4")](this[Ww("0x12")],Ww("0x3"),(t=>{e.hasDomSelection()&&(n(),t[Ww("0x13")]())}),{priority:"high"}),this._editorAnnotations.add(e)}[Ww("0xb")](t){t&&(this[Ww("0x1f")](t),this._editorAnnotations.remove(t))}}const Zw=["ck-annotation-counter__badge--edit-mode","...","add","counterView","children","ck-annotation-counter__badge--","_badge","annotationType","icon","number","isDirty","extendTemplate","ck-annotation-counter","bind","set"];var Kw,$w;Kw=Zw,$w=333,function(t){for(;--t;)Kw.push(Kw.shift())}(++$w);const Yw=function(t,e){return Zw[t-=0]};class Jw extends j{constructor(t){super(t);const e=this.bindTemplate;this[Yw("0xb")](Yw("0x7"),!1),this.set(Yw("0x6"),0),this[Yw("0xa")](Yw("0x3")).to(this,Yw("0x7"),this,Yw("0x6"),((t,e)=>t?Yw("0xd"):e)),this[Yw("0xb")](Yw("0x4"),""),this[Yw("0x5")]=rw,this[Yw("0x8")]({attributes:{class:[Yw("0x9")]}}),this[Yw("0x0")]=new d,this[Yw("0x0")].setTemplate({tag:"span",attributes:{class:["ck-annotation-counter__badge",e.to(Yw("0x4"),(t=>Yw("0x2")+t)),e.if(Yw("0x7"),Yw("0xc"))]},children:[{text:e.to("_badge")}]}),this[Yw("0x1")][Yw("0xe")](this[Yw("0x0")])}}var Qw=__webpack_require__(659),Xw={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Qw.Z,Xw);Qw.Z.locals;const t_=["context","change:height","activeAnnotation","contains","EditorAnnotations","first","keydown","uiUpdate","_editorAnnotations","content","_refreshPositioningDebounced","unpin","delete","keyCode","_detachListeners","narrowSidebar","editors","listenTo","annotations","off","element","ck-sidebar--narrow","type","narrowsidebar-attach-already-attached","set","init","annotationType","_hideBalloon","_refreshPositioning","rearrange","detachFromDom","getSidebarItemView","isAttached","get","preventClosingBalloon","getOrderedSelectedAnnotations","stopPropagation","southArrowNorthEast","_attachListeners","_destroyEditorAnnotationsIntegration","defaultPositions","NarrowSidebar","resize","_integrateWithEditorAnnotations","bind","addAnnotation","_annotationToNarrowView","balloonPanelView","has","length","stop","_setSelectedAnnotations","view","narrowsidebar-detach-not-attached","high","getByView","_detachFromContainer","plugins","attach","Esc","_showBalloon","bodyCollection","add","removeEventListener","focus","isDirty","execute","low","preventDefault","_selectedAnnotations","ready","change:container","stopListening","target","detach","pin","_manuallyClosedAnnotationViews","requires","cancel","number","includes","remove","Sidebar","_updateBalloonPosition","hasDomSelection","locale","destroy","clear","blur","create","isVisible","setActiveAnnotation","_domEmitter","refresh"];var e_,n_;e_=t_,n_=241,function(t){for(;--t;)e_.push(e_.shift())}(++n_);const i_=function(t,e){return t_[t-=0]};class o_ extends _t{static get[i_("0x18")](){return[Fw,ww]}static get pluginName(){return i_("0x52")}constructor(t){super(t),this[i_("0x49")]=!1,this[i_("0x17")]=new Set,this._domEmitter=Object[i_("0x24")](Vl.DomEmitterMixin),this[i_("0x57")]=new Map,this[i_("0x41")](i_("0x2b"),null),this[i_("0x3b")]=null,this._selectedAnnotations=[],this[i_("0x31")]=new Vl.Collection,this[i_("0x33")]=Pi((()=>{this[i_("0x45")]()}),250,{leading:!1})}[i_("0x42")](){this.context[i_("0x4")][i_("0x4a")](ww).register(i_("0x38"),this),this[i_("0x8")]=new O(this[i_("0x29")][i_("0x20")]),this.balloonPanelView=new Uc(this.context[i_("0x20")]),this[i_("0x8")].attachToDom(),this[i_("0x8")][i_("0x9")](this[i_("0x58")])}[i_("0x5")](t){this[i_("0x3b")]=t;const e=this[i_("0x29")][i_("0x4")][i_("0x4a")](Fw),n=this[i_("0x58")];if(e._annotations=t,this[i_("0x49")])throw new Vl.CKEditorError(i_("0x40"),this);this[i_("0x49")]=!0,this[i_("0x3a")](e,"set:container",(()=>{this[i_("0x15")](),this[i_("0x3a")](e,i_("0x12"),(e=>{e[i_("0x3c")](),this[i_("0x5")](t)}))})),e._attachToContainer({viewClass:i_("0x3e"),spaceBetweenItems:5});const i=t=>{const i=new Jw(this[i_("0x29")][i_("0x20")]);e[i_("0x56")](t,i),this[i_("0x57")].set(t,i),i[i_("0x55")]("isDirty",i_("0x43"),i_("0x1a")).to(t[i_("0x5d")],i_("0xc"),i_("0x3f"),i_("0x5a")),i.on(i_("0xd"),(()=>{this[i_("0x17")].clear(),n[i_("0x32")][i_("0x2e")]!==t[i_("0x5d")]?(this._showBalloon(t),t[i_("0x5d")][i_("0x3d")][i_("0xb")](),this[i_("0x26")](t)):this[i_("0x26")](null)}))};for(const e of t)i(e);this[i_("0x3a")](t,i_("0x9"),((t,e)=>{i(e)})),this[i_("0x3a")](t,i_("0x1c"),((n,i,o)=>{this[i_("0x57")][i_("0x4a")](i)[i_("0x21")](),this[i_("0x57")][i_("0x35")](i),e[i_("0x46")]({removedAnnotation:i,previousAnnotation:t[i_("0x4a")](o-1),nextAnnotation:t[i_("0x4a")](o+1)}),i===this[i_("0x2b")]&&this[i_("0x26")](null)}),{priority:i_("0xe")}),this[i_("0x3a")](t,i_("0xb"),((t,e)=>{this[i_("0x26")](e)})),this[i_("0x3a")](t,i_("0x23"),(()=>{this[i_("0x26")](null)})),this[i_("0x27")][i_("0x3a")](document,i_("0x2f"),((t,e)=>{e[i_("0x36")]===Vl.keyCodes.esc&&n[i_("0x25")]&&(this[i_("0x17")].add(n.content[i_("0x2e")]),this._hideBalloon(),e[i_("0x4d")](),e[i_("0xf")]())})),this[i_("0x27")].listenTo(document,"mousedown",((t,i)=>{const o=i[i_("0x14")];n[i_("0x25")]&&n[i_("0x3d")][i_("0x2c")](o)||e[i_("0x5d")][i_("0x3d")][i_("0x2c")](o)||t[i_("0x4b")]||(this[i_("0x17")][i_("0x22")](),this[i_("0x44")](),this[i_("0x26")](null))}));const o=this[i_("0x29")][i_("0x39")]?this[i_("0x29")][i_("0x39")]:new Vl.Collection([this.context]);for(const t of o)this[i_("0x54")](t);this[i_("0x3a")](o,i_("0x9"),((t,e)=>{this[i_("0x3a")](e,i_("0x11"),(()=>{this._integrateWithEditorAnnotations(e)}))})),this[i_("0x3a")](o,i_("0x1c"),((t,e)=>{e.plugins[i_("0x59")](i_("0x2d"))&&this[i_("0x50")](e[i_("0x4")][i_("0x4a")]("EditorAnnotations"))})),window.addEventListener(i_("0x53"),this[i_("0x33")]),this._refreshPositioning()}[i_("0x26")](t){if(t===this[i_("0x2b")])return;const e=this[i_("0x29")][i_("0x4")][i_("0x4a")](i_("0x1d"));e[i_("0x28")]({blurredAnnotation:this[i_("0x2b")],activatedAnnotation:t,disableAnimationOnActivatedAnnotation:!0}),t&&e[i_("0x48")](t)?this[i_("0x7")](t):this._hideBalloon(),this[i_("0x2b")]=t}[i_("0x15")](){if(!this[i_("0x49")])throw new Vl.CKEditorError(i_("0x0"),this);this.setActiveAnnotation(null);const t=this[i_("0x29")][i_("0x4")][i_("0x4a")](i_("0x1d"));this[i_("0x44")](),Array.from(this[i_("0x57")].values(),(t=>t[i_("0x21")]())),this[i_("0x57")][i_("0x22")](),t[i_("0x3")](this[i_("0x3b")]),this[i_("0x13")](),this[i_("0x27")][i_("0x13")](),this.stopListening(this[i_("0x29")][i_("0x39")]);for(const t of Array.from(this[i_("0x31")]))this[i_("0x50")](t);window[i_("0xa")]("resize",this._refreshPositioningDebounced),this[i_("0x33")][i_("0x19")](),this._selectedAnnotations=[],this[i_("0x49")]=!1,this[i_("0x3b")]=null}[i_("0x21")](){this.isAttached&&this[i_("0x15")](),this[i_("0x8")][i_("0x47")]()}[i_("0x54")](t){const e=t[i_("0x4")][i_("0x4a")]("EditorAnnotations"),n=this[i_("0x29")][i_("0x4")][i_("0x4a")](Fw),i=this[i_("0x3b")],o=this[i_("0x58")],r=()=>{const t=e[i_("0x4c")]({activeAnnotation:this[i_("0x2b")],annotations:this.annotations});this._setSelectedAnnotations(t),this[i_("0x26")](t[0]||null)};this[i_("0x3a")](e,i_("0x28"),r),this.listenTo(e,"blur",((t,{isAnnotationTracked:e})=>{this[i_("0x2b")]&&e(this[i_("0x2b")])&&(this._setSelectedAnnotations([]),this[i_("0x26")](null))})),this[i_("0x3a")](e,i_("0x30"),(()=>{this._refreshPositioningDebounced()})),this[i_("0x3a")](i,"blur",(t=>{e[i_("0x1f")]()&&t[i_("0x5b")]()}),{priority:i_("0x1")}),this._domEmitter[i_("0x3a")](document,"mousedown",((t,i)=>{const s=i[i_("0x14")];o[i_("0x25")]&&o.element[i_("0x2c")](s)||n[i_("0x5d")].element[i_("0x2c")](s)||this[i_("0x2b")]&&e.hasDomSelection()&&(r(),t[i_("0x4b")]=!0)}),{priority:i_("0x1")}),this._editorAnnotations[i_("0x9")](e)}[i_("0x50")](t){t&&(this.stopListening(t),this[i_("0x31")].remove(t))}[i_("0x5c")](t){for(const e of this[i_("0x10")])t[i_("0x1b")](e)||this[i_("0x17")].delete(e[i_("0x5d")]);this._selectedAnnotations=t}[i_("0x45")](){const t=this[i_("0x58")];this[i_("0x3b")].refreshPositioning(),t[i_("0x25")]&&this._updateBalloonPosition()}[i_("0x7")](t){if(this[i_("0x17")].has(t[i_("0x5d")]))return;const e=this.balloonPanelView[i_("0x32")][i_("0x2e")];e!==t[i_("0x5d")]?(e&&this._detachListeners(e),this[i_("0x4f")](t.view),this[i_("0x58")].content[i_("0x22")](),this.balloonPanelView[i_("0x32")].add(t.view),this._updateBalloonPosition()):this[i_("0x1e")]()}[i_("0x1e")](){const t=this[i_("0x58")][i_("0x32")].first,e=this[i_("0x3b")][i_("0x2")](t);if(!this[i_("0x57")][i_("0x59")](e))return;const n=this._annotationToNarrowView.get(e)[i_("0x3d")],i=function(){const t=Uc[i_("0x51")];return[t[i_("0x4e")],t.northArrowSouthEast,t.southArrowNorth,t.northArrowSouth,t.southArrowNorthWest,t.northArrowSouthWest]}();this[i_("0x58")][i_("0x16")]({target:n,positions:i})}[i_("0x44")](){const t=this[i_("0x58")],e=t[i_("0x32")].first;e&&(this[i_("0x37")](e),t[i_("0x34")](),t[i_("0x32")][i_("0x22")]())}[i_("0x4f")](t){this[i_("0x3a")](t,i_("0x2a"),(()=>this[i_("0x1e")]())),this[i_("0x3a")](t,i_("0x6"),((e,n)=>{this._manuallyClosedAnnotationViews[i_("0x9")](t),this[i_("0x44")](),n()}))}[i_("0x37")](t){this[i_("0x13")](t)}}var r_=__webpack_require__(6610),s_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(r_.Z,s_);r_.Z.locals;const a_=["hasActive","left","has","_forceRefresh","_manuallyClosed","pluginName","editableElement","Esc","attach","get","width","hasView","getBoundingClientRect","editor","afterInit","focus","switchTo","_addAnnotationToBalloon","top","requires","inlineannotations-detach-not-attached","isFocused","focusTracker","updatePosition","context","change:height","_closeAnnotation","every","plugins","inlineannotations-not-allowed-with-context","_balloon","init","_getBalloonTargetForAnnotation","update","refresh","includes","_removeAnnotationFromBalloon","selection","getFirstRange","view","change:visibleView","_addedAnnotations","find","getClientRects","setActiveAnnotation","register","map","mousedown","inline","annotations","isAttached","editing","length","clear","domConverter","fromRect","showStack","_selectedAnnotations","viewRangeToDom","activeAnnotation","bottom","_setSelectedAnnotations","push","targetRect","remove","getByView","isActive","from","document","getOrderedSelectedAnnotations","add","detach","destroy","visibleView","right","inlineannotations-attach-already-attached","change:isFocused","target","keystrokes","listenTo"];var c_,l_;c_=a_,l_=405,function(t){for(;--t;)c_.push(c_.shift())}(++l_);const d_=function(t,e){return a_[t-=0]};class u_ extends gt{static get[d_("0xe")](){return[zk,Sl,ww]}static get[d_("0x0")](){return"InlineAnnotations"}constructor(t){super(t),t[d_("0x2e")][d_("0x22")].addObserver(pa),this.isAttached=!1,this.set(d_("0x36"),null),this.annotations=null,this._manuallyClosed=new Set,this[d_("0x19")]=t.plugins[d_("0x4")](Sl),this[d_("0x24")]=new Set,this._selectedAnnotations=[],this[d_("0x4e")]=!1}[d_("0x1a")](){const t=this[d_("0x8")][d_("0x17")][d_("0x4")](ww);t[d_("0x13")]===this[d_("0x8")]&&(t[d_("0x28")](d_("0x2b"),this),this[d_("0x8")][d_("0x49")].set("Esc",((t,e)=>{const n=this[d_("0x19")];if(this[d_("0x2d")]&&n[d_("0x44")]){const t=this[d_("0x2c")][d_("0x3c")](n.visibleView);this[d_("0x15")](t),e()}})))}[d_("0x9")](){const t=this[d_("0x8")][d_("0x17")].get(ww);t[d_("0x13")]===this.editor&&(t[d_("0x4b")]()||t[d_("0xb")]("inline"))}[d_("0x27")](t){t!==this[d_("0x36")]&&(this[d_("0x36")]&&(this.activeAnnotation[d_("0x3d")]=!1),t&&this[d_("0x8")].ui[d_("0x11")][d_("0x10")]&&(this[d_("0xc")](t,!0),t.isActive=!0),t||this._setSelectedAnnotations([]),this[d_("0x36")]=t)}[d_("0x3")](t){this.annotations=t;const e=this[d_("0x8")][d_("0x17")][d_("0x4")](ww),n=this._balloon;if(this[d_("0x2d")])throw new Vl.CKEditorError(d_("0x46"),this);if(e.context!==this[d_("0x8")])throw new Vl.CKEditorError(d_("0x18"),this);const i=this[d_("0x8")][d_("0x17")][d_("0x4")]("EditorAnnotations");this[d_("0x4a")](i,d_("0x1d"),function(){const t=i[d_("0x40")]({activeAnnotation:this.activeAnnotation,annotations:this[d_("0x2c")]});var e,n;!this._forceRefresh&&(e=t,n=this[d_("0x34")],e[d_("0x2f")]===n[d_("0x2f")]&&e[d_("0x16")]((t=>n[d_("0x1e")](t))))||(this[d_("0x4e")]=!1,this[d_("0x38")](t),this[d_("0x27")](t[0]||null))}.bind(this)),this[d_("0x4a")](i,"blur",((t,{isAnnotationTracked:e})=>{this[d_("0x36")]&&e(this.activeAnnotation)&&(this[d_("0x38")]([]),this[d_("0x27")](null))})),this[d_("0x4a")](this[d_("0x8")].ui.focusTracker,d_("0x47"),((t,e,n)=>{n||this.setActiveAnnotation(null)})),this[d_("0x4a")](t,d_("0x3b"),((t,e)=>{this[d_("0x1f")](e),e===this[d_("0x36")]&&this[d_("0x27")](null)})),this.listenTo(n,d_("0x23"),((e,i,o,r)=>{if(r&&this.stopListening(r),!o||!t.getByView(o))return;const s=t[d_("0x3c")](o);this[d_("0x4a")](o,d_("0x14"),(()=>{n[d_("0x12")]()})),this[d_("0x4a")](o,d_("0x2"),(()=>{this[d_("0x15")](s),this.editor[d_("0x2e")][d_("0x22")][d_("0xa")]()})),this.activeAnnotation!==s&&this[d_("0x27")](s)})),this.listenTo(this[d_("0x8")].ui,d_("0x1c"),(()=>{n.visibleView&&t[d_("0x3c")](n[d_("0x44")])&&n[d_("0x12")]()})),this[d_("0x4a")](this[d_("0x8")][d_("0x2e")].view[d_("0x3f")],d_("0x2a"),(()=>{this[d_("0x4e")]=!0,this[d_("0x4f")][d_("0x30")]()})),this.editor[d_("0x2e")][d_("0x22")].document[d_("0x20")][d_("0x1")]&&this[d_("0x8")][d_("0x2e")][d_("0x22")][d_("0xa")](),this[d_("0x2d")]=!0}[d_("0x42")](){if(!this[d_("0x2d")])throw new Vl.CKEditorError(d_("0xf"),this);this[d_("0x27")](null);for(const t of this._addedAnnotations)this[d_("0x1f")](t);this.stopListening(),this.isAttached=!1,this.annotations=null}[d_("0x43")](){this.isAttached&&this[d_("0x42")]()}[d_("0x38")](t){for(const e of this[d_("0x34")])t[d_("0x1e")](e)||this._manuallyClosed.delete(e);for(const e of this[d_("0x2c")])t[d_("0x1e")](e)||this[d_("0x1f")](e);if(this.editor.ui.focusTracker[d_("0x10")])for(const e of t)this[d_("0xc")](e);this[d_("0x34")]=t}[d_("0xc")](t,e){this[d_("0x4f")][d_("0x4d")](t)||(this._addedAnnotations[d_("0x4d")](t)||this[d_("0x19")][d_("0x6")](t[d_("0x22")])||(this[d_("0x24")].add(t),this[d_("0x19")].add({stackId:t[d_("0x22")].id,view:t.view,position:{target:()=>this[d_("0x1b")](t)}})),e&&this[d_("0x19")][d_("0x33")](t[d_("0x22")].id))}_getBalloonTargetForAnnotation(t){const e=t[d_("0x48")],n=this.editor[d_("0x2e")][d_("0x22")],i=n.document[d_("0x20")][d_("0x21")](),o=n[d_("0x31")][d_("0x35")](i);if(o.collapse(!0),e){if(e instanceof Vl.Rect)return e;let t=[];for(const n of e)t.push(...(r=n[d_("0x26")](),Array[d_("0x3e")](r)[d_("0x29")](DOMRect[d_("0x32")])));t=function(t){const e=[];let n=t[0];for(let r=1;rt[d_("0xd")]<=n[d_("0xd")]&&t[d_("0x37")]>=n[d_("0x37")]&&t.left<=n[d_("0x4c")]&&t[d_("0x45")]>=n.right))||t[0]}var r;return t[d_("0x3a")]||o}_removeAnnotationFromBalloon(t){this[d_("0x24")][d_("0x4d")](t)&&this[d_("0x19")][d_("0x6")](t[d_("0x22")])&&(this[d_("0x24")].delete(t),this[d_("0x19")][d_("0x3b")](t.view))}[d_("0x15")](t){this[d_("0x4f")][d_("0x41")](t),this[d_("0x1f")](t)}}var h_,m_,g_=["requires","pluginName"];h_=g_,m_=288,function(t){for(;--t;)h_.push(h_.shift())}(++m_);var p_=function(t,e){return g_[t-=0]};class f_ extends gt{static get[p_("0x0")](){return[yk,ew,dw,pw,Gw,o_,u_]}static get[p_("0x1")](){return"Comments"}}class b_ extends gt{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",cd]}init(){const t=this.editor,e=t.plugins.get("CloudServices"),n=e.token,i=e.uploadUrl;n&&(this._uploadGateway=t.plugins.get("CloudServicesCore").createUploadGateway(n,i),t.plugins.get(cd).createUploadAdapter=t=>new x_(this._uploadGateway,t))}}class x_{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then((t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",((t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class k_ extends gt{static get requires(){return[b_,"ImageUpload"]}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")||t.plugins.has("ImageInlineEditing")||(0,Vl.logWarning)("easy-image-image-feature-missing",t)}static get pluginName(){return"EasyImage"}}class w_ extends gt{static get requires(){return[Ab,rh,Db,lh,Hd,zb]}static get pluginName(){return"Essentials"}}const __=["text","hasAttribute","cssText","indexOf","join","then","ownerNode","trim","The editor stylesheet could not be found in the document. Check your webpack config – style-loader should use data-cke=true attribute for the editor stylesheet.","EDITOR_STYLES","warn","styleSheets","fetch","all",".ck-content",":root","push"];var A_,v_;A_=__,v_=283,function(t){for(;--t;)A_.push(A_.shift())}(++v_);const C_=function(t,e){return __[t-=0]};function y_(){const t=[],e=[];for(const n of document[C_("0x0")])if(n[C_("0xc")][C_("0x7")]("data-cke"))for(const i of n.cssRules)-1!==i.cssText[C_("0x9")](C_("0x3"))?t[C_("0x5")](i[C_("0x8")]):-1!==i.cssText[C_("0x9")](C_("0x4"))&&e[C_("0x5")](i[C_("0x8")]);return t.length||console[C_("0x10")](C_("0xe")),[...e,...t][C_("0xa")](" ")[C_("0xd")]()}class E_ extends ft{constructor(t){super(t),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(t={}){const e=this.editor,n=e.t,i=t.converterUrl||"https://pdf-converter.cke-cs.com/v1/convert/",o=t.dataCallback||(t=>t.getData()),r=e.plugins.get("ExportPdf"),s=t.token||r._token;return this.isBusy=!0,this.refresh(),function(t){if(!t)return new Promise((t=>t("")));const e=[];for(const n of t)C_("0xf")!==n?e[C_("0x5")](window[C_("0x1")](n)[C_("0xb")]((t=>t[C_("0x6")]()))):e[C_("0x5")](y_());return Promise[C_("0x2")](e)[C_("0xb")]((t=>t[C_("0xa")](" ").trim()))}(t.stylesheets||["EDITOR_STYLES"]).then((async n=>{const r={html:'\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t'+await o(e)+"\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t",css:n,options:t.converterOptions},a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/pdf",...s?{Authorization:s.value}:null,"x-cs-app-id":t.appID||"cke5"},body:JSON.stringify(r)};return window.fetch(i,a).then((t=>{if(200!==t.status)throw t;return t.blob()})).then((e=>{const n="function"==typeof t.fileName?t.fileName():t.fileName;this.o(e,n||"document.pdf")}))})).catch((t=>{throw e.plugins.get("Notification").showWarning(n("An error occurred while generating the PDF.")),t})).finally((()=>{this.isBusy=!1,this.refresh()}))}o(t,e){const n=document.createElement("a");n.href=window.URL.createObjectURL(t),n.download=e,n.click(),n.remove()}}var T_=__webpack_require__(6491),D_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(T_.Z,D_);T_.Z.locals;class S_ extends gt{static get pluginName(){return"ExportPdf"}static get requires(){return["CloudServices",_l]}init(){const t=this.editor,e=t.t,n=t.config.get("exportPdf")||{};t.commands.add("exportPdf",new E_(t)),t.ui.componentFactory.add("exportPdf",(i=>{const o=t.commands.get("exportPdf"),r=new j(i);r.set({label:e("Export to PDF"),icon:'',tooltip:!0}),r.bind("isOn","isEnabled").to(o,"isBusy","isEnabled"),r.extendTemplate({attributes:{class:[r.bindTemplate.if("isOn","ck-exportpdf_status-pending")]}});const s=new d;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-exportpdf__spinner-container"]},children:[{tag:"span",attributes:{class:["ck","ck-exportpdf__spinner"]}}]}),r.children.add(s),this.listenTo(r,"execute",(()=>{t.execute("exportPdf",n),t.editing.view.focus()})),r}));const i=t.plugins.get("CloudServices");if(!1===n.tokenUrl)this._token=null;else{if(n.tokenUrl)return i.registerTokenUrl(n.tokenUrl).then((t=>{this._token=t}));this._token=i.token}}}const I_=["map","data-cke","content","name","cssRules","push","suggestions","warn","resolvedOptions","createdAt","DateTimeFormat","hasAttribute","CommentsRepository","timezone","all","length","join","comments","author","timeZone","styleSheets","authorId","then","get","EDITOR_STYLES",".ck-content","has","getSuggestions","indexOf","getCommentThreads","cssText","plugins","Users"];var B_,M_;B_=I_,M_=120,function(t){for(;--t;)B_.push(B_.shift())}(++M_);const N_=function(t,e){return I_[t-=0]};function O_(){const t=[],e=[];for(const n of document[N_("0x20")])if(n.ownerNode[N_("0x17")](N_("0xd")))for(const i of n[N_("0x10")])-1!==i.cssText.indexOf(N_("0x4"))?t[N_("0x11")](i.cssText):-1!==i[N_("0x9")][N_("0x7")](":root")&&e[N_("0x11")](i.cssText);return t[N_("0x1b")]||console[N_("0x13")]("The editor stylesheet could not be found in the document. Check your webpack config – style-loader should use data-cke=true attribute for the editor stylesheet."),[...e,...t][N_("0x1c")](" ").trim()}function R_(t){const e=t.plugins[N_("0x5")](N_("0xb")),n=t[N_("0xa")].has(N_("0x18")),i=t[N_("0xa")][N_("0x5")]("TrackChanges"),o={};if(e&&n){const e=function(t){const e={};if(!t[N_("0x1b")])return e;for(const n of t)n[N_("0x1d")][N_("0xc")]((t=>{void 0===e[n.id]&&(e[n.id]=[]),e[n.id][N_("0x11")]({author:t[N_("0x1e")][N_("0xf")],content:t[N_("0xe")],created:t[N_("0x15")]})}));return e}(t[N_("0xa")][N_("0x2")](N_("0x18"))[N_("0x8")]({skipNotAttached:!0,skipEmpty:!0}));Object.keys(e).length&&(o[N_("0x1d")]=e)}if(e&&i){const e=t[N_("0xa")][N_("0x2")]("TrackChanges"),n=t.plugins[N_("0x2")]("Users"),i=function(t,e){const n={};if(!t[N_("0x1b")]||!e[N_("0x1b")])return n;for(const i of t)n[i.id]={author:e[N_("0x2")](i[N_("0x0")]).name,created:i.createdAt};return n}(e[N_("0x6")]({toJSON:!0}),n.users);Object.keys(i)[N_("0x1b")]&&(o.suggestions=i)}return(o[N_("0x12")]||o.comments)&&(o[N_("0x19")]=(new(Intl[N_("0x16")]))[N_("0x14")]()[N_("0x1f")]),o}class P_ extends ft{constructor(t){super(t),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(t={}){const e=this.editor,n=e.t,i=t.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",o=t.converterOptions||{},r=e.plugins.get("ExportWord"),s=t.token||r._token,a=!1!==o.auto_pagination,c=t.dataCallback||(t=>t.getData({pagination:a}));return this.isBusy=!0,this.refresh(),function(t){if(!t)return new Promise((t=>t("")));const e=[];for(const n of t)N_("0x3")!==n?e[N_("0x11")](window.fetch(n)[N_("0x1")]((t=>t.text()))):e[N_("0x11")](O_());return Promise[N_("0x1a")](e)[N_("0x1")]((t=>t[N_("0x1c")](" ").trim()))}(t.stylesheets||["EDITOR_STYLES"]).then((async n=>{const r=await c(e),a={html:''+r+"
",css:n,options:{...o,...R_(e)}},l={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...s?{Authorization:s.value}:null},body:JSON.stringify(a)};return window.fetch(i,l).then((t=>{if(200!==t.status)throw t;return t.blob()})).then((e=>{const n="function"==typeof t.fileName?t.fileName():t.fileName;this.o(e,n||"document.docx")}))})).catch((t=>{throw e.plugins.get("Notification").showWarning(n("An error occurred while generating the Word file.")),t})).finally((()=>{this.isBusy=!1,this.refresh()}))}o(t,e){const n=document.createElement("a");n.href=window.URL.createObjectURL(t),n.download=e,n.click(),n.remove()}}var L_=__webpack_require__(160),z_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(L_.Z,z_);L_.Z.locals;class F_ extends gt{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",_l]}init(){const t=this.editor,e=t.t,n=t.config.get("exportWord")||{};t.commands.add("exportWord",new P_(t)),t.ui.componentFactory.add("exportWord",(i=>{const o=t.commands.get("exportWord"),r=new j(i);r.set({label:e("Export to Word"),icon:'',tooltip:!0}),r.bind("isOn","isEnabled").to(o,"isBusy","isEnabled"),r.extendTemplate({attributes:{class:[r.bindTemplate.if("isOn","ck-exportword_status-pending")]}});const s=new d;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-exportword__spinner-container"]},children:[{tag:"span",attributes:{class:["ck","ck-exportword__spinner"]}}]}),r.children.add(s),this.listenTo(r,"execute",(()=>{t.execute("exportWord",n),t.editing.view.focus()})),r}));const i=t.plugins.get("CloudServices");if(!1===n.tokenUrl)this._token=null;else{if(n.tokenUrl)return i.registerTokenUrl(n.tokenUrl).then((t=>{this._token=t}));this._token=i.token}}}class j_ extends ft{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=(0,Vl.first)(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>V_(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,i=t.value;e.change((t=>{const o=Array.from(n.selection.getSelectedBlocks()).filter((t=>V_(t,i,e.schema)));for(const e of o)e.is("element",i)||t.rename(e,i)}))}}function V_(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const U_="paragraph";class H_ extends gt{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.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[Ub]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const i of e)"paragraph"!==i.model&&(t.model.schema.register(i.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(i),n.push(i.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new j_(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,i)=>{const o=t.model.document.selection.getFirstPosition().parent;n.some((t=>o.is("element",t.model)))&&!o.is("element",U_)&&0===o.childCount&&i.writer.rename(o,U_)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:Vl.priorities.get("low")+1})}}var q_=__webpack_require__(3230),W_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(q_.Z,W_);q_.Z.locals;class G_ extends gt{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),i=e("Choose heading"),o=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Vl.Collection,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new Al({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(c,"value"),e.model.set("commandName","paragraph"),l.push(c)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=Bc(e);return Oc(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:o}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",c,"value",((t,e)=>{const n=t||e&&"paragraph";return"boolean"==typeof n?i:r[n]?r[n]:i})),this.listenTo(d,"execute",(e=>{const{commandName:n,commandValue:i}=e.source;t.execute(n,i?{value:i}:void 0),t.editing.view.focus()})),d}))}}class Z_ extends gt{static get requires(){return[H_,G_]}static get pluginName(){return"Heading"}}new Set(["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"]);function K_(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot()])}function $_(t,e){const n=t.plugins.get("ImageUtils"),i=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!i)return o(t);return("block"==t.getStyle("display")||t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:o(t)};function o(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function Y_(t,e){const n=(0,Vl.first)(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class J_ extends gt{static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null){const i=this.editor,o=i.model,r=o.document.selection;n=Q_(i,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)o.schema.checkAttribute(n,e)||delete t[e];return o.change((i=>{const r=i.createElement(n,t);return o.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:!e&&"imageInline"!=n}),r.parent?r:null}))}getClosestSelectedImageWidget(t){const e=t.getFirstPosition();if(!e)return null;const n=t.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=e.parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){const n=Q_(t,e);if("imageBlock"==n){const n=function(t,e){const n=Ff(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return Of(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&Nf(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}}function Q_(t,e,n){const i=t.model.schema,o=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===o?"imageInline":"block"===o?"imageBlock":e.is("selection")?Y_(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const X_=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class tA extends gt{static get requires(){return[Ab,J_,zb,Ud]}static get pluginName(){return"AutoImage"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Es.fromPosition(t.start);n.stickiness="toPrevious";const i=Es.fromPosition(t.end);i.stickiness="toNext",e.once("change:data",(()=>{this._embedImageBetweenPositions(n,i),n.detach(),i.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(Vl.global.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedImageBetweenPositions(t,e){const n=this.editor,i=new Wo(t,e),o=i.getWalker({ignoreElementEnd:!0}),r=Object.fromEntries(n.model.document.selection.getAttributes()),s=this.editor.plugins.get("ImageUtils");let a="";for(const t of o)t.item.is("$textProxy")&&(a+=t.item.data);a=a.trim(),a.match(X_)?(this._positionToInsert=Es.fromPosition(t),this._timeoutId=Vl.global.window.setTimeout((()=>{n.commands.get("insertImage").isEnabled?(n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert.toPosition()),s.insertImage({...r,src:a},e),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()):i.detach()}),100)):i.detach()}}class eA extends ft{refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled&&t.hasAttribute("alt")?this.value=t.getAttribute("alt"):this.value=!1}execute(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i=e.model,o=n.getClosestSelectedImageElement(i.document.selection);i.change((e=>{e.setAttribute("alt",t.newValue,o)}))}}class nA extends gt{static get requires(){return[J_]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new eA(this.editor))}}var iA=__webpack_require__(6831),oA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(iA.Z,oA);iA.Z.locals;var rA=__webpack_require__(1590),sA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(rA.Z,sA);rA.Z.locals;class aA extends d{constructor(t){super(t);const n=this.locale.t;this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(n("Save"),mc.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),mc.cancel,"ck-button-cancel","cancel"),this._focusables=new r,this._focusCycler=new lt({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]}),e(this)}render(){super.render(),this.keystrokes.listenTo(this.element),n({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,i){const o=new j(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createLabeledInputView(){const t=this.locale.t,e=new bl(this.locale,xl);return e.label=t("Text alternative"),e}}function cA(t){const e=t.editing.view,n=Uc.defaultPositions,i=t.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class lA extends gt{static get requires(){return[Sl]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const i=t.commands.get("imageTextAlternative"),o=new j(n);return o.set({label:e("Change image text alternative"),icon:mc.lowVision,tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>{this._showForm()})),o}))}_createForm(){const e=this.editor,n=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new aA(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",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(e.ui,"update",(()=>{i.getClosestSelectedImageWidget(n.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=cA(t);e.updatePosition(n)}}(e):this._hideForm(!0)})),t({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:cA(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class dA extends gt{static get requires(){return[nA,lA]}static get pluginName(){return"ImageTextAlternative"}}function uA(t,e){return t=>{t.on(`attribute:srcset:${e}`,n)};function n(e,n,i){if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(null===n.attributeNewValue){const t=n.attributeOldValue;t.data&&(o.removeAttribute("srcset",s),o.removeAttribute("sizes",s),t.width&&o.removeAttribute("width",s))}else{const t=n.attributeNewValue;t.data&&(o.setAttribute("srcset",t.data,s),o.setAttribute("sizes","100vw",s),t.width&&o.setAttribute("width",t.width,s))}}}function hA(t,e,n){return t=>{t.on(`attribute:${n}:${e}`,i)};function i(e,n,i){if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);o.setAttribute(n.attributeKey,n.attributeNewValue||"",s)}}class mA extends xi{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class gA extends ft{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&(0,Vl.logWarning)("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&(0,Vl.logWarning)("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(t){const e=(0,Vl.toArray)(t.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);i.insertImage({...t,...o},e)}else i.insertImage({...t,...o})}))}}class pA extends ft{refresh(){const t=this.editor.plugins.get("ImageUtils"),e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(e),this.value=this.isEnabled?e.getAttribute("src"):null}execute(t){const e=this.editor.model.document.selection.getSelectedElement();this.editor.model.change((n=>{n.setAttribute("src",t.source,e),n.removeAttribute("srcset",e),n.removeAttribute("sizes",e)}))}}class fA extends gt{static get requires(){return[J_]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(mA),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new gA(t),i=new pA(t);t.commands.add("insertImage",n),t.commands.add("replaceImageSource",i),t.commands.add("imageInsert",n)}}class bA extends ft{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),i=n.getClosestSelectedImageElement(e.document.selection),o=Object.fromEntries(i.getAttributes());return o.src||o.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(i))),s=n.insertImage(o,e.createSelection(i,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:i})}return{oldElement:i,newElement:s}})):null}}class xA extends gt{static get requires(){return[fA,J_,Ef]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new bA(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>K_(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>i.toImageWidget(K_(n),n,e("image widget"))}),n.for("downcast").add(hA(i,"imageBlock","src")).add(hA(i,"imageBlock","alt")).add(uA(i,"imageBlock")),n.for("upcast").elementToElement({view:$_(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)}).add(function(t){return t=>{t.on("element:figure",e)};function e(e,n,i){if(!i.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const o=t.findViewImgElement(n.viewItem);if(!o||!i.consumable.test(o,{name:!0}))return;i.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=i.convertItem(o,n.modelCursor),s=(0,Vl.first)(r.modelRange.getItems());s?(i.convertChildren(n.viewItem,s),i.updateConversionResult(s,n)):i.consumable.revert(n.viewItem,{name:!0,classes:"image"})}}(i))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===Y_(e.schema,c)){const t=new fa(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var kA=__webpack_require__(9048),wA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(kA.Z,wA);kA.Z.locals;class _A extends gt{static get requires(){return[xA,eb,dA]}static get pluginName(){return"ImageBlock"}}class AA extends gt{static get requires(){return[fA,J_,Ef]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new bA(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>i.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(hA(i,"imageInline","src")).add(hA(i,"imageInline","alt")).add(uA(i,"imageInline")),n.for("upcast").elementToElement({view:$_(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:null)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils");this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===Y_(e.schema,c)){const t=new fa(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,i.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}}))}}class vA extends gt{static get requires(){return[AA,eb,dA]}static get pluginName(){return"ImageInline"}}class CA extends gt{static get requires(){return[_A,vA]}static get pluginName(){return"Image"}}class yA extends gt{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[J_]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class EA extends ft{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils");if(!t.plugins.has(xA))return this.isEnabled=!1,void(this.value=!1);const n=t.model.document.selection,i=n.getSelectedElement();if(!i){const t=e.getCaptionFromModelSelection(n);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(i),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(i):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageCaptionEditing");let o=n.getSelectedElement();const r=i._getSavedCaption(o);this.editor.plugins.get("ImageUtils").isInlineImage(o)&&(this.editor.execute("imageTypeBlock"),o=n.getSelectedElement());const s=r||t.createElement("caption");t.append(s,o),e&&t.setSelection(s,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,i=e.plugins.get("ImageCaptionEditing"),o=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=o.getCaptionFromImageModelElement(s):(r=o.getCaptionFromModelSelection(n),s=r.parent),i._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class TA extends gt{static get requires(){return[J_,yA]}static get pluginName(){return"ImageCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new EA(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils"),o=t.t;t.conversion.for("upcast").elementToElement({view:t=>i.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:i})=>{if(!n.isBlockImage(t.parent))return null;const r=i.createEditableElement("figcaption");i.setCustomProperty("imageCaption",!0,r),yt({view:e,element:r,text:o("Enter image caption"),keepOnFocus:!0});const s=t.parent.getAttribute("alt");return zf(r,i,{label:s?o("Caption for image: %0",[s]):o("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),i=t.commands.get("imageTypeInline"),o=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:i,newElement:o}=t.return;if(!i)return;if(e.isBlockImage(i)){const t=n.getCaptionFromImageModelElement(i);if(t)return void this._saveCaption(o,t)}const r=this._getSavedCaption(i);r&&this._saveCaption(o,r)};i&&this.listenTo(i,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Co.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}_registerCaptionReconversion(){const t=this.editor,e=t.model,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils");e.document.on("change:data",(()=>{const o=e.document.differ.getChanges();for(const e of o){if("alt"!==e.attributeKey)continue;const o=e.range.start.nodeAfter;if(n.isBlockImage(o)){const e=i.getCaptionFromImageModelElement(o);if(!e)return;t.editing.reconvertItem(e)}}}))}}class DA extends gt{static get requires(){return[yA]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),i=t.t;t.ui.componentFactory.add("toggleImageCaption",(o=>{const r=t.commands.get("toggleImageCaption"),s=new j(o);return s.set({icon:mc.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>i(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const i=n.getCaptionFromModelSelection(t.model.document.selection);if(i){const n=t.editing.mapper.toViewElement(i);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}t.editing.view.focus()})),s}))}}var SA=__webpack_require__(8662),IA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(SA.Z,IA);SA.Z.locals;class BA extends gt{static get requires(){return[TA,DA]}static get pluginName(){return"ImageCaption"}}function MA(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function NA(t){return new Promise(((e,n)=>{const i=t.getAttribute("src");fetch(i).then((t=>t.blob())).then((t=>{const n=OA(t,i),o=n.replace("image/",""),r=new File([t],`image.${o}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const i=Vl.global.document.createElement("img");i.addEventListener("load",(()=>{const t=Vl.global.document.createElement("canvas");t.width=i.width,t.height=i.height;t.getContext("2d").drawImage(i,0,0),t.toBlob((t=>t?e(t):n()))})),i.addEventListener("error",(()=>n())),i.src=t}))}(t).then((e=>{const n=OA(e,t),i=n.replace("image/","");return new File([e],`image.${i}`,{type:n})}))}(i).then(e).catch(n):n(t)))}))}function OA(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class RA extends gt{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const i=new dd(n),o=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=MA(r);return i.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),i.buttonView.set({label:e("Insert image"),icon:mc.image,tooltip:!0}),i.buttonView.bind("isEnabled").to(o),i.on("done",((e,n)=>{const i=Array.from(n).filter((t=>s.test(t.type)));i.length&&(t.execute("uploadImage",{file:i}),t.editing.view.focus())})),i};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var PA=__webpack_require__(5870),LA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(PA.Z,LA);PA.Z.locals;var zA=__webpack_require__(9899),FA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(zA.Z,FA);zA.Z.locals;var jA=__webpack_require__(9825),VA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(jA.Z,VA);jA.Z.locals;class UA extends gt{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",((...t)=>this.uploadStatusChange(...t))),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",((...t)=>this.uploadStatusChange(...t)))}uploadStatusChange(t,e,n){const i=this.editor,o=e.item,r=o.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=i.plugins.get("ImageUtils"),a=i.plugins.get(cd),c=r?e.attributeNewValue:null,l=this.placeholder,d=i.editing.mapper.toViewElement(o),u=n.writer;if("reading"==c)return HA(d,u),void qA(s,l,d,u);if("uploading"==c){const t=a.loaders.get(r);return HA(d,u),void(t?(WA(d,u),function(t,e,n,i){const o=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),o),n.on("change:uploadedPercent",((t,e,n)=>{i.change((t=>{t.setStyle("width",n+"%",o)}))}))}(d,u,t,i.editing.view),function(t,e,n,i){if(i.data){const o=t.findViewImgElement(e);n.setAttribute("src",i.data,o)}}(s,d,u,t)):qA(s,l,d,u))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),i),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(i))))}),3e3)}(d,u,i.editing.view),function(t,e){ZA(t,e,"progressBar")}(d,u),WA(d,u),function(t,e){e.removeClass("ck-appear",t)}(d,u)}}function HA(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function qA(t,e,n,i){n.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",n);const o=t.findViewImgElement(n);o.getAttribute("src")!==e&&i.setAttribute("src",e,o),GA(n,"placeholder")||i.insert(i.createPositionAfter(o),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(i))}function WA(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),ZA(t,e,"placeholder")}function GA(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function ZA(t,e,n){const i=GA(t,n);i&&e.remove(e.createRangeOn(i))}class KA extends ft{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=(0,Vl.toArray)(t.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,o,e)}else this._uploadImage(t,o)}))}_uploadImage(t,e,n){const i=this.editor,o=i.plugins.get(cd).createLoader(t),r=i.plugins.get("ImageUtils");o&&r.insertImage({...e,uploadId:o.id},n)}}class $A extends gt{static get requires(){return[cd,_l,Ef,J_]}static get pluginName(){return"ImageUploadEditing"}constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,i=t.plugins.get(cd),o=t.plugins.get("ImageUtils"),r=MA(t.config.get("image.upload.types")),s=new KA(t);t.commands.add("uploadImage",s),t.commands.add("imageUpload",s),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(i=n.dataTransfer,Array.from(i.types).includes("text/html")&&""!==i.getData("text/html"))return;var i;const o=Array.from(n.dataTransfer.files).filter((t=>!!t&&r.test(t.type)));o.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:o})}))})))})),this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(o,t.item)&&!t.item.getAttribute("uploadProcessed"))).map((t=>({promise:NA(t.item),imageElement:t.item})));if(!r.length)return;const s=new fa(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=i.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),o=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of YA(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=i.loaders.get(t);n&&(r?o.has(t)||n.abort():(o.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const i=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",i.default,e),this._parseAndSetSrcsetAttributeOnImage(i,e,t)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,i=e.locale.t,o=e.plugins.get(cd),r=e.plugins.get(_l),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const i=t.upload(),o=a.get(t.id);if(Vl.env.isSafari){const t=e.editing.mapper.toViewElement(o),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const i=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=i}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",o)})),i})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const i=a.get(t.id);n.setAttribute("uploadStatus","complete",i),this.fire("uploadComplete",{data:e,imageElement:i})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),o.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let i=0;const o=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return i=Math.max(i,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");""!=o&&n.setAttribute("srcset",{data:o,width:i},e)}}function YA(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class JA extends gt{static get pluginName(){return"ImageUpload"}static get requires(){return[$A,RA,UA]}}var QA=__webpack_require__(5150),XA={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(QA.Z,XA);QA.Z.locals;class tv extends d{constructor(t,e={}){super(t);const n=this.bindTemplate;this.set("class",e.class||null),this.children=this.createCollection(),e.children&&e.children.forEach((t=>this.children.add(t))),this.set("_role",null),this.set("_ariaLabelledBy",null),e.labelView&&this.set({_role:"group",_ariaLabelledBy:e.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}var ev=__webpack_require__(9292),nv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(ev.Z,nv);ev.Z.locals;class iv extends d{constructor(t,e){super(t);const{insertButtonView:n,cancelButtonView:i}=this._createActionButtons(t);if(this.insertButtonView=n,this.cancelButtonView=i,this.set("imageURLInputValue",""),this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this._focusables=new r,this._focusCycler=new lt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.set("_integrations",new Vl.Collection),e)for(const[t,n]of Object.entries(e))"insertImageViaUrl"===t&&(n.fieldView.bind("value").to(this,"imageURLInputValue",(t=>t||"")),n.fieldView.on("input",(()=>{this.imageURLInputValue=n.fieldView.element.value.trim()}))),n.name=t,this._integrations.add(n);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:"-1"},children:[...this._integrations,new tv(t,{children:[this.insertButtonView,this.cancelButtonView],class:"ck-image-insert-form__action-row"})]})}render(){super.render(),n({view:this});const t=[...this._integrations,this.insertButtonView,this.cancelButtonView];t.forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e),this.listenTo(t[0].element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}getIntegration(t){return this._integrations.find((e=>e.name===t))}_createActionButtons(t){const e=t.t,n=new j(t),i=new j(t);return n.set({label:e("Insert"),icon:mc.check,class:"ck-button-save",type:"submit",withText:!0,isEnabled:this.imageURLInputValue}),i.set({label:e("Cancel"),icon:mc.cancel,class:"ck-button-cancel",withText:!0}),n.bind("isEnabled").to(this,"imageURLInputValue",(t=>!!t)),n.delegate("execute").to(this,"submit"),i.delegate("execute").to(this,"cancel"),{insertButtonView:n,cancelButtonView:i}}focus(){this._focusCycler.focusFirst()}}function ov(t){const e=t.t,n=new bl(t,xl);return n.set({label:e("Insert image via URL")}),n.fieldView.placeholder="https://example.com/image.png",n}class rv extends gt{static get pluginName(){return"ImageInsertUI"}init(){const t=this.editor,e=t=>this._createDropdownView(t);t.ui.componentFactory.add("insertImage",e),t.ui.componentFactory.add("imageInsert",e)}_createDropdownView(t){const e=this.editor,n=t.t,i=e.commands.get("uploadImage"),o=e.commands.get("insertImage");this.dropdownView=Bc(t,i?at:void 0);const r=this.dropdownView.buttonView,s=this.dropdownView.panelView;if(r.set({label:n("Insert image"),icon:mc.image,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-image-insert__panel"}}),i){const t=this.dropdownView.buttonView;t.actionView=e.ui.componentFactory.create("uploadImage"),t.actionView.extendTemplate({attributes:{class:"ck ck-button ck-splitbutton__action"}})}return this._setUpDropdown(i||o)}_setUpDropdown(t){const e=this.editor,n=e.t,i=this.dropdownView,o=i.panelView,r=this.editor.plugins.get("ImageUtils"),s=e.commands.get("replaceImageSource");let a;function c(){e.editing.view.focus(),i.isOpen=!1}return i.bind("isEnabled").to(t),i.once("change:isOpen",(()=>{a=new iv(e.locale,function(t){const e=t.config.get("image.insert.integrations"),n=t.plugins.get("ImageInsertUI"),i={insertImageViaUrl:ov(t.locale)};if(!e)return i;if(e.find((t=>"openCKFinder"===t))&&t.ui.componentFactory.has("ckfinder")){const e=t.ui.componentFactory.create("ckfinder");e.set({withText:!0,class:"ck-image-insert__ck-finder-button"}),e.delegate("execute").to(n,"cancel"),i.openCKFinder=e}return e.reduce(((e,n)=>(i[n]?e[n]=i[n]:t.ui.componentFactory.has(n)&&(e[n]=t.ui.componentFactory.create(n)),e)),{})}(e)),a.delegate("submit","cancel").to(i),o.children.add(a)})),i.on("change:isOpen",(()=>{const t=e.model.document.selection.getSelectedElement(),o=a.insertButtonView,c=a.getIntegration("insertImageViaUrl");i.isOpen&&(r.isImage(t)?(a.imageURLInputValue=s.value,o.label=n("Update"),c.label=n("Update image URL")):(a.imageURLInputValue="",o.label=n("Insert"),c.label=n("Insert image via URL")))}),{priority:"low"}),this.delegate("cancel").to(i),i.on("submit",(()=>{c(),function(){const t=e.model.document.selection.getSelectedElement();r.isImage(t)?e.execute("replaceImageSource",{source:a.imageURLInputValue}):e.execute("insertImage",{source:a.imageURLInputValue})}()})),i.on("cancel",(()=>{c()})),i}}class sv extends gt{static get pluginName(){return"ImageInsertViaUrl"}static get requires(){return[rv]}}class av extends gt{static get pluginName(){return"ImageInsert"}static get requires(){return[JA,sv,rv]}}class cv extends ft{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);this.isEnabled=!!e,e&&e.hasAttribute("width")?this.value={width:e.getAttribute("width"),height:null}:this.value=null}execute(t){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(n.document.selection);this.value={width:t.width,height:null},i&&n.change((e=>{e.setAttribute("width",t.width,i)}))}}class lv extends gt{static get requires(){return[J_]}static get pluginName(){return"ImageResizeEditing"}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const t=this.editor,e=new cv(t);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:"width"}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:"width"})}_registerConverters(t){const e=this.editor;e.conversion.for("downcast").add((e=>e.on(`attribute:width:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=n.writer,o=n.mapper.toViewElement(e.item);null!==e.attributeNewValue?(i.setStyle("width",e.attributeNewValue,o),i.addClass("image_resized",o)):(i.removeStyle("width",o),i.removeClass("image_resized",o))})))),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:t=>t.getStyle("width")}})}}const dv={small:mc.objectSizeSmall,medium:mc.objectSizeMedium,large:mc.objectSizeLarge,original:mc.objectSizeFull};class uv extends gt{static get requires(){return[lv]}static get pluginName(){return"ImageResizeButtons"}constructor(t){super(t),this._resizeUnit=t.config.get("image.resizeUnit")}init(){const t=this.editor,e=t.config.get("image.resizeOptions"),n=t.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const t of e)this._registerImageResizeButton(t);this._registerImageResizeDropdown(e)}_registerImageResizeButton(t){const e=this.editor,{name:n,value:i,icon:o}=t,r=i?i+this._resizeUnit:null;e.ui.componentFactory.add(n,(n=>{const i=new j(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!dv[o])throw new Vl.CKEditorError("imageresizebuttons-missing-icon",e,t);return i.set({label:a,icon:dv[o],tooltip:a,isToggleable:!0}),i.bind("isEnabled").to(this),i.bind("isOn").to(s,"value",hv(r)),this.listenTo(i,"execute",(()=>{e.execute("resizeImage",{width:r})})),i}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,i=t.find((t=>!t.value)),o=o=>{const r=e.commands.get("resizeImage"),s=Bc(o,ot),a=s.buttonView;return a.set({tooltip:n("Resize image"),commandValue:i.value,icon:dv.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button"}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(i))),s.bind("isOn").to(r),s.bind("isEnabled").to(this),Oc(s,(()=>this._getResizeDropdownListItemDefinitions(t,r)),{ariaLabel:n("Image resize list")}),this.listenTo(s,"execute",(t=>{e.execute(t.source.commandName,{width:t.source.commandValue}),e.editing.view.focus()})),s};e.ui.componentFactory.add("resizeImage",o),e.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(t,e){const n=this.editor.t;return t.label?t.label:e?t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const n=new Vl.Collection;return t.map((t=>{const i=t.value?t.value+this._resizeUnit:null,o={type:"button",model:new Al({commandName:"resizeImage",commandValue:i,label:this._getOptionLabelValue(t),withText:!0,icon:null})};o.model.bind("isOn").to(e,"value",hv(i)),n.add(o)})),n}}function hv(t){return e=>null===t&&e===t||e&&e.width===t}const mv=/(image|image-inline)/,gv="image_resized";class pv extends gt{static get requires(){return[mb]}static get pluginName(){return"ImageResizeHandles"}init(){const t=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(t),this._setupResizerCreator()}_setupResizerCreator(){const t=this.editor,e=t.editing.view;e.addObserver(mA),this.listenTo(e.document,"imageLoaded",((n,i)=>{if(!i.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const o=t.editing.view.domConverter,r=o.domToView(i.target).findAncestor({classes:mv});let s=this.editor.plugins.get(mb).getResizerByViewElement(r);if(s)return void s.redraw();const a=t.editing.mapper,c=a.toModelElement(r);s=t.plugins.get(mb).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:c,viewElement:r,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>o.mapViewToDom(a.toViewElement(c.parent)),isCentered(){const t=c.getAttribute("imageStyle");return!t||"block"==t||"alignCenter"==t},onCommit(n){e.change((t=>{t.removeClass(gv,r)})),t.execute("resizeImage",{width:n})}}),s.on("updateSize",(()=>{r.hasClass(gv)||e.change((t=>{t.addClass(gv,r)}))})),s.bind("isEnabled").to(this)}))}}var fv=__webpack_require__(1043),bv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(fv.Z,bv);fv.Z.locals;class xv extends gt{static get requires(){return[lv,pv,uv]}static get pluginName(){return"ImageResize"}}class kv extends ft{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils");n.change((e=>{const o=t.value;let r=i.getClosestSelectedImageElement(n.document.selection);o&&this.shouldConvertImageType(o,r)&&(this.editor.execute(i.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=i.getClosestSelectedImageElement(n.document.selection)),!o||this._styles.get(o).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",o,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:wv,objectInline:_v,objectLeft:Av,objectRight:vv,objectCenter:Cv,objectBlockLeft:yv,objectBlockRight:Ev}=mc,Tv={get inline(){return{name:"inline",title:"In line",icon:_v,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Av,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:yv,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Cv,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:vv,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Ev,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Cv,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:vv,modelElements:["imageBlock"],className:"image-style-side"}}},Dv={full:wv,left:yv,right:Ev,center:Cv,inlineLeft:Av,inlineRight:vv,inline:_v},Sv=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function Iv(t){(0,Vl.logWarning)("image-style-configuration-definition-invalid",t)}const Bv={normalizeStyles:function(t){const e=(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?Tv[t]?{...Tv[t]}:{name:t}:function(t,e){const n={...e};for(const i in t)Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);return n}(Tv[t.name],t);"string"==typeof t.icon&&(t.icon=Dv[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:i,name:o}=t;if(!(i&&i.length&&o))return Iv({style:t}),!1;{const o=[e?"imageBlock":null,n?"imageInline":null];if(!i.some((t=>o.includes(t))))return(0,Vl.logWarning)("image-style-missing-dependency",{style:t,missingPlugins:i.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)));return e},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...Sv]:[]},warnInvalidStyle:Iv,DEFAULT_OPTIONS:Tv,DEFAULT_ICONS:Dv,DEFAULT_DROPDOWN_DEFINITIONS:Sv};function Mv(t,e){for(const n of e)if(n.name===t)return n}class Nv extends gt{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[J_]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=Bv,n=this.editor,i=n.plugins.has("ImageBlockEditing"),o=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(i,o)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:o}),this._setupConversion(i,o),this._setupPostFixer(),n.commands.add("imageStyle",new kv(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,i=n.model.schema,o=function(t){return(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=Mv(n.attributeNewValue,t),r=Mv(n.attributeOldValue,t),s=i.mapper.toViewElement(n.item),a=i.writer;r&&a.removeClass(r.className,s),o&&a.addClass(o.className,s)}}(this.normalizedStyles),r=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,i)=>{if(!n.modelRange)return;const o=n.viewItem,r=(0,Vl.first)(n.modelRange.getItems());if(r&&i.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])i.consumable.consume(o,{classes:t.className})&&i.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",o),n.data.downcastDispatcher.on("attribute:imageStyle",o),t&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),e&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(J_),i=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let o=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=i.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),o=!0)}return o}))}}var Ov=__webpack_require__(4622),Rv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Ov.Z,Rv);Ov.Z.locals;class Pv extends gt{static get requires(){return[Nv]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=Lv(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const i=Lv([...e.filter(h.Z),...Bv.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of i)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(i=>{let o;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>zv(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(o=e),e}));s.length!==c.length&&Bv.warnInvalidStyle({dropdown:t});const l=Bc(i,at),d=l.buttonView,u=d.arrowView;return Mc(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:Fv(a,o.label),class:null,tooltip:!0}),u.unbind("label"),u.set({label:a}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(Pe);return e<0?o.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(Pe);return Fv(a,e<0?o.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(Pe))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(Pe)?"ck-splitbutton_flatten":null)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:o.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(Pe))),this.listenTo(l,"execute",(()=>{this.editor.editing.view.focus()})),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(zv(e),(n=>{const i=this.editor.commands.get("imageStyle"),o=new j(n);return o.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>t===e)),o.on("execute",this._executeCommand.bind(this,e)),o}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function Lv(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function zv(t){return`imageStyle:${t}`}function Fv(t,e){return(t?t+": ":"")+e}class jv extends gt{static get requires(){return[Nv,Pv]}static get pluginName(){return"ImageStyle"}}class Vv extends gt{static get requires(){return[ib,J_]}static get pluginName(){return"ImageToolbar"}afterInit(){const t=this.editor,e=t.t,n=t.plugins.get(ib),i=t.plugins.get("ImageUtils");var o;n.register("image",{ariaLabel:e("Image toolbar"),items:(o=t.config.get("image.toolbar")||[],o.map((t=>(0,h.Z)(t)?t.name:t))),getRelatedElement:t=>i.getClosestSelectedImageWidget(t)})}}class Uv extends gt{static get requires(){return[fA,J_]}static get pluginName(){return"PictureEditing"}afterInit(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),t.plugins.has("ImageInlineEditing")&&t.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){const t=this.editor,e=t.conversion,n=t.plugins.get("ImageUtils");e.for("upcast").add(function(t){const e=["srcset","media","type","sizes"];return t=>{t.on("element:picture",n)};function n(n,i,o){const r=i.viewItem;if(!o.consumable.test(r,{name:!0}))return;const s=new Map;for(const t of r.getChildren())if(t.is("element","source")){const n={};for(const i of e)t.hasAttribute(i)&&o.consumable.test(t,{attributes:i})&&(n[i]=t.getAttribute(i));Object.keys(n).length&&s.set(t,n)}const a=t.findViewImgElement(r);if(!a)return;let c=i.modelCursor.parent;if(!c.is("element","imageBlock")){const t=o.convertItem(a,i.modelCursor);i.modelRange=t.modelRange,i.modelCursor=t.modelCursor,c=(0,Vl.first)(t.modelRange.getItems())}o.consumable.consume(r,{name:!0});for(const[t,e]of s)o.consumable.consume(t,{attributes:Object.keys(e)});s.size&&o.writer.setAttribute("sources",Array.from(s.values()),c),o.convertChildren(r,c)}}(n)),e.for("downcast").add(function(t){return t=>{t.on("attribute:sources:imageBlock",e),t.on("attribute:sources:imageInline",e)};function e(e,n,i){if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);if(n.attributeNewValue&&n.attributeNewValue.length){const t=o.createContainerElement("picture",null,n.attributeNewValue.map((t=>o.createEmptyElement("source",t)))),e=[];let i=s.parent;for(;i&&i.is("attributeElement");){const t=i.parent;o.unwrap(o.createRangeOn(s),i),e.unshift(i),i=t}o.insert(o.createPositionBefore(s),t),o.move(o.createRangeOn(s),o.createPositionAt(t,"end"));for(const n of e)o.wrap(o.createRangeOn(t),n)}else if(s.parent.is("element","picture")){const t=s.parent;o.move(o.createRangeOn(s),o.createPositionBefore(t)),o.remove(t)}}}(n))}_setupImageUploadEditingIntegration(){const t=this.editor;t.plugins.has("ImageUploadEditing")&&this.listenTo(t.plugins.get("ImageUploadEditing"),"uploadComplete",((e,{imageElement:n,data:i})=>{const o=i.sources;o&&t.model.change((t=>{t.setAttributes({sources:o},n)}))}))}}class Hv extends gt{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new xt(t)),t.commands.add("outdent",new xt(t))}}const qv='',Wv='';class Gv extends gt{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?qv:Wv,o="ltr"==e.uiLanguageDirection?Wv:qv;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),o)}_defineButton(t,e,n){const i=this.editor;i.ui.componentFactory.add(t,(o=>{const r=i.commands.get(t),s=new j(o);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",(()=>{i.execute(t),i.editing.view.focus()})),s}))}}class Zv extends gt{static get pluginName(){return"Indent"}static get requires(){return[Hv,Gv]}}class Kv extends ft{constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=(0,Vl.first)(t.document.selection.getSelectedBlocks());e&&t.schema.checkAttribute(e,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=function(t){const e=t.document.selection,n=t.schema;return Array.from(e.getSelectedBlocks()).filter((t=>n.checkAttribute(t,"blockIndent")))}(t);t.change((t=>{for(const n of e){const e=n.getAttribute("blockIndent"),i=this._indentBehavior.getNextIndent(e);i?t.setAttribute("blockIndent",i,n):t.removeAttribute("blockIndent",n)}}))}}class $v{constructor(t){this.isForward="forward"===t.direction,this.offset=t.offset,this.unit=t.unit}checkEnabled(t){const e=parseFloat(t||0);return this.isForward||e>0}getNextIndent(t){const e=parseFloat(t||0);if(!(!t||t.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const n=e+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class Yv{constructor(t){this.isForward="forward"===t.direction,this.classes=t.classes}checkEnabled(t){const e=this.classes.indexOf(t);return this.isForward?e=0}getNextIndent(t){const e=this.classes.indexOf(t),n=this.isForward?1:-1;return this.classes[e+n]}}const Jv=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class Qv extends gt{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const t=this.editor,e=t.config.get("indentBlock"),n=!e.classes||!e.classes.length,i=Object.assign({direction:"forward"},e),o=Object.assign({direction:"backward"},e);n?(t.data.addStyleProcessorRules(tc),this._setupConversionUsingOffset(t.conversion),t.commands.add("indentBlock",new Kv(t,new $v(i))),t.commands.add("outdentBlock",new Kv(t,new $v(o)))):(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new Kv(t,new Yv(i))),t.commands.add("outdentBlock",new Kv(t,new Yv(o))))}afterInit(){const t=this.editor,e=t.model.schema,n=t.commands.get("indent"),i=t.commands.get("outdent"),o=t.config.get("heading.options");(o&&o.map((t=>t.model))||Jv).forEach((t=>{e.isRegistered(t)&&e.extend(t,{allowAttributes:"blockIndent"})})),e.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(t.commands.get("indentBlock")),i.registerChildCommand(t.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const t=this.editor.conversion,e="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";t.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>t.getStyle(e)}}),t.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(t){const e={model:{key:"blockIndent",values:[]},view:{}};for(const n of t)e.model.values.push(n),e.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(e)}}function Xv(t,e){return`${t}:${e=e||(0,Vl.getLanguageDirection)(t)}`}class tC extends ft{refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,"language")}execute({languageCode:t,textDirection:e}={}){const n=this.editor.model,i=n.document.selection,o=!!t&&Xv(t,e);n.change((t=>{if(i.isCollapsed)o?t.setSelectionAttribute("language",o):t.removeSelectionAttribute("language");else{const e=n.schema.getValidRanges(i.getRanges(),"language");for(const n of e)o?t.setAttribute("language",o,n):t.removeAttribute("language",n)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.getAttribute("language")||!1;for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,"language"))return n.getAttribute("language")||!1;return!1}}class eC extends gt{static get pluginName(){return"TextPartLanguageEditing"}constructor(t){super(t),t.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"language"}),t.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),t.commands.add("textPartLanguage",new tC(t))}_defineConverters(){const t=this.editor.conversion;t.for("upcast").elementToAttribute({model:{key:"language",value:t=>Xv(t.getAttribute("lang"),t.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),t.for("downcast").attributeToElement({model:"language",view:(t,{writer:e},n)=>{if(!t)return;if(!n.item.is("$textProxy")&&!n.item.is("documentSelection"))return;const{languageCode:i,textDirection:o}=function(t){const[e,n]=t.split(":");return{languageCode:e,textDirection:n}}(t);return e.createAttributeElement("span",{lang:i,dir:o})}})}}var nC=__webpack_require__(4704),iC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(nC.Z,iC);nC.Z.locals;class oC extends gt{static get pluginName(){return"TextPartLanguageUI"}init(){const t=this.editor,e=t.t,n=t.config.get("language.textPartLanguage"),i=e("Choose language"),o=e("Remove language"),r=e("Language");t.ui.componentFactory.add("textPartLanguage",(e=>{const s=new Vl.Collection,a={},c=t.commands.get("textPartLanguage");s.add({type:"button",model:new Al({label:o,languageCode:!1,withText:!0})}),s.add({type:"separator"});for(const t of n){const e={type:"button",model:new Al({label:t.title,languageCode:t.languageCode,textDirection:t.textDirection,withText:!0})},n=Xv(t.languageCode,t.textDirection);e.model.bind("isOn").to(c,"value",(t=>t===n)),s.add(e),a[n]=t.title}const l=Bc(e);return Oc(l,s),l.buttonView.set({isOn:!1,withText:!0,tooltip:r}),l.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),l.bind("isEnabled").to(c,"isEnabled"),l.buttonView.bind("label").to(c,"value",(t=>t&&a[t]||i)),this.listenTo(l,"execute",(e=>{c.execute({languageCode:e.source.languageCode,textDirection:e.source.textDirection}),t.editing.view.focus()})),l}))}}class rC extends gt{static get requires(){return[eC,oC]}static get pluginName(){return"TextPartLanguage"}}class sC{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const i=n.writer,o=i.document.selection;for(const t of this._definitions){const r=i.createAttributeElement("a",t.attributes,{priority:5});t.classes&&i.addClass(t.classes,r);for(const e in t.styles)i.setStyle(e,t.styles[e],r);i.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?i.wrap(o.getFirstRange(),r):i.wrap(n.mapper.toViewRange(e.range),r):i.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:i})=>{const o=i.toViewElement(e.item),r=Array.from(o.getChildren()).find((t=>"a"===t.name));for(const t of this._definitions){const i=(0,Vl.toMap)(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of i)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of i)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const aC=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:de(t,e,n)};var cC=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const lC=function(t){return cC.test(t)};const dC=function(t){return t.split("")};var uC="\\ud800-\\udfff",hC="["+uC+"]",mC="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",gC="\\ud83c[\\udffb-\\udfff]",pC="[^"+uC+"]",fC="(?:\\ud83c[\\udde6-\\uddff]){2}",bC="[\\ud800-\\udbff][\\udc00-\\udfff]",xC="(?:"+mC+"|"+gC+")"+"?",kC="[\\ufe0e\\ufe0f]?",wC=kC+xC+("(?:\\u200d(?:"+[pC,fC,bC].join("|")+")"+kC+xC+")*"),_C="(?:"+[pC+mC+"?",mC,fC,bC,hC].join("|")+")",AC=RegExp(gC+"(?="+gC+")|"+_C+wC,"g");const vC=function(t){return t.match(AC)||[]};const CC=function(t){return lC(t)?vC(t):dC(t)};const yC=function(t){return function(e){e=re(e);var n=lC(e)?CC(e):void 0,i=n?n[0]:e.charAt(0),o=n?aC(n,1).join(""):e.slice(1);return i[t]()+o}}("toUpperCase"),EC=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,TC=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,DC=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,SC=/^((\w+:(\/{2,})?)|(\W))/i,IC="Ctrl+K";function BC(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function MC(t){return function(t){const e=t.replace(EC,"");return e.match(TC)}(t=String(t))?t:"#"}function NC(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function OC(t,e){const n=(i=t,DC.test(i)?"mailto:":e);var i;const o=!!n&&!RC(t);return t&&o?n+t:t}function RC(t){return SC.test(t)}function PC(t){window.open(t,"_blank","noopener")}class LC extends ft{constructor(t){super(t),this.manualDecorators=new Vl.Collection,this.automaticDecorators=new sC}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||(0,Vl.first)(e.getSelectedBlocks());NC(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,i=n.document.selection,o=[],r=[];for(const t in e)e[t]?o.push(t):r.push(t);n.change((e=>{if(i.isCollapsed){const s=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=cu(s,"linkHref",i.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,a),o.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)})),e.setSelection(e.createPositionAfter(a.end.nodeBefore))}else if(""!==t){const r=(0,Vl.toMap)(i.getAttributes());r.set("linkHref",t),o.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...o,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const t of i.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const n of c)e.setAttribute("linkHref",t,n),o.forEach((t=>{e.setAttribute(t,!0,n)})),r.forEach((t=>{e.removeAttribute(t,n)}))}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,i=n.getSelectedElement();return NC(i,e.schema)?i.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}}class zC extends ft{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();NC(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,i=t.commands.get("link");e.change((t=>{const o=n.isCollapsed?[cu(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of o)if(t.removeAttribute("linkHref",e),i)for(const n of i.manualDecorators)t.removeAttribute(n.id,e)}))}}class FC{constructor({id:t,label:e,attributes:n,classes:i,styles:o,defaultValue:r}){this.id=t,this.set("value"),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=i,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}(0,Vl.mix)(FC,Vl.ObservableMixin);var jC=__webpack_require__(399),VC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(jC.Z,VC);jC.Z.locals;const UC="automatic",HC=/^(https?:)?\/\//;class qC extends gt{static get pluginName(){return"LinkEditing"}static get requires(){return[Gd,Nd,Ef]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:BC}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>BC(MC(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new LC(t)),t.commands.add("unlink",new zC(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>(t.label&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,i]of Object.entries(t)){const t=Object.assign({},i,{id:`link${yC(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===UC))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(Gd).registerAttribute("linkHref"),du(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:UC,callback:t=>HC.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id}),t=new FC(t),n.add(t),e.conversion.for("downcast").attributeToElement({model:t.id,view:(e,{writer:n,schema:i},{item:o})=>{if((o.is("selection")||i.isInline(o))&&e){const e=n.createAttributeElement("a",t.attributes,{priority:5});t.classes&&n.addClass(t.classes,e);for(const i in t.styles)n.setStyle(i,t.styles[i],e);return n.setCustomProperty("link",!0,e),e}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...t._createPattern()},model:{key:t.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",((t,e)=>{if(!(Vl.env.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const i=n.getAttribute("href");i&&(t.stop(),e.preventDefault(),PC(i))}),{context:"$capture"}),this.listenTo(e,"keydown",((e,n)=>{const i=t.commands.get("link").value;i&&n.keyCode===Vl.keyCodes.enter&&n.altKey&&(e.stop(),PC(i))}))}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,i=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(i&&i.hasAttribute("linkHref")||t.change((e=>{WC(e,ZC(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(pa);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const i=t.getFirstPosition(),o=cu(i,"linkHref",t.getAttribute("linkHref"),e);(i.isTouching(o.start)||i.isTouching(o.end))&&e.change((t=>{WC(t,ZC(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n,i;this.listenTo(e.document,"delete",(()=>{i=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(i?i=!1:GC(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),i=e.getLastPosition(),o=n.nodeAfter;if(!o)return!1;if(!o.is("$text"))return!1;if(!o.hasAttribute("linkHref"))return!1;const r=i.textNode||i.nodeBefore;if(o===r)return!0;return cu(n,"linkHref",o.getAttribute("linkHref"),t).containsRange(t.createRange(n,i),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[o])=>{i=!1,GC(t)&&n&&(t.model.change((t=>{for(const[e,i]of n)t.setAttribute(e,i,o)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,i=t.editing.view;let o=!1,r=!1;this.listenTo(i.document,"delete",((t,e)=>{r="backward"===e.direction}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{o=!1;const t=n.getFirstPosition(),i=n.getAttribute("linkHref");if(!i)return;const r=cu(t,"linkHref",i,e);o=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,o||t.model.enqueueChange((t=>{WC(t,ZC(e.schema))})))}),{priority:"low"})}_enableClipboardIntegration(){const t=this.editor,e=t.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(t.plugins.get("ClipboardPipeline"),"contentInsertion",((t,i)=>{e.change((t=>{const e=t.createRangeIn(i.content);for(const i of e.getItems())if(i.hasAttribute("linkHref")){const e=OC(i.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,i)}}))}))}}function WC(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function GC(t){return t.model.change((t=>t.batch)).isTyping}function ZC(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var KC=__webpack_require__(4827),$C={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(KC.Z,$C);KC.Z.locals;class YC extends d{constructor(t,n){super(t);const i=t.t;this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),mc.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),mc.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(n),this.children=this._createFormChildren(n.manualDecorators),this._focusables=new r,this._focusCycler=new lt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];n.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),e(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),n({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const t=this.locale.t,e=new bl(this.locale,xl);return e.label=t("Link URL"),e}_createButton(t,e,n,i){const o=new j(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const i=new H(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?n.defaultValue:t)),i.on("execute",(()=>{n.set("value",!i.isOn)})),e.add(i)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new d;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var JC=__webpack_require__(9465),QC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(JC.Z,QC);JC.Z.locals;class XC extends d{constructor(t){super(t);const e=t.t;this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),mc.pencil,"edit"),this.set("href"),this._focusables=new r,this._focusCycler=new lt({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((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(t,e,n){const i=new j(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const t=new j(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&MC(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const ty='',ey="link-ui";class ny extends gt{static get requires(){return[Sl]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(ga),this.actionsView=null,this.formView=null,this._balloon=t.plugins.get(Sl),this._createToolbarLinkButton(),this._enableBalloonActivators(),t.conversion.for("editingDowncast").markerToHighlight({model:ey,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:ey,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const t=this.editor,e=new XC(t.locale),n=t.commands.get("link"),i=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(IC,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),i=new YC(t.locale,e);return i.urlInputView.fieldView.bind("value").to(e,"value"),i.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),i.saveButtonView.bind("isEnabled").to(e),this.listenTo(i,"submit",(()=>{const{value:e}=i.urlInputView.fieldView.element,o=OC(e,n);t.execute("link",o,i.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(i,"cancel",(()=>{this._closeFormView()})),i.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),i}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.ui.componentFactory.add("link",(t=>{const i=new j(t);return i.isEnabled=!0,i.label=n("Link"),i.icon=ty,i.keystroke=IC,i.tooltip=!0,i.isToggleable=!0,i.bind("isEnabled").to(e,"isEnabled"),i.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(i,"execute",(()=>this._showUI(!0))),i}))}_enableBalloonActivators(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),t.keystrokes.set(IC,((e,n)=>{n(),t.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),t({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=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=t.value||""}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.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(t=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),i=r();const o=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,i=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}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 t=this.editor.editing.view,e=this.editor.model,n=t.document;let i=null;if(e.markers.has(ey)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(ey)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));i=t.domConverter.viewRangeToDom(n)}else i=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&Nf(n))return iy(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),i=iy(n.start),o=iy(n.end);return i&&i==o&&t.createRangeIn(i).getTrimmed().isEqual(n)?i:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(ey))e.updateMarker(ey,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(ey,{usingOperation:!1,affectsData:!1,range:e.createRange(i,n.end)})}else e.addMarker(ey,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(ey)&&t.change((t=>{t.removeMarker(ey)}))}}function iy(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))}const oy=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class ry extends gt{static get requires(){return[Ud]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const t=this.editor,e=new Wd(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=sy(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:i,range:o,url:r}=n;if(!i.isTyping)return;const s=o.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:i}=qd(t,e),o=sy(n);if(o){const t=e.createRange(i.end.getShiftedBy(-o.length),i.end);this._applyAutoLink(o,t)}}_applyAutoLink(t,e){const n=this.editor.model,i=OC(t,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&RC(i)&&!function(t){const e=t.start.nodeAfter;return e&&e.hasAttribute("linkHref")}(e)&&this._persistAutoLink(i,e)}_persistAutoLink(t,e){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange((o=>{o.setAttribute("linkHref",t,e),n.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function sy(t){const e=oy.exec(t);return e?e[2]:null}class ay extends gt{static get requires(){return[qC,ny,ry]}static get pluginName(){return"Link"}}class cy extends gt{static get requires(){return["ImageEditing","ImageUtils",qC]}static get pluginName(){return"LinkImageEditing"}init(){const t=this.editor,e=t.model.schema;t.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["linkHref"]}),t.conversion.for("upcast").add(function(t){const e=t.plugins.has("ImageInlineEditing"),n=t.plugins.get("ImageUtils");return t=>{t.on("element:a",((t,i,o)=>{const r=i.viewItem,s=n.findViewImgElement(r);if(!s)return;const a=s.findAncestor((t=>n.isBlockImageView(t)));if(e&&!a)return;const c={attributes:["href"]};if(!o.consumable.consume(r,c))return;const l=r.getAttribute("href");if(!l)return;let d=i.modelCursor.parent;if(!d.is("element","imageBlock")){const t=o.convertItem(s,i.modelCursor);i.modelRange=t.modelRange,i.modelCursor=t.modelCursor,d=i.modelCursor.nodeBefore}d&&d.is("element","imageBlock")&&o.writer.setAttribute("linkHref",l,d)}),{priority:"high"})}}(t)),t.conversion.for("downcast").add(function(t){const e=t.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",((t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const o=i.mapper.toViewElement(n.item),r=i.writer,s=Array.from(o.getChildren()).find((t=>"a"===t.name)),a=e.findViewImgElement(o),c=a.parent.is("element","picture")?a.parent:a;if(s)n.attributeNewValue?r.setAttribute("href",n.attributeNewValue,s):(r.move(r.createRangeOn(c),r.createPositionAt(o,0)),r.remove(s));else{const t=r.createContainerElement("a",{href:n.attributeNewValue});r.insert(r.createPositionAt(o,0),t),r.move(r.createRangeOn(c),r.createPositionAt(t,0))}}),{priority:"high"})}}(t)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const t=this.editor,e=t.commands.get("link").automaticDecorators;e.length&&t.conversion.for("downcast").add(e.getDispatcherForLinkedImage())}_enableManualDecorators(){const t=this.editor,e=t.commands.get("link");for(const n of e.manualDecorators)t.plugins.has("ImageBlockEditing")&&t.model.schema.extend("imageBlock",{allowAttributes:n.id}),t.plugins.has("ImageInlineEditing")&&t.model.schema.extend("imageInline",{allowAttributes:n.id}),t.conversion.for("downcast").add(ly(n)),t.conversion.for("upcast").add(dy(t,n))}}function ly(t){return e=>{e.on(`attribute:${t.id}:imageBlock`,((e,n,i)=>{const o=i.mapper.toViewElement(n.item),r=Array.from(o.getChildren()).find((t=>"a"===t.name));if(r){for(const[e,n]of(0,Vl.toMap)(t.attributes))i.writer.setAttribute(e,n,r);t.classes&&i.writer.addClass(t.classes,r);for(const e in t.styles)i.writer.setStyle(e,t.styles[e],r)}}))}}function dy(t,e){const n=t.plugins.has("ImageInlineEditing"),i=t.plugins.get("ImageUtils");return t=>{t.on("element:a",((t,o,r)=>{const s=o.viewItem,a=i.findViewImgElement(s);if(!a)return;const c=a.findAncestor((t=>i.isBlockImageView(t)));if(n&&!c)return;const l=new Lt(e._createPattern()).match(s);if(!l)return;if(!r.consumable.consume(s,l.match))return;const d=o.modelCursor.nodeBefore||o.modelCursor.parent;r.writer.setAttribute(e.id,!0,d)}),{priority:"high"})}}class uy extends gt{static get requires(){return[qC,ny,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",((e,n)=>{this._isSelectedLinkedImage(t.model.document.selection)&&(n.preventDefault(),e.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("linkImage",(n=>{const i=new j(n),o=t.plugins.get("LinkUI"),r=t.commands.get("link");return i.set({isEnabled:!0,label:e("Link image"),icon:ty,keystroke:IC,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(r,"isEnabled"),i.bind("isOn").to(r,"value",(t=>!!t)),this.listenTo(i,"execute",(()=>{this._isSelectedLinkedImage(t.model.document.selection)?o._addActionsView():o._showUI(!0)})),i}))}_isSelectedLinkedImage(t){const e=t.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(e)&&e.hasAttribute("linkHref")}}var hy=__webpack_require__(3858),my={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(hy.Z,my);hy.Z.locals;class gy extends gt{static get requires(){return[cy,uy]}static get pluginName(){return"LinkImage"}}class py{constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward="forward"==e.direction,this._includeSelf=!!e.includeSelf,this._sameAttributes=toArray(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){const n=new this(t,e)[Symbol.iterator]();return first(n)}*[Symbol.iterator](){const t=[];for(const{node:e}of fy(this._getStartNode(),this._isForward?"forward":"backward")){const n=e.getAttribute("listIndent");if(nthis._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some((t=>e.getAttribute(t)!==this._startElement.getAttribute(t))))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*fy(t,e="forward"){const n="forward"==e;let i=null;for(;isListItemBlock(t);)yield{node:t,previous:i},i=t,t=n?t.nextSibling:t.previousSibling}class by{constructor(t){this._listHead=t}[Symbol.iterator](){return fy(this._listHead,"forward")}}var xy=__webpack_require__(8676),ky={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(xy.Z,ky);xy.Z.locals;var wy=__webpack_require__(9989),_y={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(wy.Z,_y);wy.Z.locals;function Ay(t,e){const n=e.mapper,i=e.writer,o="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=Oy,e}(i),s=i.createContainerElement(o,null);return i.insert(i.createPositionAt(s,0),r),n.bindElements(t,r),r}function vy(t,e,n,i){const o=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(i.createPositionBefore(t));const c=Ey(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),l=t.previousSibling;if(c&&c.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(t))}else if(l&&"listItem"==l.name){a=r.toViewPosition(i.createPositionAt(l,"end"));const t=r.findMappedViewAncestor(a),e=Dy(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(i.createPositionBefore(t));if(a=yy(a),s.insert(a,o),l&&"listItem"==l.name){const t=r.toViewElement(l),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const i=s.breakContainer(s.createPositionBefore(t.item)),o=t.item.parent,r=s.createPositionAt(e,"end");Cy(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(o),r),n.position=i}}else{const n=o.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let i=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;i=e}i&&(s.breakContainer(s.createPositionAfter(i)),s.move(s.createRangeOn(i.parent),s.createPositionAt(e,"end")))}}Cy(s,o,o.nextSibling),Cy(s,o.previousSibling,o)}function Cy(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function yy(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function Ey(t,e){const n=!!e.sameIndent,i=!!e.smallerIndent,o=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&o==t||i&&o>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function Ty(t,e,n,i){t.ui.componentFactory.add(e,(o=>{const r=t.commands.get(e),s=new j(o);return s.set({label:n,icon:i,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function Dy(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}function Sy(t,e){const n=[],i=t.parent,o={ignoreElementEnd:!1,startPosition:t,shallow:!0,direction:e},r=i.getAttribute("listIndent"),s=[...new yo(o)].filter((t=>t.item.is("element"))).map((t=>t.item));for(const t of s){if(!t.is("element","listItem"))break;if(t.getAttribute("listIndent")r)){if(t.getAttribute("listType")!==i.getAttribute("listType"))break;if(t.getAttribute("listStyle")!==i.getAttribute("listStyle"))break;if(t.getAttribute("listReversed")!==i.getAttribute("listReversed"))break;if(t.getAttribute("listStart")!==i.getAttribute("listStart"))break;"backward"===e?n.unshift(t):n.push(t)}}return n}function Iy(t){let e=[...t.document.selection.getSelectedBlocks()].filter((t=>t.is("element","listItem"))).map((e=>{const n=t.change((t=>t.createPositionAt(e,0)));return[...Sy(n,"backward"),...Sy(n,"forward")]})).flat();return e=[...new Set(e)],e}const By=["disc","circle","square"],My=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function Ny(t){return By.includes(t)?"bulleted":My.includes(t)?"numbered":null}function Oy(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:an.call(this)}const Ry='',Py='';class Ly extends gt{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;Ty(this.editor,"numberedList",t("Numbered List"),Ry),Ty(this.editor,"bulletedList",t("Bulleted List"),Py)}}const zy={},Fy={},jy={},Vy=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:t,typeAttribute:e,listType:n}of Vy)zy[t]=n,Fy[t]=e,e&&(jy[e]=t);var Uy=__webpack_require__(3195),Hy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Uy.Z,Hy);Uy.Z.locals;class qy extends d{constructor(t,e){super(t);const n=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),e&&this.children.addMany(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",n.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:n.if("isCollapsed","hidden"),"aria-labelledby":n.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}_createButtonView(){const t=new j(this.locale),e=t.bindTemplate;return t.set({withText:!0,icon:it}),t.extendTemplate({attributes:{"aria-expanded":e.to("isOn",(t=>String(t)))}}),t.bind("label").to(this),t.bind("isOn").to(this,"isCollapsed",(t=>!t)),t.on("execute",(()=>{this.isCollapsed=!this.isCollapsed})),t}}var Wy=__webpack_require__(7133),Gy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Wy.Z,Gy);Wy.Z.locals;class Zy extends d{constructor(t,{enabledProperties:e,styleButtonViews:n,styleGridAriaLabel:i}){super(t),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this.focusables=new r;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new lt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),e.styles?(this.stylesView=this._createStylesView(n,i),this.children.add(this.stylesView)):o.push("ck-list-properties_without-styles"),(e.startIndex||e.reversed)&&(this._addNumberedListPropertyViews(e),o.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:o},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const t of this.stylesView.children)this.stylesView.focusTracker.add(t.element);i({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>Vl.global.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element),this.listenTo(this.startIndexFieldView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"});const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(t,e){const n=new d(this.locale);return n.children=n.createCollection(),n.children.addMany(t),n.setTemplate({tag:"div",attributes:{"aria-label":e,class:["ck","ck-list-styles-list"]},children:n.children}),n.children.delegate("execute").to(this),n.focus=function(){this.children.first.focus()},n.focusTracker=new Vl.FocusTracker,n.keystrokes=new Vl.KeystrokeHandler,n.render(),n.keystrokes.listenTo(n.element),n}_addNumberedListPropertyViews(t){const e=this.locale.t,n=[];t.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),n.push(this.startIndexFieldView)),t.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),n.push(this.reversedSwitchButtonView)),t.styles?(this.additionalPropertiesCollapsibleView=new qy(this.locale,n),this.additionalPropertiesCollapsibleView.set({label:e("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(n,"isEnabled",((...t)=>t.some((t=>t)))),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",((t,e,n)=>{n||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)})),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(n)}_createStartIndexField(){const t=this.locale.t,e=new bl(this.locale,kl);return e.set({label:t("Start at"),class:"ck-numbered-list-properties__start-index"}),e.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),e.fieldView.on("input",(()=>{const n=e.fieldView.element,i=n.valueAsNumber;Number.isNaN(i)||(n.checkValidity()?this.fire("listStart",{startIndex:i}):e.errorText=t("Start index must be greater than 0."))})),e}_createReversedSwitchButton(){const t=this.locale.t,e=new H(this.locale);return e.set({withText:!0,label:t("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),e.delegate("execute").to(this,"listReversed"),e}}var Ky=__webpack_require__(4553),$y={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(Ky.Z,$y);Ky.Z.locals;class Yy extends gt{static get pluginName(){return"ListPropertiesUI"}init(){const t=this.editor,e=t.locale.t,n=t.config.get("list.properties");n.styles&&t.ui.componentFactory.add("bulletedList",Jy({editor:t,parentCommandName:"bulletedList",buttonLabel:e("Bulleted List"),buttonIcon:Py,styleGridAriaLabel:e("Bulleted list styles toolbar"),styleDefinitions:[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:''},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:''},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:''}]})),(n.styles||n.startIndex||n.reversed)&&t.ui.componentFactory.add("numberedList",Jy({editor:t,parentCommandName:"numberedList",buttonLabel:e("Numbered List"),buttonIcon:Ry,styleGridAriaLabel:e("Numbered list styles toolbar"),styleDefinitions:[{label:e("Toggle the decimal list style"),tooltip:e("Decimal"),type:"decimal",icon:''},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:''},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:''},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:''},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:''},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:''}]}))}}function Jy({editor:t,parentCommandName:e,buttonLabel:n,buttonIcon:i,styleGridAriaLabel:o,styleDefinitions:r}){const s=t.commands.get(e);return a=>{const c=Bc(a,at),l=c.buttonView;return c.bind("isEnabled").to(s),c.class="ck-list-styles-dropdown",l.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),l.set({label:n,icon:i,tooltip:!0,isToggleable:!0}),l.bind("isOn").to(s,"value",(t=>!!t)),c.once("change:isOpen",(()=>{const n=function({editor:t,dropdownView:e,parentCommandName:n,styleDefinitions:i,styleGridAriaLabel:o}){const r=t.locale,s=t.config.get("list.properties");let a=null;"numberedList"!=n&&(s.startIndex=!1,s.reversed=!1);if(s.styles){const e=t.commands.get("listStyle"),o=function({editor:t,listStyleCommand:e,parentCommandName:n}){const i=t.locale,o=t.commands.get(n);return({label:n,type:r,icon:s,tooltip:a})=>{const c=new j(i);return c.set({label:n,icon:s,tooltip:a}),e.on("change:value",(()=>{c.isOn=e.value===r})),c.on("execute",(()=>{o.value?e.value!==r?t.execute("listStyle",{type:r}):t.execute("listStyle",{type:e.defaultType}):t.model.change((()=>{t.execute("listStyle",{type:r})}))})),c}}({editor:t,parentCommandName:n,listStyleCommand:e}),r="function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>!0;a=i.filter(r).map(o)}const c=new Zy(r,{styleGridAriaLabel:o,enabledProperties:s,styleButtonViews:a});s.styles&&Pc(e,(()=>c.stylesView.children.find((t=>t.isOn))));if(s.startIndex){const e=t.commands.get("listStart");c.startIndexFieldView.bind("isEnabled").to(e),c.startIndexFieldView.fieldView.bind("value").to(e),c.on("listStart",((e,n)=>t.execute("listStart",n)))}if(s.reversed){const e=t.commands.get("listReversed");c.reversedSwitchButtonView.bind("isEnabled").to(e),c.reversedSwitchButtonView.bind("isOn").to(e,"value",(t=>!!t)),c.on("listReversed",(()=>{const n=e.value;t.execute("listReversed",{reversed:!n})}))}return c.delegate("execute").to(e),c}({editor:t,dropdownView:c,parentCommandName:e,styleGridAriaLabel:o,styleDefinitions:r});c.panelView.children.add(n)})),c.on("execute",(()=>{t.editing.view.focus()})),c}}class Qy extends ft{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,i=Array.from(n.selection.getSelectedBlocks()).filter((t=>tE(t,e.schema))),o=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(o){let e=i[i.length-1].nextSibling,n=Number.POSITIVE_INFINITY,o=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>o.getAttribute("listIndent")&&(r=o.getAttribute("listIndent")),o.getAttribute("listIndent")==r&&t[e?"unshift":"push"](o),o=o[e?"previousSibling":"nextSibling"]}}function tE(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class eE extends ft{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let i=e.nextSibling;for(;i&&"listItem"==i.name&&i.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(i),i=i.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=(0,Vl.first)(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let i=t.previousSibling;for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=e;){if(i.getAttribute("listIndent")==e)return i.getAttribute("listType")==n;i=i.previousSibling}return!1}return!0}}class nE extends gt{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(t){return Ny(t)}getSelectedListItems(t){return Iy(t)}getSiblingNodes(t,e){return Sy(t,e)}}function iE(t){return(e,n,i)=>{const o=i.consumable;if(!o.test(n.item,"insert")||!o.test(n.item,"attribute:listType")||!o.test(n.item,"attribute:listIndent"))return;o.consume(n.item,"insert"),o.consume(n.item,"attribute:listType"),o.consume(n.item,"attribute:listIndent");const r=n.item;vy(r,Ay(r,i),i,t)}}const oE=(t,e,n)=>{if(!n.consumable.test(e.item,t.name))return;const i=n.mapper.toViewElement(e.item),o=n.writer;o.breakContainer(o.createPositionBefore(i)),o.breakContainer(o.createPositionAfter(i));const r=i.parent,s="numbered"==e.attributeNewValue?"ol":"ul";o.rename(s,r)},rE=(t,e,n)=>{n.consumable.consume(e.item,t.name);const i=n.mapper.toViewElement(e.item).parent,o=n.writer;Cy(o,i,i.nextSibling),Cy(o,i.previousSibling,i)};const sE=(t,e,n)=>{if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const i=n.writer,o=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=i.breakContainer(t),"li"==t.parent.name);){const e=t,n=i.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=i.remove(i.createRange(e,n));o.push(t)}t=i.createPositionAfter(t.parent)}if(o.length>0){for(let e=0;e0){const e=Cy(i,n,n.nextSibling);e&&e.parent==n&&t.offset--}}Cy(i,t.nodeBefore,t.nodeAfter)}}},aE=(t,e,n)=>{const i=n.mapper.toViewPosition(e.position),o=i.nodeBefore,r=i.nodeAfter;Cy(n.writer,o,r)},cE=(t,e,n)=>{if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,i=t.createElement("listItem"),o=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",o,i);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,i),!n.safeInsert(i,e.modelCursor))return;const s=function(t,e,n){const{writer:i,schema:o}=n;let r=i.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,i.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!o.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:mE(e.modelCursor),r=i.createPositionAfter(t))}return r}(i,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(i,e)}},lE=(t,e,n)=>{if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t){!(e.is("element","li")||pE(e))&&e._remove()}}},dE=(t,e,n)=>{if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!pE(e)&&e._remove(),pE(e)&&(n=!0)}};function uE(t){return(e,n)=>{if(n.isPhantom)return;const i=n.modelPosition.nodeBefore;if(i&&i.is("element","listItem")){const e=n.mapper.toViewElement(i),o=e.getAncestors().find(pE),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==o){n.viewPosition=t.nextPosition;break}}}}}const hE=function(t,[e,n,i]){const o=this;let r,s=e.is("documentFragment")?e.getChild(0):e;if(r=n?o.createSelection(n,i):o.document.selection,s&&s.is("element","listItem")){const t=r.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;s&&s.is("element","listItem");)s._setAttribute("listIndent",s.getAttribute("listIndent")+t),s=s.nextSibling}}};function mE(t){const e=new yo({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function gE(t,e,n,i,o,r){const s=Ey(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t}),a=o.mapper,c=o.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==t){const t=a.toViewElement(s).parent;d=c.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=yy(d);for(const t of[...i.getChildren()])pE(t)&&(d=c.move(c.createRangeOn(t),d).end,Cy(c,t,t.nextSibling),Cy(c,t.previousSibling,t))}function pE(t){return t.is("element","ol")||t.is("element","ul")}class fE extends gt{static get pluginName(){return"ListEditing"}static get requires(){return[rh,Ud,nE]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var i;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),i=new Map;let o=!1;for(const i of n)if("insert"==i.type&&"listItem"==i.name)r(i.position);else if("insert"==i.type&&"listItem"!=i.name){if("$text"!=i.name){const n=i.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),o=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),o=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),o=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),o=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),o=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(i.position.getShiftedBy(i.length))}else"remove"==i.type&&"listItem"==i.name?r(i.position):("attribute"==i.type&&"listIndent"==i.attributeKey||"attribute"==i.type&&"listType"==i.attributeKey)&&r(i.range.start);for(const t of i.values())s(t),a(t);return o;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(i.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,i.has(t))return;i.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&i.set(e,e)}}function s(t){let n=0,i=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===i?(i=r-n,s=n):(i>r&&(i=r),s=r-i),e.setAttribute("listIndent",s,t),o=!0}else i=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],i=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(i&&i.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const i=n[r];t.getAttribute("listType")!=i&&(e.setAttribute("listType",i,t),o=!0)}else n[r]=t.getAttribute("listType");i=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",bE),e.mapper.registerViewToModelLength("li",bE),n.mapper.on("modelToViewPosition",uE(n.view)),n.mapper.on("viewToModelPosition",(i=t.model,(t,e)=>{const n=e.viewPosition,o=n.parent,r=e.mapper;if("ul"==o.name||"ol"==o.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),o=r.getModelLength(n.nodeBefore);e.modelPosition=i.createPositionBefore(t).getShiftedBy(o)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=i.createPositionBefore(t)}t.stop()}else if("li"==o.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(o);let a=1,c=n.nodeBefore;for(;c&&pE(c);)a+=r.getModelLength(c),c=c.previousSibling;e.modelPosition=i.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",uE(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",sE,{priority:"high"}),e.on("insert:listItem",iE(t.model)),e.on("attribute:listType:listItem",oE,{priority:"high"}),e.on("attribute:listType:listItem",rE,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,i)=>{if(!i.consumable.consume(n.item,"attribute:listIndent"))return;const o=i.mapper.toViewElement(n.item),r=i.writer;r.breakContainer(r.createPositionBefore(o)),r.breakContainer(r.createPositionAfter(o));const s=o.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&Cy(r,a,a.nextSibling),gE(n.attributeOldValue+1,n.range.start,c.start,o,i,t),vy(n.item,o,i,t);for(const t of n.item.getChildren())i.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,i)=>{const o=i.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=i.writer;r.breakContainer(r.createPositionBefore(o)),r.breakContainer(r.createPositionAfter(o));const s=o.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&Cy(r,a,a.nextSibling),gE(i.mapper.toModelElement(o).getAttribute("listIndent")+1,n.position,c.start,o,i,t);for(const t of r.createRangeIn(l).getItems())i.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",aE,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",sE,{priority:"high"}),e.on("insert:listItem",iE(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",lE,{priority:"high"}),t.on("element:ol",lE,{priority:"high"}),t.on("element:li",dE,{priority:"high"}),t.on("element:li",cE)})),t.model.on("insertContent",hE,{priority:"high"}),t.commands.add("numberedList",new Qy(t,"numbered")),t.commands.add("bulletedList",new Qy(t,"bulleted")),t.commands.add("indentList",new eE(t,"forward")),t.commands.add("outdentList",new eE(t,"backward"));const o=n.view.document;this.listenTo(o,"enter",((t,e)=>{const n=this.editor.model.document,i=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==i.name&&i.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(o,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const i=n.getFirstPosition();if(!i.isAtStart)return;const o=i.parent;if("listItem"!==o.name)return;o.previousSibling&&"listItem"===o.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(t.editing.view.document,"tab",((e,n)=>{const i=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(i).isEnabled&&(t.execute(i),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function bE(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=bE(t);return e}class xE extends gt{static get requires(){return[fE,Ly]}static get pluginName(){return"List"}}class kE extends ft{constructor(t,e){super(t),this.defaultType=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){this._tryToConvertItemsToList(t);const e=this.editor.model,n=Iy(e);n.length&&e.change((e=>{for(const i of n)e.setAttribute("listStyle",t.type||this.defaultType,i)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")?t.getAttribute("listStyle"):null}_checkEnabled(){const t=this.editor,e=t.commands.get("numberedList"),n=t.commands.get("bulletedList");return e.isEnabled||n.isEnabled}_tryToConvertItemsToList(t){if(!t.type)return;const e=Ny(t.type);if(!e)return;const n=this.editor,i=`${e}List`;n.commands.get(i).value||n.execute(i)}}class wE extends ft{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute(t={}){const e=this.editor.model,n=Iy(e).filter((t=>"numbered"==t.getAttribute("listType")));e.change((e=>{for(const i of n)e.setAttribute("listReversed",!!t.reversed,i)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")&&"numbered"==t.getAttribute("listType")?t.getAttribute("listReversed"):null}}class _E extends ft{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute({startIndex:t=1}={}){const e=this.editor.model,n=Iy(e).filter((t=>"numbered"==t.getAttribute("listType")));e.change((e=>{for(const i of n)e.setAttribute("listStart",t>=0?t:1,i)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")&&"numbered"==t.getAttribute("listType")?t.getAttribute("listStart"):null}}const AE="default";class vE extends gt{static get requires(){return[fE]}static get pluginName(){return"ListPropertiesEditing"}constructor(t){super(t),t.config.define("list",{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){const t=this.editor,e=t.model,n=function(t){const e=[];t.styles&&e.push({attributeName:"listStyle",defaultValue:AE,addCommand(t){t.commands.add("listStyle",new kE(t,AE))},appliesToListItem:()=>!0,setAttributeOnDowncast(t,e,n){e&&e!==AE?t.setStyle("list-style-type",e,n):t.removeStyle("list-style-type",n)},getAttributeOnUpcast:t=>t.getStyle("list-style-type")||AE});t.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,addCommand(t){t.commands.add("listReversed",new wE(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),setAttributeOnDowncast(t,e,n){e?t.setAttribute("reversed","reversed",n):t.removeAttribute("reversed",n)},getAttributeOnUpcast:t=>t.hasAttribute("reversed")});t.startIndex&&e.push({attributeName:"listStart",defaultValue:1,addCommand(t){t.commands.add("listStart",new _E(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),setAttributeOnDowncast(t,e,n){0==e||e>1?t.setAttribute("start",e,n):t.removeAttribute("start",n)},getAttributeOnUpcast(t){const e=t.getAttribute("start");return e>=0?e:1}});return e}(t.config.get("list.properties"));e.schema.extend("listItem",{allowAttributes:n.map((t=>t.attributeName))});for(const e of n)e.addCommand(t);var i;this.listenTo(t.commands.get("indentList"),"_executeCleanup",function(t,e){return(n,i)=>{const o=i[0],r=o.getAttribute("listIndent"),s=i.filter((t=>t.getAttribute("listIndent")===r));let a=null;o.previousSibling.getAttribute("listIndent")+1!==r&&(a=Ey(o.previousSibling,{sameIndent:!0,direction:"backward",listIndent:r})),t.model.change((t=>{for(const n of s)for(const i of e)if(i.appliesToListItem(n)){const e=null==a?i.defaultValue:a.getAttribute(i.attributeName);t.setAttribute(i.attributeName,e,n)}}))}}(t,n)),this.listenTo(t.commands.get("outdentList"),"_executeCleanup",function(t,e){return(n,i)=>{if(!(i=i.reverse().filter((t=>t.is("element","listItem")))).length)return;const o=i[0].getAttribute("listIndent"),r=i[0].getAttribute("listType");let s=i[0].previousSibling;if(s.is("element","listItem"))for(;s.getAttribute("listIndent")!==o;)s=s.previousSibling;else s=null;s||(s=i[i.length-1].nextSibling),s&&s.is("element","listItem")&&s.getAttribute("listType")===r&&t.model.change((t=>{const n=i.filter((t=>t.getAttribute("listIndent")===o));for(const i of n)for(const n of e)if(n.appliesToListItem(i)){const e=n.attributeName,o=s.getAttribute(e);t.setAttribute(e,o,i)}}))}}(t,n)),this.listenTo(t.commands.get("bulletedList"),"_executeCleanup",EE(t)),this.listenTo(t.commands.get("numberedList"),"_executeCleanup",EE(t)),e.document.registerPostFixer(function(t,e){return n=>{let i=!1;const o=TE(t.model.document.differ.getChanges()).filter((t=>"todo"!==t.getAttribute("listType")));if(!o.length)return i;let r=o[o.length-1].nextSibling;if((!r||!r.is("element","listItem"))&&(r=o[0].previousSibling,r)){const t=o[0].getAttribute("listIndent");for(;r.is("element","listItem")&&r.getAttribute("listIndent")!==t&&(r=r.previousSibling,r););}for(const t of e){const e=t.attributeName;for(const s of o)if(t.appliesToListItem(s))if(s.hasAttribute(e)){const o=s.previousSibling;yE(o,s,t.attributeName)&&(n.setAttribute(e,o.getAttribute(e),s),i=!0)}else CE(r,s,t)?n.setAttribute(e,r.getAttribute(e),s):n.setAttribute(e,t.defaultValue,s),i=!0;else n.removeAttribute(e,s)}return i}}(t,n)),t.conversion.for("upcast").add((i=n,t=>{t.on("element:li",((t,e,n)=>{const o=e.viewItem.parent,r=e.modelRange.start.nodeAfter||e.modelRange.end.nodeBefore;for(const t of i)if(t.appliesToListItem(r)){const e=t.getAttributeOnUpcast(o);n.writer.setAttribute(t.attributeName,e,r)}}),{priority:"low"})})),t.conversion.for("downcast").add(function(t){return n=>{for(const i of t)n.on(`attribute:${i.attributeName}:listItem`,((t,n,o)=>{const r=o.writer,s=n.item,a=Ey(s.previousSibling,{sameIndent:!0,listIndent:s.getAttribute("listIndent"),direction:"backward"}),c=o.mapper.toViewElement(s);e(s,a)||r.breakContainer(r.createPositionBefore(c)),i.setAttributeOnDowncast(r,n.attributeNewValue,c.parent)}),{priority:"low"})};function e(t,e){return e&&t.getAttribute("listType")===e.getAttribute("listType")&&t.getAttribute("listIndent")===e.getAttribute("listIndent")&&t.getAttribute("listStyle")===e.getAttribute("listStyle")&&t.getAttribute("listReversed")===e.getAttribute("listReversed")&&t.getAttribute("listStart")===e.getAttribute("listStart")}}(n)),this._mergeListAttributesWhileMergingLists(n)}afterInit(){const t=this.editor;t.commands.get("todoList")&&t.model.document.registerPostFixer(function(t){return e=>{const n=TE(t.model.document.differ.getChanges()).filter((t=>"todo"===t.getAttribute("listType")&&(t.hasAttribute("listStyle")||t.hasAttribute("listReversed")||t.hasAttribute("listStart"))));if(!n.length)return!1;for(const t of n)e.removeAttribute("listStyle",t),e.removeAttribute("listReversed",t),e.removeAttribute("listStart",t);return!0}}(t))}_mergeListAttributesWhileMergingLists(t){const e=this.editor.model;let n;this.listenTo(e,"deleteContent",((t,[e])=>{const i=e.getFirstPosition(),o=e.getLastPosition();if(i.parent===o.parent)return;if(!i.parent.is("element","listItem"))return;const r=o.parent.nextSibling;if(!r||!r.is("element","listItem"))return;const s=Ey(i.parent,{sameIndent:!0,listIndent:r.getAttribute("listIndent")});s&&s.getAttribute("listType")===r.getAttribute("listType")&&(n=s)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{n&&(e.change((e=>{const i=Ey(n.nextSibling,{sameIndent:!0,listIndent:n.getAttribute("listIndent"),direction:"forward"});if(!i)return void(n=null);const o=[i,...Sy(e.createPositionAt(i,0),"forward")];for(const i of o)for(const o of t)if(o.appliesToListItem(i)){const t=o.attributeName,r=n.getAttribute(t);e.setAttribute(t,r,i)}})),n=null)}),{priority:"low"})}}function CE(t,e,n){if(!t)return!1;const i=t.getAttribute(n.attributeName);return!!i&&(i!=n.defaultValue&&t.getAttribute("listType")===e.getAttribute("listType"))}function yE(t,e,n){if(!t||!t.is("element","listItem"))return!1;if(e.getAttribute("listType")!==t.getAttribute("listType"))return!1;const i=t.getAttribute("listIndent");if(i<1||i!==e.getAttribute("listIndent"))return!1;const o=t.getAttribute(n);return!(!o||o===e.getAttribute(n))}function EE(t){return(e,n)=>{n=n.filter((t=>t.is("element","listItem"))),t.model.change((t=>{for(const e of n)t.removeAttribute("listStyle",e)}))}}function TE(t){const e=[];for(const n of t){const t=DE(n);t&&t.is("element","listItem")&&e.push(t)}return e}function DE(t){return"attribute"===t.type?t.range.start.nodeAfter:"insert"===t.type?t.position.nodeAfter:null}class SE extends gt{static get requires(){return[vE,Yy]}static get pluginName(){return"ListProperties"}}const IE="todoListChecked";class BE extends ft{constructor(t){super(t),this._selectedElements=[],this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every((t=>!!t.getAttribute(IE))),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const t=this.editor.model,e=t.schema,n=t.document.selection.getFirstRange(),i=n.start.parent,o=[];e.checkAttribute(i,IE)&&o.push(i);for(const t of n.getItems())e.checkAttribute(t,IE)&&!o.includes(t)&&o.push(t);return o}execute(t={}){this.editor.model.change((e=>{for(const n of this._selectedElements){(void 0===t.forceValue?!this.value:t.forceValue)?e.setAttribute(IE,!0,n):e.removeAttribute(IE,n)}}))}}const ME=(t,e,n)=>{const i=e.modelCursor,o=i.parent,r=e.viewItem;if("checkbox"!=r.getAttribute("type")||"listItem"!=o.name||!i.isAtStart)return;if(!n.consumable.consume(r,{name:!0}))return;const s=n.writer;s.setAttribute("listType","todo",o),e.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,o),e.modelRange=s.createRange(i)};function NE(t){return(e,n)=>{const i=n.modelPosition,o=i.parent;if(!o.is("element","listItem")||"todo"!=o.getAttribute("listType"))return;const r=RE(n.mapper.toViewElement(o),t);r&&(n.viewPosition=n.mapper.findPositionIn(r,i.offset))}}function OE(t,e,n,i){return e.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(e){const o=(0,Vl.createElement)(document,"input",{type:"checkbox",tabindex:"-1"});n&&o.setAttribute("checked","checked"),o.addEventListener("change",(()=>i(t)));const r=this.toDomElement(e);return r.appendChild(o),r}))}function RE(t,e){const n=e.createRangeIn(t);for(const t of n)if(t.item.is("containerElement","span")&&t.item.hasClass("todo-list__label__description"))return t.item}const PE=(0,Vl.parseKeystroke)("Ctrl+Enter");class LE extends gt{static get pluginName(){return"TodoListEditing"}static get requires(){return[fE]}init(){const t=this.editor,{editing:e,data:n,model:i}=t;i.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),i.schema.addAttributeCheck(((t,e)=>{const n=t.last;if("todoListChecked"==e&&"listItem"==n.name&&"todo"!=n.getAttribute("listType"))return!1})),t.commands.add("todoList",new Qy(t,"todo"));const o=new BE(t);var r,s;t.commands.add("checkTodoList",o),t.commands.add("todoListCheck",o),n.downcastDispatcher.on("insert:listItem",function(t){return(e,n,i)=>{const o=i.consumable;if(!o.test(n.item,"insert")||!o.test(n.item,"attribute:listType")||!o.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;const r=n.item;o.consume(r,"insert"),o.consume(r,"attribute:listType"),o.consume(r,"attribute:listIndent"),o.consume(r,"attribute:todoListChecked");const s=i.writer,a=Ay(r,i);s.addClass("todo-list",a.parent);const c=s.createContainerElement("label",{class:"todo-list__label"}),l=s.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=s.createContainerElement("span",{class:"todo-list__label__description"});r.getAttribute("todoListChecked")&&s.setAttribute("checked","checked",l),s.insert(s.createPositionAt(a,0),c),s.insert(s.createPositionAt(c,0),l),s.insert(s.createPositionAfter(l),d),vy(r,a,i,t)}}(i),{priority:"high"}),n.upcastDispatcher.on("element:input",ME,{priority:"high"}),e.downcastDispatcher.on("insert:listItem",function(t,e){return(n,i,o)=>{const r=o.consumable;if(!r.test(i.item,"insert")||!r.test(i.item,"attribute:listType")||!r.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const s=i.item;r.consume(s,"insert"),r.consume(s,"attribute:listType"),r.consume(s,"attribute:listIndent"),r.consume(s,"attribute:todoListChecked");const a=o.writer,c=Ay(s,o),l=!!s.getAttribute("todoListChecked"),d=OE(s,a,l,e),u=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",c.parent),a.insert(a.createPositionAt(c,0),d),a.insert(a.createPositionAfter(d),u),vy(s,c,o,t)}}(i,(t=>this._handleCheckmarkChange(t))),{priority:"high"}),e.downcastDispatcher.on("attribute:listType:listItem",(r=t=>this._handleCheckmarkChange(t),s=e.view,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=n.mapper.toViewElement(e.item),o=n.writer,a=function(t,e){const n=e.createRangeIn(t);for(const t of n)if(t.item.is("uiElement","label"))return t.item}(i,s);if("todo"==e.attributeNewValue){const t=!!e.item.getAttribute("todoListChecked"),n=OE(e.item,o,t,r),s=o.createContainerElement("span",{class:"todo-list__label__description"}),a=o.createRangeIn(i),c=Dy(i),l=yy(a.start),d=c?o.createPositionBefore(c):a.end,u=o.createRange(l,d);o.addClass("todo-list",i.parent),o.move(u,o.createPositionAt(s,0)),o.insert(o.createPositionAt(i,0),n),o.insert(o.createPositionAfter(n),s)}else if("todo"==e.attributeOldValue){const t=RE(i,s);o.removeClass("todo-list",i.parent),o.remove(a),o.move(o.createRangeIn(t),o.createPositionBefore(t)),o.remove(t)}})),e.downcastDispatcher.on("attribute:todoListChecked:listItem",function(t){return(e,n,i)=>{if("todo"!=n.item.getAttribute("listType"))return;if(!i.consumable.consume(n.item,"attribute:todoListChecked"))return;const{mapper:o,writer:r}=i,s=!!n.item.getAttribute("todoListChecked"),a=o.toViewElement(n.item).getChild(0),c=OE(n.item,r,s,t);r.insert(r.createPositionAfter(a),c),r.remove(a)}}((t=>this._handleCheckmarkChange(t)))),e.mapper.on("modelToViewPosition",NE(e.view)),n.mapper.on("modelToViewPosition",NE(e.view)),this.listenTo(e.view.document,"arrowKey",function(t,e){return(n,i)=>{if("left"!=(0,Vl.getLocalizedArrowKeyCodeDirection)(i.keyCode,e.contentLanguageDirection))return;const o=t.schema,r=t.document.selection;if(!r.isCollapsed)return;const s=r.getFirstPosition(),a=s.parent;if("listItem"===a.name&&"todo"==a.getAttribute("listType")&&s.isAtStart){const e=o.getNearestSelectionRange(t.createPositionBefore(a),"backward");e&&t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop()}}}(i,t.locale),{context:"li"}),this.listenTo(e.view.document,"keydown",((e,n)=>{(0,Vl.getCode)(n)===PE&&(t.execute("checkTodoList"),e.stop())}),{priority:"high"});const a=new Set;this.listenTo(i,"applyOperation",((t,e)=>{const n=e[0];if("rename"==n.type&&"listItem"==n.oldName){const t=n.position.nodeAfter;t.hasAttribute("todoListChecked")&&a.add(t)}else if("changeAttribute"==n.type&&"listType"==n.key&&"todo"===n.oldValue)for(const t of n.range.getItems())t.hasAttribute("todoListChecked")&&"todo"!==t.getAttribute("listType")&&a.add(t)})),i.document.registerPostFixer((t=>{let e=!1;for(const n of a)t.removeAttribute("todoListChecked",n),e=!0;return a.clear(),e}))}_handleCheckmarkChange(t){const e=this.editor,n=e.model,i=Array.from(n.document.selection.getRanges());n.change((n=>{n.setSelection(t,"end"),e.execute("checkTodoList"),n.setSelection(i)}))}}class zE extends gt{static get pluginName(){return"TodoListUI"}init(){const t=this.editor.t;Ty(this.editor,"todoList",t("To-do List"),'')}}var FE=__webpack_require__(1588),jE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(FE.Z,jE);FE.Z.locals;class VE extends gt{static get requires(){return[LE,zE]}static get pluginName(){return"TodoList"}}function UE(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,i,o){if(!o.consumable.consume(i.item,n.name))return;const r=i.attributeNewValue,s=o.writer,a=o.mapper.toViewElement(i.item),c=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(c);const l=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),l)}}function HE(t,e,n,i){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,i),t.createSlot()])}function qE(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function WE(t,e,n,i){t.change((o=>{const r=o.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:i})}))}class GE extends ft{refresh(){const t=this.editor.model,e=t.document.selection,n=qE(e);this.value=n?n.getAttribute("url"):null,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){const n=Ff(t,e);let i=n.start.parent;i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent);return e.schema.checkChild(i,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,i=qE(n);i?e.change((e=>{e.setAttribute("url",t,i)})):WE(e,t,n,!0)}}class ZE{constructor(t,e){const n=e.providers,i=e.extraProviders||[],o=new Set(e.removeProviders),r=n.concat(i).filter((t=>{const e=t.name;return e?!o.has(e):((0,Vl.logWarning)("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new KE(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,i=(0,Vl.toArray)(e.url);for(const e of i){const i=this._getUrlMatches(t,e);if(i)return new KE(this.locale,t,i,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let i=t.replace(/^https?:\/\//,"");return n=i.match(e),n||(i=i.replace(/^www\./,""),n=i.match(e),n||null)}}class KE{constructor(t,e,n,i){this.url=this._getValidUrl(e),this._locale=t,this._match=n,this._previewRenderer=i}getViewElement(t,e){const n={};let i;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const o=this._getPreviewHtml(e);i=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,o)}))}else this.url&&(n.url=this.url),i=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,i),i}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new L,e=this._locale.t;t.content='',t.viewBox="0 0 64 42";return new m({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[t]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":e("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var $E=__webpack_require__(952),YE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()($E.Z,YE);$E.Z.locals;class JE extends gt{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>``},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>``},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const e=t[1],n=t[2];return``}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>``},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new ZE(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,i=t.conversion,o=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new GE(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),i.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return HE(e,s,n,{elementName:r,renderMediaPreview:n&&o})}}),i.for("dataDowncast").add(UE(s,{elementName:r,renderMediaPreview:o})),i.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const i=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),Of(t,e,{label:n})}(HE(e,s,i,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),i.for("editingDowncast").add(UE(s,{elementName:r,renderForEditingView:!0})),i.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");if(s.hasMedia(n))return e.createElement("media",{url:n})}}).add((t=>{t.on("element:figure",(function(t,e,n){if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:i,modelCursor:o}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=i,e.modelCursor=o;(0,Vl.first)(i.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const QE=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class XE extends gt{static get requires(){return[Ab,Ud,zb]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get("ClipboardPipeline"),"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Es.fromPosition(t.start);n.stickiness="toPrevious";const i=Es.fromPosition(t.end);i.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,i),n.detach(),i.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(Vl.global.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,i=n.plugins.get(JE).registry,o=new Wo(t,e),r=o.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);if(s=s.trim(),!s.match(QE))return void o.detach();if(!i.hasMedia(s))return void o.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Es.fromPosition(t),this._timeoutId=Vl.global.window.setTimeout((()=>{n.model.change((t=>{let e;this._timeoutId=null,t.remove(o),o.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),WE(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()}),100)):o.detach()}}var tT=__webpack_require__(3525),eT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(tT.Z,eT);tT.Z.locals;class nT extends d{constructor(t,n){super(n);const i=n.t;this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),mc.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(i("Cancel"),mc.cancel,"ck-button-cancel","cancel"),this._focusables=new r,this._focusCycler=new lt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),e(this)}render(){super.render(),n({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new bl(this.locale,xl),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,i){const o=new j(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}}class iT extends gt{static get requires(){return[JE]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed");t.ui.componentFactory.add("mediaEmbed",(t=>{const n=Bc(t);return this._setUpDropdown(n,e),n}))}_setUpDropdown(t,e){const n=this.editor,i=n.t,o=t.buttonView,r=n.plugins.get(JE).registry;t.once("change:isOpen",(()=>{const i=new nT(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(n.t,r),n.locale);t.panelView.children.add(i),o.on("open",(()=>{i.disableCssTransitions(),i.url=e.value||"",i.urlInputView.fieldView.select(),i.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{i.isValid()&&(n.execute("mediaEmbed",i.url),n.editing.view.focus())})),t.on("change:isOpen",(()=>i.resetFormStatus())),t.on("cancel",(()=>{n.editing.view.focus()})),i.delegate("submit","cancel").to(t),i.urlInputView.bind("value").to(e,"value"),i.urlInputView.bind("isReadOnly").to(e,"isEnabled",(t=>!t))})),t.bind("isEnabled").to(e),o.set({label:i("Insert media"),icon:'',tooltip:!0})}}var oT=__webpack_require__(5777),rT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(oT.Z,rT);oT.Z.locals;class sT extends gt{static get requires(){return[JE,iT,XE,eb]}static get pluginName(){return"MediaEmbed"}}var aT=__webpack_require__(9289),cT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(aT.Z,cT);aT.Z.locals;class lT extends d{constructor(t){super(t);const n=t.t;this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",((t,e)=>t>0&&!e)),this._findInputView=this._createInputField(n("Find in text…")),this._replaceInputView=this._createInputField(n("Replace with…")),this._findButtonView=this._createButton({label:n("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._findPrevButtonView=this._createButton({label:n("Previous result"),class:"ck-button-prev",icon:vl,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:n("Next result"),class:"ck-button-next",icon:vl,keystroke:"F3",tooltip:!0}),this._optionsDropdown=this._createOptionsDropdown(),this._replaceButtonView=this._createButton({label:n("Replace"),class:"ck-button-replace",withText:!0}),this._replaceAllButtonView=this._createButton({label:n("Replace all"),class:"ck-button-replaceall",withText:!0}),this._findFieldsetView=this._createFindFieldset(),this._replaceFieldsetView=this._createReplaceFieldset(),this._focusTracker=new Vl.FocusTracker,this._keystrokes=new Vl.KeystrokeHandler,this._focusables=new r,this._focusCycler=new lt({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:[new ll(t,{label:n("Find and replace")}),this._findFieldsetView,this._replaceFieldsetView]}),e(this)}render(){super.render(),n({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createFindFieldset(){const t=this.locale,e=new d(t);return this._findInputView.fieldView.on("input",(()=>{this.isDirty=!0})),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findPrevious:t})=>t)),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findNext:t})=>t)),this._injectFindResultsCounter(),e.setTemplate({tag:"fieldset",attributes:{class:["ck","ck-find-and-replace-form__find"]},children:[this._findInputView,this._findButtonView,this._findPrevButtonView,this._findNextButtonView]}),e}_onFindButtonExecute(){if(this._textToFind)this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});else{const t=this.t;this._findInputView.errorText=t("Text to find must not be empty.")}}_injectFindResultsCounter(){const t=this.locale,e=t.t,n=this.bindTemplate,i=new d(t);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",((t,n)=>e("%0 of %1",[t,n]))),i.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",n.if("isDirty","ck-hidden")]},children:[{text:n.to("_resultsCounterText")}]});const o=()=>{const e=this._findInputView.fieldView.element;if(!e||!(0,Vl.isVisible)(e))return;const n=new Vl.Rect(i.element).width,o="ltr"===t.uiLanguageDirection?"paddingRight":"paddingLeft";e.style[o]=n?`calc( 2 * var(--ck-spacing-standard) + ${n}px )`:null};this.on("change:_resultsCounterText",o,{priority:"low"}),this.on("change:isDirty",o,{priority:"low"}),this._findInputView.template.children[0].children.push(i)}_createReplaceFieldset(){const t=this.locale,e=t.t,n=new d(t);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:t},e)=>t&&e)),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replaceAll:t},e)=>t&&e)),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:t},e)=>t&&e)),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",((t,n)=>t||!n?"":e("Tip: Find some text first in order to replace it."))),this._replaceButtonView.on("execute",(()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})})),this._replaceAllButtonView.on("execute",(()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()})),n.setTemplate({tag:"fieldset",attributes:{class:["ck","ck-find-and-replace-form__replace"]},children:[this._replaceInputView,this._optionsDropdown,this._replaceButtonView,this._replaceAllButtonView]}),n}_createOptionsDropdown(){const t=this.locale,e=t.t,n=Bc(t);n.class="ck-options-dropdown",n.buttonView.set({withText:!1,label:e("Show options"),icon:mc.cog,tooltip:!0});const i=new Al({withText:!0,label:e("Match case"),_isMatchCaseSwitch:!0}),o=new Al({withText:!0,label:e("Whole words only")});return i.bind("isOn").to(this,"_matchCase"),o.bind("isOn").to(this,"_wholeWordsOnly"),n.on("execute",(t=>{t.source._isMatchCaseSwitch?this._matchCase=!this._matchCase:this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0})),Oc(n,new Vl.Collection([{type:"switchbutton",model:i},{type:"switchbutton",model:o}])),n}_initFocusCycling(){[this._findInputView,this._findButtonView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._optionsDropdown,this._replaceButtonView,this._replaceAllButtonView].forEach((t=>{this._focusables.add(t),this._focusTracker.add(t.element)}))}_initKeystrokeHandling(){const t=t=>t.stopPropagation(),e=t=>{t.stopPropagation(),t.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",(t=>{e(t),this._findNextButtonView.fire("execute")})),this._keystrokes.set("shift+f3",(t=>{e(t),this._findPrevButtonView.fire("execute")})),this._keystrokes.set("enter",(t=>{const n=t.target;n===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),e(t)):n!==this._replaceInputView.fieldView.element||this.isDirty||(this._replaceButtonView.fire("execute"),e(t))})),this._keystrokes.set("shift+enter",(t=>{t.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),e(t))})),this._keystrokes.set("arrowright",t),this._keystrokes.set("arrowleft",t),this._keystrokes.set("arrowup",t),this._keystrokes.set("arrowdown",t),this.listenTo(this._findInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"}),this.listenTo(this._replaceInputView.element,"selectstart",((t,e)=>{e.stopPropagation()}),{priority:"high"})}_createButton(t){const e=new j(this.locale);return e.set(t),e}_createInputField(t){const e=new bl(this.locale,xl);return e.label=t,e}}class dT extends gt{static get pluginName(){return"FindAndReplaceUI"}constructor(t){super(t),this.formView=null}init(){const t=this.editor;t.ui.componentFactory.add("findAndReplace",(e=>{const n=Bc(e);return n.bind("isEnabled").to(t.commands.get("find")),n.once("change:isOpen",(()=>{this.formView=new lT(t.locale),n.panelView.children.add(this.formView),this._setupFormView(this.formView)})),n.on("change:isOpen",((t,e,n)=>{n?(this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()):this.fire("searchReseted")}),{priority:"low"}),this._setupDropdownButton(n),n}))}_setupDropdownButton(t){const e=this.editor,n=e.locale.t;t.buttonView.set({icon:'',label:n("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),e.keystrokes.set("Ctrl+F",((e,n)=>{t.isEnabled&&(t.isOpen=!0,n())}))}_setupFormView(t){const e=this.editor.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state,i={before:-1,same:0,after:1};t.bind("highlightOffset").to(n,"highlightedResult",(t=>t?Array.from(n.results).sort(((t,e)=>i[t.marker.getStart().compareWith(e.marker.getStart())])).indexOf(t)+1:0)),t.listenTo(n.results,"change",(()=>{t.matchCount=n.results.length})),t.bind("_areCommandsEnabled").to(e.get("findNext"),"isEnabled",e.get("findPrevious"),"isEnabled",e.get("replace"),"isEnabled",e.get("replaceAll"),"isEnabled",((t,e,n,i)=>({findNext:t,findPrevious:e,replace:n,replaceAll:i}))),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",((t,e,n)=>{n&&this.fire("searchReseted")}))}}class uT extends ft{constructor(t,e){super(t),this.isEnabled=!0,this.affectsData=!1,this._state=e}execute(t,{matchCase:e,wholeWords:n}={}){const{editor:i}=this,{model:o}=i,r=i.plugins.get("FindAndReplaceUtils");let s;"string"==typeof t?(s=r.findByTextCallback(t,{matchCase:e,wholeWords:n}),this._state.searchText=t):s=t;const a=o.document.getRootNames().reduce(((t,e)=>r.updateFindResultFromRange(o.createRangeIn(o.document.getRoot(e)),o,s,t)),null);return this._state.clear(o),this._state.results.addMany(Array.from(a)),this._state.highlightedResult=a.get(0),"string"==typeof t&&(this._state.searchText=t),this._state.matchCase=!!e,this._state.matchWholeWords=!!n,{results:a,findCallback:s}}}class hT extends ft{constructor(t,e){super(t),this.isEnabled=!0,this._state=e}execute(t,e){const{model:n}=this.editor;n.change((i=>{const o=e.marker.getRange();if("$graveyard"===o.root.rootName)return void this._state.results.remove(e);let r={};for(const t of o.getItems())if(t.is("$text")||t.is("$textProxy")){r=t.getAttributes();break}n.insertContent(i.createText(t,r),o),this._state.results.has(e)&&this._state.results.remove(e)}))}}class mT extends hT{execute(t,e){const{editor:n}=this,{model:i}=n,o=n.plugins.get("FindAndReplaceUtils"),r=e instanceof Vl.Collection?e:i.document.getRootNames().reduce(((t,n)=>o.updateFindResultFromRange(i.createRangeIn(i.document.getRoot(n)),i,o.findByTextCallback(e,this._state),t)),null);r.length&&i.change((()=>{[...r].forEach((e=>{super.execute(t,e)}))}))}}class gT extends ft{constructor(t,e){super(t),this.affectsData=!1,this._state=e,this.isEnabled=!1,this.listenTo(this._state.results,"change",(()=>{this.isEnabled=this._state.results.length>1}))}refresh(){this.isEnabled=this._state.results.length>1}execute(){const t=this._state.results,e=t.getIndex(this._state.highlightedResult),n=e+1>=t.length?0:e+1;this._state.highlightedResult=this._state.results.get(n)}}class pT extends gT{execute(){const t=this._state.results.getIndex(this._state.highlightedResult),e=t-1<0?this._state.results.length-1:t-1;this._state.highlightedResult=this._state.results.get(e)}}class fT{constructor(t){this.set("results",new Vl.Collection),this.set("highlightedResult",null),this.set("searchText",""),this.set("replaceText",""),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",((e,{removed:n,index:i})=>{if((n=Array.from(n)).length){let e=!1;if(t.change((i=>{for(const o of n)this.highlightedResult===o&&(e=!0),t.markers.has(o.marker.name)&&i.removeMarker(o.marker)})),e){const t=i>=this.results.length?0:i;this.highlightedResult=this.results.get(t)}}}))}clear(t){this.searchText="",t.change((e=>{if(this.highlightedResult){const n=this.highlightedResult.marker.name.split(":")[1],i=t.markers.get(`findResultHighlighted:${n}`);i&&e.removeMarker(i)}[...this.results].forEach((({marker:t})=>{e.removeMarker(t)}))})),this.results.clear()}}(0,Vl.mix)(fT,Vl.ObservableMixin);class bT extends gt{static get pluginName(){return"FindAndReplaceUtils"}updateFindResultFromRange(t,e,n,i){const o=i||new Vl.Collection;return e.change((i=>{[...t].forEach((({type:t,item:r})=>{if("elementStart"===t&&e.schema.checkChild(r,"$text")){const t=n({item:r,text:this.rangeToText(e.createRangeIn(r))});if(!t)return;t.forEach((t=>{const e=`findResult:${(0,Vl.uid)()}`,n=i.addMarker(e,{usingOperation:!1,affectsData:!1,range:i.createRange(i.createPositionAt(r,t.start),i.createPositionAt(r,t.end))}),s=function(t,e){const n=t.find((({marker:t})=>e.getStart().isBefore(t.getStart())));return n?t.getIndex(n):t.length}(o,n);o.add({id:e,label:t.label,marker:n},s)}))}}))})),o}rangeToText(t){return Array.from(t.getItems()).reduce(((t,e)=>e.is("text")||e.is("textProxy")?t+e.data:`${t}\n`),"")}findByTextCallback(t,e){let n="gu";e.matchCase||(n+="i");let i=`(${Xd(t)})`;if(e.wholeWords){const e="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+e).test(t)||(i=`(^|${e}|_)${i}`),new RegExp(e+"$").test(t)||(i=`${i}(?=_|${e}|$)`)}const o=new RegExp(i,n);return function({text:t}){return[...t.matchAll(o)].map(xT)}}}function xT(t){const e=t.length-1;let n=t.index;return 3===t.length&&(n+=t[1].length),{label:t[e],start:n,end:n+t[e].length}}var kT=__webpack_require__(7275),wT=__webpack_require__(5436),_T={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(wT.Z,_T);wT.Z.locals;class AT extends gt{static get requires(){return[bT]}static get pluginName(){return"FindAndReplaceEditing"}init(){this._activeResults=null,this.state=new fT(this.editor.model),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",((t,e,n,i)=>{const{model:o}=this.editor;o.change((t=>{if(i){const e=i.marker.name.split(":")[1],n=o.markers.get(`findResultHighlighted:${e}`);n&&t.removeMarker(n)}if(n){const e=n.marker.name.split(":")[1];t.addMarker(`findResultHighlighted:${e}`,{usingOperation:!1,affectsData:!1,range:n.marker.getRange()})}}))}));const t=Pi(function(t,e,n){if(n){const t=this.editor.editing.view.domConverter,e=this.editor.editing.mapper.toViewRange(n.marker.getRange());(0,kT.m)({target:t.viewRangeToDom(e),viewportOffset:40})}}.bind(this),32);this.listenTo(this.state,"change:highlightedResult",t,{priority:"low"}),this.listenTo(this.editor,"destroy",t.cancel)}find(t){const{editor:e}=this,{model:n}=e,{findCallback:i,results:o}=e.execute("find",t);return this._activeResults=o,this.listenTo(n.document,"change:data",(()=>function(t,e,n){const i=new Set,o=new Set,r=e.model;r.document.differ.getChanges().forEach((t=>{"$text"===t.name||r.schema.isInline(t.position.nodeAfter)?(i.add(t.position.parent),[...r.markers.getMarkersAtPosition(t.position)].forEach((t=>{o.add(t.name)}))):"insert"===t.type&&i.add(t.position.nodeAfter)})),r.document.differ.getChangedMarkers().forEach((({name:t,data:{newRange:e}})=>{e&&"$graveyard"===e.start.root.rootName&&o.add(t)})),i.forEach((t=>{[...r.markers.getMarkersIntersectingRange(r.createRangeIn(t))].forEach((t=>o.add(t.name)))})),r.change((e=>{o.forEach((n=>{t.has(n)&&t.remove(n),e.removeMarker(n)}))})),i.forEach((i=>{e.plugins.get("FindAndReplaceUtils").updateFindResultFromRange(r.createRangeOn(i),r,n,t)}))}(this._activeResults,e,i))),this._activeResults}stop(){this._activeResults&&(this.stopListening(this.editor.model.document),this.state.clear(this.editor.model),this._activeResults=null)}_defineCommands(){this.editor.commands.add("find",new uT(this.editor,this.state)),this.editor.commands.add("findNext",new gT(this.editor,this.state)),this.editor.commands.add("findPrevious",new pT(this.editor,this.state)),this.editor.commands.add("replace",new hT(this.editor,this.state)),this.editor.commands.add("replaceAll",new mT(this.editor,this.state))}_defineConverters(){const{editor:t}=this;t.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:t})=>{const[,e]=t.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":e}}}}),t.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:t})=>{const[,e]=t.split(":");return{name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":e}}}})}}class vT extends gt{static get requires(){return[AT,dT]}static get pluginName(){return"FindAndReplace"}init(){const t=this.editor.plugins.get("FindAndReplaceUI"),e=this.editor.plugins.get("FindAndReplaceEditing"),n=e.state;t.on("findNext",((t,e)=>{e?(n.searchText=e.searchText,this.editor.execute("find",e.searchText,e)):this.editor.execute("findNext")})),t.on("findPrevious",((t,e)=>{e&&n.searchText!==e.searchText?this.editor.execute("find",e.searchText):this.editor.execute("findPrevious")})),t.on("replace",((t,e)=>{n.searchText!==e.searchText&&this.editor.execute("find",e.searchText);const i=n.highlightedResult;i&&this.editor.execute("replace",e.replaceText,i)})),t.on("replaceAll",((t,e)=>{n.searchText!==e.searchText&&this.editor.execute("find",e.searchText),this.editor.execute("replaceAll",e.replaceText,n.results)})),t.on("searchReseted",(()=>{n.clear(this.editor.model),e.stop()}))}}class CT extends ft{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=e.selection.getAttribute(this.attributeKey),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,i=t.value;e.change((t=>{if(n.isCollapsed)i?t.setSelectionAttribute(this.attributeKey,i):t.removeSelectionAttribute(this.attributeKey);else{const o=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of o)i?t.setAttribute(this.attributeKey,i,e):t.removeAttribute(this.attributeKey,e)}}))}}class yT extends Vl.Collection{constructor(t){super(t),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(t,e){this.find((e=>e.color===t.color))||super.add(t,e)}hasColor(t){return!!this.find((e=>e.color===t))}}(0,Vl.mix)(yT,Vl.ObservableMixin);var ET=__webpack_require__(2585),TT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(ET.Z,TT);ET.Z.locals;class DT extends d{constructor(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:s}){super(t),this.items=this.createCollection(),this.colorDefinitions=e,this.focusTracker=new Vl.FocusTracker,this.keystrokes=new Vl.KeystrokeHandler,this.set("selectedColor"),this.removeButtonLabel=i,this.columns=n,this.documentColors=new yT,this.documentColorsCount=s,this._focusables=new r,this._focusCycler=new lt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items}),this.items.add(this._createRemoveColorButton())}updateDocumentColors(t,e){const n=t.document,i=this.documentColorsCount;this.documentColors.clear();for(const o of n.getRootNames()){const r=n.getRoot(o),s=t.createRangeIn(r);for(const t of s.getItems())if(t.is("$textProxy")&&t.hasAttribute(e)&&(this._addColorToDocumentColors(t.getAttribute(e)),this.documentColors.length>=i))return}}updateSelectedColors(){const t=this.documentColorsGrid,e=this.staticColorsGrid,n=this.selectedColor;e.selectedColor=n,t&&(t.selectedColor=n)}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendGrids(){if(!this.staticColorsGrid&&(this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid),this.documentColorsCount)){const t=m.bind(this.documentColors,this.documentColors),e=new il(this.locale);e.text=this._documentColorsLabel,e.extendTemplate({attributes:{class:["ck","ck-color-grid__label",t.if("isEmpty","ck-hidden")]}}),this.items.add(e),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid),this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid)}}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_createRemoveColorButton(){const t=new j;return t.set({withText:!0,icon:mc.eraser,label:this.removeButtonLabel}),t.class="ck-color-table__remove-color",t.on("execute",(()=>{this.fire("execute",{value:null})})),t.render(),this.focusTracker.add(t.element),this._focusables.add(t),t}_createStaticColorsGrid(){const t=new J(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return t.delegate("execute").to(this),t}_createDocumentColorsGrid(){const t=m.bind(this.documentColors,this.documentColors),e=new J(this.locale,{columns:this.columns});return e.delegate("execute").to(this),e.extendTemplate({attributes:{class:t.if("isEmpty","ck-hidden")}}),e.items.bindTo(this.documentColors).using((t=>{const e=new Z;return e.set({color:t.color,hasBorder:t.options&&t.options.hasBorder}),t.label&&e.set({label:t.label,tooltip:!0}),e.on("execute",(()=>{this.fire("execute",{value:t.color})})),e})),this.documentColors.on("change:isEmpty",((t,n,i)=>{i&&(e.selectedColor=null)})),e}_addColorToDocumentColors(t){const e=this.colorDefinitions.find((e=>e.color===t));e?this.documentColors.add(Object.assign({},e)):this.documentColors.add({color:t,label:t,options:{hasBorder:!1}})}}const ST="fontSize",IT="fontFamily",BT="fontColor",MT="fontBackgroundColor";function NT(t,e){const n={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const t of e)n.model.values.push(t.model),n.view[t.model]=t.view,t.upcastAlso&&(n.upcastAlso[t.model]=t.upcastAlso);return n}function OT(t){return e=>e.getStyle(t).replace(/\s/g,"")}function RT(t){return(e,{writer:n})=>n.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}class PT extends CT{constructor(t){super(t,IT)}}function LT(t){return t.map(zT).filter((t=>!!t))}function zT(t){return"object"==typeof t?t:"default"===t?{title:"Default",model:void 0}:"string"==typeof t?function(t){const e=t.replace(/"|'/g,"").split(","),n=e[0],i=e.map(FT).join(", ");return{title:n,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}(t):void 0}function FT(t){return(t=t.trim()).indexOf(" ")>0&&(t=`'${t}'`),t}class jT extends gt{static get pluginName(){return"FontFamilyEditing"}constructor(t){super(t),t.config.define(IT,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:IT}),t.model.schema.setAttributeProperties(IT,{isFormatting:!0,copyOnEnter:!0});const e=LT(t.config.get("fontFamily.options")).filter((t=>t.model)),n=NT(IT,e);t.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(n),t.commands.add(IT,new PT(t))}_prepareAnyValueConverters(){const t=this.editor;t.conversion.for("downcast").attributeToElement({model:IT,view:(t,{writer:e})=>e.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),t.conversion.for("upcast").elementToAttribute({model:{key:IT,value:t=>t.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:IT,value:t=>t.getAttribute("face")}})}}class VT extends gt{static get pluginName(){return"FontFamilyUI"}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),i=t.commands.get(IT);t.ui.componentFactory.add(IT,(o=>{const r=Bc(o);return Oc(r,(()=>function(t,e){const n=new Vl.Collection;for(const i of t){const t={type:"button",model:new Al({commandName:IT,commandParam:i.model,label:i.title,withText:!0})};t.model.bind("isOn").to(e,"value",(t=>t===i.model||!(!t||!i.model)&&t.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase())),i.view&&i.view.styles&&t.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),n.add(t)}return n}(n,i))),r.buttonView.set({label:e("Font Family"),icon:'',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),r}))}_getLocalizedOptions(){const t=this.editor,e=t.t;return LT(t.config.get(IT).options).map((t=>("Default"===t.title&&(t.title=e("Default")),t)))}}class UT extends gt{static get requires(){return[jT,VT]}static get pluginName(){return"FontFamily"}}class HT extends CT{constructor(t){super(t,ST)}}function qT(t){return t.map((t=>function(t){if(e=t,"object"==typeof e&&e.title&&e.model&&e.view)return GT(t);var e;const n=function(t){return WT[t]||WT[t.model]}(t);if(n)return GT(n);if("default"===t)return{model:void 0,title:"Default"};if(function(t){let e;if("object"==typeof t){if(!t.model)throw new Vl.CKEditorError("font-size-invalid-definition",null,t);e=parseFloat(t.model)}else e=parseFloat(t);return isNaN(e)}(t))return;return function(t){"number"!=typeof t&&"string"!=typeof t||(t={title:String(t),model:`${parseFloat(t)}px`});return t.view={name:"span",styles:{"font-size":t.model}},GT(t)}(t)}(t))).filter((t=>!!t))}const WT={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function GT(t){return t.view.priority||(t.view.priority=7),t}const ZT=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class KT extends gt{static get pluginName(){return"FontSizeEditing"}constructor(t){super(t),t.config.define(ST,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:ST}),t.model.schema.setAttributeProperties(ST,{isFormatting:!0,copyOnEnter:!0});const e=t.config.get("fontSize.supportAllValues"),n=qT(this.editor.config.get("fontSize.options")).filter((t=>t.model)),i=NT(ST,n);e?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(i),t.commands.add(ST,new HT(t))}_prepareAnyValueConverters(t){const e=this.editor,n=t.model.values.filter((t=>!Ta(String(t))&&!Sa(String(t))));if(n.length)throw new Vl.CKEditorError("font-size-invalid-use-of-named-presets",null,{presets:n});e.conversion.for("downcast").attributeToElement({model:ST,view:(t,{writer:e})=>{if(t)return e.createAttributeElement("span",{style:"font-size:"+t},{priority:7})}}),e.conversion.for("upcast").elementToAttribute({model:{key:ST,value:t=>t.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:ST,value:t=>{const e=t.getAttribute("size"),n="-"===e[0]||"+"===e[0];let i=parseInt(e,10);n&&(i=3+i);const o=ZT.length-1,r=Math.min(Math.max(i,0),o);return ZT[r]}}})}}var $T=__webpack_require__(6203),YT={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()($T.Z,YT);$T.Z.locals;class JT extends gt{static get pluginName(){return"FontSizeUI"}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),i=t.commands.get(ST);t.ui.componentFactory.add(ST,(o=>{const r=Bc(o);return Oc(r,(()=>function(t,e){const n=new Vl.Collection;for(const i of t){const t={type:"button",model:new Al({commandName:ST,commandParam:i.model,label:i.title,class:"ck-fontsize-option",withText:!0})};i.view&&i.view.styles&&t.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view&&i.view.classes&&t.model.set("class",`${t.model.class} ${i.view.classes}`),t.model.bind("isOn").to(e,"value",(t=>t===i.model)),n.add(t)}return n}(n,i))),r.buttonView.set({label:e("Font Size"),icon:'',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),r}))}_getLocalizedOptions(){const t=this.editor,e=t.t,n={Default:e("Default"),Tiny:e("Tiny"),Small:e("Small"),Big:e("Big"),Huge:e("Huge")};return qT(t.config.get(ST).options).map((t=>{const e=n[t.title];return e&&e!=t.title&&(t=Object.assign({},t,{title:e})),t}))}}class QT extends gt{static get requires(){return[KT,JT]}static get pluginName(){return"FontSize"}normalizeSizeOptions(t){return qT(t)}}class XT extends CT{constructor(t){super(t,BT)}}class tD extends gt{static get pluginName(){return"FontColorEditing"}constructor(t){super(t),t.config.define(BT,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:BT,value:OT("color")}}),t.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:BT,value:t=>t.getAttribute("color")}}),t.conversion.for("downcast").attributeToElement({model:BT,view:RT("color")}),t.commands.add(BT,new XT(t)),t.model.schema.extend("$text",{allowAttributes:BT}),t.model.schema.setAttributeProperties(BT,{isFormatting:!0,copyOnEnter:!0})}}class eD extends gt{constructor(t,{commandName:e,icon:n,componentName:i,dropdownLabel:o}){super(t),this.commandName=e,this.componentName=i,this.icon=n,this.dropdownLabel=o,this.columns=t.config.get(`${this.componentName}.columns`),this.colorTableView=void 0}init(){const t=this.editor,e=t.locale,n=e.t,i=t.commands.get(this.commandName),o=q(e,W(t.config.get(this.componentName).colors)),r=t.config.get(`${this.componentName}.documentColors`);t.ui.componentFactory.add(this.componentName,(e=>{const s=Bc(e);return this.colorTableView=function({dropdownView:t,colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r}){const s=t.locale,a=new DT(s,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r});return t.colorTableView=a,t.panelView.children.add(a),a.delegate("execute").to(t,"execute"),a}({dropdownView:s,colors:o.map((t=>({label:t.label,color:t.model,options:{hasBorder:t.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),documentColorsLabel:0!==r?n("Document colors"):void 0,documentColorsCount:void 0===r?this.columns:r}),this.colorTableView.bind("selectedColor").to(i,"value"),s.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),s.bind("isEnabled").to(i),s.on("execute",((e,n)=>{t.execute(this.commandName,n),t.editing.view.focus()})),s.on("change:isOpen",((e,n,i)=>{s.colorTableView.appendGrids(),i&&(0!==r&&this.colorTableView.updateDocumentColors(t.model,this.componentName),this.colorTableView.updateSelectedColors())})),Pc(s,(()=>s.colorTableView.staticColorsGrid.items.find((t=>t.isOn)))),s}))}}class nD extends eD{constructor(t){const e=t.locale.t;super(t,{commandName:BT,componentName:BT,icon:'',dropdownLabel:e("Font Color")})}static get pluginName(){return"FontColorUI"}}class iD extends gt{static get requires(){return[tD,nD]}static get pluginName(){return"FontColor"}}class oD extends CT{constructor(t){super(t,MT)}}class rD extends gt{static get pluginName(){return"FontBackgroundColorEditing"}constructor(t){super(t),t.config.define(MT,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),t.data.addStyleProcessorRules(Ha),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:MT,value:OT("background-color")}}),t.conversion.for("downcast").attributeToElement({model:MT,view:RT("background-color")}),t.commands.add(MT,new oD(t)),t.model.schema.extend("$text",{allowAttributes:MT}),t.model.schema.setAttributeProperties(MT,{isFormatting:!0,copyOnEnter:!0})}}class sD extends eD{constructor(t){const e=t.locale.t;super(t,{commandName:MT,componentName:MT,icon:'',dropdownLabel:e("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class aD extends gt{static get requires(){return[rD,sD]}static get pluginName(){return"FontBackgroundColor"}}class cD extends ft{refresh(){const t=this.editor.model,e=t.document;this.value=e.selection.getAttribute("highlight"),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,"highlight")}execute(t={}){const e=this.editor.model,n=e.document.selection,i=t.value;e.change((t=>{if(n.isCollapsed){const e=n.getFirstPosition();if(n.hasAttribute("highlight")){const n=t=>t.item.hasAttribute("highlight")&&t.item.getAttribute("highlight")===this.value,o=e.getLastMatchingPosition(n,{direction:"backward"}),r=e.getLastMatchingPosition(n),s=t.createRange(o,r);i&&this.value!==i?(e.isEqual(r)||t.setAttribute("highlight",i,s),t.setSelectionAttribute("highlight",i)):(e.isEqual(r)||t.removeAttribute("highlight",s),t.removeSelectionAttribute("highlight"))}else i&&t.setSelectionAttribute("highlight",i)}else{const o=e.schema.getValidRanges(n.getRanges(),"highlight");for(const e of o)i?t.setAttribute("highlight",i,e):t.removeAttribute("highlight",e)}}))}}class lD extends gt{static get pluginName(){return"HighlightEditing"}constructor(t){super(t),t.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"highlight"});const e=t.config.get("highlight.options");t.conversion.attributeToElement(function(t){const e={model:{key:"highlight",values:[]},view:{}};for(const n of t)e.model.values.push(n.model),e.view[n.model]={name:"mark",classes:n.class};return e}(e)),t.commands.add("highlight",new cD(t))}}var dD=__webpack_require__(713),uD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(dD.Z,uD);dD.Z.locals;class hD extends gt{get localizedOptionTitles(){const t=this.editor.t;return{"Yellow marker":t("Yellow marker"),"Green marker":t("Green marker"),"Pink marker":t("Pink marker"),"Blue marker":t("Blue marker"),"Red pen":t("Red pen"),"Green pen":t("Green pen")}}static get pluginName(){return"HighlightUI"}init(){const t=this.editor.config.get("highlight.options");for(const e of t)this._addHighlighterButton(e);this._addRemoveHighlightButton(),this._addDropdown(t)}_addRemoveHighlightButton(){const t=this.editor.t,e=this.editor.commands.get("highlight");this._addButton("removeHighlight",t("Remove highlight"),mc.eraser,null,(t=>{t.bind("isEnabled").to(e,"isEnabled")}))}_addHighlighterButton(t){const e=this.editor.commands.get("highlight");this._addButton("highlight:"+t.model,t.title,mD(t.type),t.model,(function(n){n.bind("isEnabled").to(e,"isEnabled"),n.bind("isOn").to(e,"value",(e=>e===t.model)),n.iconView.fillColor=t.color,n.isToggleable=!0}))}_addButton(t,e,n,i,o){const r=this.editor;r.ui.componentFactory.add(t,(t=>{const s=new j(t),a=this.localizedOptionTitles[e]?this.localizedOptionTitles[e]:e;return s.set({label:a,icon:n,tooltip:!0}),s.on("execute",(()=>{r.execute("highlight",{value:i}),r.editing.view.focus()})),o(s),s}))}_addDropdown(t){const e=this.editor,n=e.t,i=e.ui.componentFactory,o=t[0],r=t.reduce(((t,e)=>(t[e.model]=e,t)),{});i.add("highlight",(s=>{const a=e.commands.get("highlight"),c=Bc(s,at),l=c.buttonView;l.set({label:n("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),l.bind("icon").to(a,"value",(t=>mD(d(t,"type")))),l.bind("color").to(a,"value",(t=>d(t,"color"))),l.bind("commandValue").to(a,"value",(t=>d(t,"model"))),l.bind("isOn").to(a,"value",(t=>!!t)),l.delegate("execute").to(c);function d(t,e){const n=t&&t!==l.lastExecuted?t:l.lastExecuted;return r[n][e]}return c.bind("isEnabled").to(a,"isEnabled"),Mc(c,(()=>{const e=t.map((t=>{const e=i.create("highlight:"+t.model);return this.listenTo(e,"execute",(()=>{c.buttonView.set({lastExecuted:t.model})})),e}));return e.push(new ut),e.push(i.create("removeHighlight")),e}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n("Text highlight toolbar")}),function(t){const e=t.buttonView.actionView;e.iconView.bind("fillColor").to(t.buttonView,"color")}(c),l.on("execute",(()=>{e.execute("highlight",{value:l.commandValue})})),this.listenTo(c,"execute",(()=>{e.editing.view.focus()})),c}))}}function mD(t){return"marker"===t?'':''}class gD extends gt{static get requires(){return[lD,hD]}static get pluginName(){return"Highlight"}}class pD extends ft{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=function(t,e,n){const i=function(t,e){const n=Ff(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(t,n);return e.checkChild(i,"horizontalLine")}(n,e,t)}execute(){const t=this.editor.model;t.change((e=>{const n=e.createElement("horizontalLine");t.insertObject(n,null,null,{setSelection:"after"})}))}}var fD=__webpack_require__(9118),bD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(fD.Z,bD);fD.Z.locals;class xD extends gt{static get pluginName(){return"HorizontalLineEditing"}init(){const t=this.editor,e=t.model.schema,n=t.t,i=t.conversion;e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToElement({model:"horizontalLine",view:(t,{writer:e})=>e.createEmptyElement("hr")}),i.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(t,{writer:e})=>{const i=n("Horizontal line"),o=e.createContainerElement("div",null,e.createEmptyElement("hr"));return e.addClass("ck-horizontal-line",o),e.setCustomProperty("hr",!0,o),function(t,e,n){return e.setCustomProperty("horizontalLine",!0,t),Of(t,e,{label:n})}(o,e,i)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new pD(t))}}class kD extends gt{static get pluginName(){return"HorizontalLineUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("horizontalLine",(n=>{const i=t.commands.get("horizontalLine"),o=new j(n);return o.set({label:e("Horizontal line"),icon:'',tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),o}))}}class wD extends gt{static get requires(){return[xD,kD,eb]}static get pluginName(){return"HorizontalLine"}}class _D extends ft{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection,i=AD(n);this.isEnabled=function(t,e,n){const i=function(t,e){const n=Ff(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(t,n);return e.checkChild(i,"rawHtml")}(n,e,t),this.value=i?i.getAttribute("value")||"":null}execute(t){const e=this.editor.model,n=e.document.selection;e.change((i=>{let o;null!==this.value?o=AD(n):(o=i.createElement("rawHtml"),e.insertObject(o,null,null,{setSelection:"on"})),i.setAttribute("value",t,o)}))}}function AD(t){const e=t.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}var vD=__webpack_require__(3403),CD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(vD.Z,CD);vD.Z.locals;class yD extends gt{static get pluginName(){return"HtmlEmbedEditing"}constructor(t){super(t),t.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:t=>((0,Vl.logWarning)("html-embed-provide-sanitize-function"),{html:t,hasChanged:!1})}),this._widgetButtonViewReferences=new Set}init(){const t=this.editor;t.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),t.commands.add("htmlEmbed",new _D(t)),this._setupConversion()}_setupConversion(){const t=this.editor,e=t.t,n=t.editing.view,i=this._widgetButtonViewReferences,o=t.config.get("htmlEmbed");function r({domElement:t,editor:n,state:o,props:r}){t.textContent="";const a=t.ownerDocument;let c;if(o.isEditable){const e={isDisabled:!1,placeholder:r.textareaPlaceholder};c=s({domDocument:a,state:o,props:e}),t.append(c)}else if(o.showPreviews){const i={sanitizeHtml:r.sanitizeHtml};t.append(function({domDocument:t,state:n,props:i,editor:o}){const r=i.sanitizeHtml(n.getRawHtmlValue()),s=n.getRawHtmlValue().length>0?e("No preview available"):e("Empty snippet content"),a=(0,Vl.createElement)(t,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},s),c=(0,Vl.createElement)(t,"div",{class:"raw-html-embed__preview-content",dir:o.locale.contentLanguageDirection}),l=t.createRange(),d=l.createContextualFragment(r.html);c.appendChild(d);const u=(0,Vl.createElement)(t,"div",{class:"raw-html-embed__preview"},[a,c]);return u}({domDocument:a,state:o,props:i,editor:n}))}else{const e={isDisabled:!0,placeholder:r.textareaPlaceholder};t.append(s({domDocument:a,state:o,props:e}))}const l={onEditClick:r.onEditClick,onSaveClick:()=>{r.onSaveClick(c.value)},onCancelClick:r.onCancelClick};t.prepend(function({editor:t,domDocument:e,state:n,props:o}){const r=(0,Vl.createElement)(e,"div",{class:"raw-html-embed__buttons-wrapper"});if(n.isEditable){const e=ED(t,"save",o.onSaveClick),n=ED(t,"cancel",o.onCancelClick);r.append(e.element,n.element),i.add(e).add(n)}else{const e=ED(t,"edit",o.onEditClick);r.append(e.element),i.add(e)}return r}({editor:n,domDocument:a,state:o,props:l}))}function s({domDocument:t,state:e,props:n}){const i=(0,Vl.createElement)(t,"textarea",{placeholder:n.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return i.disabled=n.isDisabled,i.value=e.getRawHtmlValue(),i}this.editor.editing.view.on("render",(()=>{for(const t of i){if(t.element.isConnected)return;t.destroy(),i.delete(t)}}),{priority:"lowest"}),t.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),t.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(t,{writer:e})=>e.createElement("rawHtml",{value:t.getCustomProperty("$rawContent")})}),t.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(t,{writer:e})=>e.createRawElement("div",{class:"raw-html-embed"},(function(e){e.innerHTML=t.getAttribute("value")||""}))}),t.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(i,{writer:s})=>{let a,c,l;const d=s.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(e){a=e,r({domElement:e,editor:t,state:c,props:l}),a.addEventListener("mousedown",(()=>{if(c.isEditable){const e=t.model;e.document.selection.getSelectedElement()!==i&&e.change((t=>t.setSelection(i,"on")))}}),!0)})),u={makeEditable(){c=Object.assign({},c,{isEditable:!0}),r({domElement:a,editor:t,state:c,props:l}),n.change((t=>{t.setAttribute("data-cke-ignore-events","true",d)})),a.querySelector("textarea").focus()},save(e){e!==c.getRawHtmlValue()?(t.execute("htmlEmbed",e),t.editing.view.focus()):this.cancel()},cancel(){c=Object.assign({},c,{isEditable:!1}),r({domElement:a,editor:t,state:c,props:l}),t.editing.view.focus(),n.change((t=>{t.removeAttribute("data-cke-ignore-events",d)}))}};c={showPreviews:o.showPreviews,isEditable:!1,getRawHtmlValue:()=>i.getAttribute("value")||""},l={sanitizeHtml:o.sanitizeHtml,textareaPlaceholder:e("Paste raw HTML here..."),onEditClick(){u.makeEditable()},onSaveClick(t){u.save(t)},onCancelClick(){u.cancel()}};const h=s.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":e("HTML snippet"),dir:t.locale.uiLanguageDirection},d);return s.setCustomProperty("rawHtmlApi",u,h),s.setCustomProperty("rawHtml",!0,h),Of(h,s,{widgetLabel:e("HTML snippet"),hasSelectionHandle:!0})}})}}function ED(t,e,n){const i=t.locale.t,o=new j(t.locale),r=t.commands.get("htmlEmbed");return o.set({class:`raw-html-embed__${e}-button`,icon:mc.pencil,tooltip:!0,tooltipPosition:"rtl"===t.locale.uiLanguageDirection?"e":"w"}),o.render(),"edit"===e?(o.set({icon:mc.pencil,label:i("Edit source")}),o.bind("isEnabled").to(r)):"save"===e?(o.set({icon:mc.check,label:i("Save changes")}),o.bind("isEnabled").to(r)):o.set({icon:mc.cancel,label:i("Cancel")}),o.on("execute",n),o}class TD extends gt{static get pluginName(){return"HtmlEmbedUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("htmlEmbed",(n=>{const i=t.commands.get("htmlEmbed"),o=new j(n);return o.set({label:e("Insert HTML"),icon:'',tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("htmlEmbed"),t.editing.view.focus();t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),o}))}}class DD extends gt{static get requires(){return[yD,TD,eb]}static get pluginName(){return"HtmlEmbed"}}const SD=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],ID=[{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{copyOnEnter:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],isInline:!0}}];const BD=Ke((function(t,e,n,i){Re(t,e,n,i)}));class MD extends gt{constructor(t){super(t),this._definitions=new Map}static get pluginName(){return"DataSchema"}init(){for(const t of SD)this.registerBlockElement(t);for(const t of ID)this.registerInlineElement(t)}registerBlockElement(t){this._definitions.set(t.model,{...t,isBlock:!0})}registerInlineElement(t){this._definitions.set(t.model,{...t,isInline:!0})}extendBlockElement(t){this._extendDefinition({...t,isBlock:!0})}extendInlineElement(t){this._extendDefinition({...t,isInline:!0})}getDefinitionsForView(t,e){const n=new Set;for(const i of this._getMatchingViewDefinitions(t)){if(e)for(const t of this._getReferences(i.model))n.add(t);n.add(i)}return n}_getMatchingViewDefinitions(t){return Array.from(this._definitions.values()).filter((e=>e.view&&function(t,e){if("string"==typeof t)return t===e;if(t instanceof RegExp)return t.test(e);return!1}(t,e.view)))}*_getReferences(t){const{modelSchema:e}=this._definitions.get(t);if(!e)return;const n=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"];for(const i of n)for(const n of(0,Vl.toArray)(e[i]||[])){const e=this._definitions.get(n);n!==t&&e&&(yield*this._getReferences(e.model),yield e)}}_extendDefinition(t){const e=this._definitions.get(t.model),n=BD({},e,t,((t,e)=>Array.isArray(t)?t.concat(e):void 0));this._definitions.set(t.model,n)}}function ND(t,e,n,i){e&&function(t,e,n){if(e.attributes)for(const[i]of Object.entries(e.attributes))t.removeAttribute(i,n);if(e.styles)for(const i of Object.keys(e.styles))t.removeStyle(i,n);e.classes&&t.removeClass(e.classes,n)}(t,e,i),n&&OD(t,n,i)}function OD(t,e,n){if(e.attributes)for(const[i,o]of Object.entries(e.attributes))t.setAttribute(i,o,n);e.styles&&t.setStyle(e.styles,n),e.classes&&t.addClass(e.classes,n)}function RD(t,e){const n=Xo(t);for(const i in e)Array.isArray(e[i])?n[i]=Array.from(new Set([...t[i]||[],...e[i]])):n[i]={...t[i],...e[i]};return n}function PD({model:t}){return(e,n)=>n.writer.createElement(t,{htmlContent:e.getCustomProperty("$rawContent")})}function LD(t,{view:e,isInline:n}){const i=t.t;return(t,{writer:o})=>{const r=i("HTML object"),s=zD(e,t,o),a=t.getAttribute("htmlAttributes");o.addClass("html-object-embed__content",s),a&&OD(o,a,s);return Of(o.createContainerElement(n?"span":"div",{class:"html-object-embed","data-html-object-embed-label":r},s),o,{widgetLabel:r})}}function zD(t,e,n){return n.createRawElement(t,null,((t,n)=>{n.setContentOf(t,e.getAttribute("htmlContent"))}))}function FD({priority:t,view:e}){return(n,i)=>{if(!n)return;const{writer:o}=i,r=o.createAttributeElement(e,null,{priority:t});return OD(o,n,r),r}}function jD({view:t},e){return n=>{n.on(`element:${t}`,((t,n,i)=>{if(!n.modelRange||n.modelRange.isCollapsed)return;const o=e.processViewAttributes(n.viewItem,i);o&&i.writer.setAttribute("htmlAttributes",o,n.modelRange)}),{priority:"low"})}}function VD({model:t}){return e=>{e.on(`attribute:htmlAttributes:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e;ND(n.writer,i,o,n.mapper.toViewElement(e.item))}))}}const UD=function(t,e,n,i){for(var o=t.length,r=n+(i?1:-1);i?r--:++r-1;)a!==t&&KD.call(a,c,1),KD.call(t,c,1);return t};const YD=We((function(t,e){return t&&t.length&&e&&e.length?$D(t,e):t}));var JD=__webpack_require__(8468),QD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(JD.Z,QD);JD.Z.locals;class XD extends gt{constructor(t){super(t),this._dataSchema=t.plugins.get("DataSchema"),this._allowedAttributes=new Lt,this._disallowedAttributes=new Lt,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerModelPostFixer()}static get pluginName(){return"DataFilter"}static get requires(){return[MD,eb]}loadAllowedConfig(t){for(const e of t){const t=e.name||/[\s\S]+/,n=oS(e);this.allowElement(t),n.forEach((t=>this.allowAttributes(t)))}}loadDisallowedConfig(t){for(const e of t){const t=e.name||/[\s\S]+/,n=oS(e);0==n.length?this.disallowElement(t):n.forEach((t=>this.disallowAttributes(t)))}}allowElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!0))this._allowedElements.has(e)||(this._allowedElements.add(e),this._dataInitialized&&this.editor.data.once("set",(()=>{this._fireRegisterEvent(e)}),{priority:Vl.priorities.get("highest")+1}),this._coupledAttributes=null)}disallowElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!1))this._disallowedElements.add(e.view)}allowAttributes(t){this._allowedAttributes.add(t)}disallowAttributes(t){this._disallowedAttributes.add(t)}processViewAttributes(t,e){return tS(t,e,this._disallowedAttributes),tS(t,e,this._allowedAttributes)}_registerElementsAfterInit(){this.editor.data.on("init",(()=>{this._dataInitialized=!0;for(const t of this._allowedElements)this._fireRegisterEvent(t)}),{priority:Vl.priorities.get("highest")+1})}_registerElementHandlers(){this.on("register",((t,e)=>{const n=this.editor.model.schema;if(e.isObject&&!n.isRegistered(e.model))this._registerObjectElement(e);else if(e.isBlock)this._registerBlockElement(e);else{if(!e.isInline)throw new Vl.CKEditorError("data-filter-invalid-definition",null,e);this._registerInlineElement(e)}t.stop()}),{priority:"lowest"})}_registerModelPostFixer(){const t=this.editor.model;t.document.registerPostFixer((e=>{const n=t.document.differ.getChanges();let i=!1;const o=this._getCoupledAttributesMap();for(const t of n){if("attribute"!=t.type||null!==t.attributeNewValue)continue;const n=o.get(t.attributeKey);if(n)for(const{item:o}of t.range.getWalker({shallow:!0}))for(const t of n)o.hasAttribute(t)&&(e.removeAttribute(t,o),i=!0)}return i}))}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const t of this._allowedElements)if(t.coupledAttribute&&t.model){const e=this._coupledAttributes.get(t.coupledAttribute);e?e.push(t.model):this._coupledAttributes.set(t.coupledAttribute,[t.model])}}_fireRegisterEvent(t){t.view&&this._disallowedElements.has(t.view)||this.fire(t.view?`register:${t.view}`:"register",t)}_registerObjectElement(t){const e=this.editor,n=e.model.schema,i=e.conversion,{view:o,model:r}=t;n.register(r,t.modelSchema),o&&(n.extend(t.model,{allowAttributes:["htmlAttributes","htmlContent"]}),e.data.registerRawContentMatcher({name:o}),i.for("upcast").elementToElement({view:o,model:PD(t),converterPriority:Vl.priorities.get("low")+1}),i.for("upcast").add(jD(t,this)),i.for("editingDowncast").elementToStructure({model:{name:r,attributes:["htmlAttributes"]},view:LD(e,t)}),i.for("dataDowncast").elementToElement({model:r,view:(t,{writer:e})=>zD(o,t,e)}),i.for("dataDowncast").add(VD(t)))}_registerBlockElement(t){const e=this.editor,n=e.model.schema,i=e.conversion,{view:o,model:r}=t;if(!n.isRegistered(t.model)){if(n.register(t.model,t.modelSchema),!o)return;i.for("upcast").elementToElement({model:r,view:o,converterPriority:Vl.priorities.get("low")+1}),i.for("downcast").elementToElement({model:r,view:o})}o&&(n.extend(t.model,{allowAttributes:"htmlAttributes"}),i.for("upcast").add(jD(t,this)),i.for("downcast").add(VD(t)))}_registerInlineElement(t){const e=this.editor,n=e.model.schema,i=e.conversion,o=t.model;n.extend("$text",{allowAttributes:o}),t.attributeProperties&&n.setAttributeProperties(o,t.attributeProperties),i.for("upcast").add(function({view:t,model:e},n){return i=>{i.on(`element:${t}`,((t,i,o)=>{let r=n.processViewAttributes(i.viewItem,o);if(r||o.consumable.test(i.viewItem,{name:!0})){r=r||{},o.consumable.consume(i.viewItem,{name:!0}),i.modelRange||(i=Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor)));for(const t of i.modelRange.getItems())if(o.schema.checkAttribute(t,e)){const n=RD(r,t.getAttribute(e)||{});o.writer.setAttribute(e,n,t)}}}),{priority:"low"})}}(t,this)),i.for("downcast").attributeToElement({model:o,view:FD(t)})}}function tS(t,e,n){const i=function(t,{consumable:e},n){const i=n.matchAll(t)||[],o=[];for(const n of i)eS(e,t,n),delete n.match.name,e.consume(t,n.match),o.push(n);return o}(t,e,n),{attributes:o,styles:r,classes:s}=function(t){const e={attributes:new Set,classes:new Set,styles:new Set};for(const n of t)for(const t in e){(n.match[t]||[]).forEach((n=>e[t].add(n)))}return e}(i),a={};if(o.size)for(const t of o)rS(t)||o.delete(t);return o.size&&(a.attributes=nS(o,(e=>t.getAttribute(e)))),r.size&&(a.styles=nS(r,(e=>t.getStyle(e)))),s.size&&(a.classes=Array.from(s)),Object.keys(a).length?a:null}function eS(t,e,n){for(const i of["attributes","classes","styles"]){const o=n.match[i];if(o)for(const n of Array.from(o))t.test(e,{[i]:[n]})||YD(o,n)}}function nS(t,e){const n={};for(const i of t){void 0!==e(i)&&(n[i]=e(i))}return n}function iS(t,e){const{name:n}=t;return(0,Pt.Z)(t[e])?Object.entries(t[e]).map((([t,i])=>({name:n,[e]:{[t]:i}}))):Array.isArray(t[e])?t[e].map((t=>({name:n,[e]:[t]}))):[t]}function oS(t){const{name:e,attributes:n,classes:i,styles:o}=t,r=[];return n&&r.push(...iS({name:e,attributes:n},"attributes")),i&&r.push(...iS({name:e,classes:i},"classes")),o&&r.push(...iS({name:e,styles:o},"styles")),r}function rS(t){try{document.createAttribute(t)}catch(t){return!1}return!0}class sS extends gt{static get requires(){return[XD]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const t=this.editor.plugins.get(XD);t.on("register:pre",((e,n)=>{if("codeBlock"!==n.model)return;const i=this.editor,o=i.model.schema,r=i.conversion;o.extend("codeBlock",{allowAttributes:["htmlAttributes","htmlContentAttributes"]}),r.for("upcast").add(function(t){return e=>{e.on("element:code",((e,n,i)=>{const o=n.viewItem,r=o.parent;function s(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}r&&r.is("element","pre")&&(s(r,"htmlAttributes"),s(o,"htmlContentAttributes"))}),{priority:"low"})}}(t)),r.for("downcast").add((t=>{t.on("attribute:htmlAttributes:codeBlock",((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,r=n.mapper.toViewElement(e.item).parent;ND(n.writer,i,o,r)})),t.on("attribute:htmlContentAttributes:codeBlock",((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,r=n.mapper.toViewElement(e.item);ND(n.writer,i,o,r)}))})),e.stop()}))}}class aS extends gt{static get requires(){return[XD]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(XD).on("register",((t,e)=>{const n=this.editor,i=n.model.schema,o=n.conversion;if(!e.paragraphLikeModel)return;if(i.isRegistered(e.model)||i.isRegistered(e.paragraphLikeModel))return;const r={model:e.paragraphLikeModel,view:e.view};i.register(e.model,e.modelSchema),i.register(r.model,{inheritAllFrom:"$block"}),o.for("upcast").elementToElement({view:e.view,model:(t,{writer:n})=>this._hasBlockContent(t)?n.createElement(e.model):n.createElement(r.model),converterPriority:Vl.priorities.get("low")+1}),o.for("downcast").elementToElement({view:e.view,model:e.model}),this._addAttributeConversion(e),o.for("downcast").elementToElement({view:r.view,model:r.model}),this._addAttributeConversion(r),t.stop()}))}_hasBlockContent(t){const e=this.editor.editing.view,n=e.domConverter.blockElements;for(const i of e.createRangeIn(t).getItems())if(i.is("element")&&n.includes(i.name))return!0;return!1}_addAttributeConversion(t){const e=this.editor,n=e.conversion,i=e.plugins.get(XD);e.model.schema.extend(t.model,{allowAttributes:"htmlAttributes"}),n.for("upcast").add(jD(t,i)),n.for("downcast").add(VD(t))}}class cS extends gt{static get requires(){return[MD]}static get pluginName(){return"HeadingElementSupport"}init(){const t=this.editor;if(!t.plugins.has("HeadingEditing"))return;const e=t.plugins.get(MD),n=t.config.get("heading.options"),i=[];for(const t of n)"model"in t&&"view"in t&&(e.registerBlockElement({view:t.view,model:t.model}),i.push(t.model));e.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}})}}class lS extends gt{static get requires(){return[XD]}static get pluginName(){return"ImageElementSupport"}init(){const t=this.editor;if(!t.plugins.has("ImageInlineEditing")&&!t.plugins.has("ImageBlockEditing"))return;const e=t.model.schema,n=t.conversion,i=t.plugins.get(XD);i.on("register:figure",(()=>{n.for("upcast").add(function(t){return e=>{e.on("element:figure",((e,n,i)=>{const o=n.viewItem;if(!n.modelRange||!o.hasClass("image"))return;const r=t.processViewAttributes(o,i);r&&i.writer.setAttribute("htmlFigureAttributes",r,n.modelRange)}),{priority:"low"})}}(i))})),i.on("register:img",((t,o)=>{"imageBlock"!==o.model&&"imageInline"!==o.model||(e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["htmlA","htmlAttributes"]}),n.for("upcast").add(function(t){return e=>{e.on("element:img",((e,n,i)=>{if(!n.modelRange)return;const o=n.viewItem,r=o.parent;function s(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}function a(t){n.modelRange&&n.modelRange.getContainedElement().is("element","imageBlock")&&s(t,"htmlLinkAttributes")}s(o,"htmlAttributes"),r.is("element","a")&&a(r)}),{priority:"low"})}}(i)),n.for("downcast").add((t=>{function e(e){t.on(`attribute:${e}:imageInline`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,r=n.mapper.toViewElement(e.item);ND(n.writer,i,o,r)}),{priority:"low"})}function n(e,n){t.on(`attribute:${n}:imageBlock`,((t,n,i)=>{if(!i.consumable.test(n.item,t.name))return;const{attributeOldValue:o,attributeNewValue:r}=n,s=i.mapper.toViewElement(n.item),a=dS(i.writer,s,e);a&&(ND(i.writer,o,r,a),i.consumable.consume(n.item,t.name))}),{priority:"low"}),"a"===e&&t.on("attribute:linkHref:imageBlock",((t,e,n)=>{if(!n.consumable.consume(e.item,"attribute:htmlLinkAttributes:imageBlock"))return;const i=n.mapper.toViewElement(e.item),o=dS(n.writer,i,"a");OD(n.writer,e.item.getAttribute("htmlLinkAttributes"),o)}),{priority:"low"})}e("htmlAttributes"),n("img","htmlAttributes"),n("figure","htmlFigureAttributes"),n("a","htmlLinkAttributes")})),t.stop())}))}}function dS(t,e,n){const i=t.createRangeOn(e);for(const{item:t}of i.getWalker())if(t.is("element",n))return t}class uS extends gt{static get requires(){return[XD]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const t=this.editor;if(!t.plugins.has("MediaEmbed")||t.config.get("mediaEmbed.previewsInData"))return;const e=t.model.schema,n=t.conversion,i=this.editor.plugins.get(XD),o=this.editor.plugins.get(MD),r=t.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:r}),i.on("register:figure",(()=>{n.for("upcast").add(function(t){return e=>{e.on("element:figure",((e,n,i)=>{const o=n.viewItem;if(!n.modelRange||!o.hasClass("media"))return;const r=t.processViewAttributes(o,i);r&&i.writer.setAttribute("htmlFigureAttributes",r,n.modelRange)}),{priority:"low"})}}(i))})),i.on(`register:${r}`,((t,o)=>{"media"===o.model&&(e.extend("media",{allowAttributes:["htmlAttributes","htmlFigureAttributes"]}),n.for("upcast").add(function(t,e){return t=>{t.on(`element:${e}`,n,{priority:"low"})};function n(e,n,i){function o(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}o(n.viewItem,"htmlAttributes")}}(i,r)),n.for("dataDowncast").add(function(t){return e=>{function n(t,n){e.on(`attribute:${n}:media`,((e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const{attributeOldValue:o,attributeNewValue:r}=n,s=i.mapper.toViewElement(n.item),a=function(t,e,n){const i=t.createRangeOn(e);for(const{item:t}of i.getWalker())if(t.is("element",n))return t}(i.writer,s,t);ND(i.writer,o,r,a)}))}n(t,"htmlAttributes"),n("figure","htmlFigureAttributes")}}(r)),t.stop())}))}}class hS extends gt{static get requires(){return[XD]}static get pluginName(){return"ScriptElementSupport"}init(){const t=this.editor.plugins.get(XD);t.on("register:script",((e,n)=>{const i=this.editor,o=i.model.schema,r=i.conversion;o.register("htmlScript",n.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),r.for("upcast").elementToElement({view:"script",model:PD(n)}),r.for("upcast").add(jD(n,t)),r.for("downcast").elementToElement({model:"htmlScript",view:(t,{writer:e})=>zD("script",t,e)}),r.for("downcast").add(VD(n)),e.stop()}))}}class mS extends gt{static get requires(){return[XD]}static get pluginName(){return"TableElementSupport"}init(){const t=this.editor;if(!t.plugins.has("TableEditing"))return;const e=t.model.schema,n=t.conversion,i=t.plugins.get(XD);i.on("register:figure",(()=>{n.for("upcast").add(function(t){return e=>{e.on("element:figure",((e,n,i)=>{const o=n.viewItem;if(!n.modelRange||!o.hasClass("table"))return;const r=t.processViewAttributes(o,i);r&&i.writer.setAttribute("htmlFigureAttributes",r,n.modelRange)}),{priority:"low"})}}(i))})),i.on("register:table",((t,o)=>{"table"===o.model&&(e.extend("table",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),n.for("upcast").add(function(t){return e=>{e.on("element:table",((e,n,i)=>{const o=n.viewItem;r(o,"htmlAttributes");for(const t of o.getChildren())t.is("element","thead")&&r(t,"htmlTheadAttributes"),t.is("element","tbody")&&r(t,"htmlTbodyAttributes");function r(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}}),{priority:"low"})}}(i)),n.for("downcast").add((t=>{function e(e,n){t.on(`attribute:${n}:table`,((t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const o=i.mapper.toViewElement(n.item),r=function(t,e,n){const i=t.createRangeOn(e);for(const{item:t}of i.getWalker())if(t.is("element",n))return t}(i.writer,o,e);OD(i.writer,n.attributeNewValue,r)}))}e("table","htmlAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes")})),t.stop())}))}}class gS extends gt{static get requires(){return[XD]}static get pluginName(){return"StyleElementSupport"}init(){const t=this.editor.plugins.get(XD);t.on("register:style",((e,n)=>{const i=this.editor,o=i.model.schema,r=i.conversion;o.register("htmlStyle",n.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),r.for("upcast").elementToElement({view:"style",model:PD(n)}),r.for("upcast").add(jD(n,t)),r.for("downcast").elementToElement({model:"htmlStyle",view:(t,{writer:e})=>zD("style",t,e)}),r.for("downcast").add(VD(n)),e.stop()}))}}class pS extends gt{static get requires(){return[XD]}static get pluginName(){return"DocumentListElementSupport"}init(){const t=this.editor;if(!t.plugins.has("DocumentListEditing"))return;const e=t.model.schema,n=t.conversion,i=t.plugins.get(XD),o=t.plugins.get("DocumentListEditing");o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast(t,e,n){OD(t,e,n)}}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlListAttributes",setAttributeOnDowncast(t,e,n){OD(t,e,n)}}),i.on("register",((t,o)=>{["ul","ol","li"].includes(o.view)&&(t.stop(),e.checkAttribute("$block","htmlListAttributes")||(e.extend("$block",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),e.extend("$blockObject",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),e.extend("$container",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),n.for("upcast").add((t=>{t.on("element:ul",fS("htmlListAttributes",i),{priority:"low"}),t.on("element:ol",fS("htmlListAttributes",i),{priority:"low"}),t.on("element:li",fS("htmlLiAttributes",i),{priority:"low"})}))))})),o.on("postFixer",((t,{listNodes:e,writer:n})=>{const i=[];for(const{node:o,previous:r}of e){if(!r)continue;const e=o.getAttribute("listIndent"),s=r.getAttribute("listIndent");let a=null;if(e>s?i[s]=r:e{t.model.change((t=>{for(const e of n)t.setAttribute("htmlListAttributes",{},e)}))}))}}function fS(t,e){return(n,i,o)=>{const r=i.viewItem;i.modelRange||Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor));const s=e.processViewAttributes(r,o);for(const e of i.modelRange.getItems({shallow:!0}))e.hasAttribute("listItemId")&&(e.hasAttribute(t)||o.writer.setAttribute(t,s||{},e))}}class bS extends gt{static get requires(){return[XD,MD]}static get pluginName(){return"CustomElementSupport"}init(){const t=this.editor.plugins.get(XD),e=this.editor.plugins.get(MD);t.on("register:$customElement",((n,i)=>{n.stop();const o=this.editor,r=o.model.schema,s=o.conversion,a=o.editing.view.domConverter.unsafeElements,c=o.data.htmlProcessor.domConverter.preElements;r.register(i.model,i.modelSchema),r.extend(i.model,{allowAttributes:["htmlElementName","htmlAttributes","htmlContent"],isContent:!0}),s.for("upcast").elementToElement({view:/.*/,model:(n,r)=>{if("$comment"==n.name)return;if(!function(t){try{document.createElement(t)}catch(t){return!1}return!0}(n.name))return;if(e.getDefinitionsForView(n.name).size)return;a.includes(n.name)||a.push(n.name),c.includes(n.name)||c.push(n.name);const s=r.writer.createElement(i.model,{htmlElementName:n.name}),l=t.processViewAttributes(n,r);l&&r.writer.setAttribute("htmlAttributes",l,s);const d=new fa(n.document).createDocumentFragment(n),u=o.data.processor.toData(d);r.writer.setAttribute("htmlContent",u,s);for(const{item:t}of o.editing.view.createRangeIn(n))r.consumable.consume(t,{name:!0});return s},converterPriority:"low"}),s.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(t,{writer:e})=>{const n=t.getAttribute("htmlElementName"),i=e.createRawElement(n);return t.hasAttribute("htmlAttributes")&&OD(e,t.getAttribute("htmlAttributes"),i),i}}),s.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(t,{writer:e})=>{const n=t.getAttribute("htmlElementName"),i=t.getAttribute("htmlContent"),o=e.createRawElement(n,null,((t,e)=>{e.setContentOf(t,i);const n=t.firstChild;for(n.remove();n.firstChild;)t.appendChild(n.firstChild)}));return t.hasAttribute("htmlAttributes")&&OD(e,t.getAttribute("htmlAttributes"),o),o}})}))}}class xS extends gt{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[XD,sS,aS,cS,lS,uS,hS,mS,gS,pS,bS]}init(){const t=this.editor,e=t.plugins.get(XD);e.loadAllowedConfig(t.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(t.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(t){const e=this.editor.plugins.get("DataSchema"),n=Array.from(e.getDefinitionsForView(t,!1));return n&&n.length&&n[0].isInline&&!n[0].isObject?n[0].model:"htmlAttributes"}addModelHtmlClass(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of kS(i,n,o))wS(t,r,o,"classes",(t=>{for(const n of(0,Vl.toArray)(e))t.add(n)}))}))}removeModelHtmlClass(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of kS(i,n,o))wS(t,r,o,"classes",(t=>{for(const n of(0,Vl.toArray)(e))t.delete(n)}))}))}setModelHtmlAttributes(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of kS(i,n,o))wS(t,r,o,"attributes",(t=>{for(const[n,i]of Object.entries(e))t.set(n,i)}))}))}removeModelHtmlAttributes(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of kS(i,n,o))wS(t,r,o,"attributes",(t=>{for(const n of(0,Vl.toArray)(e))t.delete(n)}))}))}setModelHtmlStyles(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of kS(i,n,o))wS(t,r,o,"styles",(t=>{for(const[n,i]of Object.entries(e))t.set(n,i)}))}))}removeModelHtmlStyles(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of kS(i,n,o))wS(t,r,o,"styles",(t=>{for(const n of(0,Vl.toArray)(e))t.delete(n)}))}))}}function*kS(t,e,n){if(e.is("documentSelection")&&e.isCollapsed)t.schema.checkAttributeInSelection(e,n)&&(yield e);else for(const i of function(t,e,n){return e.is("node")||e.is("$text")||e.is("$textProxy")?t.schema.checkAttribute(e,n)?[t.createRangeOn(e)]:[]:t.schema.getValidRanges(t.createSelection(e).getRanges(),n)}(t,e,n))yield*i.getItems({shallow:!0})}function wS(t,e,n,i,o){const r=e.getAttribute(n),s={};for(const t of["attributes","styles","classes"])if(t!=i)r&&r[t]&&(s[t]=r[t]);else{const e="classes"==t?new Set(r&&r[t]||[]):new Map(Object.entries(r&&r[t]||{}));o(e),e.size&&(s[t]="classes"==t?Array.from(e):Object.fromEntries(e))}Object.keys(s).length?e.is("documentSelection")?t.setSelectionAttribute(n,s):t.setAttribute(n,s,e):r&&(e.is("documentSelection")?t.removeSelectionAttribute(n):t.removeAttribute(n,e))}class _S extends gt{static get pluginName(){return"HtmlComment"}init(){const t=this.editor;t.data.processor.skipComments=!1,t.model.schema.addAttributeCheck(((t,e)=>{if(t.endsWith("$root")&&e.startsWith("$comment"))return!0})),t.conversion.for("upcast").elementToMarker({view:"$comment",model:(t,{writer:e})=>{const n=this.editor.model.document.getRoot(),i=t.getCustomProperty("$rawContent"),o=`$comment:${(0,Vl.uid)()}`;return e.setAttribute(o,i,n),o}}),t.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(t,{writer:e})=>{const n=this.editor.model.document.getRoot(),i=t.markerName,o=n.getAttribute(i),r=e.createUIElement("$comment");return e.setCustomProperty("$rawContent",o,r),r}}),t.model.document.registerPostFixer((e=>{const n=t.model.document.getRoot(),i=t.model.document.differ.getChangedMarkers().filter((t=>t.name.startsWith("$comment"))),o=i.filter((t=>{const e=t.data.newRange;return e&&"$graveyard"===e.root.rootName}));if(0===o.length)return!1;for(const t of o)e.removeMarker(t.name),e.removeAttribute(t.name,n);return!0})),t.data.on("set",(()=>{for(const e of t.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(e.name)}),{priority:"high"}),t.model.on("deleteContent",((e,[n])=>{for(const e of n.getRanges()){const n=t.model.schema.getLimitElement(e),i=t.model.createPositionAt(n,0),o=t.model.createPositionAt(n,"end");let r;r=i.isTouching(e.start)&&o.isTouching(e.end)?this.getHtmlCommentsInRange(t.model.createRange(i,o)):this.getHtmlCommentsInRange(e,{skipBoundaries:!0});for(const t of r)this.removeHtmlComment(t)}}),{priority:"high"})}createHtmlComment(t,e){const n=(0,Vl.uid)(),i=this.editor.model,o=i.document.getRoot(),r=`$comment:${n}`;return i.change((n=>{const i=n.createRange(t);return n.addMarker(r,{usingOperation:!0,affectsData:!0,range:i}),n.setAttribute(r,e,o),r}))}removeHtmlComment(t){const e=this.editor,n=e.model.document.getRoot(),i=e.model.markers.get(t);return!!i&&(e.model.change((e=>{e.removeMarker(i),e.removeAttribute(t,n)})),!0)}getHtmlCommentData(t){const e=this.editor,n=e.model.markers.get(t),i=e.model.document.getRoot();return n?{content:i.getAttribute(t),position:n.getStart()}:null}getHtmlCommentsInRange(t,{skipBoundaries:e=!1}={}){const n=!e;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter((e=>function(t,e){const i=t.getRange().start;return(i.isAfter(e.start)||n&&i.isEqual(e.start))&&(i.isBefore(e.end)||n&&i.isEqual(e.end))}(e,t))).map((t=>t.name))}}class AS extends ft{refresh(){const t=this.editor.model,e=t.document;this.isEnabled=t.schema.checkAttributeInSelection(e.selection,"mention")}execute(t){const e=this.editor.model,n=e.document.selection,i="string"==typeof t.mention?{id:t.mention}:t.mention,o=i.id,r=t.range||n.getFirstRange(),s=t.text||o,a=CS({_text:s,id:o},i);if(1!=t.marker.length)throw new Vl.CKEditorError("mentioncommand-incorrect-marker",this);if(o.charAt(0)!=t.marker)throw new Vl.CKEditorError("mentioncommand-incorrect-id",this);e.change((t=>{const i=(0,Vl.toMap)(n.getAttributes()),o=new Map(i.entries());o.set("mention",a),e.insertContent(t.createText(s,o),r),e.insertContent(t.createText(" ",i),r.start.getShiftedBy(s.length))}))}}class vS extends gt{static get pluginName(){return"MentionEditing"}init(){const t=this.editor,e=t.model,n=e.document;e.schema.extend("$text",{allowAttributes:"mention"}),t.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:t=>yS(t)}}),t.conversion.for("downcast").attributeToElement({model:"mention",view:TS}),t.conversion.for("downcast").add(ES),n.registerPostFixer((t=>function(t,e,n){const i=e.differ.getChanges();let o=!1;for(const e of i){if("attribute"==e.type)continue;const i=e.position;if("$text"==e.name){const e=i.textNode&&i.textNode.nextSibling;o=SS(i.textNode,t)||o,o=SS(e,t)||o,o=SS(i.nodeBefore,t)||o,o=SS(i.nodeAfter,t)||o}if("$text"!=e.name&&"insert"==e.type){const e=i.nodeAfter;for(const n of t.createRangeIn(e).getItems())o=SS(n,t)||o}if("insert"==e.type&&n.isInline(e.name)){const e=i.nodeAfter&&i.nodeAfter.nextSibling;o=SS(i.nodeBefore,t)||o,o=SS(e,t)||o}}return o}(t,n,e.schema))),n.registerPostFixer((t=>function(t,e){const n=e.differ.getChanges();let i=!1;for(const e of n)if("attribute"===e.type&&"mention"!=e.attributeKey){const n=e.range.start.nodeBefore,o=e.range.end.nodeAfter;for(const r of[n,o])DS(r)&&r.getAttribute(e.attributeKey)!=e.attributeNewValue&&(t.setAttribute(e.attributeKey,e.attributeNewValue,r),i=!0)}return i}(t,n))),n.registerPostFixer((t=>function(t,e){const n=e.selection,i=n.focus;if(n.isCollapsed&&n.hasAttribute("mention")&&function(t){const e=t.isAtStart;return t.nodeBefore&&t.nodeBefore.is("$text")||e}(i))return t.removeSelectionAttribute("mention"),!0;return!1}(t,n))),t.commands.add("mention",new AS(t))}}function CS(t,e){return Object.assign({uid:(0,Vl.uid)()},t,e||{})}function yS(t,e){const n=t.getAttribute("data-mention"),i=t.getChild(0);if(!i)return;return CS({id:n,_text:i.data},e)}function ES(t){t.on("attribute:mention",((t,e,n)=>{const i=e.attributeNewValue;if(!e.item.is("$textProxy")||!i)return;const o=e.range.start;(o.textNode||o.nodeAfter).data!=i._text&&n.consumable.consume(e.item,t.name)}),{priority:"highest"})}function TS(t,{writer:e}){if(!t)return;const n={class:"mention","data-mention":t.id},i={id:t.uid,priority:20};return e.createAttributeElement("span",n,i)}function DS(t){if(!t||!t.is("$text")&&!t.is("$textProxy")||!t.hasAttribute("mention"))return!1;return t.data!=t.getAttribute("mention")._text}function SS(t,e){return!!DS(t)&&(e.removeAttribute("mention",t),!0)}var IS=__webpack_require__(6391),BS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(IS.Z,BS);IS.Z.locals;class MS extends Cc{constructor(t){super(t),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const t=this.selected,e=this.items.getIndex(t);this.select(e+1)}selectPrevious(){const t=this.selected,e=this.items.getIndex(t);this.select(e-1)}select(t){let e=0;t>0&&t{n?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))})),this.listenTo(this.domElement,"click",(()=>{this.fire("execute")}))}render(){super.render(),this.element=this.domElement}}class OS extends yc{highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const RS=[Vl.keyCodes.arrowup,Vl.keyCodes.arrowdown,Vl.keyCodes.esc],PS=[Vl.keyCodes.enter,Vl.keyCodes.tab];class LS extends gt{static get pluginName(){return"MentionUI"}static get requires(){return[Sl]}constructor(t){super(t),this._items=new Vl.Collection,this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=Pi(this._requestFeed,100),t.config.define("mention",{feeds:[]})}init(){const e=this.editor,n=e.config.get("mention.commitKeys")||PS,i=RS.concat(n);this._balloon=e.plugins.get(Sl),e.editing.view.document.on("keydown",((t,e)=>{var o;o=e.keyCode,i.includes(o)&&this._isUIVisible&&(e.preventDefault(),t.stop(),e.keyCode==Vl.keyCodes.arrowdown&&this._mentionsView.selectNext(),e.keyCode==Vl.keyCodes.arrowup&&this._mentionsView.selectPrevious(),n.includes(e.keyCode)&&this._mentionsView.executeSelected(),e.keyCode==Vl.keyCodes.esc&&this._hideUIAndRemoveMarker())}),{priority:"highest"}),t({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const o=e.config.get("mention.feeds");for(const t of o){const e=t.feed,n=t.marker;if(!US(n))throw new Vl.CKEditorError("mentionconfig-incorrect-marker",null,{marker:n});const i={marker:n,feedCallback:"function"==typeof e?e.bind(this.editor):VS(e),itemRenderer:t.itemRenderer};this._mentionsConfigurations.set(n,i)}this._setupTextWatcher(o),this.listenTo(e,"change:isReadOnly",(()=>{this._hideUIAndRemoveMarker()})),this.on("requestFeed:response",((t,e)=>this._handleFeedResponse(e))),this.on("requestFeed:error",(()=>this._hideUIAndRemoveMarker()))}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const t=this.editor.locale,e=new MS(t);return e.items.bindTo(this._items).using((n=>{const{item:i,marker:o}=n,r=this.editor.config.get("mention.dropdownLimit")||10;if(e.items.length>=r)return null;const s=new OS(t),a=this._renderItem(i,o);return a.delegate("execute").to(s),s.children.add(a),s.item=i,s.marker=o,s.on("execute",(()=>{e.fire("execute",{item:i,marker:o})})),s})),e.on("execute",((t,e)=>{const n=this.editor,i=n.model,o=e.item,r=e.marker,s=n.model.markers.get("mention"),a=i.createPositionAt(i.document.selection.focus),c=i.createPositionAt(s.getStart()),l=i.createRange(c,a);this._hideUIAndRemoveMarker(),n.execute("mention",{mention:o,text:o.text,marker:r,range:l}),n.editing.view.focus()})),e}_getItemRenderer(t){const{itemRenderer:e}=this._mentionsConfigurations.get(t);return e}_requestFeed(t,e){this._lastRequested=e;const{feedCallback:n}=this._mentionsConfigurations.get(t),i=n(e);i instanceof Promise?i.then((n=>{this._lastRequested==e?this.fire("requestFeed:response",{feed:n,marker:t,feedText:e}):this.fire("requestFeed:discarded",{feed:n,marker:t,feedText:e})})).catch((e=>{this.fire("requestFeed:error",{error:e}),(0,Vl.logWarning)("mention-feed-callback-error",{marker:t})})):this.fire("requestFeed:response",{feed:i,marker:t,feedText:e})}_setupTextWatcher(t){const e=this.editor,n=t.map((t=>({...t,pattern:jS(t.marker,t.minimumCharacters||0)}))),i=new Wd(e.model,function(t){const e=e=>{const n=FS(t,e);if(!n)return!1;let i=0;0!==n.position&&(i=n.position-1);const o=e.substring(i);return n.pattern.test(o)};return e}(n));i.on("matched",((t,i)=>{const o=FS(n,i.text),r=e.model.document.selection.focus,s=e.model.createPositionAt(r.parent,o.position);if(function(t){const e=t.textNode&&t.textNode.hasAttribute("mention"),n=t.nodeBefore;return e||n&&n.is("$text")&&n.hasAttribute("mention")}(r)||function(t){const e=t.nodeAfter;return e&&e.is("$text")&&e.hasAttribute("mention")}(s))return void this._hideUIAndRemoveMarker();const a=function(t,e){let n=0;0!==t.position&&(n=t.position-1);const i=jS(t.marker,0),o=e.substring(n).match(i);return o[2]}(o,i.text),c=o.marker.length+a.length,l=r.getShiftedBy(-c),d=r.getShiftedBy(-a.length),u=e.model.createRange(l,d);if(HS(e)){const t=e.model.markers.get("mention");e.model.change((e=>{e.updateMarker(t,{range:u})}))}else e.model.change((t=>{t.addMarker("mention",{range:u,usingOperation:!1,affectsData:!1})}));this._requestFeedDebounced(o.marker,a)})),i.on("unmatched",(()=>{this._hideUIAndRemoveMarker()}));const o=e.commands.get("mention");return i.bind("isEnabled").to(o),i}_handleFeedResponse(t){const{feed:e,marker:n}=t;if(!HS(this.editor))return;this._items.clear();for(const t of e){const e="object"!=typeof t?{id:t,text:t}:t;this._items.add({item:e,marker:n})}const i=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(i):this._hideUIAndRemoveMarker()}_showOrUpdateUI(t){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(t,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(t,this._mentionsView.position),singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),HS(this.editor)&&this.editor.model.change((t=>t.removeMarker("mention"))),this._mentionsView.position=void 0}_renderItem(t,e){const n=this.editor;let i,o=t.id;const r=this._getItemRenderer(e);if(r){const e=r(t);"string"!=typeof e?i=new NS(n.locale,e):o=e}if(!i){const t=new j(n.locale);t.label=o,t.withText=!0,i=t}return i}_getBalloonPanelPositionData(t,e){const n=this.editor,i=n.editing,o=i.view.domConverter,r=i.mapper;return{target:()=>{let e=t.getRange();"$graveyard"==e.start.root.rootName&&(e=n.model.document.selection.getFirstRange());const i=r.toViewRange(e);return Vl.Rect.getDomRangeRects(o.viewRangeToDom(i)).pop()},limiter:()=>{const t=this.editor.editing.view,e=t.document.selection.editableElement;return e?t.domConverter.mapViewToDom(e.root):null},positions:zS(e)}}}function zS(t){const e={caret_se:t=>({top:t.bottom+3,left:t.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(t,e)=>({top:t.top-e.height-3,left:t.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(t,e)=>({top:t.bottom+3,left:t.right-e.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(t,e)=>({top:t.top-e.height-3,left:t.right-e.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(e,t)?[e[t]]:[e.caret_se,e.caret_sw,e.caret_ne,e.caret_nw]}function FS(t,e){let n;for(const i of t){const t=e.lastIndexOf(i.marker);t>0&&!e.substring(t-1).match(i.pattern)||(!n||t>=n.position)&&(n={marker:i.marker,position:t,minimumCharacters:i.minimumCharacters,pattern:i.pattern})}return n}function jS(t,e){const n=0==e?"*":`{${e},}`,i=Vl.env.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return new RegExp(`(?:^|[ ${i}])([${t}])(.${n})$`,"u")}function VS(t){return e=>t.filter((t=>("string"==typeof t?t:String(t.id)).toLowerCase().includes(e.toLowerCase())))}function US(t){return t&&1==t.length}function HS(t){return t.model.markers.has("mention")}var qS=__webpack_require__(7583),WS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(qS.Z,WS);qS.Z.locals;class GS extends gt{toMentionAttribute(t,e){return yS(t,e)}static get pluginName(){return"Mention"}static get requires(){return[vS,LS]}}class ZS extends ft{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=function(t,e,n){const i=function(t,e){const n=Ff(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(t,n);return e.checkChild(i,"pageBreak")}(n,e,t)}execute(){const t=this.editor.model;t.change((e=>{const n=e.createElement("pageBreak");t.insertObject(n,null,null,{setSelection:"after"})}))}}var KS=__webpack_require__(6448),$S={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(KS.Z,$S);KS.Z.locals;class YS extends gt{static get pluginName(){return"PageBreakEditing"}init(){const t=this.editor,e=t.model.schema,n=t.t,i=t.conversion;e.register("pageBreak",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToStructure({model:"pageBreak",view:(t,{writer:e})=>e.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},e.createContainerElement("span",{style:"display: none"}))}),i.for("editingDowncast").elementToStructure({model:"pageBreak",view:(t,{writer:e})=>{const i=n("Page break"),o=e.createContainerElement("div"),r=e.createRawElement("span",{class:"page-break__label"},(function(t){t.innerText=n("Page break")}));return e.addClass("page-break",o),e.insert(e.createPositionAt(o,0),r),function(t,e,n){return e.setCustomProperty("pageBreak",!0,t),Of(t,e,{label:n})}(o,e,i)}}),i.for("upcast").elementToElement({view:t=>{const e="always"==t.getStyle("page-break-before"),n="always"==t.getStyle("page-break-after");if(!e&&!n)return null;if(1==t.childCount){const e=t.getChild(0);if(!e.is("element","span")||"none"!=e.getStyle("display"))return null}else if(t.childCount>1)return null;return{name:!0}},model:"pageBreak",converterPriority:"high"}),t.commands.add("pageBreak",new ZS(t))}}class JS extends gt{static get pluginName(){return"PageBreakUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("pageBreak",(n=>{const i=t.commands.get("pageBreak"),o=new j(n);return o.set({label:e("Page break"),icon:'',tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("pageBreak"),t.editing.view.focus()})),o}))}}class QS extends gt{static get requires(){return[YS,JS,eb]}static get pluginName(){return"PageBreak"}}function XS(t,e,n,{blockElements:i,inlineObjectElements:o}){let r=n.createPositionAt(t,"forward"==e?"after":"before");return r=r.getLastMatchingPosition((({item:t})=>t.is("element")&&!i.includes(t.name)&&!o.includes(t.name)),{direction:e}),"forward"==e?r.nodeAfter:r.nodeBefore}function tI(t,e){return!!t&&t.is("element")&&e.includes(t.name)}function eI(t,e){if(!t.childCount)return;const n=new fa(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new Lt({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),o=[];for(const t of n)if("elementStart"===t.type&&i.match(t.item)){const e=oI(t.item);o.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return o}(t,n);if(!i.length)return;let o=null,r=1;i.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return i=n,!(i.is("element","ol")||i.is("element","ul"));var i}(i[s-1],t),c=a?null:i[s-1],l=(u=t,(d=c)?u.indent-d.indent:u.indent-1);var d,u;if(a&&(o=null,r=1),!o||0!==l){const i=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),i=/mso-level-number-format:([^;]{0,100});/gi,o=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=i.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);return t.is("$text")?t:t.getChild(0)}return null}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=o.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:nI(s)}}(t,e);if(o){if(t.indent>r){const t=o.getChild(o.childCount-1),e=t.getChild(t.childCount-1);o=iI(i,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,o),o}function oI(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),i=n.match(/\s{0,100}lfo(\d+)/i),o=n.match(/\s{0,100}level(\d+)/i);t&&i&&o&&(e.id=t[2],e.order=i[1],e.indent=parseInt(o[1]))}return e}const rI=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class sI{constructor(t){this.document=t}isActive(t){return rI.test(t)}execute(t){const e=new fa(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const i=t.getChildIndex(n);e.remove(n),e.insertChild(i,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),function(t,e){const n=new Cn(e.document.stylesProcessor),i=new gi(n,{renderingMode:"data"}),o=i.blockElements,r=i.inlineObjectElements,s=[];for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","br")){const n=XS(t,"forward",e,{blockElements:o,inlineObjectElements:r}),i=XS(t,"backward",e,{blockElements:o,inlineObjectElements:r}),a=tI(n,o);(tI(i,o)||a)&&s.push(t)}}for(const t of s)t.hasClass("Apple-interchange-newline")?e.remove(t):e.replace(t,e.createElement("p"))}(n,e),t.content=n}}function aI(t,e){if(!t.childCount)return;const n=new fa(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new Lt({name:/v:(.+)/}),o=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling,r=n&&n.is("element")?n.name:null;i.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==r&&o.push(t.item.getAttribute("id"))}return o}(t,n);!function(t,e,n){const i=n.createRangeIn(e),o=new Lt({name:"img"}),r=[];for(const e of i)if(e.item.is("element")&&o.match(e.item)){const n=e.item,i=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];i.length&&i.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(i,t,n),function(t,e,n){const i=n.createRangeIn(e),o=[];for(const e of i)if("elementStart"==e.type&&e.item.is("element","v:shape")){const n=e.item.getAttribute("id");if(t.includes(n))continue;r(e.item.parent.getChildren(),n)||o.push(e.item)}for(const t of o){const e={src:s(t)};t.hasAttribute("alt")&&(e.alt=t.getAttribute("alt"));const i=n.createElement("img",e);n.insertChild(t.index+1,i,t.parent)}function r(t,e){for(const n of t)if(n.is("element")){if("img"==n.name&&n.getAttribute("v:shapes")==e)return!0;if(r(n.getChildren(),e))return!0}return!1}function s(t){for(const e of t.getChildren())if(e.is("element")&&e.getAttribute("src"))return e.getAttribute("src")}}(i,t,n),function(t,e){const n=e.createRangeIn(t),i=new Lt({name:/v:(.+)/}),o=[];for(const t of n)"elementStart"==t.type&&i.match(t.item)&&o.push(t.item);for(const t of o)e.remove(t)}(t,n);const o=function(t,e){const n=e.createRangeIn(t),i=new Lt({name:"img"}),o=[];for(const t of n)t.item.is("element")&&i.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&o.push(t.item);return o}(t,n);o.length&&function(t,e,n){if(t.length===e.length)for(let i=0;iString.fromCharCode(parseInt(t,16)))).join(""))}const lI=//i,dI=/xmlns:o="urn:schemas-microsoft-com/i;class uI{constructor(t){this.document=t}isActive(t){return lI.test(t)||dI.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;eI(e,n),aI(e,t.dataTransfer.getData("text/rtf")),t.content=e}}function hI(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join(" ").substr(0,e.length)))}function mI(t,e){const n=new DOMParser,i=function(t){return hI(hI(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n="",i=t.indexOf(e);if(i<0)return t;const o=t.indexOf(n,i+e.length);return t.substring(0,i+e.length)+(o>=0?t.substring(o):"")}(t=t.replace(/