>>8^n[255&(i^o.charCodeAt(t))];return i=~i>>>0,i.toString(16).padStart(8,"0")}(function(t){return Object.getOwnPropertyNames(t).sort().filter((e=>"vc"!=e&&null!=t[e])).map((e=>t[e]))}(r))!=r.vc.toLowerCase())return void i("invalid");if(new Date(1e3*r.exp)0&&!function(t){const{hostname:e}=new URL(window.location.href);if(t.includes(e))return!0;const n=e.split(".");return t.filter((t=>t.includes("*"))).map((t=>t.split("."))).filter((t=>t.length<=n.length)).map((t=>Array(n.length-t.length).fill("*"===t[0]?"*":"").concat(t))).some((t=>n.every(((e,n)=>t[n]===e||"*"===t[n]))))}(s))i("domainLimit");else if(["evaluation","trial"].includes(r.licenseType)&&1e3*r.exp{i(`${e}Limit`)}),6e5);t.on("destroy",(()=>{clearTimeout(n)}))}r.usageEndpoint&&t.once("ready",(()=>{const n={requestId:x(),requestTime:Math.round(Date.now()/1e3),license:e,editor:Ch(t)};t._sendUsageRequest(r.usageEndpoint,n).then((t=>{const{status:e,message:n}=t;n&&console.warn(n),"ok"!=e&&i("usageLimit")}),(()=>{var t;t={url:r.usageEndpoint},console.error(...M("license-key-validation-endpoint-not-reachable",t))}))}),{priority:"high"})}}(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(t){throw new I("editor-isreadonly-has-no-setter")}enableReadOnlyMode(t){if("string"!=typeof t&&"symbol"!=typeof t)throw new I("editor-read-only-lock-id-invalid",null,{lockId:t});this._readOnlyLocks.has(t)||(this._readOnlyLocks.add(t),1===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(t){if("string"!=typeof t&&"symbol"!=typeof t)throw new I("editor-read-only-lock-id-invalid",null,{lockId:t});this._readOnlyLocks.has(t)&&(this._readOnlyLocks.delete(t),0===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(t){this.data.set(t)}getData(t){return this.data.get(t)}initPlugins(){const t=this.config,e=t.get("plugins"),n=t.get("removePlugins")||[],i=t.get("extraPlugins")||[],o=t.get("substitutePlugins")||[];return this.plugins.init(e.concat(i),n,o)}destroy(){let t=Promise.resolve();return"initializing"==this.state&&(t=new Promise((t=>this.once("ready",t)))),t.then((()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()})).then((()=>this.plugins.destroy())).then((()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()})).then((()=>this._context._removeEditor(this)))}execute(t,...e){try{return this.commands.execute(t,...e)}catch(t){I.rethrowUnexpectedError(t,this)}}focus(){this.editing.view.focus()}static create(...t){throw new Error("This is an abstract method.")}_showLicenseError(t,e){setTimeout((()=>{if("invalid"==t)throw new I("invalid-license-key");if("expired"==t)throw new I("license-key-expired");if("domainLimit"==t)throw new I("license-key-domain-limit");if("featureNotAllowed"==t)throw new I("license-key-plugin-not-allowed",null,{pluginName:e});if("evaluationLimit"==t)throw new I("license-key-evaluation-limit");if("trialLimit"==t)throw new I("license-key-trial-limit");if("developmentLimit"==t)throw new I("license-key-development-limit");if("usageLimit"==t)throw new I("license-key-usage-limit");if("distributionChannel"==t)throw new I("license-key-invalid-distribution-channel")}),0),this._showLicenseError=()=>{}}async _sendUsageRequest(t,e){const n=new Headers({"Content-Type":"application/json"}),i=await fetch(new URL(t),{method:"POST",headers:n,body:JSON.stringify(e)});if(!i.ok)throw new Error(`HTTP Response: ${i.status}`);return i.json()}}_h.Context=hr,_h.EditorWatchdog=ah,_h.ContextWatchdog=class extends nh{constructor(t,e={}){super(e),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new dh,this._watchdogConfig=e,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}get context(){return this._context}create(t={}){return this._actionQueues.enqueue(lh,(()=>(this._contextConfig=t,this._create())))}getItem(t){return this._getWatchdog(t)._item}getItemState(t){return this._getWatchdog(t).state}add(t){const e=uh(t);return Promise.all(e.map((t=>this._actionQueues.enqueue(t.id,(()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let e;if(this._watchdogs.has(t.id))throw new Error(`Item with the given id is already added: '${t.id}'.`);if("editor"===t.type)return e=new ah(null,this._watchdogConfig),e.setCreator(t.creator),e._setExcludedProperties(this._contextProps),t.destructor&&e.setDestructor(t.destructor),this._watchdogs.set(t.id,e),e.on("error",((n,{error:i,causesRestart:o})=>{this._fire("itemError",{itemId:t.id,error:i}),o&&this._actionQueues.enqueue(t.id,(()=>new Promise((n=>{const i=()=>{e.off("restart",i),this._fire("itemRestart",{itemId:t.id}),n()};e.on("restart",i)}))))})),e.create(t.sourceElementOrData,t.config,this._context);throw new Error(`Not supported item type: '${t.type}'.`)})))))}remove(t){const e=uh(t);return Promise.all(e.map((t=>this._actionQueues.enqueue(t,(()=>{const e=this._getWatchdog(t);return this._watchdogs.delete(t),e.destroy()})))))}destroy(){return this._actionQueues.enqueue(lh,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(lh,(()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch((t=>{console.error("An error happened during destroying the context or items.",t)})).then((()=>this._create())).then((()=>this._fire("restart"))))))}_create(){return Promise.resolve().then((()=>(this._startErrorHandling(),this._creator(this._contextConfig)))).then((t=>(this._context=t,this._contextProps=oh(this._context),Promise.all(Array.from(this._watchdogs.values()).map((t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling();const t=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map((t=>t.destroy()))).then((()=>this._destructor(t)))}))}_getWatchdog(t){const e=this._watchdogs.get(t);if(!e)throw new Error(`Item with the given id was not registered: ${t}.`);return e}_isErrorComingFromThisItem(t){for(const e of this._watchdogs.values())if(e._isErrorComingFromThisItem(t))return!1;return sh(this._context,t.context)}};const Ah=_h;function Ch(t){const e=function(t){return{sessionId:(localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",x()),localStorage.getItem("__ckeditor-session-id")),pageSessionId:(a.window.CKEDITOR_PAGE_SESSION_ID=a.window.CKEDITOR_PAGE_SESSION_ID||x(),a.window.CKEDITOR_PAGE_SESSION_ID),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:kh(t),plugins:(e=t.plugins,Array.from(e).filter((([t])=>!!t.pluginName)).map((([t])=>{const{pluginName:e,isContextPlugin:n,isOfficialPlugin:i,isPremiumPlugin:o}=t;return{isContext:!!n,isOfficial:!!i,isPremium:!!o,name:e}}))),distribution:{channel:window[Symbol.for("cke distribution")]||"sh"},env:wh(),integration:Object.create(null),menuBar:{isVisible:!!t.config.get("menuBar.isVisible")},language:{ui:t.locale.uiLanguage,content:t.locale.contentLanguage},toolbar:{main:bh(t.config.get("toolbar")),block:bh(t.config.get("blockToolbar")),balloon:bh(t.config.get("balloonToolbar"))}};var e}(t);return t.fire("collectUsageData",{setUsageData:function(t,n){if(void 0!==Mr(e,t))throw new I("editor-usage-data-path-already-set",{path:t});Pr(e,t,n)}}),e}function vh(t){if(!zt(t.updateSourceElement))throw new I("attachtoform-missing-elementapi-interface",t);const e=t.sourceElement;if(function(t){return!!t&&"textarea"===t.tagName.toLowerCase()}(e)&&e.form){let n;const i=e.form,o=()=>t.updateSourceElement();zt(i.submit)&&(n=i.submit,i.submit=()=>{o(),n.apply(i)}),i.addEventListener("submit",o),t.on("destroy",(()=>{i.removeEventListener("submit",o),n&&(i.submit=n)}))}}function yh(t){return class extends t{updateSourceElement(t){if(!this.sourceElement)throw new I("editor-missing-sourceelement",this);const e=this.config.get("updateSourceElementOnDestroy"),n=this.sourceElement instanceof HTMLTextAreaElement;if(!e&&!n)return void ui(this.sourceElement,"");const i="string"==typeof t?t:this.data.get();ui(this.sourceElement,i)}}}function xh(t,e){if(e.ckeditorInstance)throw new I("editor-source-element-already-used",t);e.ckeditorInstance=t,t.once("destroy",(()=>{delete e.ckeditorInstance}))}yh.updateSourceElement=yh(Object).prototype.updateSourceElement;class Eh extends mr{static get pluginName(){return"PendingActions"}static get isOfficialPlugin(){return!0}init(){this.set("hasAny",!1),this._actions=new oo({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(t){if("string"!=typeof t)throw new I("pendingactions-add-invalid-message",this);const e=new(J());return e.set("message",t),this._actions.add(e),this.hasAny=!0,e}remove(t){this._actions.remove(t),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const Dh={bold:'',cancel:'',caption:'',check:'',cog:'',colorPalette:'',eraser:'',history:'',image:'',imageUpload:'',imageAssetManager:'',imageUrl:'',lowVision:'',textAlternative:'',loupe:'',previousArrow:'',nextArrow:'',importExport:'',paragraph:'',plus:'',text:'',alignBottom:'',alignMiddle:'',alignTop:'',alignLeft:'',alignCenter:'',alignRight:'',alignJustify:'',objectLeft:'',objectCenter:'',objectRight:'',objectFullWidth:'',objectInline:'',objectBlockLeft:'',objectBlockRight:'',objectSizeCustom:'',objectSizeFull:'',objectSizeLarge:'',objectSizeSmall:'',objectSizeMedium:'',pencil:'',pilcrow:'',quote:'',threeVerticalDots:'',dragIndicator:'',redo:'',undo:'',bulletedList:'',numberedList:'',todoList:'',codeBlock:'',browseFiles:'',heading1:'',heading2:'',heading3:'',heading4:'',heading5:'',heading6:'',horizontalLine:'',html:'',indent:'',outdent:'',table:'',source:'\n',remove:'',bookmark:'',bookmarkInline:'',emoji:'\n'};var Sh=o(4106),Ih={attributes:{"data-cke":!0}};Ih.setAttributes=Qo(),Ih.insert=Ko().bind(null,"head"),Ih.domAPI=qo(),Ih.insertStyleElement=Jo(),Wo()(Sh.A,Ih),Sh.A&&Sh.A.locals&&Sh.A.locals;class Th extends er{constructor(){super();const t=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",t.if("isVisible","ck-hidden",(t=>!t)),"ck-reset_all-excluded",t.if("isColorInherited","ck-icon_inherit-color")],viewBox:t.to("viewBox"),"aria-hidden":!0}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",(()=>{this._updateXMLContent(),this._colorFillPaths()})),this.on("change:fillColor",(()=>{this._colorFillPaths()}))}_updateXMLContent(){if(this.content){const t=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),e=t.getAttribute("viewBox");e&&(this.viewBox=e);for(const{name:e,value:n}of Array.from(t.attributes))Th.presentationalAttributeNames.includes(e)&&this.element.setAttribute(e,n);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach((t=>{t.style.fill=this.fillColor}))}}Th.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];const Bh=Th;class Mh extends er{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:t.to("style"),id:t.to("id")},children:[{text:t.to("text")}]})}}var Ph=o(8948),Nh={attributes:{"data-cke":!0}};Nh.setAttributes=Qo(),Nh.insert=Ko().bind(null,"head"),Nh.domAPI=qo(),Nh.insertStyleElement=Jo(),Wo()(Ph.A,Nh),Ph.A&&Ph.A.locals&&Ph.A.locals;class Lh extends er{constructor(t,e=new Mh){super(t),this._focusDelayed=null;const n=this.bindTemplate,i=x();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${i}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(e),this.iconView=new Bh,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const o={tag:"button",attributes:{class:["ck","ck-button",n.to("class"),n.if("isEnabled","ck-disabled",(t=>!t)),n.if("isVisible","ck-hidden",(t=>!t)),n.to("isOn",(t=>t?"ck-on":"ck-off")),n.if("withText","ck-button_with-text"),n.if("withKeystroke","ck-button_with-keystroke")],role:n.to("role"),type:n.to("type",(t=>t||"button")),tabindex:n.to("tabindex"),"aria-checked":n.to("_ariaChecked"),"aria-pressed":n.to("_ariaPressed"),"aria-label":n.to("ariaLabel"),"aria-labelledby":n.to("ariaLabelledBy"),"aria-disabled":n.if("isEnabled",!0,(t=>!t)),"data-cke-tooltip-text":n.to("_tooltipString"),"data-cke-tooltip-position":n.to("tooltipPosition")},children:this.children,on:{click:n.to((t=>{this.isEnabled?this.fire("execute"):t.preventDefault()}))}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",((t,e,n)=>!(!e||zh(n))&&String(!!t))),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",((t,e,n)=>!(!e||!zh(n))&&String(!!t))),d.isSafari&&(this._focusDelayed||(this._focusDelayed=go((()=>this.focus()),0)),o.on.mousedown=n.to((()=>{this._focusDelayed()})),o.on.mouseup=n.to((()=>{this._focusDelayed.cancel()}))),this.setTemplate(o)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(t){return t.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),t}_createKeystrokeView(){const t=new er;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",(t=>Oi(t)))}]}),t}_getTooltipString(t,e,n){return t?"string"==typeof t?t:(n&&(n=Oi(n)),t instanceof Function?t(e,n):`${e}${n?` (${n})`:""}`):""}}function zh(t){switch(t){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}var Oh=o(4866),Vh={attributes:{"data-cke":!0}};Vh.setAttributes=Qo(),Vh.insert=Ko().bind(null,"head"),Vh.domAPI=qo(),Vh.insertStyleElement=Jo(),Wo()(Oh.A,Vh),Oh.A&&Oh.A.locals&&Oh.A.locals;class Fh extends er{constructor(t,e={}){super(t);const n=this.bindTemplate;this.set("label",e.label||""),this.set("class",e.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",n.to("class")]},children:this.children}),e.icon&&(this.iconView=new Bh,this.iconView.content=e.icon,this.children.add(this.iconView));const i=new er(t);i.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:n.to("label")}]}),this.children.add(i)}}class Rh extends(V()){constructor(t){if(super(),this.focusables=t.focusables,this.focusTracker=t.focusTracker,this.keystrokeHandler=t.keystrokeHandler,this.actions=t.actions,t.actions&&t.keystrokeHandler)for(const e in t.actions){let n=t.actions[e];"string"==typeof n&&(n=[n]);for(const i of n)t.keystrokeHandler.set(i,((t,n)=>{this[e](),n()}),t.keystrokeHandlerOptions)}this.on("forwardCycle",(()=>this.focusFirst()),{priority:"low"}),this.on("backwardCycle",(()=>this.focusLast()),{priority:"low"})}get first(){return this.focusables.find(jh)||null}get last(){return this.focusables.filter(jh).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let t=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find(((e,n)=>{const i=e.element===this.focusTracker.focusedElement;return i&&(t=n),i})),t)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const t=this.next;t&&this.focusables.getIndex(t)===this.current||t===this.first?this.fire("forwardCycle"):this._focus(t,1)}focusPrevious(){const t=this.previous;t&&this.focusables.getIndex(t)===this.current||t===this.last?this.fire("backwardCycle"):this._focus(t,-1)}chain(t){const e=()=>null===this.current?null:this.focusables.get(this.current);this.listenTo(t,"forwardCycle",(t=>{const n=e();this.focusNext(),n!==e()&&t.stop()}),{priority:"low"}),this.listenTo(t,"backwardCycle",(t=>{const n=e();this.focusPrevious(),n!==e()&&t.stop()}),{priority:"low"})}unchain(t){this.stopListening(t)}_focus(t,e){t&&this.focusTracker.focusedElement!==t.element&&t.focus(e)}_getDomFocusableItem(t){const e=this.focusables.length;if(!e)return null;const n=this.current;if(null===n)return this[1===t?"first":"last"];let i=this.focusables.get(n),o=(n+e+t)%e;do{const n=this.focusables.get(o);if(jh(n)){i=n;break}o=(o+e+t)%e}while(o!==n);return i}}function jh(t){return Hh(t)&&fi(t.element)}function Hh(t){return!(!("focus"in t)||"function"!=typeof t.focus)}function Uh(t){return class extends t{constructor(...t){super(...t),this._onDragBound=this._onDrag.bind(this),this._onDragEndBound=this._onDragEnd.bind(this),this._lastDraggingCoordinates={x:0,y:0},this.on("render",(()=>{this._attachListeners()})),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(a.document,"mouseup",this._onDragEndBound),this.listenTo(a.document,"touchend",this._onDragEndBound),this.listenTo(a.document,"mousemove",this._onDragBound),this.listenTo(a.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(a.document,"mouseup",this._onDragEndBound),this.stopListening(a.document,"touchend",this._onDragEndBound),this.stopListening(a.document,"mousemove",this._onDragBound),this.stopListening(a.document,"touchmove",this._onDragBound)}_onDragStart(t,e){if(!this._isHandleElementPressed(e))return;this._attachDragListeners();let n=0,i=0;e instanceof MouseEvent?(n=e.clientX,i=e.clientY):(n=e.touches[0].clientX,i=e.touches[0].clientY),this._lastDraggingCoordinates={x:n,y:i},this.isDragging=!0}_onDrag(t,e){if(!this.isDragging)return void this._detachDragListeners();let n=0,i=0;e instanceof MouseEvent?(n=e.clientX,i=e.clientY):(n=e.touches[0].clientX,i=e.touches[0].clientY),e.preventDefault(),this.fire("drag",{deltaX:Math.round(n-this._lastDraggingCoordinates.x),deltaY:Math.round(i-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:n,y:i}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(t){return!!this.dragHandleElement&&(this.dragHandleElement===t.target||t.target instanceof HTMLElement&&this.dragHandleElement.contains(t.target))}}}var Wh=o(8091),Gh={attributes:{"data-cke":!0}};Gh.setAttributes=Qo(),Gh.insert=Ko().bind(null,"head"),Gh.domAPI=qo(),Gh.insertStyleElement=Jo(),Wo()(Wh.A,Gh),Wh.A&&Wh.A.locals&&Wh.A.locals;class qh extends er{constructor(t){super(t),this.children=this.createCollection(),this.keystrokes=new uo,this._focusTracker=new so,this._focusables=new Ao,this.focusCycler=new Rh({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(t){for(const e of t){const t=new Lh(this.locale);let n;for(n in t.on("execute",(()=>e.onExecute())),e.onCreate&&e.onCreate(t),e)"onExecute"!=n&&"onCreate"!=n&&t.set(n,e[n]);this.children.add(t)}this._updateFocusCyclableItems()}focus(t){-1===t?this.focusCycler.focusLast():this.focusCycler.focusFirst()}_updateFocusCyclableItems(){Array.from(this.children).forEach((t=>{this._focusables.add(t),this._focusTracker.add(t.element)}))}}class $h extends er{constructor(t){super(t),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}}var Kh=o(880),Yh={attributes:{"data-cke":!0}};Yh.setAttributes=Qo(),Yh.insert=Ko().bind(null,"head"),Yh.domAPI=qo(),Yh.insertStyleElement=Jo(),Wo()(Kh.A,Yh),Kh.A&&Kh.A.locals&&Kh.A.locals;const Qh="screen-center",Zh="editor-center",Jh="editor-top-side",Xh=hi("px");class tm extends(Uh(er)){constructor(t,{getCurrentDomRoot:e,getViewportOffset:n,keystrokeHandlerOptions:i}){super(t),this.wasMoved=!1;const o=this.bindTemplate,r=t.t;this.set("className",""),this.set("ariaLabel",r("Editor dialog")),this.set("isModal",!1),this.set("position",Qh),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=e,this._getViewportOffset=n,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new uo,this.focusTracker=new so,this._focusables=new Ao,this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"},keystrokeHandlerOptions:i}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",o.if("isModal","ck-dialog-overlay__transparent",(t=>!t)),o.if("_isVisible","ck-hidden",(t=>!t))],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",o.if("isModal","ck-dialog_modal"),o.to("className")],role:"dialog","aria-label":o.to("ariaLabel"),style:{top:o.to("_top",(t=>Xh(t))),left:o.to("_left",(t=>Xh(t))),visibility:o.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",((t,e)=>{t.defaultPrevented||(this.fire("close",{source:"escKeyPress"}),e())})),this.on("drag",((t,{deltaX:e,deltaY:n})=>{this.wasMoved=!0,this.moveBy(e,n)})),this.listenTo(a.window,"resize",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.listenTo(a.document,"scroll",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.on("change:_isVisible",((t,e,n)=>{n&&(this._isTransparent=!0,setTimeout((()=>{this.updatePosition(),this._isTransparent=!1,this.focus()}),10))})),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView&&!this.isModal?this.headerView.element:null}setupParts({icon:t,title:e,hasCloseButton:n=!0,content:i,actionButtons:o}){e&&(this.headerView=new Fh(this.locale,{icon:t}),n&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=e,this.ariaLabel=e,this.parts.add(this.headerView,0)),i&&(i instanceof er&&(i=[i]),this.contentView=new $h(this.locale),this.contentView.children.addMany(i),this.parts.add(this.contentView)),o&&(this.actionsView=new qh(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(t,e){const n=this._getViewportRect(),i=this._getDialogRect();t+i.width>n.right&&(t=n.right-i.width),t{var e;this._focusables.add(t),this.focusTracker.add(t.element),Hh(e=t)&&"focusCycler"in e&&e.focusCycler instanceof Rh&&this._focusCycler.chain(t.focusCycler)}))}_createCloseButton(){const t=new Lh(this.locale),e=this.locale.t;return t.set({label:e("Close"),tooltip:!0,icon:Dh.cancel}),t.on("execute",(()=>this.fire("close",{source:"closeButton"}))),t}}tm.defaultOffset=15;const em=tm;class nm extends sr{static get pluginName(){return"Dialog"}static get isOfficialPlugin(){return!0}constructor(t){super(t);const e=t.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),t.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:e("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}destroy(){super.destroy(),nm._visibleDialogPlugin===this&&this._unlockBodyScroll()}_initShowHideListeners(){this.on("show",((t,e)=>{this._show(e)})),this.on("show",((t,e)=>{e.onShow&&e.onShow(this)}),{priority:"low"}),this.on("hide",(()=>{nm._visibleDialogPlugin&&nm._visibleDialogPlugin._hide()})),this.on("hide",(()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)}),{priority:"low"})}_initFocusToggler(){const t=this.editor;t.keystrokes.set("Ctrl+F6",((e,n)=>{this.isOpen&&!this.view.isModal&&(this.view.focusTracker.isFocused?t.editing.view.focus():this.view.focus(),n())}))}_initMultiRootIntegration(){const t=this.editor.model;t.document.on("change:data",(()=>{if(!this.view)return;const e=t.document.differ.getChangedRoots();for(const t of e)t.state&&this.view.updatePosition()}))}show(t){this.hide(),this.fire(`show:${t.id}`,t)}_show({id:t,icon:e,title:n,hasCloseButton:i=!0,content:o,actionButtons:r,className:s,isModal:a,position:c,onHide:l,keystrokeHandlerOptions:d}){const u=this.editor;this.view=new em(u.locale,{getCurrentDomRoot:()=>u.editing.view.getDomRoot(u.model.document.selection.anchor.root.rootName),getViewportOffset:()=>u.ui.viewportOffset,keystrokeHandlerOptions:d});const h=this.view;h.on("close",(()=>{this.hide()})),u.ui.view.body.add(h),u.keystrokes.listenTo(h.element),c||(c=a?Qh:Zh),a&&this._lockBodyScroll(),h.set({position:c,_isVisible:!0,className:s,isModal:a}),h.setupParts({icon:e,title:n,hasCloseButton:i,content:o,actionButtons:r}),this.id=t,l&&(this._onHide=l),this.isOpen=!0,nm._visibleDialogPlugin=this}hide(){nm._visibleDialogPlugin&&nm._visibleDialogPlugin.fire(`hide:${nm._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;const t=this.editor,e=this.view;e.isModal&&this._unlockBodyScroll(),e.contentView&&e.contentView.reset(),t.ui.view.body.remove(e),t.ui.focusTracker.remove(e.element),t.keystrokes.stopListening(e.element),e.destroy(),t.editing.view.focus(),this.id=null,this.isOpen=!1,nm._visibleDialogPlugin=null}_lockBodyScroll(){document.documentElement.classList.add("ck-dialog-scroll-locked")}_unlockBodyScroll(){document.documentElement.classList.remove("ck-dialog-scroll-locked")}}var im=o(3389),om={attributes:{"data-cke":!0}};om.setAttributes=Qo(),om.insert=Ko().bind(null,"head"),om.domAPI=qo(),om.insertStyleElement=Jo(),Wo()(im.A,om),im.A&&im.A.locals&&im.A.locals;class rm extends Lh{constructor(t,e=new Mh){super(t,e),this._checkIconHolderView=new sm,this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",n.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",((t,e)=>t||e))}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind("isOn").to(this,"isOn",(t=>this.isToggleable&&t)),this.on("change:_hasCheck",((t,e,n)=>{const{children:i,_checkIconHolderView:o}=this;n?i.add(o,0):i.remove(o)}))}}class sm extends er{constructor(){super(),this._checkIconView=this._createCheckIconView();const t=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",!1),this.setTemplate({tag:"span",children:this.children,attributes:{class:["ck","ck-list-item-button__check-holder",t.to("isOn",(t=>t?"ck-on":"ck-off"))]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",((t,e,n)=>{const{children:i,_checkIconView:o}=this;n&&!i.has(o)?i.add(o):!n&&i.has(o)&&i.remove(o)}))}_createCheckIconView(){const t=new Bh;return t.content=Dh.check,t.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),t}}var am=o(5078),cm={attributes:{"data-cke":!0}};cm.setAttributes=Qo(),cm.insert=Ko().bind(null,"head"),cm.domAPI=qo(),cm.insertStyleElement=Jo(),Wo()(am.A,cm),am.A&&am.A.locals&&am.A.locals;class lm extends rm{constructor(t){super(t),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}var dm=o(4606),um={attributes:{"data-cke":!0}};um.setAttributes=Qo(),um.insert=Ko().bind(null,"head"),um.domAPI=qo(),um.insertStyleElement=Jo(),Wo()(dm.A,um),dm.A&&dm.A.locals&&dm.A.locals;class hm extends er{constructor(t){super(t),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${x()}`;const e=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:e.to("for")},children:[{text:e.to("text")}]})}}class mm extends er{constructor(t,e){super(t);const n=t.t,i=new hm;i.text=n("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":i.id,role:"document",tabindex:-1},children:[Ct(document,"p",{},n("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(e.values())),i]})}focus(){this.element.focus()}_createCategories(t){return t.map((t=>{const e=[Ct(document,"h3",{},t.label),...Array.from(t.groups.values()).map((t=>this._createGroup(t))).flat()];return t.description&&e.splice(1,0,Ct(document,"p",{},t.description)),Ct(document,"section",{},e)}))}_createGroup(t){const e=t.keystrokes.sort(((t,e)=>t.label.localeCompare(e.label))).map((t=>this._createGroupRow(t))).flat(),n=[Ct(document,"dl",{},e)];return t.label&&n.unshift(Ct(document,"h4",{},t.label)),n}_createGroupRow(t){const e=this.locale.t,n=Ct(document,"dt"),i=Ct(document,"dd"),o="string"==typeof(s=t.keystroke)?[[s]]:"string"==typeof s[0]?[s]:s,r=[];var s;for(const t of o)r.push(t.map(gm).join(""));return n.innerHTML=t.label,i.innerHTML=r.join(", ")+(t.mayRequireFn&&d.isMac?` ${e("(may require Fn)")}`:""),[n,i]}}function gm(t){return Oi(t).split("+").map((t=>`${t}`)).join("+")}const pm='';var fm=o(9550),km={attributes:{"data-cke":!0}};km.setAttributes=Qo(),km.insert=Ko().bind(null,"head"),km.domAPI=qo(),km.insertStyleElement=Jo(),Wo()(fm.A,km),fm.A&&fm.A.locals&&fm.A.locals;class bm extends sr{constructor(){super(...arguments),this.contentView=null}static get requires(){return[nm]}static get pluginName(){return"AccessibilityHelp"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t;t.ui.componentFactory.add("accessibilityHelp",(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0,withText:!1,label:e("Accessibility help")}),t})),t.ui.componentFactory.add("menuBar:accessibilityHelp",(()=>{const t=this._createButton(lm);return t.label=e("Accessibility"),t})),t.keystrokes.set("Alt+0",((t,e)=>{this._toggleDialog(),e()})),this._setupRootLabels()}_createButton(t){const e=this.editor,n=e.plugins.get("Dialog"),i=new t(e.locale);return i.set({keystroke:"Alt+0",icon:pm,isToggleable:!0}),i.on("execute",(()=>this._toggleDialog())),i.bind("isOn").to(n,"id",(t=>"accessibilityHelp"===t)),i}_setupRootLabels(){const t=this.editor,e=t.editing.view,n=t.t;function i(t,e){const i=[e.getAttribute("aria-label"),n("Press %0 for help.",[Oi("Alt+0")])].filter((t=>t)).join(". ");t.setAttribute("aria-label",i,e)}t.ui.on("ready",(()=>{e.change((t=>{for(const n of e.document.roots)i(t,n)})),t.on("addRoot",((n,o)=>{const r=t.editing.view.document.getRoot(o.rootName);e.change((t=>i(t,r)))}),{priority:"low"})}))}_toggleDialog(){const t=this.editor,e=t.plugins.get("Dialog"),n=t.locale.t;this.contentView||(this.contentView=new mm(t.locale,t.accessibility.keystrokeInfos)),"accessibilityHelp"===e.id?e.hide():e.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:n("Accessibility help"),icon:pm,hasCloseButton:!0,content:this.contentView})}}class wm extends Ao{constructor(t,e=[]){super(e),this.locale=t}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new Co({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render(),wm._bodyWrapper&&wm._bodyWrapper.isConnected||(wm._bodyWrapper=Ct(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(wm._bodyWrapper)),wm._bodyWrapper.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove(),wm._bodyWrapper&&!wm._bodyWrapper.childElementCount&&(wm._bodyWrapper.remove(),delete wm._bodyWrapper)}}var _m=o(9624),Am={attributes:{"data-cke":!0}};Am.setAttributes=Qo(),Am.insert=Ko().bind(null,"head"),Am.domAPI=qo(),Am.insertStyleElement=Jo(),Wo()(_m.A,Am),_m.A&&_m.A.locals&&_m.A.locals;class Cm extends Lh{constructor(t){super(t),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const t=new er;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),t}}class vm extends(xm(Lh)){}class ym extends(xm(rm)){}function xm(t){return class extends t{constructor(...t){super(...t),this.buttonView=this,this._fileInputView=new Em(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",(()=>{this._fileInputView.open()})),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}}class Em extends er{constructor(t){super(t),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const Dm='';var Sm=o(1750),Im={attributes:{"data-cke":!0}};Im.setAttributes=Qo(),Im.insert=Ko().bind(null,"head"),Im.domAPI=qo(),Im.insertStyleElement=Jo(),Wo()(Sm.A,Im),Sm.A&&Sm.A.locals&&Sm.A.locals;class Tm extends er{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}focus(){this.buttonView.focus()}_createButtonView(){const t=new Lh(this.locale),e=t.bindTemplate;return t.set({withText:!0,icon:Dm}),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}}function Bm(t,e){const n=t.t,i={Black:n("Black"),"Dim grey":n("Dim grey"),Grey:n("Grey"),"Light grey":n("Light grey"),White:n("White"),Red:n("Red"),Orange:n("Orange"),Yellow:n("Yellow"),"Light green":n("Light green"),Green:n("Green"),Aquamarine:n("Aquamarine"),Turquoise:n("Turquoise"),"Light blue":n("Light blue"),Blue:n("Blue"),Purple:n("Purple")};return e.map((t=>{const e=i[t.label];return e&&e!=t.label&&(t.label=e),t}))}function Mm(t){return t.map(Pm).filter((t=>!!t))}function Pm(t){return"string"==typeof t?{model:t,label:t,hasBorder:!1,view:{name:"span",styles:{color:t}}}:{model:t.color,label:t.label||t.color,hasBorder:void 0!==t.hasBorder&&t.hasBorder,view:{name:"span",styles:{color:`${t.color}`}}}}class Nm extends Lh{constructor(t){super(t);const e=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon='',this.extendTemplate({attributes:{style:{backgroundColor:e.to("color",(t=>d.isMediaForcedColors?null:t))},class:["ck","ck-color-grid__tile",e.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}var Lm=o(7962),zm={attributes:{"data-cke":!0}};zm.setAttributes=Qo(),zm.insert=Ko().bind(null,"head"),zm.domAPI=qo(),zm.insertStyleElement=Jo(),Wo()(Lm.A,zm),Lm.A&&Lm.A.locals&&Lm.A.locals;class Om extends er{constructor(t,e){super(t);const n=e&&e.colorDefinitions?e.colorDefinitions:[];this.columns=e&&e.columns?e.columns:5;const i={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new so,this.keystrokes=new uo,this.items.on("add",((t,e)=>{e.isOn=e.color===this.selectedColor})),n.forEach((t=>{const e=new Nm;e.set({color:t.color,label:t.label,tooltip:!0,hasBorder:t.options.hasBorder}),e.on("execute",(()=>{this.fire("execute",{value:t.color,hasBorder:t.options.hasBorder,label:t.label})})),this.items.add(e)})),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:i}}),this.on("change:selectedColor",((t,e,n)=>{for(const t of this.items)t.isOn=t.color===n}))}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const t of this.items)this.focusTracker.add(t.element);this.items.on("add",((t,e)=>{this.focusTracker.add(e.element)})),this.items.on("remove",((t,e)=>{this.focusTracker.remove(e.element)})),this.keystrokes.listenTo(this.element),rr({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var Vm=o(8156);const Fm=function(t){var e,n,i=[],o=1;if("string"==typeof t)if(Vm[t])i=Vm[t].slice(),n="rgb";else if("transparent"===t)o=0,n="rgb",i=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var r=t.slice(1);o=1,(c=r.length)<=4?(i=[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16)],4===c&&(o=parseInt(r[3]+r[3],16)/255)):(i=[parseInt(r[0]+r[1],16),parseInt(r[2]+r[3],16),parseInt(r[4]+r[5],16)],8===c&&(o=parseInt(r[6]+r[7],16)/255)),i[0]||(i[0]=0),i[1]||(i[1]=0),i[2]||(i[2]=0),n="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var s=e[1],a="rgb"===s;n=r=s.replace(/a$/,"");var c="cmyk"===r?4:"gray"===r?1:3;i=e[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===r?255*parseFloat(t)/100:parseFloat(t);if("h"===r[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==Rm[t])return Rm[t]}return parseFloat(t)})),s===r&&i.push(1),o=a||void 0===i[c]?1:i[c],i=i.slice(0,c)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(i=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),n=t.match(/([a-z])/gi).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(i=[t[0],t[1],t[2]],n="rgb",o=4===t.length?t[3]:1):t instanceof Object&&(null!=t.r||null!=t.red||null!=t.R?(n="rgb",i=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(n="hsl",i=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),o=t.a||t.alpha||t.opacity||1,null!=t.opacity&&(o/=100)):(n="rgb",i=[t>>>16,(65280&t)>>>8,255&t]);return{space:n,values:i,alpha:o}};var Rm={red:0,orange:60,yellow:120,green:180,blue:240,purple:300},jm=o(734),Hm=o.t(jm,2);function Um(t,e){if(!t)return"";const n=Wm(t);if(!n)return"";if(n.space===e)return t;if(i=n,!Object.keys(Hm).includes(i.space))return"";var i;const o=Hm[n.space][e];return o?function(t,e){switch(e){case"hex":return`#${t}`;case"rgb":return`rgb(${t[0]}, ${t[1]}, ${t[2]})`;case"hsl":return`hsl(${t[0]}, ${t[1]}%, ${t[2]}%)`;case"hwb":return`hwb(${t[0]}, ${t[1]}, ${t[2]})`;case"lab":return`lab(${t[0]}% ${t[1]} ${t[2]})`;case"lch":return`lch(${t[0]}% ${t[1]} ${t[2]})`;default:return""}}(o("hex"===n.space?n.hexValue:n.values),e):""}function Wm(t){if(t.startsWith("#")){const e=Fm(t);return{space:"hex",values:e.values,hexValue:t,alpha:e.alpha}}const e=Fm(t);return e.space?e:null}var Gm=o(6365),qm={attributes:{"data-cke":!0}};qm.setAttributes=Qo(),qm.insert=Ko().bind(null,"head"),qm.domAPI=qo(),qm.insertStyleElement=Jo(),Wo()(Gm.A,qm),Gm.A&&Gm.A.locals&&Gm.A.locals;class $m extends er{constructor(t,e){super(t);const n=`ck-labeled-field-view-${x()}`,i=`ck-labeled-field-view-status-${x()}`;this.fieldView=e(this,n,i),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(i),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",((t,e)=>t||e));const o=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",o.to("class"),o.if("isEnabled","ck-disabled",(t=>!t)),o.if("isEmpty","ck-labeled-field-view_empty"),o.if("isFocused","ck-labeled-field-view_focused"),o.if("placeholder","ck-labeled-field-view_placeholder"),o.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(t){const e=new hm(this.locale);return e.for=t,e.bind("text").to(this,"label"),e}_createStatusView(t){const e=new er(this.locale),n=this.bindTemplate;return e.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",(t=>!t))],id:t,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),e}focus(t){this.fieldView.focus(t)}}class Km extends er{constructor(t){super(t),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new so,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",e.if("isFocused","ck-input_focused"),e.if("isEmpty","ck-input-text_empty"),e.if("hasError","ck-error")],id:e.to("id"),placeholder:e.to("placeholder"),tabindex:e.to("tabIndex"),readonly:e.to("isReadOnly"),"aria-invalid":e.if("hasError",!0),"aria-describedby":e.to("ariaDescribedById"),"aria-label":e.to("ariaLabel")},on:{input:e.to(((...t)=>{this.fire("input",...t),this._updateIsEmpty()})),change:e.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",((t,e,n)=>{this._setDomElementValue(n),this._updateIsEmpty()}))}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(t){this.element.value=t||0===t?t:""}}var Ym=o(1546),Qm={attributes:{"data-cke":!0}};Qm.setAttributes=Qo(),Qm.insert=Ko().bind(null,"head"),Qm.domAPI=qo(),Qm.insertStyleElement=Jo(),Wo()(Ym.A,Qm),Ym.A&&Ym.A.locals&&Ym.A.locals;class Zm extends Km{constructor(t){super(t),this.set("inputMode","text");const e=this.bindTemplate;this.extendTemplate({attributes:{inputmode:e.to("inputMode")}})}}class Jm extends Zm{constructor(t){super(t),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class Xm extends Zm{constructor(t,{min:e,max:n,step:i}={}){super(t);const o=this.bindTemplate;this.set("min",e),this.set("max",n),this.set("step",i),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:o.to("min"),max:o.to("max"),step:o.to("step")}})}}var tg=o(8368),eg={attributes:{"data-cke":!0}};eg.setAttributes=Qo(),eg.insert=Ko().bind(null,"head"),eg.domAPI=qo(),eg.insertStyleElement=Jo(),Wo()(tg.A,eg),tg.A&&tg.A.locals&&tg.A.locals;class ng extends er{constructor(t){super(t);const e=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",e.to("position",(t=>`ck-dropdown__panel_${t}`)),e.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:e.to((t=>{"input"!==t.target.tagName.toLocaleLowerCase()&&t.preventDefault()}))}})}focus(){if(this.children.length){const t=this.children.first;"function"==typeof t.focus?t.focus():T("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const t=this.children.last;"function"==typeof t.focusLast?t.focusLast():t.focus()}}}var ig=o(426),og={attributes:{"data-cke":!0}};og.setAttributes=Qo(),og.insert=Ko().bind(null,"head"),og.domAPI=qo(),og.insertStyleElement=Jo(),Wo()(ig.A,og),ig.A&&ig.A.locals&&ig.A.locals;class rg extends er{constructor(t,e,n){super(t);const i=this.bindTemplate;this.buttonView=e,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new uo,this.focusTracker=new so,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",i.to("class"),i.if("isEnabled","ck-disabled",(t=>!t))],id:i.to("id"),"aria-describedby":i.to("ariaDescribedById")},children:[e,n]}),e.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":i.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",(()=>{this.isOpen=!this.isOpen})),this.on("change:isOpen",((t,e,n)=>{if(n)if("auto"===this.panelPosition){const t=rg._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=t?t.name:this._defaultPanelPositionName}else this.panelView.position=this.panelPosition})),this.keystrokes.listenTo(this.element);const t=(t,e)=>{this.isOpen&&(this.isOpen=!1,e())};this.keystrokes.set("arrowdown",((t,e)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,e())})),this.keystrokes.set("arrowright",((t,e)=>{this.isOpen&&e()})),this.keystrokes.set("arrowleft",t),this.keystrokes.set("esc",t)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:t,north:e,southEast:n,southWest:i,northEast:o,northWest:r,southMiddleEast:s,southMiddleWest:a,northMiddleEast:c,northMiddleWest:l}=rg.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[n,i,s,a,t,o,r,c,l,e]:[i,n,a,s,t,r,o,l,c,e]}get _defaultPanelPositionName(){return"rtl"===this.locale.uiLanguageDirection?"sw":"se"}}rg.defaultPanelPositions={south:(t,e)=>({top:t.bottom,left:t.left-(e.width-t.width)/2,name:"s"}),southEast:t=>({top:t.bottom,left:t.left,name:"se"}),southWest:(t,e)=>({top:t.bottom,left:t.left-e.width+t.width,name:"sw"}),southMiddleEast:(t,e)=>({top:t.bottom,left:t.left-(e.width-t.width)/4,name:"sme"}),southMiddleWest:(t,e)=>({top:t.bottom,left:t.left-3*(e.width-t.width)/4,name:"smw"}),north:(t,e)=>({top:t.top-e.height,left:t.left-(e.width-t.width)/2,name:"n"}),northEast:(t,e)=>({top:t.top-e.height,left:t.left,name:"ne"}),northWest:(t,e)=>({top:t.top-e.height,left:t.left-e.width+t.width,name:"nw"}),northMiddleEast:(t,e)=>({top:t.top-e.height,left:t.left-(e.width-t.width)/4,name:"nme"}),northMiddleWest:(t,e)=>({top:t.top-e.height,left:t.left-3*(e.width-t.width)/4,name:"nmw"})},rg._getOptimalPosition=ki;const sg=rg;class ag extends Lh{constructor(t){super(t),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(t=>String(t)))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const t=new Bh;return t.content=Dm,t.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),t}}var cg=o(1102),lg={attributes:{"data-cke":!0}};lg.setAttributes=Qo(),lg.insert=Ko().bind(null,"head"),lg.domAPI=qo(),lg.insertStyleElement=Jo(),Wo()(cg.A,lg),cg.A&&cg.A.locals&&cg.A.locals;var dg=o(5067),ug={attributes:{"data-cke":!0}};ug.setAttributes=Qo(),ug.insert=Ko().bind(null,"head"),ug.domAPI=qo(),ug.insertStyleElement=Jo(),Wo()(dg.A,ug),dg.A&&dg.A.locals&&dg.A.locals;class hg extends rm{constructor(t){super(t);const e=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-dropdown-menu-list__nested-menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(t=>String(t))),"data-cke-tooltip-disabled":e.to("isOn")},on:{mouseenter:e.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const t=new Bh;return t.content=Dm,t.extendTemplate({attributes:{class:"ck-dropdown-menu-list__nested-menu__button__arrow"}}),t}}class mg extends er{constructor(t){super(t);const e=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",e.if("isVisible","ck-hidden",(t=>!t))],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}class gg extends er{constructor(t){super(t),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}class pg extends er{constructor(t,e=new hm){super(t);const n=this.bindTemplate,i=new bg(t);this.set({label:"",isVisible:!0}),this.labelView=e,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,i]),i.set({role:"group",ariaLabelledBy:e.id}),i.focusTracker.destroy(),i.keystrokes.destroy(),this.items=i.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",n.if("isVisible","ck-hidden",(t=>!t))]},children:this.children})}focus(){if(this.items){const t=this.items.find((t=>!(t instanceof gg)));t&&t.focus()}}}var fg=o(6048),kg={attributes:{"data-cke":!0}};kg.setAttributes=Qo(),kg.insert=Ko().bind(null,"head"),kg.domAPI=qo(),kg.insertStyleElement=Jo(),Wo()(fg.A,kg),fg.A&&fg.A.locals&&fg.A.locals;class bg extends er{constructor(t){super(t),this._listItemGroupToChangeListeners=new WeakMap;const e=this.bindTemplate;this.focusables=new Ao,this.items=this.createCollection(),this.focusTracker=new so,this.keystrokes=new uo,this._focusCycler=new Rh({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:e.to("role"),"aria-label":e.to("ariaLabel"),"aria-labelledby":e.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(const t of this.items)t instanceof pg?this._registerFocusableItemsGroup(t):t instanceof mg&&this._registerFocusableListItem(t);this.items.on("change",((t,e)=>{for(const t of e.removed)t instanceof pg?this._deregisterFocusableItemsGroup(t):t instanceof mg&&this._deregisterFocusableListItem(t);for(const t of Array.from(e.added).reverse())t instanceof pg?this._registerFocusableItemsGroup(t,e.index):this._registerFocusableListItem(t,e.index)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(t,e){this.focusTracker.add(t.element),this.focusables.add(t,e)}_deregisterFocusableListItem(t){this.focusTracker.remove(t.element),this.focusables.remove(t)}_getOnGroupItemsChangeCallback(t){return(e,n)=>{for(const t of n.removed)this._deregisterFocusableListItem(t);for(const e of Array.from(n.added).reverse())this._registerFocusableListItem(e,this.items.getIndex(t)+n.index)}}_registerFocusableItemsGroup(t,e){Array.from(t.items).forEach(((t,n)=>{const i=void 0!==e?e+n:void 0;this._registerFocusableListItem(t,i)}));const n=this._getOnGroupItemsChangeCallback(t);this._listItemGroupToChangeListeners.set(t,n),t.items.on("change",n)}_deregisterFocusableItemsGroup(t){for(const e of t.items)this._deregisterFocusableListItem(e);t.items.off("change",this._listItemGroupToChangeListeners.get(t)),this._listItemGroupToChangeListeners.delete(t)}}class wg extends bg{constructor(t){super(t);const e=this.bindTemplate;this.role="menu",this.set("isVisible",!0),this.extendTemplate({attributes:{class:["ck-dropdown-menu-list",e.if("isVisible","ck-hidden",(t=>!t))]}})}}const _g={eastSouth:t=>({top:t.top,left:t.right-5,name:"es"}),eastNorth:(t,e)=>({top:t.top-e.height+t.height,left:t.right-5,name:"en"}),westSouth:(t,e)=>({top:t.top,left:t.left-e.width+5,name:"ws"}),westNorth:(t,e)=>({top:t.top-e.height+t.height,left:t.left-e.width+5,name:"wn"})};var Ag=o(4694),Cg={attributes:{"data-cke":!0}};Cg.setAttributes=Qo(),Cg.insert=Ko().bind(null,"head"),Cg.domAPI=qo(),Cg.insertStyleElement=Jo(),Wo()(Ag.A,Cg),Ag.A&&Ag.A.locals&&Ag.A.locals;const vg={openOnArrowRightKey(t){const e="rtl"===t.locale.uiLanguageDirection?"arrowleft":"arrowright";t.keystrokes.set(e,((e,n)=>{t.focusTracker.focusedElement===t.buttonView.element&&t.isEnabled&&(t.isOpen||(t.isOpen=!0),t.panelView.focus(),n())}))},openOnButtonClick(t){t.buttonView.on("execute",(()=>{t.isEnabled&&(t.isOpen=!0)}))},openAndFocusOnEnterKeyPress(t){t.keystrokes.set("enter",((e,n)=>{t.focusTracker.focusedElement===t.buttonView.element&&(t.isOpen=!0,t.panelView.focus(),n())}))},closeOnArrowLeftKey(t){const e="rtl"===t.locale.uiLanguageDirection?"arrowright":"arrowleft";t.keystrokes.set(e,((e,n)=>{t.isOpen&&(t.focus(),t.isOpen=!1,n())}))},closeOnEscKey(t){t.keystrokes.set("esc",((e,n)=>{t.isOpen&&(t.focus(),t.isOpen=!1,n())}))},closeOnParentClose(t,e){e.on("change:isOpen",((n,i,o)=>{o||n.source!==e||(t.isOpen=!1)}))}};var yg=o(5615),xg={attributes:{"data-cke":!0}};xg.setAttributes=Qo(),xg.insert=Ko().bind(null,"head"),xg.domAPI=qo(),xg.insertStyleElement=Jo(),Wo()(yg.A,xg),yg.A&&yg.A.locals&&yg.A.locals;const Eg=hi("px"),Dg={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class Sg extends er{constructor(t){super(t);const e=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",e.to("position",(t=>`ck-balloon-panel_${t}`)),e.if("isVisible","ck-balloon-panel_visible"),e.if("withArrow","ck-balloon-panel_with-arrow"),e.to("class")],style:{top:e.to("top",Eg),left:e.to("left",Eg)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(t){const e=Tg(t.target);if(e&&!fi(e))return!1;this.show();const n=Sg.defaultPositions,i=Object.assign({},{element:this.element,positions:[n.southArrowNorth,n.southArrowNorthMiddleWest,n.southArrowNorthMiddleEast,n.southArrowNorthWest,n.southArrowNorthEast,n.northArrowSouth,n.northArrowSouthMiddleWest,n.northArrowSouthMiddleEast,n.northArrowSouthWest,n.northArrowSouthEast,n.viewportStickyNorth],limiter:a.document.body,fitInViewport:!0},t),o=Sg._getOptimalPosition(i)||Dg,r=parseInt(o.left),s=parseInt(o.top),c=o.name,l=o.config||{},{withArrow:d=!0}=l;return this.top=s,this.left=r,this.position=c,this.withArrow=d,!0}pin(t){this.unpin(),this._startPinning(t)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(t):this._stopPinning()},this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback))}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(t){if(!this.attachTo(t))return!1;let e=Tg(t.target);const n=t.limiter?Tg(t.limiter):a.document.body;if(this.listenTo(a.document,"scroll",((i,o)=>{const r=o.target,s=e&&r.contains(e),a=n&&r.contains(n);!s&&!a&&e&&n||this.attachTo(t)}),{useCapture:!0}),this.listenTo(a.window,"resize",(()=>{this.attachTo(t)})),!this._resizeObserver&&(e&&ti(e)&&(e=e.parentElement),e)){const t=()=>{fi(e)||this.unpin()};this._resizeObserver=new di(e,t)}return!0}_stopPinning(){this.stopListening(a.document,"scroll"),this.stopListening(a.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(t={}){const{sideOffset:e=Sg.arrowSideOffset,heightOffset:n=Sg.arrowHeightOffset,stickyVerticalOffset:i=Sg.stickyVerticalOffset,config:o}=t;return{northWestArrowSouthWest:(t,n)=>({top:r(t,n),left:t.left-e,name:"arrow_sw",...o&&{config:o}}),northWestArrowSouthMiddleWest:(t,n)=>({top:r(t,n),left:t.left-.25*n.width-e,name:"arrow_smw",...o&&{config:o}}),northWestArrowSouth:(t,e)=>({top:r(t,e),left:t.left-e.width/2,name:"arrow_s",...o&&{config:o}}),northWestArrowSouthMiddleEast:(t,n)=>({top:r(t,n),left:t.left-.75*n.width+e,name:"arrow_sme",...o&&{config:o}}),northWestArrowSouthEast:(t,n)=>({top:r(t,n),left:t.left-n.width+e,name:"arrow_se",...o&&{config:o}}),northArrowSouthWest:(t,n)=>({top:r(t,n),left:t.left+t.width/2-e,name:"arrow_sw",...o&&{config:o}}),northArrowSouthMiddleWest:(t,n)=>({top:r(t,n),left:t.left+t.width/2-.25*n.width-e,name:"arrow_smw",...o&&{config:o}}),northArrowSouth:(t,e)=>({top:r(t,e),left:t.left+t.width/2-e.width/2,name:"arrow_s",...o&&{config:o}}),northArrowSouthMiddleEast:(t,n)=>({top:r(t,n),left:t.left+t.width/2-.75*n.width+e,name:"arrow_sme",...o&&{config:o}}),northArrowSouthEast:(t,n)=>({top:r(t,n),left:t.left+t.width/2-n.width+e,name:"arrow_se",...o&&{config:o}}),northEastArrowSouthWest:(t,n)=>({top:r(t,n),left:t.right-e,name:"arrow_sw",...o&&{config:o}}),northEastArrowSouthMiddleWest:(t,n)=>({top:r(t,n),left:t.right-.25*n.width-e,name:"arrow_smw",...o&&{config:o}}),northEastArrowSouth:(t,e)=>({top:r(t,e),left:t.right-e.width/2,name:"arrow_s",...o&&{config:o}}),northEastArrowSouthMiddleEast:(t,n)=>({top:r(t,n),left:t.right-.75*n.width+e,name:"arrow_sme",...o&&{config:o}}),northEastArrowSouthEast:(t,n)=>({top:r(t,n),left:t.right-n.width+e,name:"arrow_se",...o&&{config:o}}),southWestArrowNorthWest:t=>({top:s(t),left:t.left-e,name:"arrow_nw",...o&&{config:o}}),southWestArrowNorthMiddleWest:(t,n)=>({top:s(t),left:t.left-.25*n.width-e,name:"arrow_nmw",...o&&{config:o}}),southWestArrowNorth:(t,e)=>({top:s(t),left:t.left-e.width/2,name:"arrow_n",...o&&{config:o}}),southWestArrowNorthMiddleEast:(t,n)=>({top:s(t),left:t.left-.75*n.width+e,name:"arrow_nme",...o&&{config:o}}),southWestArrowNorthEast:(t,n)=>({top:s(t),left:t.left-n.width+e,name:"arrow_ne",...o&&{config:o}}),southArrowNorthWest:t=>({top:s(t),left:t.left+t.width/2-e,name:"arrow_nw",...o&&{config:o}}),southArrowNorthMiddleWest:(t,n)=>({top:s(t),left:t.left+t.width/2-.25*n.width-e,name:"arrow_nmw",...o&&{config:o}}),southArrowNorth:(t,e)=>({top:s(t),left:t.left+t.width/2-e.width/2,name:"arrow_n",...o&&{config:o}}),southArrowNorthMiddleEast:(t,n)=>({top:s(t),left:t.left+t.width/2-.75*n.width+e,name:"arrow_nme",...o&&{config:o}}),southArrowNorthEast:(t,n)=>({top:s(t),left:t.left+t.width/2-n.width+e,name:"arrow_ne",...o&&{config:o}}),southEastArrowNorthWest:t=>({top:s(t),left:t.right-e,name:"arrow_nw",...o&&{config:o}}),southEastArrowNorthMiddleWest:(t,n)=>({top:s(t),left:t.right-.25*n.width-e,name:"arrow_nmw",...o&&{config:o}}),southEastArrowNorth:(t,e)=>({top:s(t),left:t.right-e.width/2,name:"arrow_n",...o&&{config:o}}),southEastArrowNorthMiddleEast:(t,n)=>({top:s(t),left:t.right-.75*n.width+e,name:"arrow_nme",...o&&{config:o}}),southEastArrowNorthEast:(t,n)=>({top:s(t),left:t.right-n.width+e,name:"arrow_ne",...o&&{config:o}}),westArrowEast:(t,e)=>({top:t.top+t.height/2-e.height/2,left:t.left-e.width-n,name:"arrow_e",...o&&{config:o}}),eastArrowWest:(t,e)=>({top:t.top+t.height/2-e.height/2,left:t.right+n,name:"arrow_w",...o&&{config:o}}),viewportStickyNorth:(t,e,n,r)=>{const s=r||n;return t.getIntersection(s)?s.height-t.height>i?null:{top:s.top+i,left:t.left+t.width/2-e.width/2,name:"arrowless",config:{withArrow:!1,...o}}:null}};function r(t,e){return t.top-e.height-n}function s(t){return t.bottom+n}}}Sg.arrowSideOffset=25,Sg.arrowHeightOffset=10,Sg.stickyVerticalOffset=20,Sg._getOptimalPosition=ki,Sg.defaultPositions=Sg.generatePositions();const Ig=Sg;function Tg(t){return jn(t)?t:ei(t)?t.commonAncestorContainer:"function"==typeof t?Tg(t()):null}var Bg=o(7217),Mg={attributes:{"data-cke":!0}};Mg.setAttributes=Qo(),Mg.insert=Ko().bind(null,"head"),Mg.domAPI=qo(),Mg.insertStyleElement=Jo(),Wo()(Bg.A,Mg),Bg.A&&Bg.A.locals&&Bg.A.locals;class Pg extends Ig{constructor(t){super(t);const e=this.bindTemplate;this.set({isVisible:!1,position:"se",class:null,top:0,left:0}),this.extendTemplate({tag:"div",attributes:{class:["ck-reset","ck-dropdown-menu__nested-menu__panel"],tabindex:"-1"},on:{selectstart:e.to((t=>{"input"!==t.target.tagName.toLocaleLowerCase()&&t.preventDefault()}))}})}focus(t=1){const{content:e}=this;e.length&&(1===t?e.first.focus():e.last.focus())}}var Ng=o(6559),Lg={attributes:{"data-cke":!0}};Lg.setAttributes=Qo(),Lg.insert=Ko().bind(null,"head"),Lg.domAPI=qo(),Lg.insertStyleElement=Jo(),Wo()(Ng.A,Lg),Ng.A&&Ng.A.locals&&Ng.A.locals;class zg extends er{constructor(t,e,n,i,o){super(t),this._bodyCollection=e,this.id=n,this.set({isOpen:!1,isEnabled:!0,panelPosition:"w",class:void 0,parentMenuView:null}),this.keystrokes=new uo,this.focusTracker=new so,this.buttonView=new hg(t),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.buttonView.label=i,this.panelView=new Pg(t),this.panelView.isVisible=!0,this.listView=new wg(t),this.listView.bind("ariaLabel").to(this.buttonView,"label"),this.panelView.content.add(this.listView);const r=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown-menu-list__nested-menu",r.to("class"),r.if("isEnabled","ck-disabled",(t=>!t))],role:"presentation"},children:[this.buttonView]}),this.parentMenuView=o,this.parentMenuView&&this._handleParentMenuView(),this._attachBehaviors()}get _panelPositions(){const{westSouth:t,eastSouth:e,westNorth:n,eastNorth:i}=_g;return"ltr"===this.locale.uiLanguageDirection?[e,i,t,n]:[t,n,e,i]}render(){super.render(),this.panelView.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.focusTracker.add(this.listView),this.keystrokes.listenTo(this.element),this._mountPanelOnOpen()}destroy(){this._removePanelFromBody(),this.panelView.destroy(),super.destroy()}focus(){this.buttonView.focus()}_handleParentMenuView(){this.delegate(...zg.DELEGATED_EVENTS).to(this.parentMenuView),vg.closeOnParentClose(this,this.parentMenuView)}_attachBehaviors(){vg.openOnButtonClick(this),vg.openAndFocusOnEnterKeyPress(this),vg.openOnArrowRightKey(this),vg.closeOnEscKey(this),vg.closeOnArrowLeftKey(this)}_mountPanelOnOpen(){const{panelView:t}=this;this.on("change:isOpen",((e,n,i)=>{e.source===this&&(i||!this._bodyCollection.has(t)?i&&!this._bodyCollection.has(t)&&this._addPanelToBody():this._removePanelFromBody())}))}_removePanelFromBody(){const{panelView:t,keystrokes:e}=this;this._bodyCollection.has(t)&&(this._bodyCollection.remove(t),e.stopListening(t.element))}_addPanelToBody(){const{panelView:t,buttonView:e,keystrokes:n}=this;this._bodyCollection.has(t)||(this._bodyCollection.add(t),n.listenTo(t.element),t.pin({positions:this._panelPositions,limiter:a.document.body,element:t.element,target:e.element,fitInViewport:!0}))}}zg.DELEGATED_EVENTS=["mouseenter","execute","change:isOpen"];class Og extends er{constructor(t){super(t),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Vg extends er{constructor(t){super(t),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function Fg(t){if(Array.isArray(t))return{items:t,removeItems:[]};const e={items:[],removeItems:[]};return t?{...e,...t}:e}var Rg=o(66),jg={attributes:{"data-cke":!0}};jg.setAttributes=Qo(),jg.insert=Ko().bind(null,"head"),jg.domAPI=qo(),jg.insertStyleElement=Jo(),Wo()(Rg.A,jg),Rg.A&&Rg.A.locals&&Rg.A.locals;const Hg=(()=>({alignLeft:Dh.alignLeft,bold:Dh.bold,importExport:Dh.importExport,paragraph:Dh.paragraph,plus:Dh.plus,text:Dh.text,threeVerticalDots:Dh.threeVerticalDots,pilcrow:Dh.pilcrow,dragIndicator:Dh.dragIndicator}))();class Ug extends er{constructor(t,e){super(t);const n=this.bindTemplate,i=this.t;this.options=e||{},this.set("ariaLabel",i("Editor toolbar")),this.set("maxWidth","auto"),this.set("role","toolbar"),this.items=this.createCollection(),this.focusTracker=new so,this.keystrokes=new uo,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new Wg(t),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const o="rtl"===t.uiLanguageDirection;this._focusCycler=new Rh({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[o?"arrowright":"arrowleft","arrowup"],focusNext:[o?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];var s;this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:n.to("role"),"aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(s=this,s.bindTemplate.to((t=>{t.target===s.element&&t.preventDefault()})))}}),this._behavior=this.options.shouldGroupWhenFull?new qg(this):new Gg(this)}render(){super.render(),this.focusTracker.add(this.element);for(const t of this.items)this.focusTracker.add(t);this.items.on("add",((t,e)=>{this.focusTracker.add(e)})),this.items.on("remove",((t,e)=>{this.focusTracker.remove(e)})),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(t,e,n){this.items.addMany(this._buildItemsFromConfig(t,e,n))}_buildItemsFromConfig(t,e,n){const i=Fg(t),o=n||i.removeItems;return this._cleanItemsConfiguration(i.items,e,o).map((t=>G(t)?this._createNestedToolbarDropdown(t,e,o):"|"===t?new Og:"-"===t?new Vg:e.create(t))).filter((t=>!!t))}_cleanItemsConfiguration(t,e,n){const i=t.filter(((t,i,o)=>"|"===t||-1===n.indexOf(t)&&("-"===t?!this.options.shouldGroupWhenFull||(T("toolbarview-line-break-ignored-when-grouping-items",o),!1):!(!G(t)&&!e.has(t)&&(T("toolbarview-item-unavailable",{item:t}),1)))));return this._cleanSeparatorsAndLineBreaks(i)}_cleanSeparatorsAndLineBreaks(t){const e=t=>"-"!==t&&"|"!==t,n=t.length,i=t.findIndex(e);if(-1===i)return[];const o=n-t.slice().reverse().findIndex(e);return t.slice(i,o).filter(((t,n,i)=>!!e(t)||!(n>0&&i[n-1]===t)))}_createNestedToolbarDropdown(t,e,n){let{label:i,icon:o,items:r,tooltip:s=!0,withText:a=!1}=t;if(r=this._cleanItemsConfiguration(r,e,n),!r.length)return null;const c=tp(this.locale);return i||T("toolbarview-nested-toolbar-dropdown-missing-label",t),c.class="ck-toolbar__nested-toolbar-dropdown",c.buttonView.set({label:i,tooltip:s,withText:!!a}),!1!==o?c.buttonView.icon=Hg[o]||o||Dh.threeVerticalDots:c.buttonView.withText=!0,ep(c,(()=>c.toolbarView._buildItemsFromConfig(r,e,n))),c}}class Wg extends er{constructor(t){super(t),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Gg{constructor(t){const e=t.bindTemplate;t.set("isVertical",!1),t.itemsView.children.bindTo(t.items).using((t=>t)),t.focusables.bindTo(t.items).using((t=>Hh(t)?t:null)),t.extendTemplate({attributes:{class:[e.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class qg{constructor(t){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=t,this.viewChildren=t.children,this.viewFocusables=t.focusables,this.viewItemsView=t.itemsView,this.viewFocusTracker=t.focusTracker,this.viewLocale=t.locale,this.ungroupedItems=t.createCollection(),this.groupedItems=t.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),t.itemsView.children.bindTo(this.ungroupedItems).using((t=>t)),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),t.children.on("change",this._updateFocusCyclableItems.bind(this)),t.items.on("change",((t,e)=>{const n=e.index,i=Array.from(e.added);for(const t of e.removed)n>=this.ungroupedItems.length?this.groupedItems.remove(t):this.ungroupedItems.remove(t);for(let t=n;tthis.ungroupedItems.length?this.groupedItems.add(e,t-this.ungroupedItems.length):this.ungroupedItems.add(e,t)}this._updateGrouping()})),t.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(t){this.viewElement=t.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(t)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!fi(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=!0);const t=this.groupedItems.length;let e;for(;this._areItemsOverflowing;)this._groupLastItem(),e=!0;if(!e&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==t&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const t=this.viewElement,e=this.viewLocale.uiLanguageDirection,n=new oi(t.lastChild),i=new oi(t);if(!this.cachedPadding){const n=a.window.getComputedStyle(t),i="ltr"===e?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[i])}return"ltr"===e?n.right>i.right-this.cachedPadding:n.left{t&&t===e.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),t=e.contentRect.width)})),this._updateGrouping()}_enableGroupingOnMaxWidthChange(t){t.on("change:maxWidth",(()=>{this._updateGrouping()}))}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new Og),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const t=this.viewLocale,e=t.t,n=tp(t);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition="ltr"===t.uiLanguageDirection?"sw":"se",ep(n,this.groupedItems),n.buttonView.set({label:e("Show more items"),tooltip:!0,tooltipPosition:"rtl"===t.uiLanguageDirection?"se":"sw",icon:Dh.threeVerticalDots}),n}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map((t=>{Hh(t)&&this.viewFocusables.add(t)})),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}var $g=o(7133),Kg={attributes:{"data-cke":!0}};Kg.setAttributes=Qo(),Kg.insert=Ko().bind(null,"head"),Kg.domAPI=qo(),Kg.insertStyleElement=Jo(),Wo()($g.A,Kg),$g.A&&$g.A.locals&&$g.A.locals;class Yg extends er{constructor(t,e){super(t);const n=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(e),this.arrowView=this._createArrowView(),this.keystrokes=new uo,this.focusTracker=new so,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",n.to("class"),n.if("isVisible","ck-hidden",(t=>!t)),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",((t,e)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),e())})),this.keystrokes.set("arrowleft",((t,e)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),e())}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(t){const e=t||new Lh;return t||e.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),e.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),e.delegate("execute").to(this),e}_createArrowView(){const t=new Lh,e=t.bindTemplate;return t.icon=Dm,t.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":e.to("isOn"),"aria-haspopup":!0,"aria-expanded":e.to("isOn",(t=>String(t)))}}),t.bind("isEnabled").to(this),t.bind("label").to(this),t.bind("tooltip").to(this),t.delegate("execute").to(this,"open"),t}}var Qg=o(7475),Zg={attributes:{"data-cke":!0}};Zg.setAttributes=Qo(),Zg.insert=Ko().bind(null,"head"),Zg.domAPI=qo(),Zg.insertStyleElement=Jo(),Wo()(Qg.A,Zg),Qg.A&&Qg.A.locals&&Qg.A.locals;var Jg=o(2454),Xg={attributes:{"data-cke":!0}};function tp(t,e=ag){const n="function"==typeof e?new e(t):e,i=new ng(t),o=new sg(t,n,i);return n.bind("isEnabled").to(o),n instanceof Yg?n.arrowView.bind("isOn").to(o,"isOpen"):n.bind("isOn").to(o,"isOpen"),function(t){(function(t){nr({emitter:t,activator:()=>t.isRendered&&t.isOpen,callback:()=>{t.isOpen=!1},contextElements:()=>[t.element,...sp(t.focusTracker).filter((e=>!t.element.contains(e)))]})})(t),function(t){t.on("execute",(e=>{e.source instanceof Cm||(t.isOpen=!1)}))}(t),function(t){t.focusTracker.on("change:isFocused",((e,n,i)=>{!i&&t.isOpen&&(t.isOpen=!1)}))}(t),function(t){t.keystrokes.set("arrowdown",((e,n)=>{t.isOpen&&(t.panelView.focus(),n())})),t.keystrokes.set("arrowup",((e,n)=>{t.isOpen&&(t.panelView.focusLast(),n())}))}(t),function(t){t.on("change:isOpen",((e,n,i)=>{i||t.focusTracker.elements.some((t=>t.contains(a.document.activeElement)))&&t.buttonView.focus()}))}(t),function(t){t.on("change:isOpen",((e,n,i)=>{i&&t.panelView.focus()}),{priority:"low"})}(t)}(o),o}function ep(t,e,n={}){t.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.isOpen?np(t,e,n):t.once("change:isOpen",(()=>np(t,e,n)),{priority:"highest"}),n.enableActiveItemFocusOnDropdownOpen&&rp(t,(()=>t.toolbarView.items.find((t=>t.isOn))))}function np(t,e,n){const i=t.locale,o=i.t,r=t.toolbarView=new Ug(i),s="function"==typeof e?e():e;r.ariaLabel=n.ariaLabel||o("Dropdown toolbar"),n.maxWidth&&(r.maxWidth=n.maxWidth),n.class&&(r.class=n.class),n.isCompact&&(r.isCompact=n.isCompact),n.isVertical&&(r.isVertical=!0),s instanceof Ao?r.items.bindTo(s).using((t=>t)):r.items.addMany(s),t.panelView.children.add(r),t.focusTracker.add(r),r.items.delegate("execute").to(t)}function ip(t,e,n={}){t.isOpen?op(t,e,n):t.once("change:isOpen",(()=>op(t,e,n)),{priority:"highest"}),rp(t,(()=>t.listView.items.find((t=>t instanceof mg&&t.children.first.isOn))))}function op(t,e,n){const i=t.locale,o=t.listView=new bg(i),r="function"==typeof e?e():e;o.ariaLabel=n.ariaLabel,o.role=n.role,ap(t,o.items,r,i),t.panelView.children.add(o),o.items.delegate("execute").to(t)}function rp(t,e){t.on("change:isOpen",(()=>{if(!t.isOpen)return;const n=e();n&&("function"==typeof n.focus?n.focus():T("ui-dropdown-focus-child-on-open-child-missing-focus",{view:n}))}),{priority:E.low-10})}function sp(t){return[...t.elements,...t.externalViews.flatMap((t=>sp(t.focusTracker)))]}function ap(t,e,n,i){e.on("change",(()=>{const t=[...e].reduce(((t,e)=>(e instanceof mg&&e.children.first instanceof rm&&t.push(e.children.first),t)),[]),n=t.some((t=>t.isToggleable));t.forEach((t=>{t.hasCheckSpace=n}))})),e.bindTo(n).using((e=>{if("separator"===e.type)return new gg(i);if("group"===e.type){const n=new pg(i);return n.set({label:e.label}),ap(t,n.items,e.items,i),n.items.delegate("execute").to(t),n}if("button"===e.type||"switchbutton"===e.type){const t="menuitemcheckbox"===e.model.role||"menuitemradio"===e.model.role,n=new mg(i);let o;return"button"===e.type?(o=new rm(i),o.set({isToggleable:t})):o=new Cm(i),o.bind(...Object.keys(e.model)).to(e.model),o.delegate("execute").to(n),n.children.add(o),n}return null}))}Xg.setAttributes=Qo(),Xg.insert=Ko().bind(null,"head"),Xg.domAPI=qo(),Xg.insertStyleElement=Jo(),Wo()(Jg.A,Xg),Jg.A&&Jg.A.locals&&Jg.A.locals;const cp=(t,e,n)=>{const i=new Jm(t.locale);return i.set({id:e,ariaDescribedById:n}),i.bind("isReadOnly").to(t,"isEnabled",(t=>!t)),i.bind("hasError").to(t,"errorText",(t=>!!t)),i.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused","placeholder").to(i),i},lp=(t,e,n)=>{const i=new Xm(t.locale);return i.set({id:e,ariaDescribedById:n,inputMode:"numeric"}),i.bind("isReadOnly").to(t,"isEnabled",(t=>!t)),i.bind("hasError").to(t,"errorText",(t=>!!t)),i.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused","placeholder").to(i),i},dp=(t,e,n)=>{const i=tp(t.locale);return i.set({id:e,ariaDescribedById:n}),i.bind("isEnabled").to(t),i},up=(t,e=0,n=1)=>t>n?n:tMath.round(n*t)/n,mp=(Math.PI,t=>("#"===t[0]&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?hp(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:8===t.length?hp(parseInt(t.substring(6,8),16)/255,2):1})),gp=t=>{const{h:e,s:n,l:i}=(({h:t,s:e,v:n,a:i})=>{const o=(200-e)*n/100;return{h:hp(t),s:hp(o>0&&o<200?e*n/100/(o<=100?o:200-o)*100:0),l:hp(o/2),a:hp(i,2)}})(t);return`hsl(${e}, ${n}%, ${i}%)`},pp=t=>{const e=t.toString(16);return e.length<2?"0"+e:e},fp=(t,e)=>{if(t===e)return!0;for(const n in t)if(t[n]!==e[n])return!1;return!0},kp={},bp=t=>{let e=kp[t];return e||(e=document.createElement("template"),e.innerHTML=t,kp[t]=e),e},wp=(t,e,n)=>{t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n}))};let _p=!1;const Ap=t=>"touches"in t,Cp=(t,e)=>{const n=Ap(e)?e.touches[0]:e,i=t.el.getBoundingClientRect();wp(t.el,"move",t.getMove({x:up((n.pageX-(i.left+window.pageXOffset))/i.width),y:up((n.pageY-(i.top+window.pageYOffset))/i.height)}))};class vp{constructor(t,e,n,i){const o=bp(``);t.appendChild(o.content.cloneNode(!0));const r=t.querySelector(`[part=${e}]`);r.addEventListener("mousedown",this),r.addEventListener("touchstart",this),r.addEventListener("keydown",this),this.el=r,this.xy=i,this.nodes=[r.firstChild,r]}set dragging(t){const e=t?document.addEventListener:document.removeEventListener;e(_p?"touchmove":"mousemove",this),e(_p?"touchend":"mouseup",this)}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":if(t.preventDefault(),!(t=>!(_p&&!Ap(t)||(_p||(_p=Ap(t)),0)))(t)||!_p&&0!=t.button)return;this.el.focus(),Cp(this,t),this.dragging=!0;break;case"mousemove":case"touchmove":t.preventDefault(),Cp(this,t);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((t,e)=>{const n=e.keyCode;n>40||t.xy&&n<37||n<33||(e.preventDefault(),wp(t.el,"move",t.getMove({x:39===n?.01:37===n?-.01:34===n?.05:33===n?-.05:35===n?1:36===n?-1:0,y:40===n?.01:38===n?-.01:0},!0)))})(this,t)}}style(t){t.forEach(((t,e)=>{for(const n in t)this.nodes[e].style.setProperty(n,t[n])}))}}class yp extends vp{constructor(t){super(t,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:t}){this.h=t,this.style([{left:t/360*100+"%",color:gp({h:t,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${hp(t)}`)}getMove(t,e){return{h:e?up(this.h+360*t.x,0,360):360*t.x}}}class xp extends vp{constructor(t){super(t,"saturation",'aria-label="Color"',!0)}update(t){this.hsva=t,this.style([{top:100-t.v+"%",left:`${t.s}%`,color:gp(t)},{"background-color":gp({h:t.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${hp(t.s)}%, Brightness ${hp(t.v)}%`)}getMove(t,e){return{s:e?up(this.hsva.s+100*t.x,0,100):100*t.x,v:e?up(this.hsva.v-100*t.y,0,100):Math.round(100-100*t.y)}}}const Ep=Symbol("same"),Dp=Symbol("color"),Sp=Symbol("hsva"),Ip=Symbol("update"),Tp=Symbol("parts"),Bp=Symbol("css"),Mp=Symbol("sliders");class Pp extends HTMLElement{static get observedAttributes(){return["color"]}get[Bp](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[Mp](){return[xp,yp]}get color(){return this[Dp]}set color(t){if(!this[Ep](t)){const e=this.colorModel.toHsva(t);this[Ip](e),this[Dp]=t}}constructor(){super();const t=bp(``),e=this.attachShadow({mode:"open"});e.appendChild(t.content.cloneNode(!0)),e.addEventListener("move",this),this[Tp]=this[Mp].map((t=>new t(e)))}connectedCallback(){if(this.hasOwnProperty("color")){const t=this.color;delete this.color,this.color=t}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(t,e,n){const i=this.colorModel.fromAttr(n);this[Ep](i)||(this.color=i)}handleEvent(t){const e=this[Sp],n={...e,...t.detail};let i;this[Ip](n),fp(n,e)||this[Ep](i=this.colorModel.fromHsva(n))||(this[Dp]=i,wp(this,"color-changed",{value:i}))}[Ep](t){return this.color&&this.colorModel.equal(t,this.color)}[Ip](t){this[Sp]=t,this[Tp].forEach((e=>e.update(t)))}}const Np={defaultColor:"#000",toHsva:t=>(({r:t,g:e,b:n,a:i})=>{const o=Math.max(t,e,n),r=o-Math.min(t,e,n),s=r?o===t?(e-n)/r:o===e?2+(n-t)/r:4+(t-e)/r:0;return{h:hp(60*(s<0?s+6:s)),s:hp(o?r/o*100:0),v:hp(o/255*100),a:i}})(mp(t)),fromHsva:({h:t,s:e,v:n})=>(({r:t,g:e,b:n,a:i})=>{const o=i<1?pp(hp(255*i)):"";return"#"+pp(t)+pp(e)+pp(n)+o})((({h:t,s:e,v:n,a:i})=>{t=t/360*6,e/=100,n/=100;const o=Math.floor(t),r=n*(1-e),s=n*(1-(t-o)*e),a=n*(1-(1-t+o)*e),c=o%6;return{r:hp(255*[n,s,r,r,a,n][c]),g:hp(255*[a,n,n,s,r,r][c]),b:hp(255*[r,r,a,n,n,s][c]),a:hp(i,2)}})({h:t,s:e,v:n,a:1})),equal:(t,e)=>t.toLowerCase()===e.toLowerCase()||fp(mp(t),mp(e)),fromAttr:t=>t};class Lp extends Pp{get colorModel(){return Np}}var zp=o(3086),Op={attributes:{"data-cke":!0}};Op.setAttributes=Qo(),Op.insert=Ko().bind(null,"head"),Op.domAPI=qo(),Op.insertStyleElement=Jo(),Wo()(zp.A,Op),zp.A&&zp.A.locals&&zp.A.locals;class Vp extends er{constructor(t,e={}){super(t),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const n=this.createCollection();e.hideInput||n.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:n}),this._config=e,this._debounceColorPickerEvent=Ha((t=>{this.set("color",t),this.fire("colorSelected",{color:this.color})}),150,{leading:!0}),this.on("set:color",((t,e,n)=>{t.return=Um(n,this._config.format||"hsl")})),this.on("change:color",(()=>{this._hexColor=Fp(this.color)})),this.on("change:_hexColor",(()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Fp(this.color)!=Fp(this._hexColor)&&(this.color=this._hexColor)}))}render(){var t,e;if(super.render(),t="hex-color-picker",e=Lp,void 0===customElements.get(t)&&customElements.define(t,e),this.picker=a.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const t=document.createElement("style");t.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(t)}this.picker.addEventListener("color-changed",(t=>{const e=t.detail.value;this._debounceColorPickerEvent(e)}))}focus(){!this._config.hideInput&&(d.isGecko||d.isiOS||d.isSafari||d.isBlink)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const t=[...this.picker.shadowRoot.children].filter((t=>"slider"===t.getAttribute("role"))).map((t=>new Rp(t)));this.slidersView=this.createCollection(),t.forEach((t=>{this.slidersView.add(t)}))}_createInputRow(){const t=this._createColorInput();return new Hp(this.locale,t)}_createColorInput(){const t=new $m(this.locale,cp),{t:e}=this.locale;return t.set({label:e("HEX"),class:"color-picker-hex-input"}),t.fieldView.bind("value").to(this,"_hexColor",(e=>t.isFocused?t.fieldView.value:e.startsWith("#")?e.substring(1):e)),t.fieldView.on("input",(()=>{const e=t.fieldView.element.value;if(e){const t=Up(e);t&&this._debounceColorPickerEvent(t)}})),t}isValid(){const{t}=this.locale;return!!this._config.hideInput||(this.resetValidationStatus(),!!this.hexInputRow.getParsedColor()||(this.hexInputRow.inputView.errorText=t('Please enter a valid color (e.g. "ff0000").'),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function Fp(t){let e=function(t){if(!t)return"";const e=Wm(t);return e?"hex"===e.space?e.hexValue:Um(t,"hex"):"#000"}(t);return e||(e="#000"),4===e.length&&(e="#"+[e[1],e[1],e[2],e[2],e[3],e[3]].join("")),e.toLowerCase()}class Rp extends er{constructor(t){super(),this.element=t}focus(){this.element.focus()}}class jp extends er{constructor(t){super(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class Hp extends er{constructor(t,e){super(t),this.inputView=e,this.children=this.createCollection([new jp,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return Up(this.inputView.fieldView.element.value)}}function Up(t){if(!t)return null;const e=t.trim().replace(/^#/,"");return[3,4,6,8].includes(e.length)&&/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(e)?`#${e}`:null}class Wp extends(J(oo)){constructor(t){super(t),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(t,e){return this.find((e=>e.color===t.color))?this:super.add(t,e)}hasColor(t){return!!this.find((e=>e.color===t))}}class Gp extends er{constructor(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:s,focusTracker:a,focusables:c}){super(t);const l=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=e,this.columns=n,this.documentColors=new Wp,this.documentColorsCount=r,this._focusables=c,this._removeButtonLabel=i,this._colorPickerLabel=s,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",l.if("isVisible","ck-hidden",(t=>!t))]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(t,e){const n=t.document,i=this.documentColorsCount;this.documentColors.clear();for(const o of n.getRoots()){const n=t.createRangeIn(o);for(const t of n.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(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const t=Co.bind(this.documentColors,this.documentColors),e=new er(this.locale);e.setTemplate({tag:"span",attributes:{class:["ck","ck-color-grid__label",t.if("isEmpty","ck-hidden")]},children:[{text:this._documentColorsLabel}]}),this.items.add(e),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new Lh,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:Dh.colorPalette,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",(()=>{this.fire("colorPicker:show")}))}_createRemoveColorButton(){const t=new Lh;return t.set({withText:!0,icon:Dh.eraser,label:this._removeButtonLabel}),t.class="ck-color-selector__remove-color",t.on("execute",(()=>{this.fire("execute",{value:null,source:"removeColorButton"})})),t.render(),t}_createStaticColorsGrid(){const t=new Om(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return t.on("execute",((t,e)=>{this.fire("execute",{value:e.value,source:"staticColorsGrid"})})),t}_createDocumentColorsGrid(){const t=Co.bind(this.documentColors,this.documentColors),e=new Om(this.locale,{columns:this.columns});return e.extendTemplate({attributes:{class:t.if("isEmpty","ck-hidden")}}),e.items.bindTo(this.documentColors).using((t=>{const e=new Nm;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,source:"documentColorsGrid"})})),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}})}}class qp extends er{constructor(t,{focusTracker:e,focusables:n,keystrokes:i,colorPickerViewConfig:o}){super(t),this.items=this.createCollection(),this.focusTracker=e,this.keystrokes=i,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=n,this._colorPickerViewConfig=o;const r=this.bindTemplate,{saveButtonView:s,cancelButtonView:a}=this._createActionButtons();this.saveButtonView=s,this.cancelButtonView=a,this.actionBarView=this._createActionBarView({saveButtonView:s,cancelButtonView:a}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",r.if("isVisible","ck-hidden",(t=>!t))]},children:this.items})}render(){super.render();const t=new Vp(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=t,this.colorPickerView.render(),this.selectedColor&&(t.color=this.selectedColor),this.listenTo(this,"change:selectedColor",((e,n,i)=>{t.color=i})),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set("enter",(t=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&this.colorPickerView.isValid()&&(this.fire("execute",{value:this.selectedColor}),t.stopPropagation(),t.preventDefault())}))}_stopPropagationOnArrowsKeys(){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)}_addColorPickersElementsToFocusTracker(){for(const t of this.colorPickerView.slidersView)this.focusTracker.add(t.element),this._focusables.add(t);const t=this.colorPickerView.hexInputRow.children.get(1);t.element&&(this.focusTracker.add(t.element),this._focusables.add(t)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:t,cancelButtonView:e}){const n=new er,i=this.createCollection();return i.add(t),i.add(e),n.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:i}),n}_createActionButtons(){const t=this.locale,e=t.t,n=new Lh(t),i=new Lh(t);return n.set({icon:Dh.check,class:"ck-button-save",type:"button",withText:!1,label:e("Accept")}),i.set({icon:Dh.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:e("Cancel")}),n.on("execute",(()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})})),i.on("execute",(()=>{this.fire("colorPicker:cancel")})),{saveButtonView:n,cancelButtonView:i}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",((t,e)=>{this.fire("execute",{value:e.color,source:"colorPicker"}),this.set("selectedColor",e.color)}))}}var $p=o(2922),Kp={attributes:{"data-cke":!0}};Kp.setAttributes=Qo(),Kp.insert=Ko().bind(null,"head"),Kp.domAPI=qo(),Kp.insertStyleElement=Jo(),Wo()($p.A,Kp),$p.A&&$p.A.locals&&$p.A.locals;class Yp extends er{constructor(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:s,colorPickerViewConfig:a}){super(t),this.items=this.createCollection(),this.focusTracker=new so,this.keystrokes=new uo,this._focusables=new Ao,this._colorPickerViewConfig=a,this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new Gp(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:s,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new qp(t,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:a}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",((t,e,n)=>{this.colorGridsFragmentView.set("selectedColor",n),this.colorPickerFragmentView.set("selectedColor",n)})),this.colorGridsFragmentView.on("change:selectedColor",((t,e,n)=>{this.set("selectedColor",n)})),this.colorPickerFragmentView.on("change:selectedColor",((t,e,n)=>{this.set("selectedColor",n)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){this.colorPickerFragmentView.colorPickerView&&!this._isColorPickerFragmentVisible&&(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(t,e){this.colorGridsFragmentView.updateDocumentColors(t,e)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate("execute").to(this),this.colorGridsFragmentView.delegate("colorPicker:show").to(this))}_appendColorPickerFragment(){2!==this.items.length&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{this.showColorPickerFragment()})),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}class Qp{constructor(t){this._components=new Map,this.editor=t}*names(){for(const t of this._components.values())yield t.originalName}add(t,e){this._components.set(Zp(t),{callback:e,originalName:t})}create(t){if(!this.has(t))throw new I("componentfactory-item-missing",this,{name:t});return this._components.get(Zp(t)).callback(this.editor.locale)}has(t){return this._components.has(Zp(t))}}function Zp(t){return String(t).toLowerCase()}var Jp=o(4650),Xp={attributes:{"data-cke":!0}};Xp.setAttributes=Qo(),Xp.insert=Ko().bind(null,"head"),Xp.domAPI=qo(),Xp.insertStyleElement=Jo(),Wo()(Jp.A,Xp),Jp.A&&Jp.A.locals&&Jp.A.locals;const tf="ck-tooltip";class ef extends(Kn()){constructor(t){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._mutationObserver=null,ef._editors.add(t),ef._instance)return ef._instance;ef._instance=this,this.tooltipTextView=new er(t.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new Ig(t.locale),this.balloonPanelView.class=tf,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=function(t){const e=new MutationObserver((()=>{t()}));return{attach(t){e.observe(t,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){e.disconnect()}}}((()=>{this._updateTooltipPosition()})),this._pinTooltipDebounced=Ha(this._pinTooltip,600),this._unpinTooltipDebounced=Ha(this._unpinTooltip,400),this.listenTo(a.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(a.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(a.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(a.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(a.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(a.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(t){const e=t.ui.view&&t.ui.view.body;ef._editors.delete(t),this.stopListening(t.ui),e&&e.has(this.balloonPanelView)&&e.remove(this.balloonPanelView),ef._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),ef._instance=null)}static getPositioningFunctions(t){const e=ef.defaultBalloonPositions;return{s:[e.southArrowNorth,e.southArrowNorthEast,e.southArrowNorthWest],n:[e.northArrowSouth],e:[e.eastArrowWest],w:[e.westArrowEast],sw:[e.southArrowNorthEast],se:[e.southArrowNorthWest]}[t]}_onKeyDown(t,e){"Escape"===e.key&&this._currentElementWithTooltip&&(this._unpinTooltip(),e.stopPropagation())}_onEnterOrFocus(t,{target:e}){const n=of(e);n?n!==this._currentElementWithTooltip?(this._unpinTooltip(),"focus"===t.name&&!n.matches(":hover")||n.matches("[data-cke-tooltip-instant]")?this._pinTooltip(n,rf(n)):this._pinTooltipDebounced(n,rf(n))):this._unpinTooltipDebounced.cancel():"focus"===t.name&&this._unpinTooltip()}_onLeaveOrBlur(t,{target:e,relatedTarget:n}){if("mouseleave"===t.name){if(!jn(e))return;const t=this.balloonPanelView.element,i=t&&(t===n||t.contains(n)),o=!i&&e===t;if(i)return void this._unpinTooltipDebounced.cancel();if(!o&&this._currentElementWithTooltip&&e!==this._currentElementWithTooltip)return;const r=of(e),s=of(n);(o||r&&r!==s)&&(this._pinTooltipDebounced.cancel(),this._currentElementWithTooltip&&this._currentElementWithTooltip.matches("[data-cke-tooltip-instant]")||r&&r.matches("[data-cke-tooltip-instant]")?this._unpinTooltip():this._unpinTooltipDebounced())}else{if(this._currentElementWithTooltip&&e!==this._currentElementWithTooltip)return;this._pinTooltipDebounced.cancel(),this._unpinTooltipDebounced()}}_onScroll(t,{target:e}){this._currentElementWithTooltip&&(e.contains(this.balloonPanelView.element)&&e.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(t,{text:e,position:n,cssClass:i}){this._unpinTooltip();const o=ro(ef._editors.values()).ui.view.body;o.has(this.balloonPanelView)||o.add(this.balloonPanelView),this.tooltipTextView.text=e,this.balloonPanelView.class=[tf,i].filter((t=>t)).join(" "),this.balloonPanelView.pin({target:t,positions:ef.getPositioningFunctions(n)}),this._mutationObserver.attach(t);for(const t of ef._editors)this.listenTo(t.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=t,this._currentTooltipPosition=n}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const t of ef._editors)this.stopListening(t.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;const t=rf(this._currentElementWithTooltip);fi(this._currentElementWithTooltip)&&t.text?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:ef.getPositioningFunctions(t.position)}):this._unpinTooltip()}}ef.defaultBalloonPositions=Ig.generatePositions({heightOffset:5,sideOffset:13}),ef._editors=new Set,ef._instance=null;const nf=ef;function of(t){return jn(t)?t.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function rf(t){return{text:t.dataset.ckeTooltipText,position:t.dataset.ckeTooltipPosition||"s",cssClass:t.dataset.ckeTooltipClass||""}}class sf extends(Kn()){constructor(t,e={}){super(),this._balloonView=null,this._showBalloonThrottled=ih((()=>this._showBalloon()),50,{leading:!0}),this._lastFocusedEditableElement=null,this.editor=t,this._balloonClass=e.balloonClass,t.on("ready",(()=>this._handleEditorReady()))}destroy(){const t=this._balloonView;t&&(t.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const t=this.editor;this._isEnabled()&&t.ui.view&&(t.ui.focusTracker.on("change:isFocused",((t,e,n)=>{this._updateLastFocusedEditableElement(),n?this._showBalloon():this._hideBalloon()})),t.ui.focusTracker.on("change:focusedElement",((t,e,n)=>{this._updateLastFocusedEditableElement(),n&&this._showBalloon()})),t.ui.on("update",(()=>{this._showBalloonThrottled()})))}_getNormalizedConfig(){return{side:"ltr"===this.editor.locale.contentLanguageDirection?"right":"left",position:"border",verticalOffset:0,horizontalOffset:5}}_showBalloon(){const t=this._getBalloonAttachOptions();t&&(this._balloonView||(this._balloonView=this._createBalloonView()),this._balloonView.pin(t))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_createBalloonView(){const t=this.editor,e=new Ig,n=this._createBadgeContent();return e.content.add(n),this._balloonClass&&(e.class=this._balloonClass),t.ui.view.body.add(e),e}_getBalloonAttachOptions(){if(!this._lastFocusedEditableElement)return null;const t=this._getNormalizedConfig(),e="right"===t.side?af(this._lastFocusedEditableElement,n=t,((t,e)=>t.left+t.width-e.width-n.horizontalOffset)):function(t,e){return af(t,e,(t=>t.left+e.horizontalOffset))}(this._lastFocusedEditableElement,t);var n;return{target:this._lastFocusedEditableElement,positions:[e]}}_updateLastFocusedEditableElement(){const t=this.editor,e=t.ui.focusTracker.isFocused,n=t.ui.focusTracker.focusedElement;if(!e||!n)return void(this._lastFocusedEditableElement=null);const i=Array.from(t.ui.getEditableElementsNames()).map((e=>t.ui.getEditableElement(e)));i.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=i[0]}}function af(t,e,n){return(i,o)=>{const r=new oi(t);if(r.width<350||r.height<50)return null;let s;s="inside"===e.position?r.bottom-o.height:r.bottom-o.height/2,s-=e.verticalOffset;const a=n(r,o),c=i.clone().moveTo(a,s).getIntersection(o.clone().moveTo(a,s)).getVisible();return!c||c.getArea()\n',isColorInherited:!1}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/powered-by-ckeditor/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...e?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[e]}]:[],n],on:{dragstart:i.to((t=>t.preventDefault()))}}]})}}class df extends sf{constructor(t){super(t,{balloonClass:"ck-evaluation-badge-balloon"}),this.licenseTypeMessage={evaluation:"For evaluation purposes only",trial:"For evaluation purposes only",development:"For development purposes only"}}_isEnabled(){const t=hf(this.editor.config.get("licenseKey"));return Boolean(t&&this.licenseTypeMessage[t])}_createBadgeContent(){const t=hf(this.editor.config.get("licenseKey"));return new uf(this.editor.locale,this.licenseTypeMessage[t])}_getNormalizedConfig(){const t=super._getNormalizedConfig(),e=this.editor.config.get("ui.poweredBy")||{};return{position:e.position||t.position,side:"left"===(e.side||t.side)?"right":"left",verticalOffset:t.verticalOffset,horizontalOffset:t.horizontalOffset}}}class uf extends er{constructor(t,e){super(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-evaluation-badge"],"aria-hidden":!0},children:[{tag:"span",attributes:{class:["ck","ck-evaluation-badge__label"]},children:[e]}]})}}function hf(t){if("GPL"==t)return"GPL";const e=po(t.split(".")[1]);return e?e.licenseType||"production":null}var mf=o(1710),gf={attributes:{"data-cke":!0}};gf.setAttributes=Qo(),gf.insert=Ko().bind(null,"head"),gf.domAPI=qo(),gf.insertStyleElement=Jo(),Wo()(mf.A,gf),mf.A&&mf.A.locals&&mf.A.locals;const pf={POLITE:"polite",ASSERTIVE:"assertive"};class ff{constructor(t){this.editor=t,t.once("ready",(()=>{for(const t of Object.values(pf))this.announce("",t)}))}announce(t,e=pf.POLITE){const n=this.editor;if(!n.ui.view)return;this.view||(this.view=new kf(n.locale),n.ui.view.body.add(this.view));const{politeness:i,isUnsafeHTML:o}="string"==typeof e?{politeness:e}:e;let r=this.view.regionViews.find((t=>t.politeness===i));r||(r=new bf(n,i),this.view.regionViews.add(r)),r.announce({announcement:t,isUnsafeHTML:o})}}class kf extends er{constructor(t){super(t),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class bf extends er{constructor(t,e){super(t.locale),this.setTemplate({tag:"div",attributes:{"aria-live":e,"aria-relevant":"additions"},children:[{tag:"ul",attributes:{class:["ck","ck-aria-live-region-list"]}}]}),t.on("destroy",(()=>{null!==this._pruneAnnouncementsInterval&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)})),this.politeness=e,this._domConverter=t.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval((()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()}),5e3)}announce({announcement:t,isUnsafeHTML:e}){if(!t.trim().length)return;const n=document.createElement("li");e?this._domConverter.setContentOf(n,t):n.innerText=t,this._listElement.appendChild(n)}get _listElement(){return this.element.querySelector("ul")}}var wf=o(1214),_f={attributes:{"data-cke":!0}};_f.setAttributes=Qo(),_f.insert=Ko().bind(null,"head"),_f.domAPI=qo(),_f.insertStyleElement=Jo(),Wo()(wf.A,_f),wf.A&&wf.A.locals&&wf.A.locals;class Af extends mg{constructor(t,e){super(t);const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:n.to("mouseenter")}}),this.delegate("mouseenter").to(e)}}const Cf={toggleMenusAndFocusItemsOnHover(t){t.on("menu:mouseenter",(e=>{if(t.isFocusBorderEnabled||t.isOpen){if(t.isOpen)for(const n of t.menus){const t=e.path[0],i=t instanceof Af&&t.children.first===n;n.isOpen=(e.path.includes(n)||i)&&n.isEnabled}e.source.focus()}}))},focusCycleMenusOnArrows(t){const e="rtl"===t.locale.uiLanguageDirection;function n(e,n){const i=t.children.getIndex(e),o=e.isOpen,r=t.children.length,s=t.children.get((i+r+n)%r);e.isOpen=!1,o&&(s.isOpen=!0),s.buttonView.focus()}t.on("menu:arrowright",(t=>{n(t.source,e?-1:1)})),t.on("menu:arrowleft",(t=>{n(t.source,e?1:-1)}))},closeMenusWhenTheBarCloses(t){t.on("change:isOpen",(()=>{t.isOpen||t.menus.forEach((t=>{t.isOpen=!1}))}))},closeMenuWhenAnotherOnTheSameLevelOpens(t){t.on("menu:change:isOpen",((e,n,i)=>{i&&t.menus.filter((t=>e.source.parentMenuView===t.parentMenuView&&e.source!==t&&t.isOpen)).forEach((t=>{t.isOpen=!1}))}))},closeOnClickOutside(t){nr({emitter:t,activator:()=>t.isOpen,callback:()=>t.close(),contextElements:()=>t.children.map((t=>t.element))})},enableFocusHighlightOnInteraction(t){let e=!1;t.on("change:isOpen",((n,i,o)=>{o||(e||(t.isFocusBorderEnabled=!1),e=!1)})),t.listenTo(t.element,"keydown",(()=>{e=!0}),{useCapture:!0}),t.listenTo(t.element,"keyup",(()=>{e=!1}),{useCapture:!0}),t.listenTo(t.element,"focus",(()=>{e&&(t.isFocusBorderEnabled=!0)}),{useCapture:!0})}},vf={openAndFocusPanelOnArrowDownKey(t){t.keystrokes.set("arrowdown",((e,n)=>{t.focusTracker.focusedElement===t.buttonView.element&&(t.isOpen||(t.isOpen=!0),t.panelView.focus(),n())}))},openOnArrowRightKey(t){const e="rtl"===t.locale.uiLanguageDirection?"arrowleft":"arrowright";t.keystrokes.set(e,((e,n)=>{t.focusTracker.focusedElement===t.buttonView.element&&t.isEnabled&&(t.isOpen||(t.isOpen=!0),t.panelView.focus(),n())}))},openOnButtonClick(t){t.buttonView.on("execute",(()=>{t.isOpen=!0}))},toggleOnButtonClick(t){t.buttonView.on("execute",(()=>{t.isOpen=!t.isOpen}))},openAndFocusOnEnterKeyPress(t){t.keystrokes.set("enter",((e,n)=>{t.focusTracker.focusedElement===t.buttonView.element&&(t.isOpen=!0,t.panelView.focus(),n())}))},closeOnArrowLeftKey(t){const e="rtl"===t.locale.uiLanguageDirection?"arrowright":"arrowleft";t.keystrokes.set(e,((e,n)=>{t.isOpen&&(t.isOpen=!1,t.focus(),n())}))},closeOnEscKey(t){t.keystrokes.set("esc",((e,n)=>{t.isOpen&&(t.isOpen=!1,t.focus(),n())}))},closeOnParentClose(t){t.parentMenuView.on("change:isOpen",((e,n,i)=>{i||e.source!==t.parentMenuView||(t.isOpen=!1)}))}},yf={southEast:t=>({top:t.bottom,left:t.left,name:"se"}),southWest:(t,e)=>({top:t.bottom,left:t.left-e.width+t.width,name:"sw"}),northEast:(t,e)=>({top:t.top-e.height,left:t.left,name:"ne"}),northWest:(t,e)=>({top:t.top-e.height,left:t.left-e.width+t.width,name:"nw"}),eastSouth:t=>({top:t.top,left:t.right-5,name:"es"}),eastNorth:(t,e)=>({top:t.top-e.height,left:t.right-5,name:"en"}),westSouth:(t,e)=>({top:t.top,left:t.left-e.width+5,name:"ws"}),westNorth:(t,e)=>({top:t.top-e.height,left:t.left-e.width+5,name:"wn"})},xf=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditingEnhanced",items:["menuBar:sourceEditingEnhanced"]},{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:bookmark","menuBar:comment","menuBar:insertMergeField","menuBar:emoji"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function Ef({normalizedConfig:t,locale:e,componentFactory:n,extraItems:i}){const o=fc(t);return Df(t,o,i),function(t,e){const n=e.removeItems,i=[];e.items=e.items.filter((({menuId:t})=>!n.includes(t)||(i.push(t),!1))),Bf(e.items,(t=>{t.groups=t.groups.filter((({groupId:t})=>!n.includes(t)||(i.push(t),!1)));for(const e of t.groups)e.items=e.items.filter((t=>{const e=Nf(t);return!n.includes(e)||(i.push(e),!1)}))}));for(const e of n)i.includes(e)||T("menu-bar-item-could-not-be-removed",{menuBarConfig:t,itemName:e})}(t,o),Df(t,o,o.addItems),function(t,e,n){Bf(e.items,(i=>{for(const o of i.groups)o.items=o.items.filter((o=>{const r="string"==typeof o&&!n.has(o);return r&&!e.isUsingDefaultConfig&&T("menu-bar-item-unavailable",{menuBarConfig:t,parentMenuConfig:fc(i),componentName:o}),!r}))}))}(t,o,n),If(t,o),function(t,e){const n=e.t,i={File:n({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:n({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:n({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:n({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:n({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:n({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:n({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:n({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:n({string:"Font",id:"MENU_BAR_MENU_FONT"})};Bf(t.items,(t=>{t.label in i&&(t.label=i[t.label])}))}(o,e),o}function Df(t,e,n){const i=[];if(0!=n.length){for(const t of n){const n=(r=t.position).startsWith("start")?"start":r.startsWith("end")?"end":r.startsWith("after")?"after":"before",s=Pf(t.position);if("object"==typeof(o=t)&&"menu"in o)if(s){const o=e.items.findIndex((t=>t.menuId===s));-1!=o?"before"===n?(e.items.splice(o,0,t.menu),i.push(t)):"after"===n&&(e.items.splice(o+1,0,t.menu),i.push(t)):Sf(e,t.menu,s,n)&&i.push(t)}else"start"===n?(e.items.unshift(t.menu),i.push(t)):"end"===n&&(e.items.push(t.menu),i.push(t));else Mf(t)?Bf(e.items,(e=>{if(e.menuId===s)"start"===n?(e.groups.unshift(t.group),i.push(t)):"end"===n&&(e.groups.push(t.group),i.push(t));else{const o=e.groups.findIndex((t=>t.groupId===s));-1!==o&&("before"===n?(e.groups.splice(o,0,t.group),i.push(t)):"after"===n&&(e.groups.splice(o+1,0,t.group),i.push(t)))}})):Sf(e,t.item,s,n)&&i.push(t)}var o;for(const e of n)i.includes(e)||T("menu-bar-item-could-not-be-added",{menuBarConfig:t,addedItemConfig:e})}var r}function Sf(t,e,n,i){let o=!1;return Bf(t.items,(t=>{for(const{groupId:r,items:s}of t.groups){if(o)return;if(r===n)"start"===i?(s.unshift(e),o=!0):"end"===i&&(s.push(e),o=!0);else{const t=s.findIndex((t=>Nf(t)===n));-1!==t&&("before"===i?(s.splice(t,0,e),o=!0):"after"===i&&(s.splice(t+1,0,e),o=!0))}}})),o}function If(t,e){const n=e.isUsingDefaultConfig;let i=!1;e.items=e.items.filter((e=>!!e.groups.length||(Tf(t,e,n),!1))),e.items.length?(Bf(e.items,(e=>{e.groups=e.groups.filter((t=>!!t.items.length||(i=!0,!1)));for(const o of e.groups)o.items=o.items.filter((e=>!(Lf(e)&&!e.groups.length&&(Tf(t,e,n),i=!0,1))))})),i&&If(t,e)):Tf(t,t,n)}function Tf(t,e,n){n||T("menu-bar-menu-empty",{menuBarConfig:t,emptyMenuConfig:e})}function Bf(t,e){if(Array.isArray(t))for(const e of t)n(e);function n(t){e(t);for(const e of t.groups)for(const t of e.items)Lf(t)&&n(t)}}function Mf(t){return"object"==typeof t&&"group"in t}function Pf(t){const e=t.match(/^[^:]+:(.+)/);return e?e[1]:null}function Nf(t){return"string"==typeof t?t:t.menuId}function Lf(t){return"object"==typeof t&&"menuId"in t}class zf extends(J()){constructor(t){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this._extraMenuBarElements=[],this._lastFocusedForeignElement=null;const e=t.editing.view;this.editor=t,this.componentFactory=new Qp(t),this.focusTracker=new so,this.tooltipManager=new nf(t),this.poweredBy=new cf(t),this.evaluationBadge=new df(t),this.ariaLiveAnnouncer=new ff(t),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",(()=>{this._bindBodyCollectionWithFocusTracker(),this.isReady=!0})),this.listenTo(e.document,"layoutChanged",this.update.bind(this)),this.listenTo(e,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy(),this.evaluationBadge.destroy();for(const t of this._editableElementsMap.values())t.ckeditorInstance=null,this.editor.keystrokes.stopListening(t);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(t,e){this._editableElementsMap.set(t,e),e.ckeditorInstance||(e.ckeditorInstance=this.editor),this.focusTracker.add(e);const n=()=>{this.editor.editing.view.getDomRoot(t)||this.editor.keystrokes.listenTo(e)};this.isReady?n():this.once("ready",n)}removeEditableElement(t){const e=this._editableElementsMap.get(t);e&&(this._editableElementsMap.delete(t),this.editor.keystrokes.stopListening(e),this.focusTracker.remove(e),e.ckeditorInstance=null)}getEditableElement(t="main"){return this._editableElementsMap.get(t)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(t,e={}){t.isRendered?(this.focusTracker.add(t),this.editor.keystrokes.listenTo(t.element)):t.once("render",(()=>{this.focusTracker.add(t),this.editor.keystrokes.listenTo(t.element)})),this._focusableToolbarDefinitions.push({toolbarView:t,options:e})}extendMenuBar(t){this._extraMenuBarElements.push(t)}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_initMenuBar(t){const e=t.element;this.focusTracker.add(e),this.editor.keystrokes.listenTo(e);const n=function(t){let e;return e="items"in t&&t.items?{items:t.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...t}:{items:fc(xf),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...t},e}(this.editor.config.get("menuBar")||{});t.fillFromConfig(n,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",((t,n)=>{e.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),n())})),this.editor.keystrokes.set("Alt+F9",((n,i)=>{e.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),t.isFocusBorderEnabled=!0,t.focus(),i())}))}_readViewportOffsetFromConfig(){const t=this.editor,e=t.config.get("ui.viewportOffset");if(e)return e;const n=t.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){const t=this.editor;let e;t.keystrokes.set("Alt+F10",((t,n)=>{this._saveLastFocusedForeignElement();const i=this._getCurrentFocusedToolbarDefinition();i&&e||(e=this._getFocusableCandidateToolbarDefinitions());for(let t=0;t{const i=this._getCurrentFocusedToolbarDefinition();i&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):t.editing.view.focus(),i.options.afterBlur&&i.options.afterBlur(),n())}))}_saveLastFocusedForeignElement(){const t=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(t)&&!Array.from(this.editor.editing.view.domRoots.values()).includes(t)&&(this._lastFocusedForeignElement=t)}_getFocusableCandidateToolbarDefinitions(){const t=[];for(const e of this._focusableToolbarDefinitions){const{toolbarView:n,options:i}=e;(fi(n.element)||i.beforeFocus)&&t.push(e)}return t.sort(((t,e)=>Of(t)-Of(e))),t}_getCurrentFocusedToolbarDefinition(){for(const t of this._focusableToolbarDefinitions)if(t.toolbarView.element&&t.toolbarView.element.contains(this.focusTracker.focusedElement))return t;return null}_focusFocusableCandidateToolbar(t){const{toolbarView:e,options:{beforeFocus:n}}=t;return n&&n(),!!fi(e.element)&&(e.focus(),!0)}_handleScrollToTheSelection(t,e){const n={top:0,bottom:0,left:0,right:0,...this.viewportOffset};e.viewportOffset.top+=n.top,e.viewportOffset.bottom+=n.bottom,e.viewportOffset.left+=n.left,e.viewportOffset.right+=n.right}_bindBodyCollectionWithFocusTracker(){const t=this.view.body;for(const e of t)this.focusTracker.add(e.element);t.on("add",((t,e)=>{this.focusTracker.add(e.element)})),t.on("remove",((t,e)=>{this.focusTracker.remove(e.element)}))}}function Of(t){const{toolbarView:e,options:n}=t;let i=10;return fi(e.element)&&i--,n.isContextual&&i--,i}var Vf=o(178),Ff={attributes:{"data-cke":!0}};Ff.setAttributes=Qo(),Ff.insert=Ko().bind(null,"head"),Ff.domAPI=qo(),Ff.insertStyleElement=Jo(),Wo()(Vf.A,Ff),Vf.A&&Vf.A.locals&&Vf.A.locals;class Rf extends er{constructor(t){super(t),this.body=new wm(t)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class jf extends Rf{constructor(t){super(t),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:t.uiLanguageDirection,lang:t.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const t=this.t,e=new hm;return e.text=t("Rich Text Editor"),e.extendTemplate({attributes:{class:"ck-voice-label"}}),e}}class Hf extends er{constructor(t,e,n){super(t),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:t.contentLanguage,dir:t.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=e}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",(()=>this._updateIsFocusedClasses())),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const t=this._editingView;function e(e){t.change((n=>{const i=t.document.getRoot(e.name);n.addClass(e.isFocused?"ck-focused":"ck-blurred",i),n.removeClass(e.isFocused?"ck-blurred":"ck-focused",i)}))}t.isRenderingInProgress?function n(i){t.once("change:isRenderingInProgress",((t,o,r)=>{r?n(i):e(i)}))}(this):e(this)}}class Uf extends Hf{constructor(t,e,n,i={}){super(t,e,n),this._options=i,this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const t=this._editingView;t.change((e=>{const n=t.document.getRoot(this.name);e.setAttribute("aria-label",this.getEditableAriaLabel(),n)}))}getEditableAriaLabel(){const t=this.locale.t,e=this._options.label,n=this._editableElement,i=this.name;if("string"==typeof e)return e;if("object"==typeof e)return e[i];if("function"==typeof e)return e(this);if(n){const t=n.getAttribute("aria-label");if(t)return t}return t("Rich Text Editor. Editing area: %0",i)}}class Wf extends mr{static get pluginName(){return"Notification"}static get isOfficialPlugin(){return!0}init(){this.on("show:warning",((t,e)=>{window.alert(e.message)}),{priority:"lowest"})}showSuccess(t,e={}){this._showNotification({message:t,type:"success",namespace:e.namespace,title:e.title})}showInfo(t,e={}){this._showNotification({message:t,type:"info",namespace:e.namespace,title:e.title})}showWarning(t,e={}){this._showNotification({message:t,type:"warning",namespace:e.namespace,title:e.title})}_showNotification(t){const e=t.namespace?`show:${t.type}:${t.namespace}`:`show:${t.type}`;this.fire(e,{message:t.message,type:t.type,title:t.title||""})}}class Gf extends(J()){constructor(t,e){super(),e&&Da(this,e),t&&this.set(t)}}var qf=o(9938),$f={attributes:{"data-cke":!0}};$f.setAttributes=Qo(),$f.insert=Ko().bind(null,"head"),$f.domAPI=qo(),$f.insertStyleElement=Jo(),Wo()(qf.A,$f),qf.A&&qf.A.locals&&qf.A.locals;var Kf=o(3579),Yf={attributes:{"data-cke":!0}};Yf.setAttributes=Qo(),Yf.insert=Ko().bind(null,"head"),Yf.domAPI=qo(),Yf.insertStyleElement=Jo(),Wo()(Kf.A,Yf),Kf.A&&Kf.A.locals&&Kf.A.locals;const Qf=hi("px");class Zf extends sr{static get pluginName(){return"ContextualBalloon"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,e=t.document.selection.editableElement;return e?t.domConverter.mapViewToDom(e.root):null},this.decorate("getPositionOptions"),this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(t){return Array.from(this._viewToStack.keys()).includes(t)}add(t){if(this._view||this._createPanelView(),this.hasView(t.view))throw new I("contextualballoon-add-view-exist",[this,t]);const e=t.stackId||"main";if(!this._idToStack.has(e))return this._idToStack.set(e,new Map([[t.view,t]])),this._viewToStack.set(t.view,this._idToStack.get(e)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!t.singleViewMode||this.showStack(e));const n=this._idToStack.get(e);t.singleViewMode&&this.showStack(e),n.set(t.view,t),this._viewToStack.set(t.view,n),n===this._visibleStack&&this._showView(t)}remove(t){if(!this.hasView(t))throw new I("contextualballoon-remove-view-not-exist",[this,t]);const e=this._viewToStack.get(t);this._singleViewMode&&this.visibleView===t&&(this._singleViewMode=!1),this.visibleView===t&&(1===e.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(e.values())[e.size-2])),1===e.size?(this._idToStack.delete(this._getStackId(e)),this._numberOfStacks=this._idToStack.size):e.delete(t),this._viewToStack.delete(t)}updatePosition(t){t&&(this._visibleStack.get(this.visibleView).position=t),this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition()}getPositionOptions(){let t=Array.from(this._visibleStack.values()).pop().position;return t&&(t.limiter||(t=Object.assign({},t,{limiter:this.positionLimiter})),t=Object.assign({},t,{viewportOffsetConfig:this.editor.ui.viewportOffset})),t}showStack(t){this.visibleStack=t;const e=this._idToStack.get(t);if(!e)throw new I("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==e&&this._showView(Array.from(e.values()).pop())}_createPanelView(){this._view=new Ig(this.editor.locale),this.editor.ui.view.body.add(this._view),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(t){return Array.from(this._idToStack.entries()).find((e=>e[1]===t))[0]}_showNextStack(){const t=Array.from(this._idToStack.values());let e=t.indexOf(this._visibleStack)+1;t[e]||(e=0),this.showStack(this._getStackId(t[e]))}_showPrevStack(){const t=Array.from(this._idToStack.values());let e=t.indexOf(this._visibleStack)-1;t[e]||(e=t.length-1),this.showStack(this._getStackId(t[e]))}_createRotatorView(){const t=new Jf(this.editor.locale),e=this.editor.locale.t;return this.view.content.add(t),t.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",((t,e)=>!e&&t>1)),t.on("change:isNavigationVisible",(()=>this.updatePosition()),{priority:"low"}),t.bind("counter").to(this,"visibleView",this,"_numberOfStacks",((t,n)=>{if(n<2)return"";const i=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return e("%0 of %1",[i,n])})),t.buttonNextView.on("execute",(()=>{t.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()})),t.buttonPrevView.on("execute",(()=>{t.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()})),t}_createFakePanelsView(){const t=new Xf(this.editor.locale,this.view);return t.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",((t,e)=>!e&&t>=2?Math.min(t-1,2):0)),t.listenTo(this.view,"change:top",(()=>t.updatePosition())),t.listenTo(this.view,"change:left",(()=>t.updatePosition())),this.editor.ui.view.body.add(t),t}_showView({view:t,balloonClassName:e="",withArrow:n=!0,singleViewMode:i=!1}){this.view.class=e,this.view.withArrow=n,this._rotatorView.showView(t),this.visibleView=t,this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition(),i&&(this._singleViewMode=!0)}}class Jf extends er{constructor(t){super(t);const e=t.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new so,this.buttonPrevView=this._createButtonView(e("Previous"),Dh.previousArrow),this.buttonNextView=this._createButtonView(e("Next"),Dh.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",n.to("isNavigationVisible",(t=>t?"":"ck-hidden"))]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(t){this.hideView(),this.content.add(t)}hideView(){this.content.clear()}_createButtonView(t,e){const n=new Lh(this.locale);return n.set({label:t,icon:e,tooltip:!0}),n}}class Xf extends er{constructor(t,e){super(t);const n=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=e,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",(t=>t?"":"ck-hidden"))],style:{top:n.to("top",Qf),left:n.to("left",Qf),width:n.to("width",Qf),height:n.to("height",Qf)}},children:this.content}),this.on("change:numberOfPanels",((t,e,n,i)=>{n>i?this._addPanels(n-i):this._removePanels(i-n),this.updatePosition()}))}_addPanels(t){for(;t--;){const t=new er;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(t){for(;t--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:t,left:e}=this._balloonPanelView,{width:n,height:i}=new oi(this._balloonPanelView.element);Object.assign(this,{top:t,left:e,width:n,height:i})}}}var tk=o(7289),ek={attributes:{"data-cke":!0}};ek.setAttributes=Qo(),ek.insert=Ko().bind(null,"head"),ek.domAPI=qo(),ek.insertStyleElement=Jo(),Wo()(tk.A,ek),tk.A&&tk.A.locals&&tk.A.locals;const nk=hi("px");class ik extends er{constructor(t){super(t);const e=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new Co({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:e.to("isSticky",(t=>t?"block":"none")),height:e.to("isSticky",(t=>t?nk(this._contentPanelRect.height):null))}}}).render(),this.contentPanelElement=new Co({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",e.if("isSticky","ck-sticky-panel__content_sticky"),e.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:e.to("isSticky",(t=>t?nk(this._contentPanelPlaceholder.getBoundingClientRect().width):null)),top:e.to("_stickyTopOffset",(t=>t?nk(t):t)),bottom:e.to("_stickyBottomOffset",(t=>t?nk(t):t)),marginLeft:e.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this.contentPanelElement]})}render(){super.render(),this.checkIfShouldBeSticky(),this.listenTo(a.document,"scroll",(()=>{this.checkIfShouldBeSticky()}),{useCapture:!0}),this.listenTo(this,"change:isActive",(()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive)return void this._unstick();const t=new oi(this.limiterElement);let e=t.getVisible();if(e){const t=new oi(a.window);t.top+=this.viewportTopOffset,t.height-=this.viewportTopOffset,e=e.getIntersection(t)}if(e&&t.tope.bottom){const n=Math.max(t.bottom-e.bottom,0)+this.limiterBottomOffset;t.bottom-n>t.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(n):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset{this.reset(),this.focus(),this.fire("reset")})),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",(t=>!t)),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}))}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=!1)}}class rk extends er{constructor(){super();const t=this.bindTemplate;this.set({isVisible:!1,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",t.if("isVisible","ck-hidden",(t=>!t))],tabindex:-1},children:[{tag:"span",children:[{text:[t.to("primaryText")]}]},{tag:"span",children:[{text:[t.to("secondaryText")]}]}]})}focus(){this.element.focus()}}class sk extends er{constructor(t){super(t),this.children=this.createCollection(),this.focusTracker=new so,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new Rh({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(const t of this.children)this.focusTracker.add(t.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}var ak=/[\\^$.*+?()[\]{}|]/g,ck=RegExp(ak.source);const lk=function(t){return(t=Sr(t))&&ck.test(t)?t.replace(ak,"\\$&"):t};var dk=o(5540),uk={attributes:{"data-cke":!0}};uk.setAttributes=Qo(),uk.insert=Ko().bind(null,"head"),uk.domAPI=qo(),uk.insertStyleElement=Jo(),Wo()(dk.A,uk),dk.A&&dk.A.locals&&dk.A.locals;class hk extends er{constructor(t,e){super(t),this._config=e,this.filteredView=e.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new so,this.keystrokes=new uo,this.resultsView=new sk(t),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set("isEnabled",!0),this.set("resultsCount",0),this.set("totalItemsCount",0),e.infoView&&e.infoView.instance?this.infoView=e.infoView.instance:(this.infoView=new rk,this._enableDefaultInfoViewBehavior(),this.on("render",(()=>{this.search("")}))),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new Rh({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",((t,{resultsCount:e,totalItemsCount:n})=>{this.resultsCount=e,this.totalItemsCount=n})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",e.class||null],tabindex:"-1"},children:this.children})}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const t=t=>t.stopPropagation();for(const t of this.focusableChildren)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}focus(){this.queryView.focus()}reset(){this.queryView.reset(),this.search(""),this.filteredView.element.scrollTo(0,0)}search(t){const e=t?new RegExp(lk(t),"ig"):null,n=this.filteredView.filter(e);this.fire("search",{query:t,...n})}_createSearchTextQueryView(){const t=new ok(this.locale,this._config.queryView);return this.listenTo(t.fieldView,"input",(()=>{this.search(t.fieldView.element.value)})),t.on("reset",(()=>this.reset())),t.bind("isEnabled").to(this),t}_enableDefaultInfoViewBehavior(){const t=this.locale.t,e=this.infoView;function n(t,{query:e,resultsCount:n,totalItemsCount:i}){return"function"==typeof t?t(e,n,i):t}this.on("search",((i,o)=>{if(o.resultsCount)e.set({isVisible:!1});else{const i=this._config.infoView&&this._config.infoView.text;let r,s;o.totalItemsCount?i&&i.notFound?(r=i.notFound.primary,s=i.notFound.secondary):(r=t("No results found"),s=""):i&&i.noSearchableItems?(r=i.noSearchableItems.primary,s=i.noSearchableItems.secondary):(r=t("No searchable items"),s=""),e.set({primaryText:n(r,o),secondaryText:n(s,o),isVisible:!0})}}))}}var mk=o(2688),gk={attributes:{"data-cke":!0}};gk.setAttributes=Qo(),gk.insert=Ko().bind(null,"head"),gk.domAPI=qo(),gk.insertStyleElement=Jo(),Wo()(mk.A,gk),mk.A&&mk.A.locals&&mk.A.locals;class pk extends hk{constructor(t,e){super(t,e),this._config=e;const n=hi("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const i=this.resultsView.bindTemplate;this.resultsView.set("isVisible",!1),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[i.if("isVisible","ck-hidden",(t=>!t)),i.to("_position",(t=>`ck-search__results_${t}`))],style:{width:i.to("_width",n)}}}),this.focusTracker.on("change:isFocused",((t,n,i)=>{this._updateResultsVisibility(),i?this.resultsView.element.scrollTop=0:e.resetOnBlur&&this.queryView.reset()})),this.on("search",(()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition()})),this.keystrokes.set("esc",((t,e)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=!1,e())})),this.listenTo(a.document,"scroll",(()=>{this._updateResultsViewWidthAndPosition()})),this.on("change:isEnabled",(()=>{this._updateResultsVisibility()})),this.filteredView.on("execute",((t,{value:e})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=e,this.resultsView.isVisible=!1})),this.resultsView.on("change:isVisible",(()=>{this._updateResultsViewWidthAndPosition()}))}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new oi(this.queryView.fieldView.element).width;const t=pk._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:pk.defaultResultsPositions});this.resultsView._position=t?t.name:"s"}_updateResultsVisibility(){const t=void 0===this._config.queryMinChars?0:this._config.queryMinChars,e=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&e>=t}}pk.defaultResultsPositions=[t=>({top:t.bottom,left:t.left,name:"s"}),(t,e)=>({top:t.top-e.height,left:t.left,name:"n"})],pk._getOptimalPosition=ki;RegExp(/[&<>"']/g.source);var fk=o(1998),kk={attributes:{"data-cke":!0}};kk.setAttributes=Qo(),kk.insert=Ko().bind(null,"head"),kk.domAPI=qo(),kk.insertStyleElement=Jo(),Wo()(fk.A,kk),fk.A&&fk.A.locals&&fk.A.locals;var bk=o(5706),wk={attributes:{"data-cke":!0}};wk.setAttributes=Qo(),wk.insert=Ko().bind(null,"head"),wk.domAPI=qo(),wk.insertStyleElement=Jo(),Wo()(bk.A,wk),bk.A&&bk.A.locals&&bk.A.locals;const _k=hi("px");class Ak extends sr{static get pluginName(){return"BalloonToolbar"}static get isOfficialPlugin(){return!0}static get requires(){return[Zf]}constructor(t){super(t),this._resizeObserver=null,this._balloonConfig=Fg(t.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new so,this._trackFocusableEditableElements(),this.focusTracker.add(this.toolbarView),t.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this.show(!0),afterBlur:()=>this.hide(),isContextual:!0}),this._balloon=t.plugins.get(Zf),this._fireSelectionChangeDebounced=Ha((()=>this.fire("_selectionChangeDebounced")),200),this.decorate("show")}init(){const t=this.editor,e=t.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",((t,e,n)=>{const i=this._balloon.visibleView===this.toolbarView;!n&&i?this.hide():n&&this.show()})),this.listenTo(e,"change:range",((t,n)=>{(n.directChange||e.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()})),this.listenTo(this,"_selectionChangeDebounced",(()=>{this.editor.editing.view.document.isFocused&&this.show()})),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(t,"ready",(()=>{const e=t.ui.view.editable.element;this._resizeObserver=new di(e,(t=>{this.toolbarView.maxWidth=_k(.9*t.contentRect.width)}))})),this.listenTo(this.toolbarView,"groupedItemsUpdate",(()=>{this._updatePosition()})),t.ui.once("ready",(()=>{this.toolbarView.fillFromConfig(this._balloonConfig,this.editor.ui.componentFactory)}))}_createToolbarView(){const t=this.editor.locale.t,e=!this._balloonConfig.shouldNotGroupWhenFull,n=new Ug(this.editor.locale,{shouldGroupWhenFull:e,isFloating:!0});return n.ariaLabel=t("Editor contextual toolbar"),n.render(),n}show(t=!1){const e=this.editor,n=e.model.document.selection,i=e.model.schema;this._balloon.hasView(this.toolbarView)||n.isCollapsed&&!t||function(t,e){return 1!==t.rangeCount&&[...t.getRanges()].every((t=>{const n=t.getContainedElement();return n&&e.isSelectable(n)}))}(n,i)||Array.from(this.toolbarView.items).every((t=>void 0!==t.isEnabled&&!t.isEnabled))||(this.listenTo(this.editor.ui,"update",(()=>{this._updatePosition()})),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_trackFocusableEditableElements(){const{editor:t,focusTracker:e}=this,{editing:n}=t;n.view.addObserver(class extends xa{observe(t){e.add(t)}stopObserving(t){e.remove(t)}})}_getBalloonPositionData(){const t=this.editor.editing.view,e=t.document,n=e.selection,i=e.selection.isBackward;return{target:()=>{const e=i?n.getFirstRange():n.getLastRange(),o=oi.getDomRangeRects(t.domConverter.viewRangeToDom(e));return i?o[0]:(o.length>1&&0===o[o.length-1].width&&o.pop(),o[o.length-1])},positions:this._getBalloonPositions(i)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getBalloonPositions(t){const e=d.isSafari&&d.isiOS?Ig.generatePositions({heightOffset:Math.max(Ig.arrowHeightOffset,Math.round(20/a.window.visualViewport.scale))}):Ig.defaultPositions;return t?[e.northWestArrowSouth,e.northWestArrowSouthWest,e.northWestArrowSouthEast,e.northWestArrowSouthMiddleEast,e.northWestArrowSouthMiddleWest,e.southWestArrowNorth,e.southWestArrowNorthWest,e.southWestArrowNorthEast,e.southWestArrowNorthMiddleWest,e.southWestArrowNorthMiddleEast]:[e.southEastArrowNorth,e.southEastArrowNorthEast,e.southEastArrowNorthWest,e.southEastArrowNorthMiddleEast,e.southEastArrowNorthMiddleWest,e.northEastArrowSouth,e.northEastArrowSouthEast,e.northEastArrowSouthWest,e.northEastArrowSouthMiddleEast,e.northEastArrowSouthMiddleWest]}}var Ck=o(9939),vk={attributes:{"data-cke":!0}};vk.setAttributes=Qo(),vk.insert=Ko().bind(null,"head"),vk.domAPI=qo(),vk.insertStyleElement=Jo(),Wo()(Ck.A,vk),Ck.A&&Ck.A.locals&&Ck.A.locals;var yk=o(5667),xk={attributes:{"data-cke":!0}};xk.setAttributes=Qo(),xk.insert=Ko().bind(null,"head"),xk.domAPI=qo(),xk.insertStyleElement=Jo(),Wo()(yk.A,xk),yk.A&&yk.A.locals&&yk.A.locals;class Ek extends rm{constructor(t){super(t);const e=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(t=>String(t))),"data-cke-tooltip-disabled":e.to("isOn")},on:{mouseenter:e.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const t=new Bh;return t.content=Dm,t.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),t}}var Dk=o(4873),Sk={attributes:{"data-cke":!0}};Sk.setAttributes=Qo(),Sk.insert=Ko().bind(null,"head"),Sk.domAPI=qo(),Sk.insertStyleElement=Jo(),Wo()(Dk.A,Sk),Dk.A&&Dk.A.locals&&Dk.A.locals;class Ik extends er{constructor(t){super(t);const e=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-menu-bar__menu__panel",e.to("position",(t=>`ck-menu-bar__menu__panel_position_${t}`)),e.if("isVisible","ck-hidden",(t=>!t))],tabindex:"-1"},children:this.children,on:{selectstart:e.to((t=>{"input"!==t.target.tagName.toLocaleLowerCase()&&t.preventDefault()}))}})}focus(t=1){this.children.length&&(1===t?this.children.first.focus():this.children.last.focus())}}var Tk=o(55),Bk={attributes:{"data-cke":!0}};Bk.setAttributes=Qo(),Bk.insert=Ko().bind(null,"head"),Bk.domAPI=qo(),Bk.insertStyleElement=Jo(),Wo()(Tk.A,Bk),Tk.A&&Tk.A.locals&&Tk.A.locals;class Mk extends er{constructor(t){super(t);const e=this.bindTemplate;this.buttonView=new Ek(t),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new Ik(t),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new uo,this.focusTracker=new so,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("panelPosition","w"),this.set("class",void 0),this.set("parentMenuView",null),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar__menu",e.to("class"),e.if("isEnabled","ck-disabled",(t=>!t)),e.if("parentMenuView","ck-menu-bar__menu_top-level",(t=>!t))]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),vf.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(vf.openOnButtonClick(this),vf.openOnArrowRightKey(this),vf.closeOnArrowLeftKey(this),vf.openAndFocusOnEnterKeyPress(this),vf.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),vf.openAndFocusPanelOnArrowDownKey(this),vf.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",((t,e)=>{this.fire("arrowright"),e()})),this.keystrokes.set("arrowleft",((t,e)=>{this.fire("arrowleft"),e()}))}_repositionPanelOnOpen(){this.on("change:isOpen",((t,e,n)=>{if(!n)return;const i=Mk._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=i?i.name:this._defaultMenuPositionName}))}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:t,southWest:e,northEast:n,northWest:i,westSouth:o,eastSouth:r,westNorth:s,eastNorth:a}=yf;return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?[r,a,o,s]:[t,e,n,i]:this.parentMenuView?[o,s,r,a]:[e,t,i,n]}get _defaultMenuPositionName(){return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?"es":"se":this.parentMenuView?"ws":"sw"}}Mk._getOptimalPosition=ki;const Pk=Mk;class Nk extends bg{constructor(t){super(t),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){const t=Array.from(this.items).some((t=>{const e=Lk(t);return e&&e.isToggleable}));this.items.forEach((e=>{const n=Lk(e);n&&(n.hasCheckSpace=t)}))}}function Lk(t){return t instanceof mg?t.children.map((t=>function(t){return"object"==typeof t&&"buttonView"in t&&t.buttonView instanceof Lh}(t)?t.buttonView:t)).find((t=>t instanceof rm)):null}class zk extends ym{constructor(t){super(t),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}var Ok=o(4782),Vk={attributes:{"data-cke":!0}};Vk.setAttributes=Qo(),Vk.insert=Ko().bind(null,"head"),Vk.domAPI=qo(),Vk.insertStyleElement=Jo(),Wo()(Ok.A,Vk),Ok.A&&Ok.A.locals&&Ok.A.locals;const Fk=["mouseenter","arrowleft","arrowright","change:isOpen"];class Rk extends er{constructor(t){super(t),this.menus=[];const e=t.t,n=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",n.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":e("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(t,e,n=[]){const i=Ef({normalizedConfig:t,locale:this.locale,componentFactory:e,extraItems:n}).items.map((t=>this._createMenu({componentFactory:e,menuDefinition:t})));this.children.addMany(i)}render(){super.render(),Cf.toggleMenusAndFocusItemsOnHover(this),Cf.closeMenusWhenTheBarCloses(this),Cf.closeMenuWhenAnotherOnTheSameLevelOpens(this),Cf.focusCycleMenusOnArrows(this),Cf.closeOnClickOutside(this),Cf.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const t of this.children)t.isOpen=!1}registerMenu(t,e=null){e?(t.delegate(...Fk).to(e),t.parentMenuView=e):t.delegate(...Fk).to(this,(t=>"menu:"+t)),t._attachBehaviors(),this.menus.push(t)}_createMenu({componentFactory:t,menuDefinition:e,parentMenuView:n}){const i=this.locale,o=new Pk(i);return this.registerMenu(o,n),o.buttonView.set({label:e.label}),o.once("change:isOpen",(()=>{const n=new Nk(i);n.ariaLabel=e.label,o.panelView.children.add(n),n.items.addMany(this._createMenuItems({menuDefinition:e,parentMenuView:o,componentFactory:t}))})),o}_createMenuItems({menuDefinition:t,parentMenuView:e,componentFactory:n}){const i=this.locale,o=[];for(const r of t.groups){for(const t of r.items){const r=new Af(i,e);if(G(t))r.children.add(this._createMenu({componentFactory:n,menuDefinition:t,parentMenuView:e}));else{const i=this._createMenuItemContentFromFactory({componentName:t,componentFactory:n,parentMenuView:e});if(!i)continue;r.children.add(i)}o.push(r)}r!==t.groups[t.groups.length-1]&&o.push(new gg(i))}return o}_createMenuItemContentFromFactory({componentName:t,parentMenuView:e,componentFactory:n}){const i=n.create(t);return i instanceof Pk||i instanceof lm||i instanceof zk?(this._registerMenuTree(i,e),i.on("execute",(()=>{this.close()})),i):(T("menu-bar-component-unsupported",{componentName:t,componentView:i}),null)}_registerMenuTree(t,e){if(!(t instanceof Pk))return void t.delegate("mouseenter").to(e);this.registerMenu(t,e);const n=t.panelView.children.filter((t=>t instanceof Nk))[0];if(!n)return void t.delegate("mouseenter").to(e);const i=n.items.filter((t=>t instanceof mg));for(const e of i)this._registerMenuTree(e.children.get(0),t)}_setupIsOpenUpdater(){let t;this.on("menu:change:isOpen",((e,n,i)=>{clearTimeout(t),i?this.isOpen=!0:t=setTimeout((()=>{this.isOpen=Array.from(this.children).some((t=>t.isOpen))}),0)}))}}class jk extends zf{constructor(t,e){super(t),this.view=e,this._toolbarConfig=Fg(t.config.get("toolbar")),this._elementReplacer=new ot,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const e=this.editor,n=this.view,i=e.editing.view,o=n.editable,r=i.document.getRoot();o.name=r.rootName,n.render();const s=o.element;this.setEditableElement(o.name,s),n.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(s),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),n.menuBarView&&this._initMenuBar(n.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const t=this.view,e=this.editor.editing.view;this._elementReplacer.restore(),e.getDomRoot(t.editable.name)&&e.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.view;t.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),t.stickyPanel.limiterElement=t.element,t.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",(({top:t})=>t||0)),t.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){const t=this.editor,e=t.editing.view,n=e.document.getRoot(),i=t.sourceElement;let o;const r=t.config.get("placeholder");r&&(o="string"==typeof r?r:r[this.view.editable.name]),!o&&i&&"textarea"===i.tagName.toLowerCase()&&(o=i.getAttribute("placeholder")),o&&(n.placeholder=o),Vr({view:e,element:n,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:t}=this.view,e=this.editor.plugins.get("ContextualBalloon");e.on("getPositionOptions",(e=>{const n=e.return;if(!n||!t.isSticky||!t.element)return;const i=new oi(t.element).height,o="function"==typeof n.target?n.target():n.target,r="function"==typeof n.limiter?n.limiter():n.limiter;if(o&&r&&new oi(o).height>=new oi(r).height-i)return;const s={...n.viewportOffsetConfig},a=(s.top||0)+i;e.return={...n,viewportOffsetConfig:{...s,top:a}}}),{priority:"low"});const n=()=>{e.visibleView&&e.updatePosition()};this.listenTo(t,"change:isSticky",n),this.listenTo(this.editor.ui,"change:viewportOffset",n)}_handleScrollToTheSelectionWithStickyPanel(t,e,n){const i=this.view.stickyPanel;if(i.isSticky){const t=new oi(i.element).height;e.viewportOffset.top+=t}else{const t=()=>{this.editor.editing.view.scrollToTheSelection(n)};this.listenTo(i,"change:isSticky",t),setTimeout((()=>{this.stopListening(i,"change:isSticky",t)}),20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,e=this.editor.plugins.get("Dialog");e.on("show",(()=>{const n=e.view;n.on("moveTo",((e,i)=>{if(!t.isSticky||n.wasMoved||n.isModal)return;const o=new oi(t.contentPanelElement);i[1]{const i=new this(t,e);n(i.initPlugins().then((()=>i.ui.init(qk(t)?t:null))).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function qk(t){return jn(t)}class $k extends zf{constructor(t,e){super(t),this.view=e}get element(){return this.view.editable.element}init(){const t=this.editor,e=this.view,n=t.editing.view,i=e.editable,o=n.document.getRoot();i.name=o.rootName,e.render();const r=i.element;this.setEditableElement(i.name,r),i.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),this._initPlaceholder(),this._initMenuBar(this.view.menuBarView),this.fire("ready")}destroy(){super.destroy();const t=this.view,e=this.editor.editing.view;e.getDomRoot(t.editable.name)&&e.detachDomRoot(t.editable.name),t.destroy()}_initPlaceholder(){const t=this.editor,e=t.editing.view,n=e.document.getRoot(),i=t.config.get("placeholder");if(i){const t="string"==typeof i?i:i[n.rootName];t&&(n.placeholder=t)}Vr({view:e,element:n,isDirectHost:!1,keepOnFocus:!0})}}class Kk extends Rf{constructor(t,e,n,i){super(t),this.editable=new Uf(t,e,n,{label:i}),this.menuBarView=new Rk(t),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:t.uiLanguageDirection}})}render(){super.render(),this.registerChild(this.editable),this.registerChild(this.menuBarView)}}class Yk extends(yh(Ah)){static get editorName(){return"BalloonEditor"}constructor(t,e={}){if(!Qk(t)&&void 0!==e.initialData)throw new I("editor-create-initial-data",null);super(e),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return Qk(t)?Zn(t):t}(t)),Qk(t)&&(this.sourceElement=t,xh(this,t));const n=this.config.get("plugins");n.push(Ak),this.config.set("plugins",n),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();const i=new Kk(this.locale,this.editing.view,this.sourceElement,this.config.get("label"));this.ui=new $k(this,i),vh(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,e={}){return new Promise((n=>{if(Qk(t)&&"TEXTAREA"===t.tagName)throw new I("editor-wrong-element",null);const i=new this(t,e);n(i.initPlugins().then((()=>i.ui.init())).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function Qk(t){return jn(t)}class Zk extends zf{constructor(t,e){super(t),this.view=e,this._toolbarConfig=Fg(t.config.get("toolbar"))}get element(){return this.view.editable.element}init(){const t=this.editor,e=this.view,n=t.editing.view,i=e.editable,o=n.document.getRoot();i.name=o.rootName,e.render();const r=i.element;this.setEditableElement(i.name,r),i.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),this._initPlaceholder(),this._initToolbar(),e.menuBarView&&this._initMenuBar(e.menuBarView),this.fire("ready")}destroy(){super.destroy();const t=this.view,e=this.editor.editing.view;e.getDomRoot(t.editable.name)&&e.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.editor,e=this.view,n=e.editable.element,i=e.toolbar;e.panel.bind("isVisible").to(this.focusTracker,"isFocused"),e.bind("viewportTopOffset").to(this,"viewportOffset",(({top:t})=>t||0)),e.listenTo(t.ui,"update",(()=>{e.panel.isVisible&&e.panel.pin({target:n,positions:e.panelPositions})})),i.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(i)}_initPlaceholder(){const t=this.editor,e=t.editing.view,n=e.document.getRoot(),i=t.config.get("placeholder");if(i){const t="string"==typeof i?i:i[n.rootName];t&&(n.placeholder=t)}Vr({view:e,element:n,isDirectHost:!1,keepOnFocus:!0})}}var Jk=o(2885),Xk={attributes:{"data-cke":!0}};Xk.setAttributes=Qo(),Xk.insert=Ko().bind(null,"head"),Xk.domAPI=qo(),Xk.insertStyleElement=Jo(),Wo()(Jk.A,Xk),Jk.A&&Jk.A.locals&&Jk.A.locals;const tb=hi("px");class eb extends Rf{constructor(t,e,n,i={}){super(t),this.toolbar=new Ug(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull,isFloating:!0}),i.useMenuBar&&(this.menuBarView=new Rk(t)),this.set("viewportTopOffset",0),this.panel=new Ig(t),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new Uf(t,e,n,{label:i.label}),this._resizeObserver=null}render(){if(super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.menuBarView?this.panel.content.addMany([this.menuBarView,this.toolbar]):this.panel.content.add(this.toolbar),this.toolbar.options.shouldGroupWhenFull){const t=this.editable.element;this._resizeObserver=new di(t,(()=>{this.toolbar.maxWidth=tb(new oi(t).width)}))}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(t,e){let n;return n=t.top>e.height+this.viewportTopOffset?t.top-e.height:t.bottom>e.height+this.viewportTopOffset+50?this.viewportTopOffset:t.bottom,n}_getPanelPositions(){const t=[(t,e)=>({top:this._getPanelPositionTop(t,e),left:t.left,name:"toolbar_west",config:{withArrow:!1}}),(t,e)=>({top:this._getPanelPositionTop(t,e),left:t.left+t.width-e.width,name:"toolbar_east",config:{withArrow:!1}})];return"ltr"===this.locale.uiLanguageDirection?t:t.reverse()}}class nb extends(yh(Ah)){static get editorName(){return"InlineEditor"}constructor(t,e={}){if(!ib(t)&&void 0!==e.initialData)throw new I("editor-create-initial-data",null);super(e),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return ib(t)?Zn(t):t}(t)),this.model.document.createRoot(),ib(t)&&(this.sourceElement=t,xh(this,t));const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=this.config.get("menuBar"),o=new eb(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:n,useMenuBar:i.isVisible,label:this.config.get("label")});this.ui=new Zk(this,o),vh(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,e={}){return new Promise((n=>{if(ib(t)&&"TEXTAREA"===t.tagName)throw new I("editor-wrong-element",null);const i=new this(t,e);n(i.initPlugins().then((()=>i.ui.init())).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function ib(t){return jn(t)}class ob extends Ia{constructor(t){super(t),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const e=this.document;function n(t){return(n,i)=>{i.preventDefault();const o=i.dropRange?[i.dropRange]:null,r=new v(e,t);e.fire(r,{dataTransfer:i.dataTransfer,method:n.name,targetRanges:o,target:i.target,domEvent:i.domEvent}),r.stop.called&&i.stopPropagation()}}this.listenTo(e,"paste",n("clipboardInput"),{priority:"low"}),this.listenTo(e,"drop",n("clipboardInput"),{priority:"low"}),this.listenTo(e,"dragover",n("dragging"),{priority:"low"})}onDomEvent(t){const e="clipboardData"in t?t.clipboardData:t.dataTransfer,n="drop"==t.type||"paste"==t.type,i={dataTransfer:new uc(e,{cacheFiles:n})};if("drop"==t.type||"dragover"==t.type){const e=Xn(t);i.dropRange=e&&this.view.domConverter.domRangeToView(e)}this.fire(t.type,t,i)}}const rb=["figcaption","li"],sb=["ol","ul"];function ab(t,e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return"\n";let n="",i=null;for(const s of e.getChildren())n+=(o=s,((r=i)?o.is("element","li")&&!o.isEmpty&&o.getChild(0).is("containerElement")||sb.includes(o.name)&&sb.includes(r.name)?"\n\n":o.is("containerElement")||r.is("containerElement")?rb.includes(o.name)||rb.includes(r.name)?"\n":o.is("element")&&o.getCustomProperty("dataPipeline:transparentRendering")||r.is("element")&&r.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":"")+ab(t,s)),i=s;var o,r;if(e.is("rawElement")){const i=document.createElement("div");e.render(i,t),n+=cb(i)}return n}function cb(t){let e="";if(t.nodeType===Node.TEXT_NODE)return t.textContent;if("BR"===t.tagName)return"\n";for(const n of t.childNodes)e+=cb(n);return e}const lb=function(t,e){return t&&Hi(t,e,Ve)},db=function(t){return t==t&&!G(t)},ub=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}},hb=function(t){var e=function(t){for(var e=Ve(t),n=e.length;n--;){var i=e[n],o=t[i];e[n]=[i,o,db(o)]}return e}(t);return 1==e.length&&e[0][2]?ub(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,i){var o=n.length,r=o,s=!i;if(null==t)return!r;for(t=Object(t);o--;){var a=n[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++ot.model.getSelectedContent(t.model.document.selection)){return this.editor.model.change((i=>{const o=i.model.document.selection;i.setSelection(e);const r=this._insertFakeMarkersIntoSelection(i,i.model.document.selection,t),s=n(i),a=this._removeFakeMarkersInsideElement(i,s);for(const[t,e]of Object.entries(r)){a[t]||(a[t]=i.createRangeIn(s));for(const t of e)i.remove(t)}s.markers.clear();for(const[t,e]of Object.entries(a))s.markers.set(t,e);return i.setSelection(o),s}))}_pasteMarkersIntoTransformedElement(t,e){const n=this._getPasteMarkersFromRangeMap(t);return this.editor.model.change((t=>{const i=this._insertFakeMarkersElements(t,n),o=e(t),r=this._removeFakeMarkersInsideElement(t,o);for(const e of Object.values(i).flat())t.remove(e);for(const[e,n]of Object.entries(r))t.model.markers.has(e)||t.addMarker(e,{usingOperation:!0,affectsData:!0,range:n});return o}))}_pasteFragmentWithMarkers(t){const e=this._getPasteMarkersFromRangeMap(t.markers);t.markers.clear();for(const n of e)t.markers.set(n.name,n.range);return this.editor.model.insertContent(t)}_forceMarkersCopy(t,e,n={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const i=this._markersToCopy.get(t);this._markersToCopy.set(t,n),e(),i?this._markersToCopy.set(t,i):this._markersToCopy.delete(t)}_isMarkerCopyable(t,e){const n=this._getMarkerClipboardConfig(t);if(!n)return!1;if(!e)return!0;const{allowedActions:i}=n;return"all"===i||i.includes(e)}_hasMarkerConfiguration(t){return!!this._getMarkerClipboardConfig(t)}_getMarkerClipboardConfig(t){const[e]=t.split(":");return this._markersToCopy.get(e)||null}_insertFakeMarkersIntoSelection(t,e,n){const i=this._getCopyableMarkersFromSelection(t,e,n);return this._insertFakeMarkersElements(t,i)}_getCopyableMarkersFromSelection(t,e,n){const i=Array.from(e.getRanges()),o=new Set(i.flatMap((e=>Array.from(t.model.markers.getMarkersIntersectingRange(e)))));return Array.from(o).filter((t=>{if(!this._isMarkerCopyable(t.name,n))return!1;const{copyPartiallySelected:e}=this._getMarkerClipboardConfig(t.name);if(!e){const e=t.getRange();return i.some((t=>t.containsRange(e,!0)))}return!0})).map((t=>({name:"dragstart"===n?this._getUniqueMarkerName(t.name):t.name,range:t.getRange()})))}_getPasteMarkersFromRangeMap(t,e=null){const{model:n}=this.editor;return(t instanceof Map?Array.from(t.entries()):Object.entries(t)).flatMap((([t,i])=>{if(!this._hasMarkerConfiguration(t))return[{name:t,range:i}];if(this._isMarkerCopyable(t,e)){const e=this._getMarkerClipboardConfig(t),o=n.markers.has(t)&&"$graveyard"===n.markers.get(t).getRange().root.rootName;return(e.duplicateOnPaste||o)&&(t=this._getUniqueMarkerName(t)),[{name:t,range:i}]}return[]}))}_insertFakeMarkersElements(t,e){const n={},i=e.flatMap((t=>{const{start:e,end:n}=t.range;return[{position:e,marker:t,type:"start"},{position:n,marker:t,type:"end"}]})).sort((({position:t},{position:e})=>t.isBefore(e)?1:-1));for(const{position:e,marker:o,type:r}of i){const i=t.createElement("$marker",{"data-name":o.name,"data-type":r});n[o.name]||(n[o.name]=[]),n[o.name].push(i),t.insert(i,e)}return n}_removeFakeMarkersInsideElement(t,e){return function(t,e){var n={};return e=fb(e),lb(t,(function(t,i,o){ae(n,i,e(t,i,o))})),n}(this._getAllFakeMarkersFromElement(t,e).reduce(((e,n)=>{const i=n.markerElement&&t.createPositionBefore(n.markerElement);let o=e[n.name],r=!1;return o&&o.start&&o.end&&(this._getMarkerClipboardConfig(n.name).duplicateOnPaste?e[this._getUniqueMarkerName(n.name)]=e[n.name]:r=!0,o=null),r||(e[n.name]={...o,[n.type]:i}),n.markerElement&&t.remove(n.markerElement),e}),{}),(n=>new Sc(n.start||t.createPositionFromPath(e,[0]),n.end||t.createPositionAt(e,"end"))))}_getAllFakeMarkersFromElement(t,e){const n=Array.from(t.createRangeIn(e)).flatMap((({item:t})=>{if(!t.is("element","$marker"))return[];const e=t.getAttribute("data-name"),n=t.getAttribute("data-type");return[{markerElement:t,name:e,type:n}]})),i=[],o=[];for(const t of n)"end"===t.type&&(n.some((e=>e.name===t.name&&"start"===e.type))||i.push({markerElement:null,name:t.name,type:"start"})),"start"===t.type&&(n.some((e=>e.name===t.name&&"end"===e.type))||o.unshift({markerElement:null,name:t.name,type:"end"}));return[...i,...n,...o]}_getUniqueMarkerName(t){const e=t.split(":"),n=x().substring(1,6);return 3===e.length?`${e.slice(0,2).join(":")}:${n}`:`${e.join(":")}:${n}`}}class bb extends sr{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[kb]}init(){this.editor.editing.view.addObserver(ob),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(t,e,n){const i=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===n},(()=>{const o=i._copySelectedFragmentWithMarkers(n,e);this.fire("outputTransformation",{dataTransfer:t,content:o,method:n})}))}_setupPasteDrop(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(i,"clipboardInput",((e,n)=>{"paste"!=n.method||t.model.canEditAt(t.model.document.selection)||e.stop()}),{priority:"highest"}),this.listenTo(i,"clipboardInput",((t,e)=>{const i=e.dataTransfer;let o;if(e.content)o=e.content;else{let t="";i.getData("text/html")?t=function(t){return t.replace(/(\s+)<\/span>/g,((t,e)=>1==e.length?" ":e)).replace(//g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((r=(r=i.getData("text/plain")).replace(/&/g,"&").replace(//g,">").replace(/\r?\n\r?\n/g,"
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||r.includes("
"))&&(r=`
${r}
`),t=r),o=this.editor.data.htmlProcessor.toView(t)}var r;const s=new v(this,"inputTransformation"),a=i.getData("application/ckeditor5-editor-id")||null;this.fire(s,{content:o,dataTransfer:i,sourceEditorId:a,targetRanges:e.targetRanges,method:e.method}),s.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,sourceEditorId:n.sourceEditorId,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=o._pasteFragmentWithMarkers(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,i=(t,n)=>{const i=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(i,e.selection,t.name)};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.model.canEditAt(t.model.document.selection)?i(e,n):n.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((e,i)=>{const o=t.data.toView(i.content,{isClipboardPipeline:!0});n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:o,method:i.method})}),{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",ab(t.data.htmlProcessor.domConverter,i.content)),i.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),"cut"==i.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class wb{constructor(t,e=20){this._batch=null,this.model=t,this._size=0,this.limit=e,this._isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(t){this._size+=t,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t=!1){this.isLocked&&!t||(this._batch=null,this._size=0)}}class _b extends cr{constructor(t,e){super(t),this._buffer=new wb(t.model,e),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,i=t.text||"",o=i.length;let r=n.selection;if(t.selection?r=t.selection:t.range&&(r=e.createSelection(t.range)),!e.canEditAt(r))return;const s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock();const a=Array.from(n.selection.getAttributes());e.deleteContent(r),i&&e.insertContent(t.createText(i,a),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(o)}))}}const Ab=["insertText","insertReplacementText"],Cb=[...Ab,"insertCompositionText"];class vb extends xa{constructor(t){super(t),this.focusObserver=t.getObserver(cc);const e=d.isAndroid?Cb:Ab,n=t.document;n.on("beforeinput",((i,o)=>{if(!this.isEnabled)return;const{data:r,targetRanges:s,inputType:a,domEvent:c}=o;if(!e.includes(a))return;this.focusObserver.flush();const l=new v(n,"insertText");n.fire(l,new Sa(t,c,{text:r,selection:t.createSelection(s)})),l.stop.called&&i.stop()})),d.isAndroid||n.on("compositionend",((e,{data:i,domEvent:o})=>{this.isEnabled&&i&&n.fire("insertText",new Sa(t,o,{text:i}))}),{priority:"lowest"})}observe(){}stopObserving(){}}class yb extends sr{static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model,n=t.editing.view,i=t.editing.mapper,o=e.document.selection;this._compositionQueue=new xb(t),n.addObserver(vb);const r=new _b(t,t.config.get("typing.undoStep")||20);t.commands.add("insertText",r),t.commands.add("input",r),this.listenTo(n.document,"insertText",((r,s)=>{n.document.isComposing||s.preventDefault(),d.isAndroid&&n.document.isComposing&&this._compositionQueue.flush("next beforeinput");const{text:a,selection:c}=s;let l;l=c?Array.from(c.getRanges()).map((t=>i.toModelRange(t))):Array.from(o.getRanges());let u=a;if(d.isAndroid){const t=Array.from(l[0].getItems()).reduce(((t,e)=>t+(e.is("$textProxy")?e.data:"")),"");if(t&&(t.length<=u.length?u.startsWith(t)&&(u=u.substring(t.length),l[0].start=l[0].start.getShiftedBy(t.length)):t.startsWith(u)&&(l[0].start=l[0].start.getShiftedBy(u.length),u="")),0==u.length&&l[0].isCollapsed)return}const h={text:u,selection:e.createSelection(l)};d.isAndroid&&n.document.isComposing?this._compositionQueue.push(h):(t.execute("insertText",h),n.scrollToTheSelection())})),d.isAndroid?this.listenTo(n.document,"keydown",((t,i)=>{!o.isCollapsed&&229==i.keyCode&&n.document.isComposing&&Eb(e,r)})):this.listenTo(n.document,"compositionstart",(()=>{o.isCollapsed||Eb(e,r)})),d.isAndroid?(this.listenTo(n.document,"mutations",((t,{mutations:e})=>{if(n.document.isComposing)for(const{node:t}of e){const e=Db(t,i),n=i.toModelElement(e);if(this._compositionQueue.isComposedElement(n))return void this._compositionQueue.flush("mutations")}})),this.listenTo(n.document,"compositionend",(()=>{this._compositionQueue.flush("composition end")})),this.listenTo(n.document,"compositionend",(()=>{const t=[];for(const e of this._compositionQueue.flushComposedElements()){const n=i.toViewElement(e);n&&t.push({type:"children",node:n})}t.length&&n.document.fire("mutations",{mutations:t})}),{priority:"lowest"})):this.listenTo(n.document,"compositionend",(()=>{n.document.fire("mutations",{mutations:[]})}),{priority:"lowest"})}destroy(){super.destroy(),this._compositionQueue.destroy()}}class xb{constructor(t){this.flushDebounced=Ha((()=>this.flush("timeout")),50),this._queue=[],this._compositionElements=new Set,this.editor=t}destroy(){for(this.flushDebounced.cancel(),this._compositionElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(t){const e={text:t.text};if(t.selection){e.selectionRanges=[];for(const n of t.selection.getRanges())e.selectionRanges.push(Wc.fromRange(n)),this._compositionElements.add(n.start.parent)}this._queue.push(e),this.flushDebounced()}shift(){const t=this._queue.shift(),e={text:t.text};if(t.selectionRanges){const n=t.selectionRanges.map((t=>function(t){const e=t.toRange();return t.detach(),"$graveyard"==e.root.rootName?null:e}(t))).filter((t=>!!t));n.length&&(e.selection=this.editor.model.createSelection(n))}return e}flush(t){const e=this.editor,n=e.model,i=e.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const o=e.commands.get("insertText").buffer;n.enqueueChange(o.batch,(()=>{for(o.lock();this._queue.length;){const t=this.shift();e.execute("insertText",t)}o.unlock()})),i.scrollToTheSelection()}isComposedElement(t){return this._compositionElements.has(t)}flushComposedElements(){const t=Array.from(this._compositionElements);return this._compositionElements.clear(),t}}function Eb(t,e){if(!e.isEnabled)return;const n=e.buffer;n.lock(),t.enqueueChange(n.batch,(()=>{t.deleteContent(t.document.selection)})),n.unlock()}function Db(t,e){let n=t.is("$text")?t.parent:t;for(;!e.toModelElement(n);)n=n.parent;return n}class Sb extends cr{constructor(t,e){super(t),this.direction=e,this._buffer=new wb(t.model,t.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(i=>{this._buffer.lock();const o=i.createSelection(t.selection||n.selection);if(!e.canEditAt(o))return;const r=t.sequence||1,s=o.isCollapsed;if(o.isCollapsed&&e.modifySelection(o,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(i);if(this._shouldReplaceFirstBlockWithParagraph(o,r))return void this.editor.execute("paragraph",{selection:o});if(o.isCollapsed)return;let a=0;o.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=rt(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(o,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),i.setSelection(o),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,i=e.schema.getLimitElement(n);if(!n.isCollapsed||!n.containsEntireContent(i))return!1;if(!e.schema.checkChild(i,"paragraph"))return!1;const o=i.getChild(0);return!o||!o.is("element","paragraph")}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,i=e.schema.getLimitElement(n),o=t.createElement("paragraph");t.remove(t.createRangeIn(i)),t.insert(o,i),t.setSelection(o,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const i=t.getFirstPosition(),o=n.schema.getLimitElement(i),r=o.getChild(0);return i.parent==r&&!!t.containsEntireContent(r)&&!!n.schema.checkChild(o,"paragraph")&&"paragraph"!=r.name}}const Ib="word",Tb="selection",Bb="backward",Mb="forward",Pb={deleteContent:{unit:Tb,direction:Bb},deleteContentBackward:{unit:"codePoint",direction:Bb},deleteWordBackward:{unit:Ib,direction:Bb},deleteHardLineBackward:{unit:Tb,direction:Bb},deleteSoftLineBackward:{unit:Tb,direction:Bb},deleteContentForward:{unit:"character",direction:Mb},deleteWordForward:{unit:Ib,direction:Mb},deleteHardLineForward:{unit:Tb,direction:Mb},deleteSoftLineForward:{unit:Tb,direction:Mb}};class Nb extends xa{constructor(t){super(t);const e=t.document;let n=0;e.on("keydown",(()=>{n++})),e.on("keyup",(()=>{n=0})),e.on("beforeinput",((i,o)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:s,inputType:a}=o,c=Pb[a];if(!c)return;const l={direction:c.direction,unit:c.unit,sequence:n};l.unit==Tb&&(l.selectionToRemove=t.createSelection(r[0])),"deleteContentBackward"===a&&(d.isAndroid&&(l.sequence=1),function(t){if(1!=t.length||t[0].isCollapsed)return!1;const e=t[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let n=0;for(const{nextPosition:t,item:i}of e){if(t.parent.is("$text")){const e=t.parent.data,i=t.offset;if(fo(e,i)||ko(e,i)||wo(e,i))continue;n++}else(i.is("containerElement")||i.is("emptyElement"))&&n++;if(n>1)return!0}return!1}(r)&&(l.unit=Tb,l.selectionToRemove=t.createSelection(r)));const u=new Cs(e,"delete",r[0]);e.fire(u,new Sa(t,s,l)),u.stop.called&&i.stop()})),d.isBlink&&function(t){const e=t.view,n=e.document;let i=null,o=!1;function r(t){return t==Pi.backspace||t==Pi.delete}function s(t){return t==Pi.backspace?Bb:Mb}n.on("keydown",((t,{keyCode:e})=>{i=e,o=!1})),n.on("keyup",((a,{keyCode:c,domEvent:l})=>{const d=n.selection,u=t.isEnabled&&c==i&&r(c)&&!d.isCollapsed&&!o;if(i=null,u){const t=d.getFirstRange(),i=new Cs(n,"delete",t),o={unit:Tb,direction:s(c),selectionToRemove:d};n.fire(i,new Sa(e,l,o))}})),n.on("beforeinput",((t,{inputType:e})=>{const n=Pb[e];r(i)&&n&&n.direction==s(i)&&(o=!0)}),{priority:"high"}),n.on("beforeinput",((t,{inputType:e,data:n})=>{i==Pi.delete&&"insertText"==e&&""==n&&t.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class Lb extends sr{static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.editing.view,n=e.document,i=t.model.document;e.addObserver(Nb),this._undoOnBackspace=!1;const o=new Sb(t,"forward");t.commands.add("deleteForward",o),t.commands.add("forwardDelete",o),t.commands.add("delete",new Sb(t,"backward")),this.listenTo(n,"delete",((i,o)=>{n.isComposing||o.preventDefault();const{direction:r,sequence:s,selectionToRemove:a,unit:c}=o,l="forward"===r?"deleteForward":"delete",d={sequence:s};if("selection"==c){const e=Array.from(a.getRanges()).map((e=>t.editing.mapper.toModelRange(e)));d.selection=t.model.createSelection(e)}else d.unit=c;t.execute(l,d),e.scrollToTheSelection()}),{priority:"low"}),this.listenTo(n,"keydown",((e,o)=>{if(n.isComposing||o.keyCode!=Pi.backspace||!i.selection.isCollapsed)return;const r=t.model.schema.getLimitElement(i.selection);t.model.createPositionAt(r,0).isTouching(i.selection.getFirstPosition())&&o.preventDefault()})),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(i,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class zb extends sr{static get requires(){return[yb,Lb]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}function Ob(t,e){let n=t.start;return{text:Array.from(t.getWalker({ignoreElementEnd:!1})).reduce(((t,{item:i})=>i.is("$text")||i.is("$textProxy")?t+i.data:(n=e.createPositionAfter(i),"")),""),range:e.createRange(n,t.end)}}class Vb extends(J()){constructor(t,e){super(),this.model=t,this.testCallback=e,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,i=n.document.selection,o=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:r,range:s}=Ob(o,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}class Fb extends sr{static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this._isNextGravityRestorationSkipped=!1,this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,i=t.locale,o=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!o.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==Pi.arrowright,r=e.keyCode==Pi.arrowleft;if(!n&&!r)return;const s=i.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this.listenTo(o,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&Gb(o.getFirstPosition(),this.attributes)||this._restoreGravity())})),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model,i=n.document.selection,o=i.getFirstPosition();return!(this._isGravityOverridden||o.isAtStart&&Rb(i,e)||!Gb(o,e)||(Ub(t),Rb(i,e)&&Gb(o,e,!0)?Hb(n,e):this._overrideGravity(),0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,i=n.document.selection,o=i.getFirstPosition();return this._isGravityOverridden?(Ub(t),this._restoreGravity(),Gb(o,e,!0)?Hb(n,e):jb(n,e,o),!0):o.isAtStart?!!Rb(i,e)&&(Ub(t),jb(n,e,o),!0):!Rb(i,e)&&Gb(o,e,!0)?(Ub(t),jb(n,e,o),!0):!!Wb(o,e)&&(o.isAtEnd&&!Rb(i,e)&&Gb(o,e)?(Ub(t),jb(n,e,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}_enableClickingAfterNode(){const t=this.editor,e=t.model,n=e.document.selection,i=t.editing.view.document;t.editing.view.addObserver(fu),t.editing.view.addObserver(ku);let o=!1,r=!1;this.listenTo(i,"touchstart",(()=>{r=!1,o=!0})),this.listenTo(i,"mousedown",(()=>{r=!0})),this.listenTo(i,"selectionChange",(()=>{const t=this.attributes;if(!r&&!o)return;if(r=!1,o=!1,!n.isCollapsed)return;if(!Rb(n,t))return;const i=n.getFirstPosition();Gb(i,t)&&(i.isAtStart||Gb(i,t,!0)?Hb(e,t):this._isGravityOverridden||this._overrideGravity())}))}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection,n=this.attributes;this.listenTo(t,"insertContent",(()=>{const i=e.getFirstPosition();Rb(e,n)&&Gb(i,n)&&Hb(t,n)}),{priority:"low"})}_handleDeleteContentAfterNode(){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)=>{o="backward"===e.direction}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{if(!o)return;const t=n.getFirstPosition();r=Rb(n,this.attributes)&&!Wb(t,this.attributes)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{o&&(o=!1,r||t.model.enqueueChange((()=>{const t=n.getFirstPosition();Rb(n,this.attributes)&&Gb(t,this.attributes)&&(t.isAtStart||Gb(t,this.attributes,!0)?Hb(e,this.attributes):this._isGravityOverridden||this._overrideGravity())})))}),{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Rb(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function jb(t,e,n){const i=n.nodeBefore;t.change((n=>{if(i){const e=[],o=t.schema.isObject(i)&&t.schema.isInline(i);for(const[n,r]of i.getAttributes())!t.schema.checkAttribute("$text",n)||o&&!1===t.schema.getAttributeProperties(n).copyFromObject||e.push([n,r]);n.setSelectionAttribute(e)}else n.removeSelectionAttribute(e)}))}function Hb(t,e){t.change((t=>{t.removeSelectionAttribute(e)}))}function Ub(t){t.preventDefault()}function Wb(t,e){return Gb(t.getShiftedBy(-1),e)}function Gb(t,e,n=!1){const{nodeBefore:i,nodeAfter:o}=t;for(const t of e){const e=i?i.getAttribute(t):void 0,r=o?o.getAttribute(t):void 0;if((!n||void 0!==e&&void 0!==r)&&r!==e)return!0}return!1}const qb={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:Yb('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Yb("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Yb("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Yb('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Yb('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Yb("'"),to:[null,"‚",null,"’"]}},$b={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Kb=["symbols","mathematical","typography","quotes"];function Yb(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function Qb(t,e,n,i){return i.createRange(Zb(t,e,n,!0,i),Zb(t,e,n,!1,i))}function Zb(t,e,n,i,o){let r=t.textNode||(i?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=i?r.previousSibling:r.nextSibling;return s?o.createPositionAt(s,i?"before":"after"):t}function*Jb(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class Xb extends cr{execute(){this.editor.model.change((t=>{this.enterBlock(t),this.fire("afterExecute",{writer:t})}))}enterBlock(t){const e=this.editor.model,n=e.document.selection,i=e.schema,o=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(i.isLimit(s)||i.isLimit(a))return o||s!=a||e.deleteContent(n),!1;if(o){const e=Jb(t.model.schema,n.getAttributes());return tw(t,r.start),t.setSelectionAttribute(e),!0}{const i=!(r.start.isAtStart&&r.end.isAtEnd),o=s==a;if(e.deleteContent(n,{leaveUnmerged:i}),i){if(o)return tw(t,n.focus),!0;t.setSelection(a,0)}}return!1}}function tw(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}const ew={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class nw extends xa{constructor(t){super(t);const e=this.document;let n=!1;e.on("keydown",((t,e)=>{n=e.shiftKey})),e.on("beforeinput",((i,o)=>{if(!this.isEnabled)return;let r=o.inputType;d.isSafari&&n&&"insertParagraph"==r&&(r="insertLineBreak");const s=o.domEvent,a=ew[r];if(!a)return;const c=new Cs(e,"enter",o.targetRanges[0]);e.fire(c,new Sa(t,s,{isSoft:a.isSoft})),c.stop.called&&i.stop()}))}observe(){}stopObserving(){}}class iw extends sr{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.editing.view,n=e.document,i=this.editor.t;e.addObserver(nw),t.commands.add("enter",new Xb(t)),this.listenTo(n,"enter",((i,o)=>{n.isComposing||o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"}),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class ow extends cr{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const i=n.isCollapsed,o=n.getFirstRange(),r=o.start.parent,s=o.end.parent,a=r==s;if(i){const i=Jb(t.schema,n.getAttributes());rw(t,e,o.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(i)}else{const i=!(o.start.isAtStart&&o.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:i}),a?rw(t,e,n.focus):i&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const i=e.getFirstRange(),o=i.start.parent,r=i.end.parent;return!sw(o,t)&&!sw(r,t)||o===r}(t.schema,e.selection)}}function rw(t,e,n){const i=e.createElement("softBreak");t.insertContent(i,n),e.setSelection(i,"after")}function sw(t,e){return!t.is("rootElement")&&(e.isLimit(t)||sw(t.parent,e))}class aw extends sr{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model.schema,n=t.conversion,i=t.editing.view,o=i.document,r=this.editor.t;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),i.addObserver(nw),t.commands.add("shiftEnter",new ow(t)),this.listenTo(o,"enter",((e,n)=>{o.isComposing||n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),i.scrollToTheSelection())}),{priority:"low"}),t.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Insert a soft break (a <br> element)"),keystroke:"Shift+Enter"}]})}}class cw extends(V()){constructor(){super(...arguments),this._stack=[]}add(t,e){const n=this._stack,i=n[0];this._insertDescriptor(t);const o=n[0];i===o||lw(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||lw(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(lw(t,e[n]))return;n>-1&&e.splice(n,1);let i=0;for(;e[i]&&(o=e[i],r=t,o.priority>r.priority||!(o.prioritydw(r.classes));)i++;var o,r;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 lw(t,e){return t&&e&&t.priority==e.priority&&dw(t.classes)==dw(e.classes)}function dw(t){return Array.isArray(t)?t.sort().join(","):t}const uw='',hw="ck-widget",mw="ck-widget_selected";function gw(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function pw(t,e,n={}){if(!t.is("containerElement"))throw new I("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass(hw,t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=Aw,e.setCustomProperty("widgetLabel",[],t),n.label&&function(t,e){t.getCustomProperty("widgetLabel").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 Bh;return n.set("content",uw),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),bw(t,e),t}function fw(t,e,n){if(e.classes&&n.addClass(Ri(e.classes),t),e.attributes)for(const i in e.attributes)n.setAttribute(i,e.attributes[i],t)}function kw(t,e,n){if(e.classes&&n.removeClass(Ri(e.classes),t),e.attributes)for(const i in e.attributes)n.removeAttribute(i,t)}function bw(t,e,n=fw,i=kw){const o=new cw;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 ww(t,e,n={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("role","textbox",t),e.setAttribute("tabindex","-1",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)})),bw(t,e),t}function _w(t,e){const n=t.getSelectedElement();if(n){const i=xw(t);if(i)return e.createRange(e.createPositionAt(n,i))}return e.schema.findOptimalInsertionRange(t)}function Aw(){return null}function Cw(t){const e=t=>{const{width:e,paddingLeft:n,paddingRight:i}=t.ownerDocument.defaultView.getComputedStyle(t);return parseFloat(e)-(parseFloat(n)||0)-(parseFloat(i)||0)},n=t.parentElement;if(!n)return 0;let i=e(n),o=0,r=n;for(;isNaN(i);){if(r=r.parentElement,++o>5)return 0;i=e(r)}return i}const vw="widget-type-around";function yw(t,e,n){return!!t&&gw(t)&&!n.isInline(e)}function xw(t){return t.getAttribute(vw)}var Ew=o(6779),Dw={attributes:{"data-cke":!0}};Dw.setAttributes=Qo(),Dw.insert=Ko().bind(null,"head"),Dw.domAPI=qo(),Dw.insertStyleElement=Jo(),Wo()(Ew.A,Dw),Ew.A&&Ew.A.locals&&Ew.A.locals;const Sw=["before","after"],Iw=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,Tw="ck-widget__type-around_disabled";class Bw extends sr{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get isOfficialPlugin(){return!0}static get requires(){return[iw,Lb]}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(Tw,n):t.addClass(Tw,n)})),o||t.model.change((t=>{t.removeSelectionAttribute(vw)}))})),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=xw(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);s&&yw(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 Sw){const i=new Co({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(Iw,!0)]});t.appendChild(i.render())}}(n,e),function(t){const e=new Co({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:[gw,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(vw)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();e&&yw(t.editing.mapper.toViewElement(e),e,i)||t.model.change((t=>{t.removeSelectionAttribute(vw)}))})),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(Sw.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!yw(a,s,i))return;const c=xw(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(vw)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,i=n.model,o=i.document.selection,r=i.schema,s=n.editing.view,a=function(t,e){const n=Vi(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;yw(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):o.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=xw(e.document.selection);return e.change((e=>n?n!==(t?"after":"before")&&(e.removeSelectionAttribute(vw),!0):(e.setSelectionAttribute(vw,t?"after":"before"),!0)))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,i=n.schema,o=e.plugins.get("Widget"),r=o._getObjectElementNextToSelection(t);return!!yw(e.editing.mapper.toViewElement(r),r,i)&&(n.change((e=>{o._setSelectionOverElement(r),e.setSelectionAttribute(vw,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!!yw(o.toViewElement(s),s,i)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(vw,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=o.classList.contains("ck-widget__type-around__button_before")?"before":"after",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:yw(r,o,s)&&(this._insertParagraph(o,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:gw})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",((e,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=t.selection)}),{priority:"high"}),d.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=xw(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:gw})}_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=xw(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=xw(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])=>{n&&!n.is("documentSelection")||xw(e)&&t.stop()}),{priority:"high"})}}function Mw(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 Pw(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 Nw=o(1216),Lw={attributes:{"data-cke":!0}};Lw.setAttributes=Qo(),Lw.insert=Ko().bind(null,"head"),Lw.domAPI=qo(),Lw.insertStyleElement=Jo(),Wo()(Nw.A,Lw),Nw.A&&Nw.A.locals&&Nw.A.locals;class zw extends sr{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get isOfficialPlugin(){return!0}static get requires(){return[Bw,Lb]}init(){const t=this.editor,e=t.editing.view,n=e.document,i=t.t;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;gw(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;gw(t)&&(s=t,!(a=r)||!Array.from(s.getAncestors()).includes(a))&&(i.addClass(mw,t),this._previouslySelected.add(t),r=t)}var s,a}),{priority:"low"}),e.addObserver(fu),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[gw,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",function(t){const e=t.model;return(n,i)=>{const o=i.keyCode==Pi.arrowup,r=i.keyCode==Pi.arrowdown,s=i.shiftKey,a=e.document.selection;if(!o&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const i=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=Mw(i,t,"forward");if(!n)return null;const o=i.createRange(t,n),r=Pw(i.schema,o,"backward");return r?i.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=Mw(i,t,"backward");if(!n)return null;const o=i.createRange(n,t),r=Pw(i.schema,o,"forward");return r?i.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const i=t.model,o=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 r=t.mapper.toViewRange(e),s=o.viewRangeToDom(r),a=oi.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const i=e.createSelection(a.anchor);i.setFocus(n),t.setSelection(i)}else t.setSelection(n)})),n.stop(),i.preventDefault(),i.stopPropagation())}}}(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"}),this.listenTo(n,"tab",((t,e)=>{"atTarget"==t.eventPhase&&(e.shiftKey||this._selectFirstNestedEditable()&&(e.preventDefault(),t.stop()))}),{context:gw,priority:"low"}),this.listenTo(n,"tab",((t,e)=>{e.shiftKey&&this._selectAncestorWidget()&&(e.preventDefault(),t.stop())}),{priority:"low"}),this.listenTo(n,"keydown",((t,e)=>{e.keystroke==Pi.esc&&this._selectAncestorWidget()&&(e.preventDefault(),t.stop())}),{priority:"low"}),t.accessibility.addKeystrokeInfoGroup({id:"widget",label:i("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:i("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:i("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:i("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:i("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:i("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(t,e){const n=this.editor,i=n.editing.view,o=i.document;let r=e.target;if(!r)return;if(e.domEvent.detail>=3)return void(this._selectBlockContent(r)&&e.preventDefault());if(!gw(r)){const t=function(t){let e=t;for(;e;){if(e.is("editableElement")||gw(e))return e;e=e.parent}return null}(r);if(!t)return;if(gw(t))r=t;else{const t=function(t,e){const n=Xn(e.domEvent);let i=null;if(i=n?t.domConverter.domRangeToView(n):t.createRange(t.createPositionAt(e.target,0)),!i)return null;const o=i.start;if(!o.parent)return null;let r=o.parent;return o.parent.is("editableElement")&&(o.isAtEnd&&o.nodeBefore?r=o.nodeBefore:o.isAtStart&&o.nodeAfter&&(r=o.nodeAfter)),r.is("$text")?r.parent:r}(i,e);if(!t||!gw(t))return;r=t}}d.isAndroid&&e.preventDefault(),o.isFocused||i.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_selectBlockContent(t){const e=this.editor,n=e.model,i=e.editing.mapper,o=n.schema,r=i.findMappedViewAncestor(this.editor.editing.view.createPositionAt(t,0)),s=function(t,e){for(const n of t.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(n,"$text"))return n;if(e.isLimit(n)&&!e.isObject(n))break}return null}(i.toModelElement(r),n.schema);return!!s&&(n.change((t=>{const e=o.isLimit(s)?null:function(t,e){const n=new _c({startPosition:t});for(const{item:t}of n){if(e.isLimit(t)||!t.is("element"))return null;if(e.checkChild(t,"$text"))return t}return null}(t.createPositionAfter(s),o),n=t.createPositionAt(s,0),i=e?t.createPositionAt(e,0):t.createPositionAt(s,"end");t.setSelection(t.createRange(n,i))})),!0)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,i=this.editor.model,o=i.schema,r=i.document.selection,s=r.getSelectedElement(),a=Vi(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&o.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=o.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(i.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&o.isObject(a)||l&&o.isObject(l))&&(i.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&l)return;this._setSelectionOverElement(d),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){const e=this.editor.model.document.selection;if(!this.editor.model.canEditAt(e))return;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(mw,e);this._previouslySelected.clear()}_selectFirstNestedEditable(){const t=this.editor,e=this.editor.editing.view.document;for(const n of e.selection.getFirstRange().getItems())if(n.is("editableElement")){const e=t.editing.mapper.toModelElement(n);if(!e)continue;const i=t.model.createPositionAt(e,0),o=t.model.schema.getNearestSelectionRange(i,"forward");return t.model.change((t=>{t.setSelection(o)})),!0}return!1}_selectAncestorWidget(){const t=this.editor,e=t.editing.mapper,n=t.editing.view.document.selection.getFirstPosition().parent,i=(n.is("$text")?n.parent:n).findAncestor(gw);if(!i)return!1;const o=e.toModelElement(i);return!!o&&(t.model.change((t=>{t.setSelection(o,"on")})),!0)}}class Ow extends sr{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Zf]}static get pluginName(){return"WidgetToolbarRepository"}static get isOfficialPlugin(){return!0}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||!gw(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}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:o="ck-toolbar-container"}){if(!n.length)return void T("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Ug(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new I("widget-toolbar-duplicated",this,{toolbarId:t});const c={view:a,getRelatedElement:i,balloonClassName:o,itemsConfig:n,initialized:!1};r.ui.addToolbar(a,{isContextual:!0,beforeFocus:()=>{const t=i(r.editing.view.document.selection);t&&this._showToolbar(c,t)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(t,c)}_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)?Vw(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:Fw(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);Vw(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function Vw(t,e){const n=t.plugins.get("ContextualBalloon"),i=Fw(t,e);n.updatePosition(i)}function Fw(t,e){const n=t.editing.view,i=Ig.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class Rw extends(J()){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 oi(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(`ck-widget__resizer__handle-${n}`))return n}(t),this._referenceCoordinates=function(t,e){const n=new oi(t),i=e.split("-"),o={x:"right"==i[1]?n.right:n.left,y:"bottom"==i[0]?n.bottom:n.top};return o.x+=t.ownerDocument.defaultView.scrollX,o.y+=t.ownerDocument.defaultView.scrollY,o}(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 o=n.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=function(t,e=new oi(t)){const n=Cw(t);return n?e.width/n*100:0}(n,i)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}class jw extends er{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 Hw extends(J()){constructor(t){super(),this._viewResizerWrapper=null,this._options=t,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 Rw(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 oi(n),o=Math.round(i.width),r=Math.round(i.height),s=new oi(n);e.width=Math.round(s.width),e.height=Math.round(s.height),this.redraw(i),this.state.update({...e,handleHostWidth:o,handleHostHeight:r})}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,o=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(i.isSameNode(o)){const e=t||new oi(o);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[o.offsetWidth+"px",o.offsetHeight+"px",o.offsetLeft+"px",o.offsetTop+"px"];"same"!==st(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}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=(o=t).pageX,i=o.pageY;var o;const r=!this._options.isCentered||this._options.isCentered(this),s={x:e._referenceCoordinates.x-(n+e.originalWidth),y:i-e.originalHeight-e._referenceCoordinates.y};r&&e.activeHandlePosition.endsWith("-right")&&(s.x=n-(e._referenceCoordinates.x+e.originalWidth)),r&&(s.x*=2);let a=Math.abs(e.originalWidth+s.x),c=Math.abs(e.originalHeight+s.y);return"width"==(a/e.aspectRatio>c?"width":"height")?c=a/e.aspectRatio:a=c*e.aspectRatio,{width:Math.round(a),height:Math.round(c),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a*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 Co({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new jw,this._sizeView.render(),t.appendChild(this._sizeView.element)}}var Uw=o(2060),Ww={attributes:{"data-cke":!0}};Ww.setAttributes=Qo(),Ww.insert=Ko().bind(null,"head"),Ww.domAPI=qo(),Ww.insertStyleElement=Jo(),Wo()(Uw.A,Ww),Uw.A&&Uw.A.locals&&Uw.A.locals;class Gw extends sr{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.editing,e=a.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),t.view.addObserver(fu),this._observer=new(Kn()),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=ih((()=>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(a.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 Hw(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;Hw.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)}}const qw=hi("px");class $w extends er{constructor(){super();const t=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",t.if("isVisible","ck-hidden",(t=>!t))],style:{left:t.to("left",(t=>qw(t))),top:t.to("top",(t=>qw(t))),width:t.to("width",(t=>qw(t)))}}})}}class Kw extends sr{constructor(){super(...arguments),this.removeDropMarkerDelayed=go((()=>this.removeDropMarker()),40),this._updateDropMarkerThrottled=ih((t=>this._updateDropMarker(t)),40),this._reconvertMarkerThrottled=ih((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0),this._dropTargetLineView=new $w,this._domEmitter=new(Kn()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:t}of this._scrollables.values())t.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(t,e,n,i,o,r){this.removeDropMarkerDelayed.cancel();const s=Yw(this.editor,t,e,n,i,o,r);if(s)return r&&r.containsRange(s)?this.removeDropMarker():void this._updateDropMarkerThrottled(s)}getFinalDropRange(t,e,n,i,o,r){const s=Yw(this.editor,t,e,n,i,o,r);return this.removeDropMarker(),s}removeDropMarker(){const t=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_setupDropMarker(){const t=this.editor;t.ui.view.body.add(this._dropTargetLineView),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 this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);e.markerRange.isCollapsed?this._updateDropTargetLine(e.markerRange):this._dropTargetLineView.isVisible=!1}})}_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})}))}_createDropTargetPosition(t){return t.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.append("",t.createElement("span"),""),e}))}_updateDropTargetLine(t){const e=this.editor.editing,n=t.start.nodeBefore,i=t.start.nodeAfter,o=t.start.parent,r=n?e.mapper.toViewElement(n):null,s=r?e.view.domConverter.mapViewToDom(r):null,c=i?e.mapper.toViewElement(i):null,l=c?e.view.domConverter.mapViewToDom(c):null,d=e.mapper.toViewElement(o);if(!d)return;const u=e.view.domConverter.mapViewToDom(d),h=this._getScrollableRect(d),{scrollX:m,scrollY:g}=a.window,p=s?new oi(s):null,f=l?new oi(l):null,k=new oi(u).excludeScrollbarsAndBorders(),b=p?p.bottom:k.top,w=f?f.top:k.bottom,_=a.window.getComputedStyle(u),A=b<=w?(b+w)/2:w;if(h.topa.schema.checkChild(r,t)))){if(a.schema.checkChild(r,"$text"))return a.createRange(r);if(e)return Zw(t,Xw(t,e.parent),i,o)}}}else if(a.schema.isInline(l))return Zw(t,l,i,o);if(a.schema.isBlock(l))return Zw(t,l,i,o);if(a.schema.checkChild(l,"$block")){const e=Array.from(l.getChildren()).filter((e=>e.is("element")&&!Qw(t,e)));let n=0,r=e.length;if(0==r)return a.createRange(a.createPositionAt(l,"end"));for(;n{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),d.isAndroid&&this.forceDisabled("noAndroidSupport"),t.plugins.has("BlockToolbar")){const e=t.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(e,"dragstart",((t,e)=>this._handleBlockDragStart(e))),this._domEmitter.listenTo(a.document,"dragover",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(a.document,"drop",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(a.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&e.setAttribute("draggable","true"),this.on("change:isEnabled",((t,n,i)=>{e.setAttribute("draggable",i?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(t){if(!this.isEnabled)return;const e=this.editor.model,n=e.document.selection,i=this.editor.editing.view,o=Array.from(n.getSelectedBlocks()),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));e.change((t=>t.setSelection(r))),this._isBlockDragging=!0,i.focus(),i.getObserver(ob).onDomEvent(t)}_handleBlockDragging(t){if(!this.isEnabled||!this._isBlockDragging)return;const e=t.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),n=t.clientY,i=document.elementFromPoint(e,n),o=this.editor.editing.view;i&&i.closest(".ck-editor__editable")&&o.getObserver(ob).onDomEvent({...t,type:t.type,dataTransfer:t.dataTransfer,target:i,clientX:e,clientY:n,preventDefault:()=>t.preventDefault(),stopPropagation:()=>t.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}var e_=o(9262),n_={attributes:{"data-cke":!0}};n_.setAttributes=Qo(),n_.insert=Ko().bind(null,"head"),n_.domAPI=qo(),n_.insertStyleElement=Jo(),Wo()(e_.A,n_),e_.A&&e_.A.locals&&e_.A.locals;class i_ extends sr{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=go((()=>this._clearDraggableAttributes()),40),this._blockMode=!1,this._domEmitter=new(Kn())}static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[bb,zw,Kw,t_]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,e.addObserver(ob),e.addObserver(fu),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),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)})),d.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=t.plugins.get(Kw);this.listenTo(i,"dragstart",((t,n)=>{if(n.target&&n.target.is("editableElement"))return void n.preventDefault();if(this._prepareDraggedRange(n.target),!this._draggedRange)return void n.preventDefault();this._draggingUid=x(),n.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const i=e.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,i,"dragstart");const{dataTransfer:o,domTarget:r,domEvent:s}=n,{clientX:a}=s;this._updatePreview({dataTransfer:o,domTarget:r,clientX:a}),n.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(a.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&n.focus()})),this.listenTo(i,"dragleave",(()=>{o.removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((t,e)=>{if(!this.isEnabled)return void(e.dataTransfer.dropEffect="none");const{clientX:n,clientY:i}=e.domEvent;o.updateDropMarker(e.target,e.targetRanges,n,i,this._blockMode,this._draggedRange),this._draggedRange||(e.dataTransfer.dropEffect="copy"),d.isGecko||("copy"==e.dataTransfer.effectAllowed?e.dataTransfer.dropEffect="copy":["all","copyMove"].includes(e.dataTransfer.effectAllowed)&&(e.dataTransfer.dropEffect="move")),t.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get(Kw);this.listenTo(e,"clipboardInput",((e,i)=>{if("drop"!=i.method)return;const{clientX:o,clientY:r}=i.domEvent,s=n.getFinalDropRange(i.target,i.targetRanges,o,r,this._blockMode,this._draggedRange);return s?(this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),"move"==o_(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(s,!0)?(this._finalizeDragging(!1),void e.stop()):void(i.targetRanges=[t.editing.mapper.toViewRange(s)])):(this._finalizeDragging(!1),void e.stop())}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(bb);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"==o_(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,o)=>{if(d.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=r_(o.target);if(d.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&gw(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{d.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}))}_finalizeDragging(t){const e=this.editor,n=e.model;e.plugins.get(Kw).removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(t&&this.isEnabled&&n.change((t=>{const e=n.createSelection(this._draggedRange);n.deleteContent(e,{doNotAutoparagraph:!0});const i=e.getFirstPosition().parent;i.isEmpty&&!n.schema.checkChild(i,"$text")&&n.schema.checkChild(i,"paragraph")&&t.insertElement("paragraph",i,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(t){const e=this.editor,n=e.model,i=n.document.selection,o=t?r_(t):null;if(o){const t=e.editing.mapper.toModelElement(o);return this._draggedRange=Wc.fromRange(n.createRangeOn(t)),this._blockMode=n.schema.isBlock(t),void(e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop"))}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const r=Array.from(i.getSelectedBlocks()),s=i.getFirstRange();if(0==r.length)return void(this._draggedRange=Wc.fromRange(s));const a=s_(n,r);if(r.length>1)this._draggedRange=Wc.fromRange(a),this._blockMode=!0;else if(1==r.length){const t=s.start.isTouching(a.start)&&s.end.isTouching(a.end);this._draggedRange=Wc.fromRange(t?a:s),this._blockMode=t}n.change((t=>t.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:t,domTarget:e,clientX:n}){const i=this.editor.editing.view,o=i.document.selection.editableElement,r=i.domConverter.mapViewToDom(o),s=a.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Ct(a.document,"div",{style:"position: fixed; left: -999999px;"}),a.document.body.appendChild(this._previewContainer));const c=new oi(r);if(r.contains(e))return;const l=parseFloat(s.paddingLeft),u=Ct(a.document,"div");u.className="ck ck-content",u.style.width=s.width,u.style.paddingLeft=`${c.left-n+l}px`,d.isiOS&&(u.style.backgroundColor="white"),i.domConverter.setContentOf(u,t.getData("text/html")),t.setDragImage(u,0,0),this._previewContainer.appendChild(u)}}function o_(t){return d.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function r_(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(gw);if(gw(t))return t;const e=t.findAncestor((t=>gw(t)||t.is("editableElement")));return gw(e)?e:null}function s_(t,e){const n=e[0],i=e[e.length-1],o=n.getCommonAncestor(i),r=t.createPositionBefore(n),s=t.createPositionAfter(i);if(o&&o.is("element")&&!t.schema.isLimit(o)){const e=t.createRangeOn(o),n=r.isTouching(e.start),i=s.isTouching(e.end);if(n&&i)return s_(t,[o])}return t.createRange(r,s)}class a_ extends sr{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[bb]}init(){const t=this.editor,e=t.model,n=t.editing.view,i=e.document.selection;n.addObserver(ob),t.plugins.get(bb).on("contentInsertion",((t,n)=>{(function(t,e){let n=e.createRangeIn(t);if(1==t.childCount){const i=t.getChild(0);i.is("element")&&e.schema.isBlock(i)&&!e.schema.isObject(i)&&!e.schema.isLimit(i)&&(n=e.createRangeIn(i))}for(const t of n.getItems()){if(!e.schema.isInline(t))return!1;if(Array.from(t.getAttributeKeys()).find((t=>e.schema.getAttributeProperties(t).isFormatting)))return!1}return!0})(n.content,e)&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const n of r.getItems())for(const i of o)e.schema.checkAttribute(n,i[0])&&t.setAttribute(i[0],i[1],n)}))}))}}class c_ extends sr{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[kb,bb,i_,a_]}init(){const t=this.editor,e=this.editor.t;t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Copy selected content"),keystroke:"CTRL+C"},{label:e("Paste content"),keystroke:"CTRL+V"},{label:e("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}class l_ extends cr{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)||!d_(t.schema,n))do{if(n=n.parent,!n)return}while(!d_(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function d_(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const u_=zi("Ctrl+A");class h_ extends sr{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t,n=t.editing.view.document;t.commands.add("selectAll",new l_(t)),this.listenTo(n,"keydown",((e,n)=>{Li(n)===u_&&(t.execute("selectAll"),n.preventDefault())})),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Select all"),keystroke:"CTRL+A"}]})}}class m_ extends sr{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0}),t})),t.ui.componentFactory.add("menuBar:selectAll",(()=>this._createButton(lm)))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("selectAll"),o=new t(e.locale),r=n.t;return o.set({label:r("Select all"),icon:'',keystroke:"Ctrl+A"}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{e.execute("selectAll"),e.editing.view.focus()})),o}}class g_ extends sr{static get requires(){return[h_,m_]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}class p_ extends cr{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,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}get createdBatches(){return this._createdBatches}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=>!k_(t,a)));e.length&&(f_(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=Ad([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let o of s){const r=o.affectedSelectable;r&&!n.canEditAt(r)&&(o=new ud(o.baseVersion)),e.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(t,o)}}}}function f_(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class b_ extends p_{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 w_ extends p_{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 __ extends sr{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;this._undoCommand=new b_(t),this._redoCommand=new w_(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"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Undo"),keystroke:"CTRL+Z"},{label:e("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}class A_ extends sr{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?Dh.undo:Dh.redo,o="ltr"==e.uiLanguageDirection?Dh.redo:Dh.undo;this._addButtonsToFactory("undo",n("Undo"),"CTRL+Z",i),this._addButtonsToFactory("redo",n("Redo"),"CTRL+Y",o)}_addButtonsToFactory(t,e,n,i){const o=this.editor;o.ui.componentFactory.add(t,(()=>{const o=this._createButton(Lh,t,e,n,i);return o.set({tooltip:!0}),o})),o.ui.componentFactory.add("menuBar:"+t,(()=>this._createButton(lm,t,e,n,i)))}_createButton(t,e,n,i,o){const r=this.editor,s=r.locale,a=r.commands.get(e),c=new t(s);return c.set({label:n,icon:o,keystroke:i}),c.bind("isEnabled").to(a,"isEnabled"),this.listenTo(c,"execute",(()=>{r.execute(e),r.editing.view.focus()})),c}}class C_ extends sr{static get requires(){return[__,A_]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}}function v_(t,e,n,i){let o,r=null;"function"==typeof i?o=i:(r=t.commands.get(i),o=()=>{t.execute(i)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const c=ro(t.model.document.selection.getRanges());if(!c.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const l=Array.from(t.model.document.differ.getChanges()),d=l[0];if(1!=l.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const u=d.position.parent;if(u.is("element","codeBlock"))return;if(u.is("element","listItem")&&"function"!=typeof i&&!["numberedList","bulletedList","todoList"].includes(i))return;if(r&&!0===r.value)return;const h=u.getChild(0),m=t.model.createRangeOn(h);if(!m.containsRange(c)&&!c.end.isEqual(m.end))return;const g=n.exec(h.data.substr(0,c.end.offset));g&&t.model.enqueueChange((e=>{const n=e.createPositionAt(u,0),i=e.createPositionAt(u,g[0].length),r=new Wc(n,i);if(!1!==o({match:g})){e.remove(r);const n=t.model.document.selection.getFirstRange(),i=e.createRangeIn(u);!u.isEmpty||i.isEqual(n)||i.containsRange(n,!0)||e.remove(u)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function y_(t,e,n,i){let o,r;n instanceof RegExp?o=n:r=n,r=r||(t=>{let e;const n=[],i=[];for(;null!==(e=o.exec(t))&&!(e&&e.length<4);){let{index:t,1:o,2:r,3:s}=e;const a=o+r+s;t+=e[0].length-a.length;const c=[t,t+o.length],l=[t+o.length+r.length,t+o.length+r.length+s.length];n.push(c),n.push(l),i.push([t+o.length,t+o.length+r.length])}return{remove:n,format:i}}),t.model.document.on("change:data",((n,o)=>{if(o.isUndo||!o.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,u=d.parent,{text:h,range:m}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,i)=>!i.is("$text")&&!i.is("$textProxy")||i.getAttribute("code")?(n=e.createPositionAfter(i),""):t+i.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(u,0),d),s),g=r(h),p=x_(m.start,g.format,s),f=x_(m.start,g.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==i(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function x_(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function E_(t,e){return(n,i)=>{if(!t.commands.get(e).isEnabled)return!1;const o=t.model.schema.getValidRanges(i,e);for(const t of o)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class D_ extends cr{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,i=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)i?t.setSelectionAttribute(this.attributeKey,!0):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)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const S_="bold";class I_ extends sr{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:S_}),t.model.schema.setAttributeProperties(S_,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:S_,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e&&("bold"==e||Number(e)>=600)?{name:!0,styles:["font-weight"]}:null}]}),t.commands.add(S_,new D_(t,S_)),t.keystrokes.set("CTRL+B",S_),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Bold text"),keystroke:"CTRL+B"}]})}}function T_({editor:t,commandName:e,plugin:n,icon:i,label:o,keystroke:r}){return s=>{const a=t.commands.get(e),c=new s(t.locale);return c.set({label:o,icon:i,keystroke:r,isToggleable:!0}),c.bind("isEnabled").to(a,"isEnabled"),c.bind("isOn").to(a,"value"),c instanceof lm?c.set({role:"menuitemcheckbox"}):c.set({tooltip:!0}),n.listenTo(c,"execute",(()=>{t.execute(e),t.editing.view.focus()})),c}}const B_="bold";class M_ extends sr{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=T_({editor:t,commandName:B_,plugin:this,icon:Dh.bold,label:e("Bold"),keystroke:"CTRL+B"});t.ui.componentFactory.add(B_,(()=>n(Lh))),t.ui.componentFactory.add("menuBar:"+B_,(()=>n(lm)))}}const P_="italic";class N_ extends sr{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:P_}),t.model.schema.setAttributeProperties(P_,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:P_,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(P_,new D_(t,P_)),t.keystrokes.set("CTRL+I",P_),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Italic text"),keystroke:"CTRL+I"}]})}}const L_="italic";class z_ extends sr{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=T_({editor:t,commandName:L_,plugin:this,icon:'',keystroke:"CTRL+I",label:e("Italic")});t.ui.componentFactory.add(L_,(()=>n(Lh))),t.ui.componentFactory.add("menuBar:"+L_,(()=>n(lm)))}}class O_ extends cr{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,i=e.document.selection,o=Array.from(i.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=o.filter((t=>V_(t)||R_(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,o.filter(V_))}))}_getValue(){const t=ro(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!V_(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=ro(t.getSelectedBlocks());return!!n&&R_(e,n)}_removeQuote(t,e){F_(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];F_(t,e).reverse().forEach((e=>{let i=V_(e.start);i||(i=t.createElement("blockQuote"),t.wrap(e,i)),n.push(i)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function V_(t){return"blockQuote"==t.parent.name?t.parent:null}function F_(t,e){let n,i=0;const o=[];for(;i{const i=t.model.document.differ.getChanges();for(const t of i)if("insert"==t.type){const i=t.position.nodeAfter;if(!i)continue;if(i.is("element","blockQuote")&&i.isEmpty)return n.remove(i),!0;if(i.is("element","blockQuote")&&!e.checkChild(t.position,i))return n.unwrap(i),!0;if(i.is("element")){const t=n.createRangeIn(i);for(const i of t.getItems())if(i.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(i),i))return n.unwrap(i),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,i=t.model.document.selection,o=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{i.isCollapsed&&o.value&&i.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!i.isCollapsed||!o.value)return;const r=i.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var H_=o(1501),U_={attributes:{"data-cke":!0}};U_.setAttributes=Qo(),U_.insert=Ko().bind(null,"head"),U_.domAPI=qo(),U_.insertStyleElement=Jo(),Wo()(H_.A,U_),H_.A&&H_.A.locals&&H_.A.locals;class W_ extends sr{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("blockQuote",(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0}),t})),t.ui.componentFactory.add("menuBar:blockQuote",(()=>{const t=this._createButton(lm);return t.set({role:"menuitemcheckbox"}),t}))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("blockQuote"),o=new t(e.locale),r=n.t;return o.set({label:r("Block quote"),icon:Dh.quote,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value"),this.listenTo(o,"execute",(()=>{e.execute("blockQuote"),e.editing.view.focus()})),o}}class G_ extends cr{constructor(t){super(t),this._isEnabledBasedOnSelection=!1}refresh(){const t=this.editor.model,e=ro(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&q_(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document,i=t.selection||n.selection;e.canEditAt(i)&&e.change((t=>{const n=i.getSelectedBlocks();for(const i of n)!i.is("element","paragraph")&&q_(i,e.schema)&&t.rename(i,"paragraph")}))}}function q_(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class $_ extends cr{constructor(t){super(t),this._isEnabledBasedOnSelection=!1}execute(t){const e=this.editor.model,n=t.attributes;let i=t.position;return e.canEditAt(i)?e.change((t=>{if(i=this._findPositionToInsertParagraph(i,t),!i)return null;const o=t.createElement("paragraph");return n&&e.schema.setAllowedAttributes(o,n,t),e.insertContent(o,i),t.setSelection(o,"in"),t.createPositionAt(o,0)})):null}_findPositionToInsertParagraph(t,e){const n=this.editor.model;if(n.schema.checkChild(t,"paragraph"))return t;const i=n.schema.findAllowedParent(t,"paragraph");if(!i)return null;const o=t.parent,r=n.schema.checkChild(o,"$text");return o.isEmpty||r&&t.isAtEnd?n.createPositionAfter(o):!o.isEmpty&&r&&t.isAtStart?n.createPositionBefore(o):e.split(t,i).position}}class K_ extends sr{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new G_(t)),t.commands.add("insertParagraph",new $_(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>K_.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}K_.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);const Y_=K_;class Q_ extends cr{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=ro(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>Z_(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=>Z_(t,i,e.schema)));for(const e of o)e.is("element",i)||t.rename(e,i)}))}}function Z_(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const J_="paragraph";class X_ extends sr{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}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[Y_]}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 Q_(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",J_)&&0===o.childCount&&i.writer.rename(o,J_)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:E.low+1})}}var tA=o(6186),eA={attributes:{"data-cke":!0}};eA.setAttributes=Qo(),eA.insert=Ko().bind(null,"head"),eA.domAPI=qo(),eA.insertStyleElement=Jo(),Wo()(tA.A,eA),tA.A&&tA.A.locals&&tA.A.locals;class nA extends sr{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}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 oo,a=t.commands.get("heading"),c=t.commands.get("paragraph"),l=[a];for(const t of n){const e={type:"button",model:new Gf({label:t.title,class:t.class,role:"menuitemradio",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=tp(e);return ip(d,s,{ariaLabel:o,role:"menu"}),d.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,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=e?"paragraph":t;return"boolean"==typeof n?i:r[n]?r[n]:i})),d.buttonView.bind("ariaLabel").to(a,"value",c,"value",((t,e)=>{const n=e?"paragraph":t;return"boolean"==typeof n?o:r[n]?`${r[n]}, ${o}`:o})),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})),t.ui.componentFactory.add("menuBar:heading",(i=>{const o=new Pk(i),r=t.commands.get("heading"),s=t.commands.get("paragraph"),a=[r],c=new Nk(i);o.set({class:"ck-heading-dropdown"}),c.set({ariaLabel:e("Heading"),role:"menu"}),o.buttonView.set({label:e("Heading")}),o.panelView.children.add(c);for(const e of n){const n=new Af(i,o),l=new lm(i);n.children.add(l),c.items.add(n),l.set({isToggleable:!0,label:e.title,role:"menuitemradio",class:e.class}),l.delegate("execute").to(o),l.on("execute",(()=>{const n="paragraph"===e.model?"paragraph":"heading";t.execute(n,{value:e.model}),t.editing.view.focus()})),"paragraph"===e.model?(l.bind("isOn").to(s,"value"),a.push(s)):l.bind("isOn").to(r,"value",(t=>t===e.model))}return o.bind("isEnabled").toMany(a,"isEnabled",((...t)=>t.some((t=>t)))),o}))}}class iA extends cr{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection,i=oA(n);this.isEnabled=function(t,e,n){const i=function(t,e){const n=_w(t,e).start.parent;return n.isEmpty&&!n.is("rootElement")?n.parent:n}(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=oA(n):(o=i.createElement("rawHtml"),e.insertObject(o,null,null,{setSelection:"on"})),i.setAttribute("value",t,o)}))}}function oA(t){const e=t.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}var rA=o(9856),sA={attributes:{"data-cke":!0}};sA.setAttributes=Qo(),sA.insert=Ko().bind(null,"head"),sA.domAPI=qo(),sA.insertStyleElement=Jo(),Wo()(rA.A,sA),rA.A&&rA.A.locals&&rA.A.locals;class aA extends sr{static get pluginName(){return"HtmlEmbedEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this._widgetButtonViewReferences=new Set,t.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:t=>(T("html-embed-provide-sanitize-function"),{html:t,hasChanged:!1})})}init(){const t=this.editor;t.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),t.commands.add("htmlEmbed",new iA(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({editor:t,domElement:n,state:o,props:r}){n.textContent="";const a=n.ownerDocument;let c;if(o.isEditable){const t={isDisabled:!1,placeholder:r.textareaPlaceholder};c=s({domDocument:a,state:o,props:t}),n.append(c)}else if(o.showPreviews){const i={sanitizeHtml:r.sanitizeHtml};n.append(function({editor:t,domDocument:n,state:i,props:o}){const r=o.sanitizeHtml(i.getRawHtmlValue()),s=Ct(n,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},i.getRawHtmlValue().length>0?e("No preview available"):e("Empty snippet content")),a=Ct(n,"div",{class:"raw-html-embed__preview-content",dir:t.locale.contentLanguageDirection}),c=n.createRange().createContextualFragment(r.html);a.appendChild(c);return Ct(n,"div",{class:"raw-html-embed__preview"},[s,a])}({domDocument:a,state:o,props:i,editor:t}))}else{const t={isDisabled:!0,placeholder:r.textareaPlaceholder};n.append(s({domDocument:a,state:o,props:t}))}const l={onEditClick:r.onEditClick,onSaveClick:()=>{r.onSaveClick(c.value)},onCancelClick:r.onCancelClick};n.prepend(function({editor:t,domDocument:e,state:n,props:o}){const r=Ct(e,"div",{class:"raw-html-embed__buttons-wrapper"});if(n.isEditable){const e=cA(t,"save",o.onSaveClick),n=cA(t,"cancel",o.onCancelClick);r.append(e.element,n.element),i.add(e).add(n)}else{const e=cA(t,"edit",o.onEditClick);r.append(e.element),i.add(e)}return r}({editor:t,domDocument:a,state:o,props:l}))}function s({domDocument:t,state:e,props:n}){const i=Ct(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&&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({editor:t,domElement:e,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),pw(h,s,{label:e("HTML snippet"),hasSelectionHandle:!0})}})}}function cA(t,e,n){const{t:i}=t.locale,o=new Lh(t.locale),r=t.commands.get("htmlEmbed");return o.set({class:`raw-html-embed__${e}-button`,icon:Dh.pencil,tooltip:!0,tooltipPosition:"rtl"===t.locale.uiLanguageDirection?"e":"w"}),o.render(),"edit"===e?(o.set({icon:Dh.pencil,label:i("Edit source")}),o.bind("isEnabled").to(r)):"save"===e?(o.set({icon:Dh.check,label:i("Save changes")}),o.bind("isEnabled").to(r)):o.set({icon:Dh.cancel,label:i("Cancel")}),o.on("execute",n),o}class lA extends sr{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t;t.ui.componentFactory.add("htmlEmbed",(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0,label:e("Insert HTML")}),t})),t.ui.componentFactory.add("menuBar:htmlEmbed",(()=>{const t=this._createButton(lm);return t.set({label:e("HTML snippet")}),t}))}_createButton(t){const e=this.editor,n=e.commands.get("htmlEmbed"),i=new t(e.locale);return i.set({icon:Dh.html}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",(()=>{e.execute("htmlEmbed"),e.editing.view.focus(),e.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),i}}class dA extends cr{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)}))}}function uA(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot("children")])}function hA(t,e){const n=t.plugins.get("ImageUtils"),i=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>n.isInlineImageView(t)?i&&("block"==t.getStyle("display")||t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:o(t):null;function o(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function mA(t,e){const n=ro(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}function gA(t){return t&&t.endsWith("px")?parseInt(t):null}function pA(t){const e=gA(t.getStyle("width")),n=gA(t.getStyle("height"));return!(!e||!n)}const fA=/^(image|image-inline)$/;class kA extends sr{constructor(){super(...arguments),this._domEmitter=new(Kn())}static get pluginName(){return"ImageUtils"}static get isOfficialPlugin(){return!0}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,i={}){const o=this.editor,r=o.model,s=r.document.selection,a=bA(o,e||s,n);t={...Object.fromEntries(s.getAttributes()),...t};for(const e in t)r.schema.checkAttribute(a,e)||delete t[e];return r.change((n=>{const{setImageSizes:o=!0}=i,s=n.createElement(a,t);return r.insertObject(s,e,null,{setSelection:"on",findOptimalPosition:e||"imageInline"==a?void 0:"auto"}),s.parent?(o&&this.setImageNaturalSizeAttributes(s),s):null}))}setImageNaturalSizeAttributes(t){const e=t.getAttribute("src");e&&(t.getAttribute("width")||t.getAttribute("height")||this.editor.model.change((n=>{const i=new a.window.Image;this._domEmitter.listenTo(i,"load",(()=>{t.getAttribute("width")||t.getAttribute("height")||this.editor.model.enqueueChange(n.batch,(e=>{e.setAttribute("width",i.naturalWidth,t),e.setAttribute("height",i.naturalHeight,t)})),this._domEmitter.stopListening(i,"load")})),i.src=e})))}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")}getImageWidgetFromImageView(t){return t.findAncestor({classes:fA})}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==bA(t,e,null)){const n=function(t,e){const n=_w(t,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(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){return e.setCustomProperty("image",!0,t),pw(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&gw(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}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function bA(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":"auto"!==o?"imageBlock":e.is("selection")?mA(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class wA extends sr{static get requires(){return[kA]}static get pluginName(){return"ImageTextAlternativeEditing"}static get isOfficialPlugin(){return!0}init(){this.editor.commands.add("imageTextAlternative",new dA(this.editor))}}var _A=o(8429),AA={attributes:{"data-cke":!0}};AA.setAttributes=Qo(),AA.insert=Ko().bind(null,"head"),AA.domAPI=qo(),AA.insertStyleElement=Jo(),Wo()(_A.A,AA),_A.A&&_A.A.locals&&_A.A.locals;var CA=o(871),vA={attributes:{"data-cke":!0}};vA.setAttributes=Qo(),vA.insert=Ko().bind(null,"head"),vA.domAPI=qo(),vA.insertStyleElement=Jo(),Wo()(CA.A,vA),CA.A&&CA.A.locals&&CA.A.locals;class yA extends er{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new so,this.keystrokes=new uo,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Dh.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Dh.cancel,"ck-button-cancel","cancel"),this._focusables=new Ao,this._focusCycler=new Rh({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]})}render(){super.render(),this.keystrokes.listenTo(this.element),or({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 Lh(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 $m(this.locale,cp);return e.label=t("Text alternative"),e}}function xA(t){const e=t.editing.view,n=Ig.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 EA extends sr{static get requires(){return[Zf]}static get pluginName(){return"ImageTextAlternativeUI"}static get isOfficialPlugin(){return!0}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 Lh(n);return o.set({label:e("Change image text alternative"),icon:Dh.textAlternative,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 t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(ir(yA))(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.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(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=xA(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),nr({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:xA(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){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 sr{static get requires(){return[wA,EA]}static get pluginName(){return"ImageTextAlternative"}static get isOfficialPlugin(){return!0}}function SA(t,e){const 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);null===n.attributeNewValue?(o.removeAttribute("srcset",s),o.removeAttribute("sizes",s)):n.attributeNewValue&&(o.setAttribute("srcset",n.attributeNewValue,s),o.setAttribute("sizes","100vw",s))};return t=>{t.on(`attribute:srcset:${e}`,n)}}function IA(t,e,n){const 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)};return t=>{t.on(`attribute:${n}:${e}`,i)}}class TA extends xa{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}stopObserving(t){this.stopListening(t)}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class BA extends cr{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&T("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&T("image-inline-plugin-required")}refresh(){const t=this.editor.plugins.get("ImageUtils");this.isEnabled=t.isImageAllowed()}execute(t){const e=Ri(t.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((e,r)=>{const s=n.getSelectedElement();if("string"==typeof e&&(e={src:e}),r&&s&&i.isImage(s)){const n=this.editor.model.createPositionAfter(s);i.insertImage({...e,...o},n,t.imageType)}else t.breakBlock?i.insertImage({...e,...o},n.getFirstPosition(),t.imageType):i.insertImage({...e,...o},null,t.imageType)}))}}class MA extends cr{constructor(t){super(t),this.decorate("cleanupImage")}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(),n=this.editor.plugins.get("ImageUtils");this.editor.model.change((i=>{i.setAttribute("src",t.source,e),this.cleanupImage(i,e),n.setImageNaturalSizeAttributes(e)}))}cleanupImage(t,e){t.removeAttribute("srcset",e),t.removeAttribute("sizes",e),t.removeAttribute("sources",e),t.removeAttribute("width",e),t.removeAttribute("height",e),t.removeAttribute("alt",e)}}class PA extends sr{static get requires(){return[kA]}static get pluginName(){return"ImageEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(TA),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const n=new BA(t),i=new MA(t);t.commands.add("insertImage",n),t.commands.add("replaceImageSource",i),t.commands.add("imageInsert",n)}}class NA extends sr{static get requires(){return[kA]}static get pluginName(){return"ImageSizeAttributes"}static get isOfficialPlugin(){return!0}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i="imageBlock"===t?"figure":"img";function o(e,i,o,r,s=!1){e.on(`attribute:${i}:${t}`,((e,i,a)=>{if(!a.consumable.consume(i.item,e.name))return;const c=a.writer,l=a.mapper.toViewElement(i.item),d=n.findViewImgElement(l);null!==i.attributeNewValue?c.setAttribute(o,i.attributeNewValue,d):c.removeAttribute(o,d);const u=i.item.getAttribute("width"),h=i.item.getAttribute("height"),m=u&&h;if(m&&s&&c.setAttribute("loading","lazy",d),i.item.hasAttribute("sources"))return;const g=i.item.hasAttribute("resizedWidth");("imageInline"!==t||g||r)&&m&&c.setStyle("aspect-ratio",`${u}/${h}`,d)}))}e.conversion.for("upcast").attributeToAttribute({view:{name:i,styles:{width:/.+/}},model:{key:"width",value:t=>pA(t)?gA(t.getStyle("width")):null}}).attributeToAttribute({view:{name:i,key:"width"},model:"width"}).attributeToAttribute({view:{name:i,styles:{height:/.+/}},model:{key:"height",value:t=>pA(t)?gA(t.getStyle("height")):null}}).attributeToAttribute({view:{name:i,key:"height"},model:"height"}),e.conversion.for("editingDowncast").add((t=>{o(t,"width","width",!0,!0),o(t,"height","height",!0,!0)})),e.conversion.for("dataDowncast").add((t=>{o(t,"width","width",!1),o(t,"height","height",!1)}))}}class LA extends cr{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(t={}){const e=this.editor,n=this.editor.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(n.document.selection),r=Object.fromEntries(o.getAttributes());return r.src||r.uploadId?n.change((e=>{const{setImageSizes:s=!0}=t,a=Array.from(n.markers).filter((t=>t.getRange().containsItem(o))),c=i.insertImage(r,n.createSelection(o,"on"),this._modelElementName,{setImageSizes:s});if(!c)return null;const l=e.createRangeOn(c);for(const t of a){const n=t.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(l,!0):l;e.updateMarker(t,{range:i})}return{oldElement:o,newElement:c}})):null}}var zA=o(1091),OA={attributes:{"data-cke":!0}};OA.setAttributes=Qo(),OA.insert=Ko().bind(null,"head"),OA.domAPI=qo(),OA.insertStyleElement=Jo(),Wo()(zA.A,OA),zA.A&&zA.A.locals&&zA.A.locals;class VA extends sr{static get requires(){return[kA]}static get pluginName(){return"ImagePlaceholder"}static get isOfficialPlugin(){return!0}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const t=this.editor.model.schema;t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["placeholder"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const t=this.editor,e=t.conversion,n=t.plugins.get("ImageUtils");e.for("editingDowncast").add((t=>{t.on("attribute:placeholder",((t,e,i)=>{if(!i.consumable.test(e.item,t.name))return;if(!e.item.is("element","imageBlock")&&!e.item.is("element","imageInline"))return;i.consumable.consume(e.item,t.name);const o=i.writer,r=i.mapper.toViewElement(e.item),s=n.findViewImgElement(r);e.attributeNewValue?(o.addClass("image_placeholder",s),o.setStyle("background-image",`url(${e.attributeNewValue})`,s),o.setCustomProperty("editingPipeline:doNotReuseOnce",!0,s)):(o.removeClass("image_placeholder",s),o.removeStyle("background-image",s))}))}))}_setupLoadListener(){const t=this.editor,e=t.model,n=t.editing,i=n.view,o=t.plugins.get("ImageUtils");i.addObserver(TA),this.listenTo(i.document,"imageLoaded",((t,r)=>{const s=i.domConverter.mapDomToView(r.target);if(!s)return;const a=o.getImageWidgetFromImageView(s);if(!a)return;const c=n.mapper.toModelElement(a);c&&c.hasAttribute("placeholder")&&e.enqueueChange({isUndoable:!1},(t=>{t.removeAttribute("placeholder",c)}))}))}}class FA extends sr{static get requires(){return[PA,NA,kA,VA,bb]}static get pluginName(){return"ImageBlockEditing"}static get isOfficialPlugin(){return!0}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 LA(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})=>uA(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>i.toImageWidget(uA(n),n,e("image widget"))}),n.for("downcast").add(IA(i,"imageBlock","src")).add(IA(i,"imageBlock","alt")).add(SA(i,"imageBlock")),n.for("upcast").elementToElement({view:hA(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)}).add(function(t){const 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=ro(i.convertItem(o,n.modelCursor).modelRange.getItems());r?(i.convertChildren(n.viewItem,r),i.updateConversionResult(r,n)):i.consumable.revert(n.viewItem,{name:!0,classes:"image"})};return t=>{t.on("element:figure",e)}}(i))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"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"===mA(e.schema,c)){const t=new bu(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageBlock")&&i.setImageNaturalSizeAttributes(t)}))}))}}var RA=o(1545),jA={attributes:{"data-cke":!0}};jA.setAttributes=Qo(),jA.insert=Ko().bind(null,"head"),jA.domAPI=qo(),jA.insertStyleElement=Jo(),Wo()(RA.A,jA),RA.A&&RA.A.locals&&RA.A.locals;class HA extends er{constructor(t,e=[]){super(t),this.focusTracker=new so,this.keystrokes=new uo,this._focusables=new Ao,this.children=this.createCollection(),this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const t of e)this.children.add(t),this._focusables.add(t),t instanceof Tm&&this._focusables.addMany(t.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),or({view:this});for(const t of this._focusables)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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class UA extends sr{static get pluginName(){return"ImageInsertUI"}static get isOfficialPlugin(){return!0}static get requires(){return[kA]}constructor(t){super(t),this._integrations=new Map,t.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(t.model.document,"change",(()=>{this.isImageSelected=n.isImage(e.getSelectedElement())}));const i=t=>this._createToolbarComponent(t);t.ui.componentFactory.add("insertImage",i),t.ui.componentFactory.add("imageInsert",i),t.ui.componentFactory.add("menuBar:insertImage",(t=>this._createMenuBarComponent(t)))}registerIntegration({name:t,observable:e,buttonViewCreator:n,formViewCreator:i,menuBarButtonViewCreator:o,requiresForm:r=!1,override:s=!1}){this._integrations.has(t)&&!s&&T("image-insert-integration-exists",{name:t}),this._integrations.set(t,{observable:e,buttonViewCreator:n,menuBarButtonViewCreator:o,formViewCreator:i,requiresForm:r})}_createToolbarComponent(t){const e=this.editor,n=t.t,i=this._prepareIntegrations();if(!i.length)return null;let o;const r=i[0];if(1==i.length){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const e=r.buttonViewCreator(!1);o=new Yg(t,e),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",(t=>n(t?"Replace image":"Insert image")))}const s=this.dropdownView=tp(t,o),a=i.map((({observable:t})=>"function"==typeof t?t():t));return s.bind("isEnabled").toMany(a,"isEnabled",((...t)=>t.some((t=>t)))),s.once("change:isOpen",(()=>{const t=i.flatMap((({formViewCreator:t})=>t(1==i.length))),n=new HA(e.locale,t);s.panelView.children.add(n)})),s}_createMenuBarComponent(t){const e=t.t,n=this._prepareIntegrations();if(!n.length)return null;const i=n.flatMap((({menuBarButtonViewCreator:t})=>t(1==n.length))),o=new Pk(t),r=new Nk(t);o.panelView.children.add(r),o.buttonView.set({icon:Dh.image,label:e("Image")});for(const e of i){const n=new Af(t,o);n.children.add(e),r.items.add(n),e.delegate("execute").to(o)}return o}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),e=[];if(!t.length)return T("image-insert-integrations-not-specified"),e;for(const n of t)this._integrations.has(n)?e.push(this._integrations.get(n)):["upload","assetManager","url"].includes(n)||T("image-insert-unknown-integration",{item:n});return e.length||T("image-insert-integrations-not-registered"),e}}var WA=o(8574),GA={attributes:{"data-cke":!0}};GA.setAttributes=Qo(),GA.insert=Ko().bind(null,"head"),GA.domAPI=qo(),GA.insertStyleElement=Jo(),Wo()(WA.A,GA),WA.A&&WA.A.locals&&WA.A.locals;class qA extends sr{static get requires(){return[FA,zw,DA,UA]}static get pluginName(){return"ImageBlock"}static get isOfficialPlugin(){return!0}}class $A extends sr{static get requires(){return[PA,NA,kA,VA,bb]}static get pluginName(){return"ImageInlineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new LA(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(IA(i,"imageInline","src")).add(IA(i,"imageInline","alt")).add(SA(i,"imageInline")),n.for("upcast").elementToElement({view:hA(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"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"===mA(e.schema,c)){const t=new bu(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)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageInline")&&i.setImageNaturalSizeAttributes(t)}))}))}}class KA extends sr{static get requires(){return[$A,zw,DA,UA]}static get pluginName(){return"ImageInline"}static get isOfficialPlugin(){return!0}}class YA extends cr{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils"),n=t.plugins.get("ImageUtils");if(!t.plugins.has(FA))return this.isEnabled=!1,void(this.value=!1);const i=t.model.document.selection,o=i.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(i);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=n.isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):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"),o=this.editor.plugins.get("ImageUtils");let r=n.getSelectedElement();const s=i._getSavedCaption(r);o.isInlineImage(r)&&(this.editor.execute("imageTypeBlock"),r=n.getSelectedElement());const a=s||t.createElement("caption");t.append(a,r),e&&t.setSelection(a,"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 QA extends sr{static get pluginName(){return"ImageCaptionUtils"}static get isOfficialPlugin(){return!0}static get requires(){return[kA]}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 ZA extends sr{static get requires(){return[kA,QA]}static get pluginName(){return"ImageCaptionEditing"}static get isOfficialPlugin(){return!0}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 YA(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),r.placeholder=o("Enter image caption"),Vr({view:e,element:r,keepOnFocus:!0});const s=t.parent.getAttribute("alt");return ww(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?Xc.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 JA extends sr{static get requires(){return[QA]}static get pluginName(){return"ImageCaptionUI"}static get isOfficialPlugin(){return!0}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 Lh(o);return s.set({icon:Dh.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 XA=o(3038),tC={attributes:{"data-cke":!0}};tC.setAttributes=Qo(),tC.insert=Ko().bind(null,"head"),tC.domAPI=qo(),tC.insertStyleElement=Jo(),Wo()(XA.A,tC),XA.A&&XA.A.locals&&XA.A.locals;class eC extends cr{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,{setImageSizes:r=!0}=t;let s=i.getClosestSelectedImageElement(n.document.selection);o&&this.shouldConvertImageType(o,s)&&(this.editor.execute(i.isBlockImage(s)?"imageTypeInline":"imageTypeBlock",{setImageSizes:r}),s=i.getClosestSelectedImageElement(n.document.selection)),!o||this._styles.get(o).isDefault?e.removeAttribute("imageStyle",s):e.setAttribute("imageStyle",o,s),r&&i.setImageNaturalSizeAttributes(s)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const nC={get inline(){return{name:"inline",title:"In line",icon:Dh.objectInline,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Dh.objectLeft,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Dh.objectBlockLeft,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Dh.objectCenter,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Dh.objectRight,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Dh.objectBlockRight,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Dh.objectCenter,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Dh.objectRight,modelElements:["imageBlock"],className:"image-style-side"}}},iC=(()=>({full:Dh.objectFullWidth,left:Dh.objectBlockLeft,right:Dh.objectBlockRight,center:Dh.objectCenter,inlineLeft:Dh.objectLeft,inlineRight:Dh.objectRight,inline:Dh.objectInline}))(),oC=[{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 rC(t){T("image-style-configuration-definition-invalid",t)}const sC={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>{return"string"==typeof(e="string"==typeof(e=t)?nC[e]?{...nC[e]}:{name:e}:function(t,e){const n={...e};for(const i in t)Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);return n}(nC[e.name],e)).icon&&(e.icon=iC[e.icon]||e.icon),e;var e})).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:i,name:o}=t;if(!(i&&i.length&&o))return rC({style:t}),!1;{const o=[e?"imageBlock":null,n?"imageInline":null];if(!i.some((t=>o.includes(t))))return T("image-style-missing-dependency",{style:t,missingPlugins:i.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},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")?[...oC]:[]},warnInvalidStyle:rC,DEFAULT_OPTIONS:nC,DEFAULT_ICONS:iC,DEFAULT_DROPDOWN_DEFINITIONS:oC};function aC(t,e){for(const n of e)if(n.name===t)return n}class cC extends sr{static get pluginName(){return"ImageStyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[kA]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=sC,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 eC(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,i=n.model.schema,o=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=aC(e.attributeNewValue,r),o=aC(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;o&&a.removeClass(o.className,s),i&&a.addClass(i.className,s)});var r;const s=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=ro(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",s,{priority:"low"})),e&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(kA),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 lC=o(7879),dC={attributes:{"data-cke":!0}};dC.setAttributes=Qo(),dC.insert=Ko().bind(null,"head"),dC.domAPI=qo(),dC.insertStyleElement=Jo(),Wo()(lC.A,dC),lC.A&&lC.A.locals&&lC.A.locals;class uC extends sr{static get requires(){return[cC]}static get pluginName(){return"ImageStyleUI"}static get isOfficialPlugin(){return!0}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=hC(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const i=hC([...e.filter(G),...sC.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})=>mC(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(o=e),e}));s.length!==c.length&&sC.warnInvalidStyle({dropdown:t});const l=tp(i,Yg),d=l.buttonView,u=d.arrowView;return ep(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:gC(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(qi);return e<0?o.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(qi);return gC(a,e<0?o.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(qi))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(qi)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:o.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(qi))),this.listenTo(l,"execute",(()=>{this.editor.editing.view.focus()})),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(mC(e),(n=>{const i=this.editor.commands.get("imageStyle"),o=new Lh(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 hC(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function mC(t){return`imageStyle:${t}`}function gC(t,e){return(t?t+": ":"")+e}function pC(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function fC(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class kC extends sr{static get pluginName(){return"ImageUploadUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("uploadImage",(()=>this._createToolbarButton())),t.ui.componentFactory.add("imageUpload",(()=>this._createToolbarButton())),t.ui.componentFactory.add("menuBar:uploadImage",(()=>this._createMenuBarButton("standalone"))),t.plugins.has("ImageInsertUI")&&t.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>t.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:t=>this._createMenuBarButton(t?"insertOnly":"insertNested")})}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("uploadImage"),o=e.config.get("image.upload.types"),r=pC(o),s=new t(e.locale),a=n.t;return s.set({acceptedType:o.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0,label:a("Upload from computer"),icon:Dh.imageUpload}),s.bind("isEnabled").to(i),s.on("done",((t,n)=>{const i=Array.from(n).filter((t=>r.test(t.type)));i.length&&(e.execute("uploadImage",{file:i}),e.editing.view.focus())})),s}_createToolbarButton(){const t=this.editor.locale.t,e=this.editor.plugins.get("ImageInsertUI"),n=this.editor.commands.get("uploadImage"),i=this._createButton(vm);return i.tooltip=!0,i.bind("label").to(e,"isImageSelected",n,"isAccessAllowed",((e,n)=>t(n?e?"Replace image from computer":"Upload image from computer":"You have no image upload permissions."))),i}_createDropdownButton(){const t=this.editor.locale.t,e=this.editor.plugins.get("ImageInsertUI"),n=this._createButton(vm);return n.withText=!0,n.bind("label").to(e,"isImageSelected",(e=>t(e?"Replace from computer":"Upload from computer"))),n.on("execute",(()=>{e.dropdownView.isOpen=!1})),n}_createMenuBarButton(t){const e=this.editor.locale.t,n=this._createButton(zk);switch(n.withText=!0,t){case"standalone":n.label=e("Image from computer");break;case"insertOnly":n.label=e("Image");break;case"insertNested":n.label=e("From computer")}return n}}class bC extends(J()){constructor(){super();const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,i)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{i("error")},e.onabort=()=>{i("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}class wC extends sr{constructor(){super(...arguments),this.loaders=new oo,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get isOfficialPlugin(){return!0}static get requires(){return[Eh]}init(){this.loaders.on("change",(()=>this._updatePendingAction())),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return T("filerepository-no-upload-adapter"),null;const e=new _C(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof _C?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(Eh);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}class _C extends(J()){constructor(t,e){super(),this.id=x(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new bC,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new I("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new I("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,i)=>{e.rejecter=i,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,i(t)}))})),e}}var AC=o(7504),CC={attributes:{"data-cke":!0}};CC.setAttributes=Qo(),CC.insert=Ko().bind(null,"head"),CC.domAPI=qo(),CC.insertStyleElement=Jo(),Wo()(AC.A,CC),AC.A&&AC.A.locals&&AC.A.locals;var vC=o(1230),yC={attributes:{"data-cke":!0}};yC.setAttributes=Qo(),yC.insert=Ko().bind(null,"head"),yC.domAPI=qo(),yC.insertStyleElement=Jo(),Wo()(vC.A,yC),vC.A&&vC.A.locals&&vC.A.locals;var xC=o(1160),EC={attributes:{"data-cke":!0}};EC.setAttributes=Qo(),EC.insert=Ko().bind(null,"head"),EC.domAPI=qo(),EC.insertStyleElement=Jo(),Wo()(xC.A,EC),xC.A&&xC.A.locals&&xC.A.locals;class DC extends sr{static get pluginName(){return"ImageUploadProgress"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this.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(wC),c=r?e.attributeNewValue:null,l=this.placeholder,d=i.editing.mapper.toViewElement(o),u=n.writer;if("reading"==c)return SC(d,u),void IC(s,l,d,u);if("uploading"==c){const t=a.loaders.get(r);return SC(d,u),void(t?(TC(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)):IC(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){MC(t,e,"progressBar")}(d,u),TC(d,u),function(t,e){e.removeClass("ck-appear",t)}(d,u)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function SC(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function IC(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),BC(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 TC(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),MC(t,e,"placeholder")}function BC(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function MC(t,e,n){const i=BC(t,n);i&&e.remove(e.createRangeOn(i))}class PC extends cr{constructor(t){super(t),this.set("isAccessAllowed",!0)}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=Ri(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(wC).createLoader(t),r=i.plugins.get("ImageUtils");o&&r.insertImage({...e,uploadId:o.id},n)}}class NC extends sr{static get requires(){return[wC,Wf,bb,kA]}static get pluginName(){return"ImageUploadEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this._uploadedImages=new Map,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(wC),o=t.plugins.get("ImageUtils"),r=t.plugins.get("ClipboardPipeline"),s=pC(t.config.get("image.upload.types")),c=new PC(t);t.commands.add("uploadImage",c),t.commands.add("imageUpload",c),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add((t=>t.on("element:img",((t,e,n)=>{if(!n.consumable.test(e.viewItem,{attributes:["data-ck-upload-id"]}))return;const o=e.viewItem.getAttribute("data-ck-upload-id");if(!o)return;const[r]=Array.from(e.modelRange.getItems({shallow:!0})),s=i.loaders.get(o);r&&(n.writer.setAttribute("uploadId",o,r),n.consumable.consume(e.viewItem,{attributes:["data-ck-upload-id"]}),s&&s.data&&n.writer.setAttribute("uploadStatus",s.status,r))}),{priority:"low"}))),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&&s.test(t.type)));if(o.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.execute("uploadImage",{file:o})})),!t.commands.get("uploadImage").isAccessAllowed)){const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("You have no image upload permissions."),{namespace:"image"})}})),this.listenTo(r,"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).map((t=>t.item)).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)&&!t.getAttribute("uploadProcessed"))).map((t=>{return{promise:(e=t,new Promise(((t,n)=>{const i=e.getAttribute("src");fetch(i).then((t=>t.blob())).then((e=>{const n=fC(e,i),o=n.replace("image/",""),r=new File([e],`image.${o}`,{type:n});t(r)})).catch((e=>e&&"TypeError"===e.name?function(t){return function(t){return new Promise(((e,n)=>{const i=a.document.createElement("img");i.addEventListener("load",(()=>{const t=a.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=fC(e,t),i=n.replace("image/","");return new File([e],`image.${i}`,{type:n})}))}(i).then(t).catch(n):n(e)))}))),imageElement:t};var e}));if(!r.length)return;const s=new bu(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 LC(t,n)){const n=e.getAttribute("uploadId");if(!n)continue;const s=i.loaders.get(n);s?r?o.has(n)||Array.from(this._uploadImageElements.get(n)).every((t=>"$graveyard"==t.root.rootName))&&s.abort():(o.add(n),this._uploadImageElements.has(n)?this._uploadImageElements.get(n).add(e):this._uploadImageElements.set(n,new Set([e])),"idle"==s.status&&this._readAndUpload(s)):!r&&this._uploadedImages.has(n)&&t.model.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","complete",e),this.fire("uploadComplete",{data:this._uploadedImages.get(n),imageElement:e})}))}}})),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),o.setImageNaturalSizeAttributes(e)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"))}_readAndUpload(t){const e=this.editor,n=e.model,i=e.locale.t,o=e.plugins.get(wC),r=e.plugins.get(Wf),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);for(const t of n)e.setAttribute("uploadStatus","reading",t)})),t.read().then((()=>{const o=t.upload();e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Uploading image"));for(const i of a.get(t.id)){if(d.isSafari){const t=e.editing.mapper.toViewElement(i),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}))}n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",i)}))}return o})).then((o=>{n.enqueueChange({isUndoable:!1},(n=>{for(const e of a.get(t.id))n.setAttribute("uploadStatus","complete",e),this.fire("uploadComplete",{data:o,imageElement:e});e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Image upload complete")),this._uploadedImages.set(t.id,o)})),c()})).catch((o=>{if(e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Error during image upload")),"error"!==t.status&&"aborted"!==t.status)throw o;"error"==t.status&&o&&r.showWarning(o,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{for(const n of a.get(t.id))"$graveyard"!==n.root.rootName&&e.remove(n)})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{for(const n of 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(", ");if(""!=o){const t={srcset:o};e.hasAttribute("width")||e.hasAttribute("height")||(t.width=i),n.setAttributes(t,e)}}_registerConverters(t){const{conversion:e,plugins:n}=this.editor,i=n.get(wC),o=n.get(kA);e.for("dataDowncast").add((e=>{e.on(`attribute:uploadId:${t}`,((t,e,n)=>{if(!n.consumable.test(e.item,t.name))return;const r=i.loaders.get(e.attributeNewValue);if(!r||!r.data)return null;const s=n.mapper.toViewElement(e.item),a=o.findViewImgElement(s);a&&(n.consumable.consume(e.item,t.name),n.writer.setAttribute("data-ck-upload-id",r.id,a))}))}))}}function LC(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))}const zC=(OC=lb,function(t,e){if(null==t)return t;if(!Oe(t))return OC(t,e);for(var n=t.length,i=-1,o=Object(t);++i{e.setAttribute("resizedWidth",t.width,o),e.removeAttribute("resizedHeight",o),i.setImageNaturalSizeAttributes(o)}))}}class jC extends sr{static get requires(){return[kA]}static get pluginName(){return"ImageResizeEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{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 RC(t);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(t){const e=this.editor,n=e.plugins.get("ImageUtils");e.conversion.for("downcast").add((e=>e.on(`attribute:resizedWidth:${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("dataDowncast").attributeToAttribute({model:{name:t,key:"resizedHeight"},view:t=>({key:"style",value:{height:t}})}),e.conversion.for("editingDowncast").add((e=>e.on(`attribute:resizedHeight:${t}`,((e,i,o)=>{if(!o.consumable.consume(i.item,e.name))return;const r=o.writer,s=o.mapper.toViewElement(i.item),a="imageInline"===t?n.findViewImgElement(s):s;null!==i.attributeNewValue?r.setStyle("height",i.attributeNewValue,a):r.removeStyle("height",a)})))),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:t=>pA(t)?null:t.getStyle("width")}}),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:t=>pA(t)?null:t.getStyle("height")}})}}const HC=(()=>({small:Dh.objectSizeSmall,medium:Dh.objectSizeMedium,large:Dh.objectSizeLarge,custom:Dh.objectSizeCustom,original:Dh.objectSizeFull}))();class UC extends sr{static get requires(){return[jC]}static get pluginName(){return"ImageResizeButtons"}static get isOfficialPlugin(){return!0}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;e.ui.componentFactory.add(n,(n=>{const r=new Lh(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!HC[o])throw new I("imageresizebuttons-missing-icon",e,t);if(r.set({label:a,icon:HC[o],tooltip:a,isToggleable:!0}),r.bind("isEnabled").to(this),e.plugins.has("ImageCustomResizeUI")&&WC(t)){const t=e.plugins.get("ImageCustomResizeUI");this.listenTo(r,"execute",(()=>{t._showForm(this._resizeUnit)}))}else{const t=i?i+this._resizeUnit:null;r.bind("isOn").to(s,"value",GC(t)),this.listenTo(r,"execute",(()=>{e.execute("resizeImage",{width:t})}))}return r}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,i=t.find((t=>!t.value)),o=o=>{const r=e.commands.get("resizeImage"),s=tp(o,ag),a=s.buttonView,c=n("Resize image");return a.set({tooltip:c,commandValue:i.value,icon:HC.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:c,ariaLabelledBy:void 0}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(i))),s.bind("isEnabled").to(this),ip(s,(()=>this._getResizeDropdownListItemDefinitions(t,r)),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(s,"execute",(t=>{"onClick"in t.source?t.source.onClick():(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=!1){const n=this.editor.t;return t.label?t.label:e?WC(t)?n("Custom image size"):t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):WC(t)?n("Custom"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const{editor:n}=this,i=new oo,o=t.map((t=>WC(t)?{...t,valueWithUnits:"custom"}:t.value?{...t,valueWithUnits:`${t.value}${this._resizeUnit}`}:{...t,valueWithUnits:null}));for(const t of o){let r=null;if(n.plugins.has("ImageCustomResizeUI")&&WC(t)){const i=n.plugins.get("ImageCustomResizeUI");r={type:"button",model:new Gf({label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{i._showForm(this._resizeUnit)}})};const s=FC(o,"valueWithUnits");r.model.bind("isOn").to(e,"value",qC(s))}else r={type:"button",model:new Gf({commandName:"resizeImage",commandValue:t.valueWithUnits,label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null})},r.model.bind("isOn").to(e,"value",GC(t.valueWithUnits));r.model.bind("isEnabled").to(e,"isEnabled"),i.add(r)}return i}}function WC(t){return"custom"===t.value}function GC(t){return e=>null===t&&e===t||null!==e&&e.width===t}function qC(t){return e=>!t.some((t=>GC(t)(e)))}const $C="image_resized";class KC extends sr{static get requires(){return[Gw,kA]}static get pluginName(){return"ImageResizeHandles"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(t),this._setupResizerCreator()}_setupResizerCreator(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils");e.addObserver(TA),this.listenTo(e.document,"imageLoaded",((i,o)=>{if(!o.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 r=t.editing.view.domConverter,s=r.domToView(o.target),a=n.getImageWidgetFromImageView(s);let c=this.editor.plugins.get(Gw).getResizerByViewElement(a);if(c)return void c.redraw();const l=t.editing.mapper,d=l.toModelElement(a);c=t.plugins.get(Gw).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:d,viewElement:a,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>r.mapViewToDom(l.toViewElement(d)),isCentered:()=>"alignCenter"==d.getAttribute("imageStyle"),onCommit(n){e.change((t=>{t.removeClass($C,a)})),t.execute("resizeImage",{width:n})}}),c.on("updateSize",(()=>{a.hasClass($C)||e.change((t=>{t.addClass($C,a)}));const t="imageInline"===d.name?s:a;t.getStyle("height")&&e.change((e=>{e.removeStyle("height",t)}))})),c.bind("isEnabled").to(this)}))}}function YC(t){if(!t)return null;const[,e,n]=t.trim().match(/([.,\d]+)(%|px)$/)||[],i=Number.parseFloat(e);return Number.isNaN(i)?null:{value:i,unit:n}}function QC(t,e,n){return"px"===n?{value:e.value,unit:"px"}:{value:e.value/t*100,unit:"%"}}function ZC(t){const{editing:e}=t,n=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);if(!n)return null;const i=e.mapper.toViewElement(n);return{model:n,view:i,dom:e.view.domConverter.mapViewToDom(i)}}var JC=o(1173),XC={attributes:{"data-cke":!0}};XC.setAttributes=Qo(),XC.insert=Ko().bind(null,"head"),XC.domAPI=qo(),XC.insertStyleElement=Jo(),Wo()(JC.A,XC),JC.A&&JC.A.locals&&JC.A.locals;class tv extends er{constructor(t,e,n){super(t);const i=this.locale.t;this.focusTracker=new so,this.keystrokes=new uo,this.unit=e,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(i("Save"),Dh.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Dh.cancel,"ck-button-cancel","cancel"),this._focusables=new Ao,this._validators=n,this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),or({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 Lh(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 $m(this.locale,lp);return e.label=t("Resize image (in %0)",this.unit),e.fieldView.set({step:.1}),e}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.labeledInput.errorText=e,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:t}=this.labeledInput.fieldView;return t?t.value:null}get parsedSize(){const{rawSize:t}=this;if(null===t)return null;const e=Number.parseFloat(t);return Number.isNaN(e)?null:e}get sizeWithUnits(){const{parsedSize:t,unit:e}=this;return null===t?null:`${t}${e}`}}class ev extends sr{static get requires(){return[Zf]}static get pluginName(){return"ImageCustomResizeUI"}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(t){const e=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(ir(tv))(e.locale,t,function(t){const e=t.t;return[t=>""===t.rawSize.trim()?e("The value must not be empty."):null===t.parsedSize?e("The value should be a plain number."):void 0]}(e)),this._form.render(),this.listenTo(this._form,"submit",(()=>{this._form.isValid()&&(e.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))})),this.listenTo(this._form.labeledInput,"change:errorText",(()=>{e.ui.update()})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),nr({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(t){if(this._isVisible)return;this._form||this._createForm(t);const e=this.editor,n=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:xA(e)});const i=function(t,e){const n=ZC(t);if(!n)return null;const i=YC(n.model.getAttribute("resizedWidth")||null);return i?i.unit===e?i:QC(Cw(n.dom),{unit:"px",value:new oi(n.dom).width},e):null}(e,t),o=i?i.value.toFixed(1):"",r=function(t,e){const n=ZC(t);if(!n)return null;const i=Cw(n.dom),o=YC(window.getComputedStyle(n.dom).minWidth)||{value:1,unit:"px"};return{unit:e,lower:Math.max(.1,QC(i,o,e).value),upper:"px"===e?i:100}}(e,t);n.fieldView.value=n.fieldView.element.value=o,r&&Object.assign(n.fieldView,{min:r.lower.toFixed(1),max:Math.ceil(r.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){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)}}var nv=o(4214),iv={attributes:{"data-cke":!0}};iv.setAttributes=Qo(),iv.insert=Ko().bind(null,"head"),iv.domAPI=qo(),iv.insertStyleElement=Jo(),Wo()(nv.A,iv),nv.A&&nv.A.locals&&nv.A.locals;class ov{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=>t.is("element","a")));if(r)for(const t of this._definitions){const i=ho(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)}}}))}}}var rv=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const sv=function(t){return rv.test(t)};var av="\\ud800-\\udfff",cv="["+av+"]",lv="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",dv="\\ud83c[\\udffb-\\udfff]",uv="[^"+av+"]",hv="(?:\\ud83c[\\udde6-\\uddff]){2}",mv="[\\ud800-\\udbff][\\udc00-\\udfff]",gv="(?:"+lv+"|"+dv+")?",pv="[\\ufe0e\\ufe0f]?",fv=pv+gv+"(?:\\u200d(?:"+[uv,hv,mv].join("|")+")"+pv+gv+")*",kv="(?:"+[uv+lv+"?",lv,hv,mv,cv].join("|")+")",bv=RegExp(dv+"(?="+dv+")|"+kv+fv,"g");const wv=function(t){return sv(t)?function(t){return t.match(bv)||[]}(t):function(t){return t.split("")}(t)},_v=function(t){t=Sr(t);var e,n,i,o,r=sv(t)?wv(t):void 0,s=r?r[0]:t.charAt(0),a=r?(e=r,n=1,o=e.length,i=void 0===i?o:i,!n&&i>=o?e:ts(e,n,i)).join(""):t.slice(1);return s.toUpperCase()+a},Av=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Cv=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,vv=/^((\w+:(\/{2,})?)|(\W))/i,yv=["https?","ftps?","mailto"],xv="Ctrl+K";function Ev(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function Dv(t,e=yv){const n=String(t),i=e.join("|");return function(t,e){return!!t.replace(Av,"").match(e)}(n,new RegExp(`${"^(?:(?:):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("",i)}`,"i"))?n:"#"}function Sv(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function Iv(t,e){const n=(i=t,Cv.test(i)?"mailto:":e);var i;const o=!!n&&!Tv(t);return t&&o?n+t:t}function Tv(t){return vv.test(t)}function Bv(t){window.open(t,"_blank","noopener")}function Mv(t){const e=t.plugins.has("BookmarkEditing")?t.plugins.get("BookmarkEditing"):null;return{isScrollableToTarget:function(t){return!!t&&t.startsWith("#")&&!!e&&!!e.getElementForBookmarkId(t.slice(1))},scrollToTarget:function(n){const i=n.slice(1),o=e.getElementForBookmarkId(i);t.model.change((t=>{t.setSelection(o,"on")})),t.editing.view.scrollToTheSelection({alignToTop:!0,forceScroll:!0})}}}class Pv extends cr{constructor(){super(...arguments),this.manualDecorators=new oo,this.automaticDecorators=new ov}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()||ro(e.getSelectedBlocks());Sv(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=Nv(i);let c=Qb(s,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(c=this._updateLinkContent(n,e,c,t)),e.setAttribute("linkHref",t,c),o.forEach((t=>{e.setAttribute(t,!0,c)})),r.forEach((t=>{e.removeAttribute(t,c)})),e.setSelection(e.createPositionAfter(c.end.nodeBefore))}else if(""!==t){const r=ho(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 s of c){let a=s;if(1===c.length){const o=Nv(i);i.getAttribute("linkHref")===o&&(a=this._updateLinkContent(n,e,s,t),e.setSelection(e.createSelection(a)))}e.setAttribute("linkHref",t,a),o.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)}))}}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,i=n.getSelectedElement();return Sv(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}_updateLinkContent(t,e,n,i){const o=e.createText(i,{linkHref:i});return t.insertContent(o,n)}}function Nv(t){if(t.isCollapsed){const e=t.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(t.getFirstRange().getItems());if(e.length>1)return null;const n=e[0];return n.is("$text")||n.is("$textProxy")?n.data:null}}class Lv extends cr{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();Sv(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?[Qb(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 zv extends(J()){constructor({id:t,label:e,attributes:n,classes:i,styles:o,defaultValue:r}){super(),this.id=t,this.set("value",void 0),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}}}var Ov=o(7456),Vv={attributes:{"data-cke":!0}};Vv.setAttributes=Qo(),Vv.insert=Ko().bind(null,"head"),Vv.domAPI=qo(),Vv.insertStyleElement=Jo(),Wo()(Ov.A,Vv),Ov.A&&Ov.A.locals&&Ov.A.locals;const Fv="automatic",Rv=/^(https?:)?\/\//;class jv extends sr{static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Fb,yb,bb]}constructor(t){super(t),t.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const t=this.editor,e=this.editor.config.get("link.allowedProtocols");t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Ev}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,n)=>Ev(Dv(t,e),n)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new Pv(t)),t.commands.add("unlink",new Lv(t));const n=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>("label"in t&&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${_v(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter((t=>t.mode===Fv))),this._enableManualDecorators(n.filter((t=>"manual"===t.mode))),t.plugins.get(Fb).registerAttribute("linkHref"),function(t,e,n,i){const o=t.editing.view,r=new Set;o.document.registerPostFixer((n=>{const o=t.model.document.selection;let s=!1;if(o.hasAttribute(e)){const a=Qb(o.getFirstPosition(),e,o.getAttribute(e),t.model),c=t.editing.mapper.toViewRange(a);for(const t of c.getItems())t.is("element","a")&&!t.hasClass(i)&&(n.addClass(i,t),r.add(t),s=!0)}return s})),t.conversion.for("editingDowncast").add((t=>{function e(){o.change((t=>{for(const e of r.values())t.removeClass(i,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}(t,"linkHref",0,"ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:Fv,callback:t=>!!t&&Rv.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});const i=new zv(t);n.add(i),e.conversion.for("downcast").attributeToElement({model:i.id,view:(t,{writer:e,schema:n},{item:o})=>{if((o.is("selection")||n.isInline(o))&&t){const t=e.createAttributeElement("a",i.attributes,{priority:5});i.classes&&e.addClass(i.classes,t);for(const n in i.styles)e.setStyle(n,i.styles[n],t);return e.setCustomProperty("link",!0,t),t}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...i._createPattern()},model:{key:i.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document,n=Mv(t);function i(t){n.isScrollableToTarget(t)?n.scrollToTarget(t):Bv(t)}this.listenTo(e,"click",((t,e)=>{if(!(d.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const o=n.getAttribute("href");o&&(t.stop(),e.preventDefault(),i(o))}),{context:"$capture"}),this.listenTo(e,"keydown",((e,n)=>{const o=t.commands.get("link").value;o&&n.keyCode===Pi.enter&&n.altKey&&(e.stop(),i(o))}))}_enableSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(e,"change:attribute",((n,{attributeKeys:i})=>{i.includes("linkHref")&&!e.hasAttribute("linkHref")&&t.change((e=>{var n;!function(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}(e,(n=t.schema,n.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))))}))}))}_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=Iv(i.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,i)}}))}))}}class Hv extends sr{static get requires(){return["ImageEditing","ImageUtils",jv]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){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;if(!o.consumable.consume(r,{attributes:["href"]}))return;const c=r.getAttribute("href");if(!c)return;let l=i.modelCursor.parent;if(!l.is("element","imageBlock")){const t=o.convertItem(s,i.modelCursor);i.modelRange=t.modelRange,i.modelCursor=t.modelCursor,l=i.modelCursor.nodeBefore}l&&l.is("element","imageBlock")&&o.writer.setAttribute("linkHref",c,l)}),{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=>t.is("element","a"))),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(Uv(n)),t.conversion.for("upcast").add(Wv(t,n))}}function Uv(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=>t.is("element","a")));if(r){for(const[e,n]of ho(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 Wv(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 Zr(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"})}}var Gv=o(2350),qv={attributes:{"data-cke":!0}};qv.setAttributes=Qo(),qv.insert=Ko().bind(null,"head"),qv.domAPI=qo(),qv.insertStyleElement=Jo(),Wo()(Gv.A,qv),Gv.A&&Gv.A.locals&&Gv.A.locals;class $v extends er{constructor(t,e,n){super(t),this.focusTracker=new so,this.keystrokes=new uo,this._focusables=new Ao;const i=t.t;this._validators=n,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Dh.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Dh.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),or({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()}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}_createUrlInput(){const t=this.locale.t,e=new $m(this.locale,cp);return e.fieldView.inputMode="url",e.label=t("Link URL"),e}_createButton(t,e,n,i){const o=new Lh(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 Cm(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 er;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}get url(){const{element:t}=this.urlInputView.fieldView;return t?t.value.trim():null}}var Kv=o(8040),Yv={attributes:{"data-cke":!0}};Yv.setAttributes=Qo(),Yv.insert=Ko().bind(null,"head"),Yv.domAPI=qo(),Yv.insertStyleElement=Jo(),Wo()(Kv.A,Yv),Kv.A&&Kv.A.locals&&Kv.A.locals;class Qv extends er{constructor(t,e={},n){super(t),this.focusTracker=new so,this.keystrokes=new uo,this._focusables=new Ao;const i=t.t;this._options=n,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),'',"unlink"),this.editButtonView=this._createButton(i("Edit link"),Dh.pencil,"edit"),this.set("href",void 0),this._linkConfig=e,this._focusCycler=new Rh({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 Lh(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const t=new Lh(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&Dv(t,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"},on:{click:e.to((t=>{this._options&&this._options.isScrollableToTarget(this.href)?(t.preventDefault(),this._options.scrollToTarget(this.href)):Bv(this.href)}))}}),t.bind("tooltip").to(this,"href",(t=>this._options&&this._options.isScrollableToTarget(t)?n("Scroll to target"):n("Open link in new tab"))),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}}const Zv='',Jv="link-ui";class Xv extends sr{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Zf]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.editing.view.addObserver(pu),this._balloon=t.plugins.get(Zf),this._createToolbarLinkButton(),this._enableBalloonActivators(),t.conversion.for("editingDowncast").markerToHighlight({model:Jv,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:Jv,view:(t,{writer:e})=>{if(!t.markerRange.isCollapsed)return null;const n=e.createUIElement("span");return e.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Create link"),keystroke:xv},{label:e("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}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 Qv(t.locale,t.config.get("link"),Mv(t)),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(xv,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),i=new(ir($v))(t.locale,e,function(t){const e=t.t,n=t.config.get("link.allowCreatingEmptyLinks");return[t=>{if(!n&&!t.url.length)return e("Link URL must not be empty.")}]}(t));return i.urlInputView.fieldView.bind("value").to(e,"value"),i.urlInputView.bind("isEnabled").to(e,"isEnabled"),i.saveButtonView.bind("isEnabled").to(e,"isEnabled"),this.listenTo(i,"submit",(()=>{if(i.isValid()){const{value:e}=i.urlInputView.fieldView.element,o=Iv(e,n);t.execute("link",o,i.getDecoratorSwitchesState()),this._closeFormView()}})),this.listenTo(i.urlInputView,"change:errorText",(()=>{t.ui.update()})),this.listenTo(i,"cancel",(()=>{this._closeFormView()})),i.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),i}_createToolbarLinkButton(){const t=this.editor;t.ui.componentFactory.add("link",(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0}),t})),t.ui.componentFactory.add("menuBar:link",(()=>{const t=this._createButton(lm);return t.set({role:"menuitemcheckbox"}),t}))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("link"),o=new t(e.locale),r=n.t;return o.set({label:r("Link"),icon:Zv,keystroke:xv,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}_enableBalloonActivators(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),t.keystrokes.set(xv,((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())})),nr({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.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=t.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_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.formView.urlInputView.fieldView.reset(),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.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const t=this._balloon.visibleView;return!!this.formView&&t==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let i;if(e.markers.has(Jv)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(Jv)),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&&gw(n))return ty(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),i=ty(n.start),o=ty(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(Jv))e.updateMarker(Jv,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(Jv,{usingOperation:!1,affectsData:!1,range:e.createRange(i,n.end)})}else e.addMarker(Jv,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(Jv)&&t.change((t=>{t.removeMarker(Jv)}))}}function ty(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))||null}class ey extends sr{static get requires(){return[jv,Xv,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}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 Lh(n),o=t.plugins.get("LinkUI"),r=t.commands.get("link");return i.set({isEnabled:!0,label:e("Link image"),icon:Zv,keystroke:xv,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 ny=o(3669),iy={attributes:{"data-cke":!0}};iy.setAttributes=Qo(),iy.insert=Ko().bind(null,"head"),iy.domAPI=qo(),iy.insertStyleElement=Jo(),Wo()(ny.A,iy),ny.A&&ny.A.locals&&ny.A.locals;class oy extends sr{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.commands.add("indent",new dr(t)),t.commands.add("outdent",new dr(t))}}class ry extends sr{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?Dh.indent:Dh.outdent,o="ltr"==e.uiLanguageDirection?Dh.outdent:Dh.indent;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,(()=>{const i=this._createButton(Lh,t,e,n);return i.set({tooltip:!0}),i})),i.ui.componentFactory.add("menuBar:"+t,(()=>this._createButton(lm,t,e,n)))}_createButton(t,e,n,i){const o=this.editor,r=o.commands.get(e),s=new t(o.locale);return s.set({label:n,icon:i}),s.bind("isEnabled").to(r,"isEnabled"),this.listenTo(s,"execute",(()=>{o.execute(e),o.editing.view.focus()})),s}}const sy=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 ay extends sr{static get requires(){return[Lb,jv]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}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(),this._enablePasteLinking()}_expandLinkRange(t,e){return e.textNode&&e.textNode.hasAttribute("linkHref")?Qb(e,"linkHref",e.textNode.getAttribute("linkHref"),t):null}_selectEntireLinks(t,e){const n=this.editor.model,i=n.document.selection,o=i.getFirstPosition(),r=i.getLastPosition();let s=e.getJoined(this._expandLinkRange(n,o)||e);s&&(s=s.getJoined(this._expandLinkRange(n,r)||e)),s&&(s.start.isBefore(o)||s.end.isAfter(r))&&t.setSelection(s)}_enablePasteLinking(){const t=this.editor,e=t.model,n=e.document.selection,i=t.plugins.get("ClipboardPipeline"),o=t.commands.get("link");i.on("inputTransformation",((t,i)=>{if(!this.isEnabled||!o.isEnabled||n.isCollapsed||"paste"!==i.method)return;if(n.rangeCount>1)return;const r=n.getFirstRange(),s=i.dataTransfer.getData("text/plain");if(!s)return;const a=s.match(sy);a&&a[2]===s&&(e.change((t=>{this._selectEntireLinks(t,r),o.execute(s)})),t.stop())}),{priority:"high"})}_enableTypingHandling(){const t=this.editor,e=new Vb(t.model,(t=>{let e=t;if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(e))return;e=e.slice(0,-1),"!.:,;?".includes(e[e.length-1])&&(e=e.slice(0,-1));const n=cy(e);return n?{url:n,removedTrailingCharacters:t.length-e.length}:void 0}));e.on("matched:data",((e,n)=>{const{batch:i,range:o,url:r,removedTrailingCharacters:s}=n;if(!i.isTyping)return;const a=o.end.getShiftedBy(-s),c=a.getShiftedBy(-r.length),l=t.model.createRange(c,a);this._applyAutoLink(r,l)})),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}=Ob(t,e),o=cy(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=Iv(t,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&Tv(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 cy(t){const e=sy.exec(t);return e?e[2]:null}class ly{constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward="forward"==e.direction,this._includeSelf=!!e.includeSelf,this._sameAttributes=Ri(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){return ro(new this(t,e)[Symbol.iterator]())}*[Symbol.iterator](){const t=[];for(const{node:e}of new dy(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}}class dy{constructor(t,e="forward"){this._previousNodesByIndent=[],this._previous=null,this._previousNodeIndent=null,this._node=t,this._isForward="forward"===e}[Symbol.iterator](){return this}next(){if(!my(this._node))return{done:!0,value:void 0};const t=this._node.getAttribute("listIndent");let e=null;if(this._previous){const n=this._previousNodeIndent;t>n?this._previousNodesByIndent[n]=this._previous:tt.getAttribute("listItemId")!=e))}function Ey(t){return Array.from(t).filter((t=>"$graveyard"!==t.root.rootName)).sort(((t,e)=>t.index-e.index))}function Dy(t){const e=t.document.selection.getSelectedElement();return e&&t.schema.isObject(e)&&t.schema.isBlock(e)?e:null}function Sy(t,e){return e.checkChild(t.parent,"listItem")&&e.checkChild(t,"$text")&&!e.isObject(t)}function Iy(t){return"numbered"==t||"customNumbered"==t}function Ty(t,e,n){return py(e,{direction:"forward"}).pop().index>t.index?Cy(t,e,n):[]}class By extends cr{constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=My(t.document.selection);t.change((t=>{const n=[];xy(e)&&!ky(e[0])?("forward"==this._direction&&n.push(...vy(e,t)),n.push(...Ay(e[0],t))):"forward"==this._direction?n.push(...vy(e,t,{expand:!0})):n.push(...function(t,e){const n=wy(t=Ri(t)),i=new Set,o=Math.min(...n.map((t=>t.getAttribute("listIndent")))),r=new Map;for(const t of n)r.set(t,ly.first(t,{lowerIndent:!0}));for(const t of n){if(i.has(t))continue;i.add(t);const n=t.getAttribute("listIndent")-1;if(n<0)yy(t,e);else{if(t.getAttribute("listIndent")==o){const n=Ty(t,r.get(t),e);for(const t of n)i.add(t);if(n.length)continue}e.setAttribute("listIndent",n,t)}}return Ey(i)}(e,t));for(const e of n){if(!e.hasAttribute("listType"))continue;const n=ly.first(e,{sameIndent:!0});n&&t.setAttribute("listType",n.getAttribute("listType"),e)}this._fireAfterExecute(n)}))}_fireAfterExecute(t){this.fire("afterExecute",Ey(new Set(t)))}_checkEnabled(){let t=My(this.editor.model.document.selection),e=t[0];if(!e)return!1;if("backward"==this._direction)return!0;if(xy(t)&&!ky(t[0]))return!0;t=wy(t),e=t[0];const n=ly.first(e,{sameIndent:!0});return!!n&&n.getAttribute("listType")==e.getAttribute("listType")}}function My(t){const e=Array.from(t.getSelectedBlocks()),n=e.findIndex((t=>!my(t)));return-1!=n&&(e.length=n),e}class Py extends cr{constructor(t,e,n={}){super(t),this.type=e,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,i=Dy(e),o=Array.from(n.selection.getSelectedBlocks()).filter((t=>e.schema.checkAttribute(t,"listType")||Sy(t,e.schema))),r=void 0!==t.forceValue?!t.forceValue:this.value;e.change((s=>{if(r){const t=o[o.length-1],e=py(t,{direction:"forward"}),n=[];e.length>1&&n.push(...Ay(e[1],s)),n.push(...yy(o,s)),n.push(...function(t,e){const n=[];let i=Number.POSITIVE_INFINITY;for(const{node:o}of new dy(t.nextSibling)){const t=o.getAttribute("listIndent");if(0==t)break;t{const{firstElement:r,lastElement:s}=this._getMergeSubjectElements(n,t),a=r.getAttribute("listIndent")||0,c=s.getAttribute("listIndent"),l=s.getAttribute("listItemId");if(a!=c){const t=(d=s,Array.from(new ly(d,{direction:"forward",higherIndent:!0})));i.push(...vy([s,...t],o,{indentBy:a-c,expand:a{const e=Ay(this._getStartBlock(),t);this._fireAfterExecute(e)}))}_fireAfterExecute(t){this.fire("afterExecute",Ey(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&my(e)&&!ky(e)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?t:t.nextSibling}}class zy extends sr{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(t){return _y(t)}isFirstBlockOfListItem(t){return ky(t)}isListItemBlock(t){return my(t)}expandListBlocksToCompleteItems(t,e={}){return wy(t,e)}isNumberedListType(t){return Iy(t)}}function Oy(t){return t.is("element","ol")||t.is("element","ul")}function Vy(t){return t.is("element","li")}function Fy(t,e,n,i=Hy(n,e)){return t.createAttributeElement(jy(n),null,{priority:2*e/100-100,id:i})}function Ry(t,e,n){return t.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:n})}function jy(t){return"numbered"==t||"customNumbered"==t?"ol":"ul"}function Hy(t,e){return`list-${t}-${e}`}function Uy(t,e,n){const i=t.nodeBefore;if(my(i)){let t=i;for(const{node:o}of new dy(t,"backward")){if(t=o,n.has(t))return;if(n.add(t),e.has(i))return}e.add(t)}else{const n=t.nodeAfter;my(n)&&e.add(n)}}function Wy(t,e,n,{dataPipeline:i}={}){const o=function(t){return(e,n)=>{const i=[];for(const n of t)e.hasAttribute(n)&&i.push(`attribute:${n}`);return!!i.every((t=>!1!==n.test(e,t)))&&(i.forEach((t=>n.consume(e,t))),!0)}}(t);return(r,s,a)=>{const{writer:c,mapper:l,consumable:d}=a,u=s.item;if(!t.includes(s.attributeKey))return;if(!o(u,d))return;const h=function(t,e,n){const i=n.createRangeOn(t);return e.toViewRange(i).getTrimmed().end.nodeBefore}(u,l,n);qy(h,c,l),function(t,e){let n=t.parent;for(;n.is("attributeElement")&&["ul","ol","li"].includes(n.name);){const i=n.parent;e.unwrap(e.createRangeOn(t),n),n=i}}(h,c);const m=function(t,e,n,i,{dataPipeline:o}){let r=i.createRangeOn(e);if(!ky(t))return r;for(const s of n){if("itemMarker"!=s.scope)continue;const n=s.createElement(i,t,{dataPipeline:o});if(!n)continue;if(i.setCustomProperty("listItemMarker",!0,n),s.canInjectMarkerIntoElement&&s.canInjectMarkerIntoElement(t)?i.insert(i.createPositionAt(e,0),n):(i.insert(r.start,n),r=i.createRange(i.createPositionBefore(n),i.createPositionAfter(e))),!s.createWrapperElement||!s.canWrapElement)continue;const a=s.createWrapperElement(i,t,{dataPipeline:o});i.setCustomProperty("listItemWrapper",!0,a),s.canWrapElement(t)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(n),a),r=i.createRange(r.start,i.createPositionAfter(e)))}return r}(u,h,e,c,{dataPipeline:i});!function(t,e,n,i){if(!t.hasAttribute("listIndent"))return;const o=t.getAttribute("listIndent");let r=t;for(let t=o;t>=0;t--){const o=Ry(i,t,r.getAttribute("listItemId")),s=Fy(i,t,r.getAttribute("listType"));for(const t of n)"list"!=t.scope&&"item"!=t.scope||!r.hasAttribute(t.attributeName)||t.setAttributeOnDowncast(i,r.getAttribute(t.attributeName),"list"==t.scope?s:o);if(e=i.wrap(e,o),e=i.wrap(e,s),0==t)break;if(r=ly.first(r,{lowerIndent:!0}),!r)break}}(u,m,e,c)}}function Gy(t,{dataPipeline:e}={}){return(n,{writer:i})=>{if(!$y(n,t))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const o=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}function qy(t,e,n){for(;t.parent.is("attributeElement")&&t.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeOn(t),t.parent);const i=[];o(e.createPositionBefore(t).getWalker({direction:"backward"})),o(e.createRangeIn(t).getWalker());for(const t of i)e.remove(t);function o(t){for(const{item:e}of t){if(e.is("element")&&n.toModelElement(e))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&i.push(e)}}}function $y(t,e,n=gy(t)){if(!my(t))return!1;for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&"htmlEmptyBlock"!=n&&!e.includes(n))return!1;return n.length<2}var Ky=o(7875),Yy={attributes:{"data-cke":!0}};Yy.setAttributes=Qo(),Yy.insert=Ko().bind(null,"head"),Yy.domAPI=qo(),Yy.insertStyleElement=Jo(),Wo()(Ky.A,Yy),Ky.A&&Ky.A.locals&&Ky.A.locals;var Qy=o(532),Zy={attributes:{"data-cke":!0}};Zy.setAttributes=Qo(),Zy.insert=Ko().bind(null,"head"),Zy.domAPI=qo(),Zy.insertStyleElement=Jo(),Wo()(Qy.A,Zy),Qy.A&&Qy.A.locals&&Qy.A.locals;const Jy=["listType","listIndent","listItemId"];class Xy extends sr{static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[iw,Lb,zy,bb]}constructor(t){super(t),this._downcastStrategies=[],t.config.define("list.multiBlock",!0)}init(){const t=this.editor,e=t.model,n=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new I("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:Jy}),n?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const t of Jy)e.schema.setAttributeProperties(t,{copyOnReplace:!0});t.commands.add("numberedList",new Py(t,"numbered")),t.commands.add("bulletedList",new Py(t,"bulleted")),t.commands.add("customNumberedList",new Py(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new Py(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new By(t,"forward")),t.commands.add("outdentList",new By(t,"backward")),t.commands.add("splitListItemBefore",new Ly(t,"before")),t.commands.add("splitListItemAfter",new Ly(t,"after")),n&&(t.commands.add("mergeListItemBackward",new Ny(t,"backward")),t.commands.add("mergeListItemForward",new Ny(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...Jy,...this._downcastStrategies.map((t=>t.attributeName))]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),n=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",((i,o)=>{const r=t.model.document.selection;Dy(t.model)||t.model.change((()=>{const s=r.getFirstPosition();if(r.isCollapsed&&"backward"==o.direction){if(!s.isAtStart)return;const n=s.parent;if(!my(n))return;if(ly.first(n,{sameAttributes:"listType",sameIndent:!0})||0!==n.getAttribute("listIndent")){if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:tx(t.model,"backward")})}else by(n)||t.execute("splitListItemAfter"),t.execute("outdentList");o.preventDefault(),i.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd)return;if(!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:tx(t.model,"forward")}),o.preventDefault(),i.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,n=t.commands,i=n.get("enter");this.listenTo(t.editing.view.document,"enter",((n,i)=>{const o=e.document,r=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&my(r)&&r.isEmpty&&!i.isSoft){const e=ky(r),o=by(r);e&&o?(t.execute("outdentList"),i.preventDefault(),n.stop()):e&&!o?(t.execute("splitListItemAfter"),i.preventDefault(),n.stop()):o&&(t.execute("splitListItemBefore"),i.preventDefault(),n.stop())}}),{context:"li"}),this.listenTo(i,"afterExecute",(()=>{const e=n.get("splitListItemBefore");e.refresh(),e.isEnabled&&2===gy(t.model.document.selection.getLastPosition().parent).length&&e.execute()}))}_setupTabIntegration(){const t=this.editor;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"})}_setupConversion(){const t=this.editor,e=t.model,n=this.getListAttributeNames(),i=t.config.get("list.multiBlock"),o=i?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(t,{writer:e})=>e.createElement(o,{listType:""})}).elementToElement({view:"p",model:(t,{writer:e})=>t.parent&&t.parent.is("element","li")?e.createElement(o,{listType:""}):null,converterPriority:"high"}).add((t=>{t.on("element:li",((t,e,n)=>{const{writer:i,schema:o}=n;if(!e.modelRange)return;const r=Array.from(e.modelRange.getItems({shallow:!0})).filter((t=>o.checkAttribute(t,"listItemId")));if(!r.length)return;const s=hy.next(),a=function(t){let e=0,n=t.parent;for(;n;){if(Vy(n))e++;else{const t=n.previousSibling;t&&Vy(t)&&e++}n=n.parent}return e}(e.viewItem);let c=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const l=r[0].getAttribute("listType");l&&(c=l);const d={listItemId:s,listIndent:a,listType:c};for(const t of r)t.hasAttribute("listItemId")||i.setAttributes(d,t);r.length>1&&r[1].getAttribute("listItemId")!=d.listItemId&&n.keepEmptyElement(r[0])}))})),i||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:o,view:Gy(n),converterPriority:"high"}).add((t=>{var i;t.on("attribute",Wy(n,this._downcastStrategies,e)),t.on("remove",(i=e.schema,(t,e,n)=>{const{writer:o,mapper:r}=n,s=t.name.split(":")[1];if(!i.checkAttribute(s,"listItemId"))return;const a=r.toViewPosition(e.position),c=e.position.getShiftedBy(e.length),l=r.toViewPosition(c,{isPhantom:!0}),d=o.createRange(a,l).getTrimmed().end.nodeBefore;d&&qy(d,o,r)}))})),t.conversion.for("dataDowncast").elementToElement({model:o,view:Gy(n,{dataPipeline:!0}),converterPriority:"high"}).add((t=>{t.on("attribute",Wy(n,this._downcastStrategies,e,{dataPipeline:!0}))}));const r=(s=this._downcastStrategies,a=t.editing.view,(t,e)=>{if(e.modelPosition.offset>0)return;const n=e.modelPosition.parent;if(!my(n))return;if(!s.some((t=>"itemMarker"==t.scope&&t.canInjectMarkerIntoElement&&t.canInjectMarkerIntoElement(n))))return;const i=e.mapper.toViewElement(n),o=a.createRangeIn(i),r=o.getWalker();let c=o.start;for(const{item:t}of r){if(t.is("element")&&e.mapper.toModelElement(t)||t.is("$textProxy"))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&(c=a.createPositionAfter(t),r.skip((({previousPosition:t})=>!t.isEqual(c))))}e.viewPosition=c});var s,a;t.editing.mapper.on("modelToViewPosition",r),t.data.mapper.on("modelToViewPosition",r),this.listenTo(e.document,"change:data",function(t,e,n,i){return()=>{const i=t.document.differ.getChanges(),s=[],a=new Set,c=new Set,l=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name)Uy(t.position,a,l),t.attributes.has("listItemId")?c.add(t.position.nodeAfter):Uy(t.position.getShiftedBy(t.length),a,l);else if("remove"==t.type&&t.attributes.has("listItemId"))Uy(t.position,a,l);else if("attribute"==t.type){const e=t.range.start.nodeAfter;n.includes(t.attributeKey)?(Uy(t.range.start,a,l),null===t.attributeNewValue?(Uy(t.range.start.getShiftedBy(1),a,l),r(e)&&s.push(e)):c.add(e)):my(e)&&r(e)&&s.push(e)}for(const t of a.values())s.push(...o(t,c));for(const t of new Set(s))e.reconvertItem(t)};function o(t,e){const i=[],o=new Set,a=[];for(const{node:c,previous:l}of new dy(t)){if(o.has(c))continue;const t=c.getAttribute("listIndent");l&&tn.includes(t))));const d=py(c,{direction:"forward"});for(const t of d)o.add(t),(r(t,d)||s(t,a,e))&&i.push(t)}return i}function r(t,o){const r=e.mapper.toViewElement(t);if(!r)return!1;if(i.fire("checkElement",{modelElement:t,viewElement:r}))return!0;if(!t.is("element","paragraph")&&!t.is("element","listItem"))return!1;const s=$y(t,n,o);return!(!s||!r.is("element","p"))||!(s||!r.is("element","span"))}function s(t,n,o){if(o.has(t))return!1;const r=e.mapper.toViewElement(t);let s=n.length-1;for(let t=r.parent;!t.is("editableElement");t=t.parent){const e=Vy(t),o=Oy(t);if(!o&&!e)continue;const r="checkAttributes:"+(e?"item":"list");if(i.fire(r,{viewElement:t,modelAttributes:n[s]}))break;if(o&&(s--,s<0))return!1}return!0}}(e,t.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",((t,{viewElement:e,modelAttributes:n})=>{e.id!=n.listItemId&&(t.return=!0,t.stop())})),this.on("checkAttributes:list",((t,{viewElement:e,modelAttributes:n})=>{e.name==jy(n.listType)&&e.id==Hy(n.listType,n.listIndent)||(t.return=!0,t.stop())}))}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer((n=>function(t,e,n,i){const o=t.document.differ.getChanges(),r=new Set,s=new Set,a=i.editor.config.get("list.multiBlock");let c=!1;for(const i of o){if("insert"==i.type&&"$text"!=i.name){const o=i.position.nodeAfter;if(!t.schema.checkAttribute(o,"listItemId"))for(const t of Array.from(o.getAttributeKeys()))n.includes(t)&&(e.removeAttribute(t,o),c=!0);Uy(i.position,s,r),i.attributes.has("listItemId")||Uy(i.position.getShiftedBy(i.length),s,r);for(const{item:e,previousPosition:n}of t.createRangeIn(o))my(e)&&Uy(n,s,r)}else"remove"==i.type?Uy(i.position,s,r):"attribute"==i.type&&n.includes(i.attributeKey)&&(Uy(i.range.start,s,r),null===i.attributeNewValue&&Uy(i.range.start.getShiftedBy(1),s,r));if(!a&&"attribute"==i.type&&Jy.includes(i.attributeKey)){const t=i.range.start.nodeAfter;null===i.attributeNewValue&&t&&t.is("element","listItem")?(e.rename(t,"paragraph"),c=!0):null===i.attributeOldValue&&t&&t.is("element")&&"listItem"!=t.name&&(e.rename(t,"listItem"),c=!0)}}const l=new Set;for(const t of s.values())c=i.fire("postFixer",{listNodes:new uy(t),listHead:t,writer:e,seenIds:l})||c;return c}(t,n,e,this))),this.on("postFixer",((t,{listNodes:e,writer:n})=>{t.return=function(t,e){let n=0,i=-1,o=null,r=!1;for(const{node:s}of t){const t=s.getAttribute("listIndent");if(t>n){let a;null===o?(o=t-n,a=n):(o>t&&(o=t),a=t-o),a>i+1&&(a=i+1),e.setAttribute("listIndent",a,s),r=!0,i=a}else o=null,n=t+1,i=t}return r}(e,n)||t.return}),{priority:"high"}),this.on("postFixer",((t,{listNodes:e,writer:n,seenIds:i})=>{t.return=function(t,e,n){const i=new Set;let o=!1;for(const{node:r}of t){if(i.has(r))continue;let t=r.getAttribute("listType"),s=r.getAttribute("listItemId");if(e.has(s)&&(s=hy.next()),e.add(s),r.is("element","listItem"))r.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,r),o=!0);else for(const e of py(r,{direction:"forward"}))i.add(e),e.getAttribute("listType")!=t&&(s=hy.next(),t=e.getAttribute("listType")),e.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,e),o=!0)}return o}(e,i,n)||t.return}),{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",function(t){return(e,[n,i])=>{const o=n.is("documentFragment")?Array.from(n.getChildren()):[n];if(!o.length)return;const r=(i?t.createSelection(i):t.document.selection).getFirstPosition();let s;if(my(r.parent))s=r.parent;else{if(!my(r.nodeBefore)||!my(r.nodeAfter))return;s=r.nodeBefore}t.change((t=>{const e=s.getAttribute("listType"),n=s.getAttribute("listIndent"),i=o[0].getAttribute("listIndent")||0,r=Math.max(n-i,0);for(const n of o){const i=my(n);s.is("element","listItem")&&n.is("element","paragraph")&&t.rename(n,"listItem"),t.setAttributes({listIndent:(i?n.getAttribute("listIndent"):0)+r,listItemId:i?n.getAttribute("listItemId"):hy.next(),listType:e},n)}}))}}(t),{priority:"high"}),this.listenTo(e,"outputTransformation",((e,n)=>{t.change((t=>{const e=Array.from(n.content.getChildren()),i=e[e.length-1];if(e.length>1&&i.is("element")&&i.isEmpty&&e.slice(0,-1).every(my)&&t.remove(i),"copy"==n.method||"cut"==n.method){const e=Array.from(n.content.getChildren());xy(e)&&yy(e,t)}}))}))}_setupAccessibilityIntegration(){const t=this.editor,e=t.t;t.accessibility.addKeystrokeInfoGroup({id:"list",label:e("Keystrokes that can be used in a list"),keystrokes:[{label:e("Increase list item indent"),keystroke:"Tab"},{label:e("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function tx(t,e){const n=t.document.selection;if(!n.isCollapsed)return!Dy(t);if("forward"===e)return!0;const i=n.getFirstPosition().parent,o=i.previousSibling;return!t.schema.isObject(o)&&(!!o.isEmpty||xy([i,o]))}function ex(t,e,n,i){t.ui.componentFactory.add(e,(()=>{const o=nx(Lh,t,e,n,i);return o.set({tooltip:!0,isToggleable:!0}),o})),t.ui.componentFactory.add(`menuBar:${e}`,(()=>{const o=nx(lm,t,e,n,i);return o.set({role:"menuitemcheckbox",isToggleable:!0}),o}))}function nx(t,e,n,i,o){const r=e.commands.get(n),s=new t(e.locale);return s.set({label:i,icon:o}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{e.execute(n),e.editing.view.focus()})),s}class ix extends sr{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||ex(this.editor,"numberedList",t("Numbered List"),Dh.numberedList),this.editor.ui.componentFactory.has("bulletedList")||ex(this.editor,"bulletedList",t("Bulleted List"),Dh.bulletedList)}}class ox extends cr{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute({startIndex:t=1}={}){const e=this.editor.model,n=e.document;let i=Array.from(n.selection.getSelectedBlocks()).filter((t=>my(t)&&Iy(t.getAttribute("listType"))));i=_y(i),e.change((e=>{for(const n of i)e.setAttribute("listStart",t>=0?t:1,n)}))}_getValue(){const t=ro(this.editor.model.document.selection.getSelectedBlocks());return t&&my(t)&&Iy(t.getAttribute("listType"))?t.getAttribute("listStart"):null}}const rx={},sx={},ax={},cx=[{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 cx)rx[t]=n,sx[t]=e,e&&(ax[e]=t);function lx(){return cx.map((t=>t.listStyle))}function dx(t){return rx[t]||null}function ux(t){return ax[t]||null}function hx(t){return sx[t]||null}class mx extends cr{constructor(t,e,n){super(t),this.defaultType=e,this._supportedTypes=n}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document;e.change((e=>{this._tryToConvertItemsToList(t);let i=Array.from(n.selection.getSelectedBlocks()).filter((t=>t.hasAttribute("listType")));if(i.length){i=_y(i);for(const n of i)e.setAttribute("listStyle",t.type||this.defaultType,n)}}))}isStyleTypeSupported(t){return!this._supportedTypes||this._supportedTypes.includes(t)}_getValue(){const t=ro(this.editor.model.document.selection.getSelectedBlocks());return my(t)?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=dx(t.type);if(!e)return;const n=this.editor,i=`${e}List`;n.commands.get(i).value||n.execute(i)}}class gx extends cr{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute(t={}){const e=this.editor.model,n=e.document;let i=Array.from(n.selection.getSelectedBlocks()).filter((t=>my(t)&&"numbered"==t.getAttribute("listType")));i=_y(i),e.change((e=>{for(const n of i)e.setAttribute("listReversed",!!t.reversed,n)}))}_getValue(){const t=ro(this.editor.model.document.selection.getSelectedBlocks());return my(t)&&"numbered"==t.getAttribute("listType")?t.getAttribute("listReversed"):null}}function px(t){return(e,n,i)=>{const{writer:o,schema:r,consumable:s}=i;if(!1===s.test(n.viewItem,t.viewConsumables))return;n.modelRange||Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor));let a=!1;for(const e of n.modelRange.getItems({shallow:!0}))r.checkAttribute(e,t.attributeName)&&t.appliesToListItem(e)&&(e.hasAttribute(t.attributeName)||(o.setAttribute(t.attributeName,t.getAttributeOnUpcast(n.viewItem),e),a=!0));a&&s.consume(n.viewItem,t.viewConsumables)}}class fx extends sr{static get pluginName(){return"ListPropertiesUtils"}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return lx()}getListTypeFromListStyleType(t){return dx(t)}getListStyleTypeFromTypeAttribute(t){return ux(t)}getTypeAttributeFromListStyleType(t){return hx(t)}}function kx(t){const{startIndex:e,reversed:n,styles:i}=t;return{styles:bx(i),startIndex:e||!1,reversed:n||!1}}function bx(t){const e={listTypes:["bulleted","numbered"],useAttribute:!1};return!0===t||(t?Array.isArray(t)||"string"==typeof t?e.listTypes=Ri(t):(e.listTypes=t.listTypes?Ri(t.listTypes):e.listTypes,e.useAttribute=!!t.useAttribute,t.listStyleTypes&&(e.listStyleTypes=t.listStyleTypes)):e.listTypes=[]),e}const wx="default";class _x extends sr{static get requires(){return[Xy,fx]}static get pluginName(){return"ListPropertiesEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const t=this.editor,e=t.model,n=t.plugins.get(Xy),i=function(t){const e=[],n=kx(t);if(t.styles){const t=n.styles.useAttribute;e.push({attributeName:"listStyle",defaultValue:wx,viewConsumables:{styles:"list-style-type"},addCommand(e){let n=lx();t&&(n=n.filter((t=>!!hx(t)))),e.commands.add("listStyle",new mx(e,wx,n))},appliesToListItem:t=>"numbered"==t.getAttribute("listType")||"bulleted"==t.getAttribute("listType"),hasValidAttribute(t){if(!this.appliesToListItem(t))return!t.hasAttribute("listStyle");if(!t.hasAttribute("listStyle"))return!1;const e=t.getAttribute("listStyle");return e==wx||dx(e)==t.getAttribute("listType")},setAttributeOnDowncast(e,n,i){if(n&&n!==wx){if(!t)return void e.setStyle("list-style-type",n,i);{const t=hx(n);if(t)return void e.setAttribute("type",t,i)}}e.removeStyle("list-style-type",i),e.removeAttribute("type",i)},getAttributeOnUpcast(t){const e=t.getStyle("list-style-type");if(e)return function(t){switch(t){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return t}}(e);const n=t.getAttribute("type");return n?ux(n):wx}})}return t.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(t){t.commands.add("listReversed",new gx(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),hasValidAttribute(t){return this.appliesToListItem(t)==t.hasAttribute("listReversed")},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,viewConsumables:{attributes:"start"},addCommand(t){t.commands.add("listStart",new ox(t))},appliesToListItem:t=>Iy(t.getAttribute("listType")),hasValidAttribute(t){return this.appliesToListItem(t)==t.hasAttribute("listStart")},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}}),e}(t.config.get("list.properties"));for(const o of i)o.addCommand(t),e.schema.extend("$listItem",{allowAttributes:o.attributeName}),n.registerDowncastStrategy({scope:"list",attributeName:o.attributeName,setAttributeOnDowncast(t,e,n){o.setAttributeOnDowncast(t,e,n)}});t.conversion.for("upcast").add((t=>{for(const e of i)t.on("element:ol",px(e)),t.on("element:ul",px(e))})),n.on("checkAttributes:list",((t,{viewElement:e,modelAttributes:n})=>{for(const o of i)o.getAttributeOnUpcast(e)!=n[o.attributeName]&&(t.return=!0,t.stop())})),this.listenTo(t.commands.get("indentList"),"afterExecute",((t,n)=>{e.change((t=>{for(const e of n)for(const n of i)n.appliesToListItem(e)&&t.setAttribute(n.attributeName,n.defaultValue,e)}))})),n.on("postFixer",((t,{listNodes:e,writer:n})=>{for(const{node:o}of e)for(const e of i)e.hasValidAttribute(o)||(e.appliesToListItem(o)?n.setAttribute(e.attributeName,e.defaultValue,o):n.removeAttribute(e.attributeName,o),t.return=!0)})),n.on("postFixer",((t,{listNodes:e,writer:n})=>{for(const{node:o,previousNodeInList:r}of e)if(r&&r.getAttribute("listType")==o.getAttribute("listType"))for(const e of i){const{attributeName:i}=e;if(!e.appliesToListItem(o))continue;const s=r.getAttribute(i);o.getAttribute(i)!=s&&(n.setAttribute(i,s,o),t.return=!0)}}))}}var Ax=o(1911),Cx={attributes:{"data-cke":!0}};Cx.setAttributes=Qo(),Cx.insert=Ko().bind(null,"head"),Cx.domAPI=qo(),Cx.insertStyleElement=Jo(),Wo()(Ax.A,Cx),Ax.A&&Ax.A.locals&&Ax.A.locals;class vx extends er{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 so,this.keystrokes=new uo,this.focusables=new Ao;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Rh({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),n&&n.length?(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);rr({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>a.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);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 er(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(){for(const t of this.children)if(t instanceof Lh&&t.isOn)return void t.focus();this.children.first.focus()},n.focusTracker=new so,n.keystrokes=new uo,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)),this.stylesView?(this.additionalPropertiesCollapsibleView=new Tm(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 $m(this.locale,lp);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)?e.errorText=t("Invalid start index value."):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 Cm(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 yx=o(1330),xx={attributes:{"data-cke":!0}};xx.setAttributes=Qo(),xx.insert=Ko().bind(null,"head"),xx.domAPI=qo(),xx.insertStyleElement=Jo(),Wo()(yx.A,xx),yx.A&&yx.A.locals&&yx.A.locals;class Ex extends sr{static get pluginName(){return"ListPropertiesUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=t.config.get("list.properties"),i=kx(n),o=i.styles.listTypes;if(o.includes("bulleted")){const n=[{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:''}],o=e("Bulleted List"),r=e("Bulleted list styles toolbar"),s="bulletedList";t.ui.componentFactory.add(s,Dx({editor:t,normalizedConfig:i,parentCommandName:s,buttonLabel:o,buttonIcon:Dh.bulletedList,styleGridAriaLabel:r,styleDefinitions:n})),t.ui.componentFactory.add(`menuBar:${s}`,Ix({editor:t,normalizedConfig:i,parentCommandName:s,buttonLabel:o,styleGridAriaLabel:r,styleDefinitions:n}))}if(o.includes("numbered")||n.startIndex||n.reversed){const n=[{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:''}],r=e("Numbered List"),s=e("Numbered list styles toolbar"),a="numberedList";t.ui.componentFactory.add(a,Dx({editor:t,normalizedConfig:i,parentCommandName:a,buttonLabel:r,buttonIcon:Dh.numberedList,styleGridAriaLabel:s,styleDefinitions:n})),o.includes("numbered")&&t.ui.componentFactory.add(`menuBar:${a}`,Ix({editor:t,normalizedConfig:i,parentCommandName:a,buttonLabel:r,styleGridAriaLabel:s,styleDefinitions:n}))}}}function Dx({editor:t,normalizedConfig:e,parentCommandName:n,buttonLabel:i,buttonIcon:o,styleGridAriaLabel:r,styleDefinitions:s}){const a=t.commands.get(n);return c=>{const l=tp(c,Yg),d=l.buttonView;return l.bind("isEnabled").to(a),l.class="ck-list-styles-dropdown",d.on("execute",(()=>{t.execute(n),t.editing.view.focus()})),d.set({label:i,icon:o,tooltip:!0,isToggleable:!0}),d.bind("isOn").to(a,"value",(t=>!!t)),l.once("change:isOpen",(()=>{const i=function({editor:t,normalizedConfig:e,dropdownView:n,parentCommandName:i,styleDefinitions:o,styleGridAriaLabel:r}){const s=t.locale,a={...e,..."numberedList"!=i?{startIndex:!1,reversed:!1}:null},c=i.replace("List","");let l=null;if(e.styles.listTypes.includes(c)){const n=t.commands.get("listStyle"),r=Sx({editor:t,parentCommandName:i,listStyleCommand:n}),s=e.styles.listStyleTypes;let a=o;if(s){const t=s[c];t&&(a=o.filter((e=>t.includes(e.type))))}const d=Tx(n);l=a.filter(d).map(r)}const d=new vx(s,{styleGridAriaLabel:r,enabledProperties:a,styleButtonViews:l});if(e.styles.listTypes.includes(c)&&rp(n,(()=>d.stylesView.children.find((t=>t.isOn)))),a.startIndex){const e=t.commands.get("listStart");d.startIndexFieldView.bind("isEnabled").to(e),d.startIndexFieldView.fieldView.bind("value").to(e),d.on("listStart",((e,n)=>t.execute("listStart",n)))}if(a.reversed){const e=t.commands.get("listReversed");d.reversedSwitchButtonView.bind("isEnabled").to(e),d.reversedSwitchButtonView.bind("isOn").to(e,"value",(t=>!!t)),d.on("listReversed",(()=>{const n=e.value;t.execute("listReversed",{reversed:!n})}))}return d.delegate("execute").to(n),d}({editor:t,normalizedConfig:e,dropdownView:l,parentCommandName:n,styleGridAriaLabel:r,styleDefinitions:s});l.panelView.children.add(i)})),l.on("execute",(()=>{t.editing.view.focus()})),l}}function Sx({editor:t,listStyleCommand:e,parentCommandName:n}){const i=t.locale,o=t.commands.get(n);return({label:r,type:s,icon:a,tooltip:c})=>{const l=new Lh(i);return l.set({label:r,icon:a,tooltip:c}),l.bind("isOn").to(e,"value",(t=>t===s)),l.on("execute",(()=>{o.value?e.value===s?t.execute(n):e.value!==s&&t.execute("listStyle",{type:s}):t.model.change((()=>{t.execute("listStyle",{type:s})}))})),l}}function Ix({editor:t,normalizedConfig:e,parentCommandName:n,buttonLabel:i,styleGridAriaLabel:o,styleDefinitions:r}){return s=>{const a=new Pk(s),c=t.commands.get(n),l=t.commands.get("listStyle"),d=Tx(l),u=Sx({editor:t,parentCommandName:n,listStyleCommand:l}),h=e.styles.listStyleTypes;let m=r;if(h){const t=h[c.type];t&&(m=r.filter((e=>t.includes(e.type))))}const g=m.filter(d).map(u),p=new vx(s,{styleGridAriaLabel:o,enabledProperties:{...e,startIndex:!1,reversed:!1},styleButtonViews:g});return p.delegate("execute").to(a),a.buttonView.set({label:i,icon:Dh[n]}),a.panelView.children.add(p),a.bind("isEnabled").to(c,"isEnabled"),a.on("execute",(()=>{t.editing.view.focus()})),a}}function Tx(t){return"function"==typeof t.isStyleTypeSupported?e=>t.isStyleTypeSupported(e.type):()=>!0}function Bx(t,e){const 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)};return t=>{t.on("attribute:url:media",n)}}function Mx(t,e,n,i){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,i),t.createSlot()])}function Px(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function Nx(t,e,n,i){t.change((o=>{const r=o.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})}))}class Lx extends cr{refresh(){const t=this.editor.model,e=t.document.selection,n=Px(e);this.value=n?n.getAttribute("url"):void 0,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=_w(t,e).start.parent;return n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent),e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,i=Px(n);i?e.change((e=>{e.setAttribute("url",t,i)})):Nx(e,t,n,!0)}}class zx{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):(T("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 Ox(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,i=Ri(e.url);for(const e of i){const i=this._getUrlMatches(t,e);if(i)return new Ox(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 Ox{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 Bh,e=this._locale.t;return t.content='',t.viewBox="0 0 64 42",new Co({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 Vx=o(5767),Fx={attributes:{"data-cke":!0}};Fx.setAttributes=Qo(),Fx.insert=Ko().bind(null,"head"),Fx.domAPI=qo(),Fx.insertStyleElement=Jo(),Wo()(Vx.A,Fx),Vx.A&&Vx.A.locals&&Vx.A.locals;class Rx extends sr{static get pluginName(){return"MediaEmbedEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\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\/shorts\/([\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+)/,/^instagram\.com\/reel\/(\w+)/]},{name:"twitter",url:[/^twitter\.com/,/^x\.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 zx(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 Lx(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),i.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return Mx(e,s,n,{elementName:r,renderMediaPreview:!!n&&o})}}),i.for("dataDowncast").add(Bx(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),pw(t,e,{label:n})}(Mx(e,s,i,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),i.for("editingDowncast").add(Bx(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");return s.hasMedia(n)?e.createElement("media",{url:n}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");return s.hasMedia(n)?e.createElement("media",{url:n}):null}}).add((t=>{t.on("element:figure",((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,ro(i.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const jx=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class Hx extends sr{static get requires(){return[c_,Lb,C_]}static get pluginName(){return"AutoMediaEmbed"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document,n=t.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=Id.fromPosition(t.start);n.stickiness="toPrevious";const i=Id.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&&(a.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(Rx).registry,o=new Wc(t,e),r=o.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);s=s.trim(),s.match(jx)&&i.hasMedia(s)&&n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Id.fromPosition(t),this._timeoutId=a.window.setTimeout((()=>{n.model.change((t=>{this._timeoutId=null,t.remove(o),o.detach();let e=null;"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),Nx(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get(Lb).requestUndoOnBackspace()}),100)):o.detach()}}var Ux=o(6004),Wx={attributes:{"data-cke":!0}};Wx.setAttributes=Qo(),Wx.insert=Ko().bind(null,"head"),Wx.domAPI=qo(),Wx.insertStyleElement=Jo(),Wo()(Ux.A,Wx),Ux.A&&Ux.A.locals&&Ux.A.locals;class Gx extends er{constructor(t,e){super(e),this.focusTracker=new so,this.keystrokes=new uo,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView]})}render(){super.render(),or({view:this}),this.focusTracker.add(this.urlInputView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.urlInputView.focus()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.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 $m(this.locale,cp),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.inputMode="url",n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}}class qx extends sr{static get requires(){return[Rx,nm]}static get pluginName(){return"MediaEmbedUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("mediaEmbed",(()=>{const t=this.editor.locale.t,e=this._createDialogButton(Lh);return e.tooltip=!0,e.label=t("Insert media"),e})),t.ui.componentFactory.add("menuBar:mediaEmbed",(()=>{const t=this.editor.locale.t,e=this._createDialogButton(lm);return e.label=t("Media"),e}))}_createDialogButton(t){const e=this.editor,n=new t(e.locale),i=e.commands.get("mediaEmbed"),o=this.editor.plugins.get("Dialog");return n.icon='',n.bind("isEnabled").to(i,"isEnabled"),n.on("execute",(()=>{"mediaEmbed"===o.id?o.hide():this._showDialog()})),n}_showDialog(){const t=this.editor,e=t.plugins.get("Dialog"),n=t.commands.get("mediaEmbed"),i=t.locale.t;if(!this._formView){const e=t.plugins.get(Rx).registry;this._formView=new(ir(Gx))(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.")}]}(t.t,e),t.locale),this._formView.on("submit",(()=>this._handleSubmitForm()))}e.show({id:"mediaEmbed",title:i("Insert media"),content:this._formView,isModal:!0,onShow:()=>{this._formView.url=n.value||"",this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select()},actionButtons:[{label:i("Cancel"),withText:!0,onExecute:()=>e.hide()},{label:i("Accept"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSubmitForm()}]})}_handleSubmitForm(){const t=this.editor,e=t.plugins.get("Dialog");this._formView.isValid()&&(t.execute("mediaEmbed",this._formView.url),e.hide(),t.editing.view.focus())}}var $x=o(3155),Kx={attributes:{"data-cke":!0}};function Yx(t){return void 0!==t&&t.endsWith("px")}function Qx(t){return t.toFixed(2).replace(/\.?0+$/,"")+"px"}function Zx(t){const e=t.element.previousSibling;return(n=e||t.element.parent).is("element","ol")||n.is("element","ul");var n}function Jx(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=new RegExp(`@list\\s+l${t.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),s=new RegExp(`@list l${t.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=r.exec(e),c=s.exec(e),l=a&&!c,d=n.exec(e);let u="decimal",h="ol",m=null;if(d&&d[1]){const e=i.exec(d[1]);if(e&&e[1]&&(u=e[1].trim(),h="bullet"!==u&&"image"!==u?"ol":"ul"),"bullet"===u){const e=function(t){if("li"==t.name&&"ul"==t.parent.name&&t.parent.hasAttribute("type"))return t.parent.getAttribute("type");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);if(t)return t.is("$text")?t:t.getChild(0)}return null}(t);if(!e)return null;const n=e._data;return"o"===n?"circle":"·"===n?"disc":"§"===n?"square":null}(t.element);e&&(u=e)}else{const t=o.exec(d[1]);t&&t[1]&&(m=parseInt(t[1]))}l&&(h="ol")}return{type:h,startIndex:m,style:Xx(u),isLegalStyleList:l}}function Xx(t){if(t.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(t){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return t;default:return null}}function tE(t,e,n){const i=e.createElement(t.type);return t.style&&e.setStyle("list-style-type",t.style,i),t.startIndex&&t.startIndex>1&&e.setAttribute("start",t.startIndex,i),t.isLegalStyleList&&n&&e.addClass("legal-list",i),i}function eE(t){const e=t.getStyle("mso-list");if(void 0===e)return{};const n=e.match(/(^|\s{1,100})l(\d+)/i),i=e.match(/\s{0,100}lfo(\d+)/i),o=e.match(/\s{0,100}level(\d+)/i);return n&&i&&o?{id:n[2],order:i[1],indent:parseInt(o[1])}:{indent:1}}function nE(t,e){const n=new Zr({name:"span",styles:{"mso-list":"Ignore"}}),i=e.createRangeIn(t);for(const t of i)"elementStart"===t.type&&n.match(t.item)&&e.remove(t.item)}function iE(t){const e=t.getStyle("margin-left");return void 0===e||e.endsWith("px")?e:function(t){const e=parseFloat(t);return t.endsWith("pt")?Qx(96*e/72):t.endsWith("pc")?Qx(12*e*96/72):t.endsWith("in")?Qx(96*e):t.endsWith("cm")?Qx(96*e/2.54):t.endsWith("mm")?Qx(e/10*96/2.54):t}(e)}Kx.setAttributes=Qo(),Kx.insert=Ko().bind(null,"head"),Kx.domAPI=qo(),Kx.insertStyleElement=Jo(),Wo()($x.A,Kx),$x.A&&$x.A.locals&&$x.A.locals;const oE=//i,rE=/xmlns:o="urn:schemas-microsoft-com/i;class sE{constructor(t,e=!1){this.document=t,this.hasMultiLevelListPlugin=e}isActive(t){return oE.test(t)||rE.test(t)}execute(t){const e=new bu(this.document),{body:n,stylesString:i}=t._parsedData;!function(t,e){const n=[];for(const i of e.createRangeIn(t)){const t=i.item;t.is("element","a")&&!t.hasAttribute("href")&&(t.hasAttribute("id")||t.hasAttribute("name"))&&n.push(t)}for(const t of n){const n=t.parent.getChildIndex(t)+1,i=t.getChildren();e.insertChild(n,i,t.parent)}}(n,e),function(t,e,n){if(!t.childCount)return;const i=new bu(t.document),o=function(t,e){const n=e.createRangeIn(t),i=[],o=new Set;for(const t of n.getItems()){if(!t.is("element")||!t.name.match(/^(p|h\d+|li|div)$/))continue;let e=iE(t);if(void 0===e||0!=parseFloat(e)||Array.from(t.getClassNames()).find((t=>t.startsWith("MsoList")))||(e=void 0),t.hasStyle("mso-list")||void 0!==e&&o.has(e)){const n=eE(t);i.push({element:t,id:n.id,order:n.order,indent:n.indent,marginLeft:e}),void 0!==e&&o.add(e)}else o.clear()}return i}(t,i);if(!o.length)return;const r={},s=[];for(const t of o)if(void 0!==t.indent){Zx(t)||(s.length=0);const o=`${t.id}:${t.indent}`,a=Math.min(t.indent-1,s.length);if(as.length-1||s[a].listElement.name!=c.type){0==a&&"ol"==c.type&&void 0!==t.id&&r[o]&&(c.startIndex=r[o]);const e=tE(c,i,n);if(Yx(t.marginLeft)&&(0==a||Yx(s[a-1].marginLeft))){let n=t.marginLeft;a>0&&(n=Qx(parseFloat(n)-parseFloat(s[a-1].marginLeft))),i.setStyle("padding-left",n,e)}if(0==s.length){const n=t.element.parent,o=n.getChildIndex(t.element)+1;i.insertChild(o,e,n)}else{const t=s[a-1].listItemElements;i.appendChild(e,t[t.length-1])}s[a]={...t,listElement:e,listItemElements:[]},0==a&&void 0!==t.id&&(r[o]=c.startIndex||1)}}const c="li"==t.element.name?t.element:i.createElement("li");i.appendChild(c,s[a].listElement),s[a].listItemElements.push(c),0==a&&void 0!==t.id&&r[o]++,t.element!=c&&i.appendChild(t.element,c),nE(t.element,i),i.removeStyle("text-indent",t.element),i.removeStyle("margin-left",t.element)}else{const e=s.find((e=>e.marginLeft==t.marginLeft));if(e){const n=e.listItemElements;i.appendChild(t.element,n[n.length-1]),i.removeStyle("margin-left",t.element)}else s.length=0}}(n,i,this.hasMultiLevelListPlugin),function(t,e){if(!t.childCount)return;const n=new bu(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new Zr({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,s=["Chart"],a=i.match(e),c=e.getAttribute("o:gfxdata"),l="v:shapetype"===r,d=c&&s.some((t=>e.getAttribute("id").includes(t)));a&&c&&!l&&!d&&o.push(t.item.getAttribute("id"))}return o}(t,n);!function(t,e,n){const i=n.createRangeIn(e),o=new Zr({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 Zr({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 Zr({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 o=0;oString.fromCharCode(parseInt(t,16)))).join(""))}`;n.setAttribute("src",r,t[o])}var i}(o,function(t){if(!t)return[];const e=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,n=new RegExp("(?:("+e.source+"))([\\da-fA-F\\s]+)\\}","g"),i=t.match(n),o=[];if(i)for(const t of i){let n=!1;t.includes("\\pngblip")?n="image/png":t.includes("\\jpegblip")&&(n="image/jpeg"),n&&o.push({hex:t.replace(e,"").replace(/[^\da-fA-F]/g,""),type:n})}return o}(e),n)}(n,t.dataTransfer.getData("text/rtf")),function(t){const e=[],n=new bu(t.document);for(const{item:i}of n.createRangeIn(t))if(i.is("element")){for(const t of i.getClassNames())/\bmso/gi.exec(t)&&n.removeClass(t,i);for(const t of i.getStyleNames())/\bmso/gi.exec(t)&&n.removeStyle(t,i);(i.is("element","w:sdt")||i.is("element","w:sdtpr")&&i.isEmpty||i.is("element","o:p")&&i.isEmpty)&&e.push(i)}for(const t of e){const e=t.parent,i=e.getChildIndex(t);n.insertChild(i,t.getChildren(),e),n.remove(t)}}(n),t.content=n}}function aE(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 cE(t,e){return!!t&&t.is("element")&&e.includes(t.name)}const lE=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class dE{constructor(t){this.document=t}isActive(t){return lE.test(t)}execute(t){const e=new bu(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 Is(e.document.stylesProcessor),i=new ka(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=aE(t,"forward",e,{blockElements:o,inlineObjectElements:r}),i=aE(t,"backward",e,{blockElements:o,inlineObjectElements:r}),a=cE(n,o);(cE(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}}const uE=/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join(" ").substr(0,e.length)))}const gE="removeFormat";class pE extends sr{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add(gE,(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0}),t})),t.ui.componentFactory.add(`menuBar:${gE}`,(()=>this._createButton(lm)))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get(gE),o=new t(e.locale),r=n.t;return o.set({label:r("Remove Format"),icon:''}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{e.execute(gE),e.editing.view.focus()})),o}}class fE extends cr{refresh(){const t=this.editor.model;this.isEnabled=!!ro(this._getFormattingItems(t.document.selection,t.schema))}execute(){const t=this.editor.model,e=t.schema;t.change((n=>{for(const i of this._getFormattingItems(t.document.selection,e))if(i.is("selection"))for(const t of this._getFormattingAttributes(i,e))n.removeSelectionAttribute(t);else{const t=n.createRangeOn(i);for(const o of this._getFormattingAttributes(i,e))n.removeAttribute(o,t)}}))}*_getFormattingItems(t,e){const n=t=>!!ro(this._getFormattingAttributes(t,e));for(const i of t.getRanges())for(const t of i.getItems())!e.isBlock(t)&&n(t)&&(yield t);for(const e of t.getSelectedBlocks())n(e)&&(yield e);n(t)&&(yield t)}*_getFormattingAttributes(t,e){for(const[n]of t.getAttributes()){const t=e.getAttributeProperties(n);t&&t.isFormatting&&(yield n)}}}class kE extends sr{static get pluginName(){return"RemoveFormatEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.commands.add("removeFormat",new fE(t))}}function bE(t,e){const{modelAttribute:n,styleName:i,viewElement:o,defaultValue:r,reduceBoxSides:s=!1,shouldUpcast:a=()=>!0}=e;t.for("upcast").attributeToAttribute({view:{name:o,styles:{[i]:/[\s\S]+/}},model:{key:n,value:t=>{if(!a(t))return;const e=t.getNormalizedStyle(i),n=s?CE(e):e;return r!==n?n:void 0}}})}function wE(t,e,n,i){t.for("upcast").add((t=>t.on("element:"+e,((t,e,o)=>{if(!e.modelRange)return;const r=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((t=>e.viewItem.hasStyle(t)));if(!r.length)return;const s={styles:r};if(!o.consumable.test(e.viewItem,s))return;const a=[...e.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(e.viewItem,s);const c={style:e.viewItem.getNormalizedStyle("border-style"),color:e.viewItem.getNormalizedStyle("border-color"),width:e.viewItem.getNormalizedStyle("border-width")},l={style:CE(c.style),color:CE(c.color),width:CE(c.width)};l.style!==i.style&&o.writer.setAttribute(n.style,l.style,a),l.color!==i.color&&o.writer.setAttribute(n.color,l.color,a),l.width!==i.width&&o.writer.setAttribute(n.width,l.width,a)}))))}function _E(t,e){const{modelElement:n,modelAttribute:i,styleName:o}=e;t.for("downcast").attributeToAttribute({model:{name:n,key:i},view:t=>({key:"style",value:{[o]:t}})})}function AE(t,e){const{modelAttribute:n,styleName:i}=e;t.for("downcast").add((t=>t.on(`attribute:${n}:table`,((t,e,n)=>{const{item:o,attributeNewValue:r}=e,{mapper:s,writer:a}=n;if(!n.consumable.consume(e.item,t.name))return;const c=[...s.toViewElement(o).getChildren()].find((t=>t.is("element","table")));r?a.setStyle(i,r,c):a.removeStyle(i,c)}))))}function CE(t){if(!t)return;const e=["top","right","bottom","left"];if(!e.every((e=>t[e])))return t;const n=t.top;return e.every((e=>t[e]===n))?n:t}function vE(t,e,n,i,o=1){null!=e&&null!=o&&e>o?i.setAttribute(t,e,n):i.removeAttribute(t,n)}function yE(t,e,n={}){const i=t.createElement("tableCell",n);return t.insertElement("paragraph",i),t.insert(i,e),i}function xE(t,e){const n=e.parent.parent,i=parseInt(n.getAttribute("headingColumns")||"0"),{column:o}=t.getCellLocation(e);return!!i&&o{e.on(`element:${t}`,((t,e,{writer:n})=>{if(!e.modelRange)return;const i=e.modelRange.start.nodeAfter,o=n.createPositionAt(i,0);if(e.viewItem.isEmpty)return void n.insertElement("paragraph",o);const r=Array.from(i.getChildren());if(r.every((t=>t.is("element","$marker")))){const t=n.createElement("paragraph");n.insert(t,n.createPositionAt(i,0));for(const e of r)n.move(n.createRangeOn(e),n.createPositionAt(t,"end"))}}),{priority:"low"})}}function IE(t){let e=0,n=0;const i=Array.from(t.getChildren()).filter((t=>"th"===t.name||"td"===t.name));for(;n1||o>1)&&this._recordSpans(n,o,i),this._shouldSkipSlot()||(e=this._formatOutValue(n)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,e||this.next()}skipRow(t){this._skipRows.add(t)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(t,e=this._row,n=this._column){return{done:!1,value:new BE(this,t,e,n)}}_shouldSkipSlot(){const t=this._skipRows.has(this._row),e=this._rowthis._endColumn;return t||e||n||i}_getSpanned(){const t=this._spannedCells.get(this._row);return t&&t.get(this._column)||null}_recordSpans(t,e,n){const i={cell:t,row:this._row,column:this._column};for(let t=this._row;t0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const t=this._getRowLength(0);for(let e=this._startRow;!this._jumpedToStartRow;e--)t===this._getRowLength(e)&&(this._row=e,this._rowIndex=e,this._jumpedToStartRow=!0)}_getRowLength(t){return[...this._table.getChild(t).getChildren()].reduce(((t,e)=>t+parseInt(e.getAttribute("colspan")||"1")),0)}}class BE{constructor(t,e,n,i){this.cell=e,this.row=t._row,this.column=t._column,this.cellAnchorRow=n,this.cellAnchorColumn=i,this._cellIndex=t._cellIndex,this._rowIndex=t._rowIndex,this._table=t._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function ME(t,e){return(n,{writer:i})=>{const o=n.getAttribute("headingRows")||0,r=i.createContainerElement("table",null,[]),s=i.createContainerElement("figure",{class:"table"},r);o>0&&i.insert(i.createPositionAt(r,"end"),i.createContainerElement("thead",null,i.createSlot((t=>t.is("element","tableRow")&&t.indext.is("element","tableRow")&&t.index>=o))));for(const{positionOffset:t,filter:n}of e.additionalSlots)i.insert(i.createPositionAt(r,t),i.createSlot(n));return i.insert(i.createPositionAt(r,"after"),i.createSlot((t=>!t.is("element","tableRow")&&!e.additionalSlots.some((({filter:e})=>e(t)))))),e.asWidget?function(t,e){return e.setCustomProperty("table",!0,t),pw(t,e,{hasSelectionHandle:!0})}(s,i):s}}function PE(t={}){return(e,{writer:n})=>{const i=e.parent,o=i.parent,r=o.getChildIndex(i),s=new TE(o,{row:r}),a=o.getAttribute("headingRows")||0,c=o.getAttribute("headingColumns")||0;let l=null;for(const i of s)if(i.cell==e){const e=i.row{if(!e.parent.is("element","tableCell"))return null;if(!LE(e))return null;if(t.asWidget)return n.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const t=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,t),t}}}function LE(t){return 1==t.parent.childCount&&!function(t){for(const e of t.getAttributeKeys())if(!e.startsWith("selection:")&&"htmlEmptyBlock"!=e)return!0;return!1}(t)}class zE extends cr{refresh(){const t=this.editor.model,e=t.document.selection,n=t.schema;this.isEnabled=function(t,e){const n=t.getFirstPosition().parent,i=n===n.root?n:n.parent;return e.checkChild(i,"table")}(e,n)}execute(t={}){const e=this.editor,n=e.model,i=e.plugins.get("TableUtils"),o=e.config.get("table.defaultHeadings.rows"),r=e.config.get("table.defaultHeadings.columns");void 0===t.headingRows&&o&&(t.headingRows=o),void 0===t.headingColumns&&r&&(t.headingColumns=r),n.change((e=>{const o=i.createTable(e,t);n.insertObject(o,null,null,{findOptimalPosition:"auto"}),e.setSelection(e.createPositionAt(o.getNodeByPath([0,0,0]),0))}))}}class OE extends cr{constructor(t,e={}){super(t),this.order=e.order||"below"}refresh(){const t=this.editor.model.document.selection,e=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t).length;this.isEnabled=e}execute(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),i="above"===this.order,o=n.getSelectionAffectedTableCells(e),r=n.getRowIndexes(o),s=i?r.first:r.last,a=o[0].findAncestor("table");n.insertRows(a,{at:i?s:s+1,copyStructureFromAbove:!i})}}class VE extends cr{constructor(t,e={}){super(t),this.order=e.order||"right"}refresh(){const t=this.editor.model.document.selection,e=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t).length;this.isEnabled=e}execute(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),i="left"===this.order,o=n.getSelectionAffectedTableCells(e),r=n.getColumnIndexes(o),s=i?r.first:r.last,a=o[0].findAncestor("table");n.insertColumns(a,{columns:1,at:i?s:s+1})}}class FE extends cr{constructor(t,e={}){super(t),this.direction=e.direction||"horizontally"}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===t.length}execute(){const t=this.editor.plugins.get("TableUtils"),e=t.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?t.splitCellHorizontally(e,2):t.splitCellVertically(e,2)}}function RE(t,e,n){const{startRow:i,startColumn:o,endRow:r,endColumn:s}=e,a=n.createElement("table"),c=r-i+1;for(let t=0;t0&&vE("headingRows",r-n,t,o,0);const s=parseInt(e.getAttribute("headingColumns")||"0");s>0&&vE("headingColumns",s-i,t,o,0)}(a,t,i,o,n),a}function jE(t,e,n=0){const i=[],o=new TE(t,{startRow:n,endRow:e-1});for(const t of o){const{row:n,cellHeight:o}=t;n1&&(a.rowspan=c);const l=parseInt(t.getAttribute("colspan")||"1");l>1&&(a.colspan=l);const d=r+s,u=[...new TE(o,{startRow:r,endRow:d,includeAllSlots:!0})];let h,m=null;for(const e of u){const{row:i,column:o,cell:r}=e;r===t&&void 0===h&&(h=o),void 0!==h&&h===o&&i===d&&(m=yE(n,e.getPositionBefore(),a))}return vE("rowspan",s,t,n),m}function UE(t,e){const n=[],i=new TE(t);for(const t of i){const{column:i,cellWidth:o}=t;i1&&(r.colspan=s);const a=parseInt(t.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);const c=yE(i,i.createPositionAfter(t),r);return vE("colspan",o,t,i),c}function GE(t,e,n,i,o,r){const s=parseInt(t.getAttribute("colspan")||"1"),a=parseInt(t.getAttribute("rowspan")||"1");n+s-1>o&&vE("colspan",o-n+1,t,r,1),e+a-1>i&&vE("rowspan",i-e+1,t,r,1)}function qE(t,e){const n=e.getColumns(t),i=new Array(n).fill(0);for(const{column:e}of new TE(t))i[e]++;const o=i.reduce(((t,e,n)=>e?t:[...t,n]),[]);if(o.length>0){const n=o[o.length-1];return e.removeColumns(t,{at:n}),!0}return!1}function $E(t,e){const n=[],i=e.getRows(t);for(let e=0;e0){const i=n[n.length-1];return e.removeRows(t,{at:i}),!0}return!1}function KE(t,e){qE(t,e)||$E(t,e)}function YE(t,e){const n=Array.from(new TE(t,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(n.every((({cellHeight:t})=>1===t)))return e.lastRow;const i=n[0].cellHeight-1;return e.lastRow+i}function QE(t,e){const n=Array.from(new TE(t,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(n.every((({cellWidth:t})=>1===t)))return e.lastColumn;const i=n[0].cellWidth-1;return e.lastColumn+i}class ZE extends cr{constructor(t,e){super(t),this.direction=e.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const t=this._getMergeableCell();this.value=t,this.isEnabled=!!t}execute(){const t=this.editor.model,e=t.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(e.selection)[0],i=this.value,o=this.direction;t.change((t=>{const e="right"==o||"down"==o,r=e?n:i,s=e?i:n,a=s.parent;!function(t,e,n){JE(t)||(JE(e)&&n.remove(n.createRangeIn(e)),n.move(n.createRangeIn(t),n.createPositionAt(e,"end"))),n.remove(t)}(s,r,t);const c=this.isHorizontal?"colspan":"rowspan",l=parseInt(n.getAttribute(c)||"1"),d=parseInt(i.getAttribute(c)||"1");t.setAttribute(c,l+d,r),t.setSelection(t.createRangeIn(r));const u=this.editor.plugins.get("TableUtils");KE(a.findAncestor("table"),u)}))}_getMergeableCell(){const t=this.editor.model.document,e=this.editor.plugins.get("TableUtils"),n=e.getTableCellsContainingSelection(t.selection)[0];if(!n)return;const i=this.isHorizontal?function(t,e,n){const i=t.parent.parent,o="right"==e?t.nextSibling:t.previousSibling,r=(i.getAttribute("headingColumns")||0)>0;if(!o)return;const s="right"==e?t:o,a="right"==e?o:t,{column:c}=n.getCellLocation(s),{column:l}=n.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||"1"),u=xE(n,s),h=xE(n,a);return r&&u!=h?void 0:c+d===l?o:void 0}(n,this.direction,e):function(t,e,n){const i=t.parent,o=i.parent,r=o.getChildIndex(i);if("down"==e&&r===n.getRows(o)-1||"up"==e&&0===r)return null;const s=parseInt(t.getAttribute("rowspan")||"1"),a=o.getAttribute("headingRows")||0;if(a&&("down"==e&&r+s===a||"up"==e&&r===a))return null;const c=parseInt(t.getAttribute("rowspan")||"1"),l="down"==e?r+c:r,d=[...new TE(o,{endRow:l})],u=d.find((e=>e.cell===t)).column,h=d.find((({row:t,cellHeight:n,column:i})=>i===u&&("down"==e?t===l:l===t+n)));return h&&h.cell?h.cell:null}(n,this.direction,e);if(!i)return;const o=this.isHorizontal?"rowspan":"colspan",r=parseInt(n.getAttribute(o)||"1");return parseInt(i.getAttribute(o)||"1")===r?i:void 0}}function JE(t){const e=t.getChild(0);return 1==t.childCount&&e.is("element","paragraph")&&e.isEmpty}class XE extends cr{refresh(){const t=this.editor.plugins.get("TableUtils"),e=t.getSelectionAffectedTableCells(this.editor.model.document.selection),n=e[0];if(n){const i=n.findAncestor("table"),o=t.getRows(i)-1,r=t.getRowIndexes(e),s=0===r.first&&r.last===o;this.isEnabled=!s}else this.isEnabled=!1}execute(){const t=this.editor.model,e=this.editor.plugins.get("TableUtils"),n=e.getSelectionAffectedTableCells(t.document.selection),i=e.getRowIndexes(n),o=n[0],r=o.findAncestor("table"),s=e.getCellLocation(o).column;t.change((t=>{const n=i.last-i.first+1;e.removeRows(r,{at:i.first,rows:n});const o=function(t,e,n,i){const o=t.getChild(Math.min(e,i-1));let r=o.getChild(0),s=0;for(const t of o.getChildren()){if(s>n)return r;r=t,s+=parseInt(t.getAttribute("colspan")||"1")}return r}(r,i.first,s,e.getRows(r));t.setSelection(t.createPositionAt(o,0))}))}}class tD extends cr{refresh(){const t=this.editor.plugins.get("TableUtils"),e=t.getSelectionAffectedTableCells(this.editor.model.document.selection),n=e[0];if(n){const i=n.findAncestor("table"),o=t.getColumns(i),{first:r,last:s}=t.getColumnIndexes(e);this.isEnabled=s-rt.cell===e)).column,last:o.find((t=>t.cell===n)).column},s=function(t,e,n,i){return parseInt(n.getAttribute("colspan")||"1")>1?n:e.previousSibling||n.nextSibling?n.nextSibling||e.previousSibling:i.first?t.reverse().find((({column:t})=>tt>i.last)).cell}(o,e,n,r);this.editor.model.change((e=>{const n=r.last-r.first+1;t.removeColumns(i,{at:r.first,columns:n}),e.setSelection(e.createPositionAt(s,0))}))}}class eD extends cr{refresh(){const t=this.editor.plugins.get("TableUtils"),e=this.editor.model,n=t.getSelectionAffectedTableCells(e.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every((t=>this._isInHeading(t,t.parent.parent)))}execute(t={}){if(t.forceValue===this.value)return;const e=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=e.getSelectionAffectedTableCells(n.document.selection),o=i[0].findAncestor("table"),{first:r,last:s}=e.getRowIndexes(i),a=this.value?r:s+1,c=o.getAttribute("headingRows")||0;n.change((t=>{if(a){const e=jE(o,a,a>c?c:0);for(const{cell:n}of e)HE(n,a,t)}vE("headingRows",a,o,t,0)}))}_isInHeading(t,e){const n=parseInt(e.getAttribute("headingRows")||"0");return!!n&&t.parent.index0;this.isEnabled=i,this.value=i&&n.every((t=>xE(e,t)))}execute(t={}){if(t.forceValue===this.value)return;const e=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=e.getSelectionAffectedTableCells(n.document.selection),o=i[0].findAncestor("table"),{first:r,last:s}=e.getColumnIndexes(i),a=this.value?r:s+1;n.change((t=>{if(a){const e=UE(o,a);for(const{cell:n,column:i}of e)WE(n,i,a,t)}vE("headingColumns",a,o,t,0)}))}}const iD=5,oD=2;function rD(t,e){return 4e3/sD(t,e)}function sD(t,e){const n=aD(t,"tbody",e)||aD(t,"thead",e);return cD(e.editing.view.domConverter.mapViewToDom(n))}function aD(t,e,n){return[...[...n.editing.mapper.toViewElement(t).getChildren()].find((t=>t.is("element","table"))).getChildren()].find((t=>t.is("element",e)))}function cD(t){const e=a.window.getComputedStyle(t);return"border-box"===e.boxSizing?parseFloat(e.width)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderLeftWidth)-parseFloat(e.borderRightWidth):parseFloat(e.width)}function lD(t){const e=Math.pow(10,oD),n="number"==typeof t?t:parseFloat(t);return Math.round(n*e)/e}function dD(t){return t.map((t=>"number"==typeof t?t:parseFloat(t))).filter((t=>!Number.isNaN(t))).reduce(((t,e)=>t+e),0)}function uD(t){let e=function(t){const e=t.filter((t=>"auto"===t)).length;if(0===e)return t.map((t=>lD(t)));const n=dD(t),i=Math.max((100-n)/e,iD);return t.map((t=>"auto"===t?i:t)).map((t=>lD(t)))}(t.map((t=>"auto"===t?t:parseFloat(t.replace("%","")))));const n=dD(e);return 100!==n&&(e=e.map((t=>lD(100*t/n))).map(((t,e,n)=>e!==n.length-1?t:lD(t+100-dD(n))))),e.map((t=>t+"%"))}function hD(t){const e=a.window.getComputedStyle(t);return"border-box"===e.boxSizing?parseInt(e.width):parseFloat(e.width)+parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderWidth)}function mD(t,e,n,i){for(let o=0;ot.is("element","tableColumnGroup")))}function pD(t){const e=gD(t);return e?Array.from(e.getChildren()):[]}class fD extends sr{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(t){const e=t.parent,n=e.parent,i=n.getChildIndex(e),o=new TE(n,{row:i});for(const{cell:e,row:n,column:i}of o)if(e===t)return{row:n,column:i}}createTable(t,e){const n=t.createElement("table"),i=e.rows||2,o=e.columns||2;return kD(t,n,0,i,o),e.headingRows&&vE("headingRows",Math.min(e.headingRows,i),n,t,0),e.headingColumns&&vE("headingColumns",Math.min(e.headingColumns,o),n,t,0),n}insertRows(t,e={}){const n=this.editor.model,i=e.at||0,o=e.rows||1,r=void 0!==e.copyStructureFromAbove,s=e.copyStructureFromAbove?i-1:i,a=this.getRows(t),c=this.getColumns(t);if(i>a)throw new I("tableutils-insertrows-insert-out-of-range",this,{options:e});n.change((e=>{const n=t.getAttribute("headingRows")||0;if(n>i&&vE("headingRows",n+o,t,e,0),!r&&(0===i||i===a))return void kD(e,t,i,o,c);const l=r?Math.max(i,s):i,d=new TE(t,{endRow:l}),u=new Array(c).fill(1);for(const{row:t,column:n,cellHeight:a,cellWidth:c,cell:l}of d){const d=t+a-1,h=t<=s&&s<=d;t0&&yE(e,o,i>1?{colspan:i}:void 0),t+=Math.abs(i)-1}}}))}insertColumns(t,e={}){const n=this.editor.model,i=e.at||0,o=e.columns||1;n.change((e=>{const n=t.getAttribute("headingColumns");io-1)throw new I("tableutils-removerows-row-index-out-of-range",this,{table:t,options:e});n.change((e=>{const n={first:r,last:s},{cellsToMove:i,cellsToTrim:o}=function(t,{first:e,last:n}){const i=new Map,o=[];for(const{row:r,column:s,cellHeight:a,cell:c}of new TE(t,{endRow:n})){const t=r+a-1;if(r>=e&&r<=n&&t>n){const t=a-(n-r+1);i.set(s,{cell:c,rowspan:t})}if(r=e){let i;i=t>=n?n-e+1:t-e+1,o.push({cell:c,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:o}}(t,n);i.size&&function(t,e,n,i){const o=[...new TE(t,{includeAllSlots:!0,row:e})],r=t.getChild(e);let s;for(const{column:t,cell:e,isAnchor:a}of o)if(n.has(t)){const{cell:e,rowspan:o}=n.get(t),a=s?i.createPositionAfter(s):i.createPositionAt(r,0);i.move(i.createRangeOn(e),a),vE("rowspan",o,e,i),s=e}else a&&(s=e)}(t,s+1,i,e);for(let n=s;n>=r;n--)e.remove(t.getChild(n));for(const{rowspan:t,cell:n}of o)vE("rowspan",t,n,e);!function(t,{first:e,last:n},i){const o=t.getAttribute("headingRows")||0;e{!function(t,e,n){const i=t.getAttribute("headingColumns")||0;if(i&&e.first=i;o--){for(const{cell:n,column:i,cellWidth:r}of[...new TE(t)])i<=o&&r>1&&i+r>o?vE("colspan",r-1,n,e):i===o&&e.remove(n);if(n[o]){const t=0===o?n[1]:n[o-1],i=parseFloat(n[o].getAttribute("columnWidth")),r=parseFloat(t.getAttribute("columnWidth"));e.remove(n[o]),e.setAttribute("columnWidth",i+r+"%",t)}}$E(t,this)||qE(t,this)}))}splitCellVertically(t,e=2){const n=this.editor.model,i=t.parent.parent,o=parseInt(t.getAttribute("rowspan")||"1"),r=parseInt(t.getAttribute("colspan")||"1");n.change((n=>{if(r>1){const{newCellsSpan:i,updatedSpan:s}=wD(r,e);vE("colspan",s,t,n);const a={};i>1&&(a.colspan=i),o>1&&(a.rowspan=o),bD(r>e?e-1:r-1,n,n.createPositionAfter(t),a)}if(re===t)),l=a.filter((({cell:e,cellWidth:n,column:i})=>e!==t&&i===c||ic));for(const{cell:t,cellWidth:e}of l)n.setAttribute("colspan",e+s,t);const d={};o>1&&(d.rowspan=o),bD(s,n,n.createPositionAfter(t),d);const u=i.getAttribute("headingColumns")||0;u>c&&vE("headingColumns",u+s,i,n)}}))}splitCellHorizontally(t,e=2){const n=this.editor.model,i=t.parent,o=i.parent,r=o.getChildIndex(i),s=parseInt(t.getAttribute("rowspan")||"1"),a=parseInt(t.getAttribute("colspan")||"1");n.change((n=>{if(s>1){const i=[...new TE(o,{startRow:r,endRow:r+s-1,includeAllSlots:!0})],{newCellsSpan:c,updatedSpan:l}=wD(s,e);vE("rowspan",l,t,n);const{column:d}=i.find((({cell:e})=>e===t)),u={};c>1&&(u.rowspan=c),a>1&&(u.colspan=a);let h=0;for(const t of i){const{column:e,row:i}=t,o=e===d;h>=c&&o&&(h=0),i>=r+l&&o&&(h||bD(1,n,t.getPositionBefore(),u),h++)}}if(sr){const t=o+i;n.setAttribute("rowspan",t,e)}const l={};a>1&&(l.colspan=a),kD(n,o,r+1,i,1,l);const d=o.getAttribute("headingRows")||0;d>r&&vE("headingRows",d+i,o,n)}}))}getColumns(t){return[...t.getChild(0).getChildren()].filter((t=>t.is("element","tableCell"))).reduce(((t,e)=>t+parseInt(e.getAttribute("colspan")||"1")),0)}getRows(t){return Array.from(t.getChildren()).reduce(((t,e)=>e.is("element","tableRow")?t+1:t),0)}createTableWalker(t,e={}){return new TE(t,e)}getSelectedTableCells(t){const e=[];for(const n of this.sortRanges(t.getRanges())){const t=n.getContainedElement();t&&t.is("element","tableCell")&&e.push(t)}return e}getTableCellsContainingSelection(t){const e=[];for(const n of t.getRanges()){const t=n.start.findAncestor("tableCell");t&&e.push(t)}return e}getSelectionAffectedTableCells(t){const e=this.getSelectedTableCells(t);return e.length?e:this.getTableCellsContainingSelection(t)}getRowIndexes(t){const e=t.map((t=>t.parent.index));return this._getFirstLastIndexesObject(e)}getColumnIndexes(t){const e=t[0].findAncestor("table"),n=[...new TE(e)].filter((e=>t.includes(e.cell))).map((t=>t.column));return this._getFirstLastIndexesObject(n)}isSelectionRectangular(t){if(t.length<2||!this._areCellInTheSameTableSection(t))return!1;const e=new Set,n=new Set;let i=0;for(const o of t){const{row:t,column:r}=this.getCellLocation(o),s=parseInt(o.getAttribute("rowspan"))||1,a=parseInt(o.getAttribute("colspan"))||1;e.add(t),n.add(r),s>1&&e.add(t+s-1),a>1&&n.add(r+a-1),i+=s*a}const o=function(t,e){const n=Array.from(t.values()),i=Array.from(e.values());return(Math.max(...n)-Math.min(...n)+1)*(Math.max(...i)-Math.min(...i)+1)}(e,n);return o==i}sortRanges(t){return Array.from(t).sort(_D)}_getFirstLastIndexesObject(t){const e=t.sort(((t,e)=>t-e));return{first:e[0],last:e[e.length-1]}}_areCellInTheSameTableSection(t){const e=t[0].findAncestor("table"),n=this.getRowIndexes(t),i=parseInt(e.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,i))return!1;const o=this.getColumnIndexes(t),r=parseInt(e.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,r)}_areIndexesInSameSection({first:t,last:e},n){return t{const i=e.getSelectedTableCells(t.document.selection),o=i.shift(),{mergeWidth:r,mergeHeight:s}=function(t,e,n){let i=0,o=0;for(const t of e){const{row:e,column:r}=n.getCellLocation(t);i=yD(t,r,i,"colspan"),o=yD(t,e,o,"rowspan")}const{row:r,column:s}=n.getCellLocation(t);return{mergeWidth:i-s,mergeHeight:o-r}}(o,i,e);vE("colspan",r,o,n),vE("rowspan",s,o,n);for(const t of i)CD(t,o,n);KE(o.findAncestor("table"),e),n.setSelection(o,"in")}))}}function CD(t,e,n){vD(t)||(vD(e)&&n.remove(n.createRangeIn(e)),n.move(n.createRangeIn(t),n.createPositionAt(e,"end"))),n.remove(t)}function vD(t){const e=t.getChild(0);return 1==t.childCount&&e.is("element","paragraph")&&e.isEmpty}function yD(t,e,n,i){const o=parseInt(t.getAttribute(i)||"1");return Math.max(n,e+o)}class xD extends cr{constructor(t){super(t),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const t=this.editor.model,e=this.editor.plugins.get("TableUtils"),n=e.getSelectionAffectedTableCells(t.document.selection),i=e.getRowIndexes(n),o=n[0].findAncestor("table"),r=[];for(let e=i.first;e<=i.last;e++)for(const n of o.getChild(e).getChildren())r.push(t.createRangeOn(n));t.change((t=>{t.setSelection(r)}))}}class ED extends cr{constructor(t){super(t),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const t=this.editor.plugins.get("TableUtils"),e=this.editor.model,n=t.getSelectionAffectedTableCells(e.document.selection),i=n[0],o=n.pop(),r=i.findAncestor("table"),s=t.getCellLocation(i),a=t.getCellLocation(o),c=Math.min(s.column,a.column),l=Math.max(s.column,a.column),d=[];for(const t of new TE(r,{startColumn:c,endColumn:l}))d.push(e.createRangeOn(t.cell));e.change((t=>{t.setSelection(d)}))}}function DD(t,e){let n=!1;const i=function(t){const e=parseInt(t.getAttribute("headingRows")||"0"),n=Array.from(t.getChildren()).reduce(((t,e)=>e.is("element","tableRow")?t+1:t),0),i=[];for(const{row:o,cell:r,cellHeight:s}of new TE(t)){if(s<2)continue;const t=ot){const e=t-o;i.push({cell:r,rowspan:e})}}return i}(t);if(i.length){n=!0;for(const t of i)vE("rowspan",t.rowspan,t.cell,e,1)}return n}function SD(t,e){let n=!1;const i=function(t){const e=new Array(t.childCount).fill(0);for(const{rowIndex:n}of new TE(t,{includeAllSlots:!0}))e[n]++;return e}(t),o=[];for(const[e,n]of i.entries())!n&&t.getChild(e).is("element","tableRow")&&o.push(e);if(o.length){n=!0;for(const n of o.reverse())e.remove(t.getChild(n)),i.splice(n,1)}const r=i.filter(((e,n)=>t.getChild(n).is("element","tableRow"))),s=r[0];if(!r.every((t=>t===s))){const i=r.reduce(((t,e)=>e>t?e:t),0);for(const[o,s]of r.entries()){const r=i-s;if(r){for(let n=0;nt.is("$text")));for(const t of n)e.wrap(e.createRangeOn(t),"paragraph");return!!n.length}function PD(t){return!!t.position.parent.is("element","tableCell")&&("insert"==t.type&&"$text"==t.name||"remove"==t.type)}function ND(t,e){if(!t.is("element","paragraph"))return!1;const n=e.toViewElement(t);return!!n&&LE(t)!==n.is("element","span")}var LD=o(8864),zD={attributes:{"data-cke":!0}};zD.setAttributes=Qo(),zD.insert=Ko().bind(null,"head"),zD.domAPI=qo(),zD.insertStyleElement=Jo(),Wo()(LD.A,zD),LD.A&&LD.A.locals&&LD.A.locals;class OD extends sr{static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[fD]}constructor(t){super(t),this._additionalSlots=[]}init(){const t=this.editor,e=t.model,n=e.schema,i=t.conversion,o=t.plugins.get(fD);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add((t=>{t.on("element:figure",((t,e,n)=>{if(!n.consumable.test(e.viewItem,{name:!0,classes:"table"}))return;const i=function(t){for(const e of t.getChildren())if(e.is("element","table"))return e}(e.viewItem);if(!i||!n.consumable.test(i,{name:!0}))return;n.consumable.consume(e.viewItem,{name:!0,classes:"table"});const o=ro(n.convertItem(i,e.modelCursor).modelRange.getItems());o?(n.convertChildren(e.viewItem,n.writer.createPositionAt(o,"end")),n.updateConversionResult(o,e)):n.consumable.revert(e.viewItem,{name:!0,classes:"table"})}))})),i.for("upcast").add((t=>{t.on("element:table",((t,e,n)=>{const i=e.viewItem;if(!n.consumable.test(i,{name:!0}))return;const{rows:o,headingRows:r,headingColumns:s}=function(t){let e,n=0;const i=[],o=[];let r;for(const s of Array.from(t.getChildren())){if("tbody"!==s.name&&"thead"!==s.name&&"tfoot"!==s.name)continue;"thead"!==s.name||r||(r=s);const t=Array.from(s.getChildren()).filter((t=>t.is("element","tr")));let a=null;for(const c of t){const t=Array.from(c.getChildren()).filter((t=>t.is("element","td")||t.is("element","th")));if(r&&s===r||"tbody"===s.name&&t.length>0&&(null===a||t.length===a)&&t.every((t=>t.is("element","th"))))n++,i.push(c);else{o.push(c);const t=IE(c);(!e||tn.convertItem(t,n.writer.createPositionAt(c,"end")))),n.convertChildren(i,n.writer.createPositionAt(c,"end")),c.isEmpty){const t=n.writer.createElement("tableRow");n.writer.insert(t,n.writer.createPositionAt(c,"end")),yE(n.writer,n.writer.createPositionAt(t,"end"))}n.updateConversionResult(c,e)}}))})),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:ME(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:ME(o,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add((t=>{t.on("element:tr",((t,e)=>{e.viewItem.isEmpty&&0==e.modelCursor.index&&t.stop()}),{priority:"high"})})),i.for("downcast").elementToElement({model:"tableRow",view:(t,{writer:e})=>t.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(SE("td")),i.for("upcast").add(SE("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:PE({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:PE()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:NE({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:NE(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:VD("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:VD("rowspan")},view:"rowspan"}),t.config.define("table.defaultHeadings.rows",0),t.config.define("table.defaultHeadings.columns",0),t.commands.add("insertTable",new zE(t)),t.commands.add("insertTableRowAbove",new OE(t,{order:"above"})),t.commands.add("insertTableRowBelow",new OE(t,{order:"below"})),t.commands.add("insertTableColumnLeft",new VE(t,{order:"left"})),t.commands.add("insertTableColumnRight",new VE(t,{order:"right"})),t.commands.add("removeTableRow",new XE(t)),t.commands.add("removeTableColumn",new tD(t)),t.commands.add("splitTableCellVertically",new FE(t,{direction:"vertically"})),t.commands.add("splitTableCellHorizontally",new FE(t,{direction:"horizontally"})),t.commands.add("mergeTableCells",new AD(t)),t.commands.add("mergeTableCellRight",new ZE(t,{direction:"right"})),t.commands.add("mergeTableCellLeft",new ZE(t,{direction:"left"})),t.commands.add("mergeTableCellDown",new ZE(t,{direction:"down"})),t.commands.add("mergeTableCellUp",new ZE(t,{direction:"up"})),t.commands.add("setTableColumnHeader",new nD(t)),t.commands.add("setTableRowHeader",new eD(t)),t.commands.add("selectTableRow",new xD(t)),t.commands.add("selectTableColumn",new ED(t)),function(t){t.document.registerPostFixer((e=>function(t,e){const n=e.document.differ.getChanges();let i=!1;const o=new Set;for(const e of n){let n=null;"insert"==e.type&&"table"==e.name&&(n=e.position.nodeAfter),"insert"!=e.type&&"remove"!=e.type||"tableRow"!=e.name&&"tableCell"!=e.name||(n=e.position.findAncestor("table")),ID(e)&&(n=e.range.start.findAncestor("table")),n&&!o.has(n)&&(i=DD(n,t)||i,i=SD(n,t)||i,o.add(n))}return i}(e,t)))}(e),function(t){t.document.registerPostFixer((e=>function(t,e){const n=e.document.differ.getChanges();let i=!1;for(const e of n)"insert"==e.type&&"table"==e.name&&(i=TD(e.position.nodeAfter,t)||i),"insert"==e.type&&"tableRow"==e.name&&(i=BD(e.position.nodeAfter,t)||i),"insert"==e.type&&"tableCell"==e.name&&(i=MD(e.position.nodeAfter,t)||i),"remove"!=e.type&&"insert"!=e.type||!PD(e)||(i=MD(e.position.parent,t)||i);return i}(e,t)))}(e),this.listenTo(e.document,"change:data",(()=>{!function(t,e){const n=t.document.differ;for(const t of n.getChanges()){let n,i=!1;if("attribute"==t.type){const e=t.range.start.nodeAfter;if(!e||!e.is("element","table"))continue;if("headingRows"!=t.attributeKey&&"headingColumns"!=t.attributeKey)continue;n=e,i="headingRows"==t.attributeKey}else"tableRow"!=t.name&&"tableCell"!=t.name||(n=t.position.findAncestor("table"),i="tableRow"==t.name);if(!n)continue;const o=n.getAttribute("headingRows")||0,r=n.getAttribute("headingColumns")||0,s=new TE(n);for(const t of s){const n=t.rowND(t,e.mapper)));for(const t of n)e.reconvertItem(t)}}(e,t.editing)}))}registerAdditionalSlot(t){this._additionalSlots.push(t)}}function VD(t){return e=>{const n=parseInt(e.getAttribute(t));return Number.isNaN(n)||n<=0?null:n}}var FD=o(8603),RD={attributes:{"data-cke":!0}};RD.setAttributes=Qo(),RD.insert=Ko().bind(null,"head"),RD.domAPI=qo(),RD.insertStyleElement=Jo(),Wo()(FD.A,RD),FD.A&&FD.A.locals&&FD.A.locals;class jD extends er{constructor(t){super(t);const e=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new uo,this.focusTracker=new so,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((t,e)=>`${e} × ${t}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":e.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:e.to("label")}]}],on:{mousedown:e.to((t=>{t.preventDefault()})),click:e.to((()=>{this.fire("execute")}))}}),this.on("boxover",((t,e)=>{const{row:n,column:i}=e.target.dataset;this.items.get(10*(parseInt(n,10)-1)+(parseInt(i,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((t,e,n)=>{if(!n)return;const{row:i,column:o}=n.dataset;this.set({rows:parseInt(i),columns:parseInt(o)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),rr({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const t of this.items)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const t=this.rows,e=this.columns;this.items.map(((n,i)=>{const o=Math.floor(i/10){const i=t.commands.get("insertTable"),o=tp(n);let r;return o.bind("isEnabled").to(i),o.buttonView.set({icon:Dh.table,label:e("Insert table"),tooltip:!0}),o.on("change:isOpen",(()=>{r||(r=new jD(n),o.panelView.children.add(r),r.delegate("execute").to(o),o.on("execute",(()=>{t.execute("insertTable",{rows:r.rows,columns:r.columns}),t.editing.view.focus()})))})),o})),t.ui.componentFactory.add("menuBar:insertTable",(n=>{const i=t.commands.get("insertTable"),o=new Pk(n),r=new jD(n);return r.delegate("execute").to(o),o.on("change:isOpen",((t,e,n)=>{n||r.reset()})),r.on("execute",(()=>{t.execute("insertTable",{rows:r.rows,columns:r.columns}),t.editing.view.focus()})),o.buttonView.set({label:e("Table"),icon:Dh.table}),o.panelView.children.add(r),o.bind("isEnabled").to(i),o})),t.ui.componentFactory.add("tableColumn",(t=>{const i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:e("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:e("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:e("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:e("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:e("Select column")}}];return this._prepareDropdown(e("Column"),'',i,t)})),t.ui.componentFactory.add("tableRow",(t=>{const n=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:e("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:e("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:e("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:e("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:e("Select row")}}];return this._prepareDropdown(e("Row"),'',n,t)})),t.ui.componentFactory.add("mergeTableCells",(t=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:e("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:e("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:e("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:e("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:e("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:e("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(e("Merge cells"),'',i,t)}))}_prepareDropdown(t,e,n,i){const o=this.editor,r=tp(i),s=this._fillDropdownWithListOptions(r,n);return r.buttonView.set({label:t,icon:e,tooltip:!0}),r.bind("isEnabled").toMany(s,"isEnabled",((...t)=>t.some((t=>t)))),this.listenTo(r,"execute",(t=>{o.execute(t.source.commandName),t.source instanceof Cm||o.editing.view.focus()})),r}_prepareMergeSplitButtonDropdown(t,e,n,i){const o=this.editor,r=tp(i,Yg),s="mergeTableCells",a=o.commands.get(s),c=this._fillDropdownWithListOptions(r,n);return r.buttonView.set({label:t,icon:e,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([a,...c],"isEnabled",((...t)=>t.some((t=>t)))),this.listenTo(r.buttonView,"execute",(()=>{o.execute(s),o.editing.view.focus()})),this.listenTo(r,"execute",(t=>{o.execute(t.source.commandName),o.editing.view.focus()})),r}_fillDropdownWithListOptions(t,e){const n=this.editor,i=[],o=new oo;for(const t of e)UD(t,n,i,o);return ip(t,o),i}}function UD(t,e,n,i){if("button"===t.type||"switchbutton"===t.type){const i=t.model=new Gf(t.model),{commandName:o,bindIsOn:r}=t.model,s=e.commands.get(o);n.push(s),i.set({commandName:o}),i.bind("isEnabled").to(s),r&&i.bind("isOn").to(s,"value"),i.set({withText:!0})}i.add(t)}var WD=o(2850),GD={attributes:{"data-cke":!0}};GD.setAttributes=Qo(),GD.insert=Ko().bind(null,"head"),GD.domAPI=qo(),GD.insertStyleElement=Jo(),Wo()(WD.A,GD),WD.A&&WD.A.locals&&WD.A.locals;class qD extends sr{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[fD,fD]}init(){const t=this.editor,e=t.model,n=t.editing.view;this.listenTo(e,"deleteContent",((t,e)=>this._handleDeleteContent(t,e)),{priority:"high"}),this.listenTo(n.document,"insertText",((t,e)=>this._handleInsertTextEvent(t,e)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const t=this.editor.plugins.get(fD),e=this.editor.model.document.selection,n=t.getSelectedTableCells(e);return 0==n.length?null:n}getSelectionAsFragment(){const t=this.editor.plugins.get(fD),e=this.getSelectedTableCells();return e?this.editor.model.change((n=>{const i=n.createDocumentFragment(),{first:o,last:r}=t.getColumnIndexes(e),{first:s,last:a}=t.getRowIndexes(e),c=e[0].findAncestor("table");let l=a,d=r;if(t.isSelectionRectangular(e)){const t={firstColumn:o,lastColumn:r,firstRow:s,lastRow:a};l=YE(c,t),d=QE(c,t)}const u=RE(c,{startRow:s,startColumn:o,endRow:l,endColumn:d},n);return n.insert(u,i,0),i})):null}setCellSelection(t,e){const n=this._getCellsToSelect(t,e);this.editor.model.change((t=>{t.setSelection(n.cells.map((e=>t.createRangeOn(e))),{backward:n.backward})}))}getFocusCell(){const t=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return t&&t.is("element","tableCell")?t:null}getAnchorCell(){const t=ro(this.editor.model.document.selection.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){const t=this.editor,e=new Set;t.conversion.for("editingDowncast").add((t=>t.on("selection",((t,n,i)=>{const o=i.writer;!function(t){for(const n of e)t.removeClass("ck-editor__editable_selected",n);e.clear()}(o);const r=this.getSelectedTableCells();if(!r)return;for(const t of r){const n=i.mapper.toViewElement(t);o.addClass("ck-editor__editable_selected",n),e.add(n)}const s=i.mapper.toViewElement(r[r.length-1]);o.setSelection(s,0)}),{priority:"lowest"})))}_enablePluginDisabling(){const t=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){const e=this.getSelectedTableCells();if(!e)return;t.model.change((n=>{const i=n.createPositionAt(e[0],0),o=t.model.schema.getNearestSelectionRange(i);n.setSelection(o)}))}}))}_handleDeleteContent(t,e){const n=this.editor.plugins.get(fD),i=e[0],o=e[1],r=this.editor.model,s=!o||"backward"==o.direction,a=n.getSelectedTableCells(i);a.length&&(t.stop(),r.change((t=>{const e=a[s?a.length-1:0];r.change((t=>{for(const e of a)r.deleteContent(t.createSelection(e,"in"))}));const n=r.schema.getNearestSelectionRange(t.createPositionAt(e,0));i.is("documentSelection")?t.setSelection(n):i.setTo(n)})))}_handleInsertTextEvent(t,e){const n=this.editor,i=this.getSelectedTableCells();if(!i)return;const o=n.editing.view,r=n.editing.mapper,s=i.map((t=>o.createRangeOn(r.toViewElement(t))));e.selection=o.createSelection(s)}_getCellsToSelect(t,e){const n=this.editor.plugins.get("TableUtils"),i=n.getCellLocation(t),o=n.getCellLocation(e),r=Math.min(i.row,o.row),s=Math.max(i.row,o.row),a=Math.min(i.column,o.column),c=Math.max(i.column,o.column),l=new Array(s-r+1).fill(null).map((()=>[])),d={startRow:r,endRow:s,startColumn:a,endColumn:c};for(const{row:e,cell:n}of new TE(t.findAncestor("table"),d))l[e-r].push(n);const u=o.rowt.reverse())),{cells:l.flat(),backward:u||h}}}class $D extends sr{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[kb,bb,qD,fD]}init(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"copy",((t,e)=>this._onCopyCut(t,e))),this.listenTo(e,"cut",((t,e)=>this._onCopyCut(t,e))),this.listenTo(t.model,"insertContent",((t,[e,n])=>this._onInsertContent(t,e,n)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(t,e){const n=this.editor.editing.view,i=this.editor.plugins.get(qD),o=this.editor.plugins.get(kb);i.getSelectedTableCells()&&("cut"!=t.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(e.preventDefault(),t.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===t.name},(()=>{const r=o._copySelectedFragmentWithMarkers(t.name,this.editor.model.document.selection,(()=>i.getSelectionAsFragment()));n.document.fire("clipboardOutput",{dataTransfer:e.dataTransfer,content:this.editor.data.toView(r),method:t.name})})))}_onInsertContent(t,e,n){if(n&&!n.is("documentSelection"))return;const i=this.editor.model,o=this.editor.plugins.get(fD),r=this.editor.plugins.get(kb),s=this.getTableIfOnlyTableInContent(e,i);if(!s)return;const a=o.getSelectionAffectedTableCells(i.document.selection);a.length?(t.stop(),e.is("documentFragment")?r._pasteMarkersIntoTransformedElement(e.markers,(t=>this._replaceSelectedCells(s,a,t))):this.editor.model.change((t=>{this._replaceSelectedCells(s,a,t)}))):KE(s,o)}_replaceSelectedCells(t,e,n){const i=this.editor.plugins.get(fD),o={width:i.getColumns(t),height:i.getRows(t)},r=function(t,e,n,i){const o=t[0].findAncestor("table"),r=i.getColumnIndexes(t),s=i.getRowIndexes(t),a={firstColumn:r.first,lastColumn:r.last,firstRow:s.first,lastRow:s.last},c=1===t.length;return c&&(a.lastRow+=e.height-1,a.lastColumn+=e.width-1,function(t,e,n,i){const o=i.getColumns(t),r=i.getRows(t);n>o&&i.insertColumns(t,{at:o,columns:n-o}),e>r&&i.insertRows(t,{at:r,rows:e-r})}(o,a.lastRow+1,a.lastColumn+1,i)),c||!i.isSelectionRectangular(t)?function(t,e,n){const{firstRow:i,lastRow:o,firstColumn:r,lastColumn:s}=e,a={first:i,last:o},c={first:r,last:s};YD(t,r,a,n),YD(t,s+1,a,n),KD(t,i,c,n),KD(t,o+1,c,n,i)}(o,a,n):(a.lastRow=YE(o,a),a.lastColumn=QE(o,a)),a}(e,o,n,i),s=r.lastRow-r.firstRow+1,a=r.lastColumn-r.firstColumn+1;t=RE(t,{startRow:0,startColumn:0,endRow:Math.min(s,o.height)-1,endColumn:Math.min(a,o.width)-1},n);const c=e[0].findAncestor("table"),l=this._replaceSelectedCellsWithPasted(t,o,c,r,n);if(this.editor.plugins.get("TableSelection").isEnabled){const t=i.sortRanges(l.map((t=>n.createRangeOn(t))));n.setSelection(t)}else n.setSelection(l[0],0);return c}_replaceSelectedCellsWithPasted(t,e,n,i,o){const{width:r,height:s}=e,a=function(t,e,n){const i=new Array(n).fill(null).map((()=>new Array(e).fill(null)));for(const{column:e,row:n,cell:o}of new TE(t))i[n][e]=o;return i}(t,r,s),c=[...new TE(n,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],l=[];let d;for(const t of c){const{row:e,column:n}=t;n===i.firstColumn&&(d=t.getPositionBefore());const c=e-i.firstRow,u=n-i.firstColumn,h=a[c%s][u%r],m=h?o.cloneElement(h):null,g=this._replaceTableSlotCell(t,m,d,o);g&&(GE(g,e,n,i.lastRow,i.lastColumn,o),l.push(g),d=o.createPositionAfter(g))}const u=parseInt(n.getAttribute("headingRows")||"0"),h=parseInt(n.getAttribute("headingColumns")||"0"),m=i.firstRowQD(t,e,n))).map((({cell:t})=>HE(t,e,i)))}function YD(t,e,n,i){if(!(e<1))return UE(t,e).filter((({row:t,cellHeight:e})=>QD(t,e,n))).map((({cell:t,column:n})=>WE(t,n,e,i)))}function QD(t,e,n){const i=t+e-1,{first:o,last:r}=n;return t>=o&&t<=r||t=o}class ZD extends sr{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[qD,fD]}init(){const t=this.editor,e=t.editing.view.document,n=t.t;this.listenTo(e,"arrowKey",((...t)=>this._onArrowKey(...t)),{context:"table"}),this.listenTo(e,"tab",((...t)=>this._handleTabOnSelectedTable(...t)),{context:"figure"}),this.listenTo(e,"tab",((...t)=>this._handleTab(...t)),{context:["th","td"]}),t.accessibility.addKeystrokeInfoGroup({id:"table",label:n("Keystrokes that can be used in a table cell"),keystrokes:[{label:n("Move the selection to the next cell"),keystroke:"Tab"},{label:n("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:n("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:n("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(t,e){const n=this.editor,i=n.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(e.preventDefault(),e.stopPropagation(),t.stop(),n.model.change((t=>{t.setSelection(t.createRangeIn(i.getChild(0).getChild(0)))})))}_handleTab(t,e){const n=this.editor,i=this.editor.plugins.get(fD),o=this.editor.plugins.get("TableSelection"),r=n.model.document.selection,s=!e.shiftKey;let a=i.getTableCellsContainingSelection(r)[0];if(a||(a=o.getFocusCell()),!a)return;e.preventDefault(),e.stopPropagation(),t.stop();const c=a.parent,l=c.parent,d=l.getChildIndex(c),u=c.getChildIndex(a),h=0===u;if(!s&&h&&0===d)return void n.model.change((t=>{t.setSelection(t.createRangeOn(l))}));const m=u===c.childCount-1,g=d===i.getRows(l)-1;if(s&&g&&m&&(n.execute("insertTableRowBelow"),d===i.getRows(l)-1))return void n.model.change((t=>{t.setSelection(t.createRangeOn(l))}));let p;if(s&&m){const t=l.getChild(d+1);p=t.getChild(0)}else if(!s&&h){const t=l.getChild(d-1);p=t.getChild(t.childCount-1)}else p=c.getChild(u+(s?1:-1));n.model.change((t=>{t.setSelection(t.createRangeIn(p))}))}_onArrowKey(t,e){const n=this.editor,i=Vi(e.keyCode,n.locale.contentLanguageDirection);this._handleArrowKeys(i,e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),t.stop())}_handleArrowKeys(t,e){const n=this.editor.plugins.get(fD),i=this.editor.plugins.get("TableSelection"),o=this.editor.model,r=o.document.selection,s=["right","down"].includes(t),a=n.getSelectedTableCells(r);if(a.length){let n;return n=e?i.getFocusCell():s?a[a.length-1]:a[0],this._navigateFromCellInDirection(n,t,e),!0}const c=r.focus.findAncestor("tableCell");if(!c)return!1;if(!r.isCollapsed)if(e){if(r.isBackward==s&&!r.containsEntireContent(c))return!1}else{const t=r.getSelectedElement();if(!t||!o.schema.isObject(t))return!1}return!!this._isSelectionAtCellEdge(r,c,s)&&(this._navigateFromCellInDirection(c,t,e),!0)}_isSelectionAtCellEdge(t,e,n){const i=this.editor.model,o=this.editor.model.schema,r=n?t.getLastPosition():t.getFirstPosition();if(!o.getLimitElement(r).is("element","tableCell"))return i.createPositionAt(e,n?"end":0).isTouching(r);const s=i.createSelection(r);return i.modifySelection(s,{direction:n?"forward":"backward"}),r.isEqual(s.focus)}_navigateFromCellInDirection(t,e,n=!1){const i=this.editor.model,o=t.findAncestor("table"),r=[...new TE(o,{includeAllSlots:!0})],{row:s,column:a}=r[r.length-1],c=r.find((({cell:e})=>e==t));let{row:l,column:d}=c;switch(e){case"left":d--;break;case"up":l--;break;case"right":d+=c.cellWidth;break;case"down":l+=c.cellHeight}if(l<0||l>s||d<0&&l<=0||d>a&&l>=s)return void i.change((t=>{t.setSelection(t.createRangeOn(o))}));d<0?(d=n?0:a,l--):d>a&&(d=n?a:0,l++);const u=r.find((t=>t.row==l&&t.column==d)).cell,h=["right","down"].includes(e),m=this.editor.plugins.get("TableSelection");if(n&&m.isEnabled){const e=m.getAnchorCell()||t;m.setCellSelection(e,u)}else{const t=i.createPositionAt(u,h?0:"end");i.change((e=>{e.setSelection(t)}))}}}class JD extends Ia{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(t){this.fire(t.type,t)}}class XD extends sr{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[qD,fD]}init(){this.editor.editing.view.addObserver(JD),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const t=this.editor,e=t.plugins.get(fD);let n=!1;const i=t.plugins.get(qD);this.listenTo(t.editing.view.document,"mousedown",((o,r)=>{const s=t.model.document.selection;if(!this.isEnabled||!i.isEnabled)return;if(!r.domEvent.shiftKey)return;const a=i.getAnchorCell()||e.getTableCellsContainingSelection(s)[0];if(!a)return;const c=this._getModelTableCellFromDomEvent(r);c&&tS(a,c)&&(n=!0,i.setCellSelection(a,c),r.preventDefault())})),this.listenTo(t.editing.view.document,"mouseup",(()=>{n=!1})),this.listenTo(t.editing.view.document,"selectionChange",(t=>{n&&t.stop()}),{priority:"highest"})}_enableMouseDragSelection(){const t=this.editor;let e,n,i=!1,o=!1;const r=t.plugins.get(qD);this.listenTo(t.editing.view.document,"mousedown",((t,n)=>{this.isEnabled&&r.isEnabled&&(n.domEvent.shiftKey||n.domEvent.ctrlKey||n.domEvent.altKey||(e=this._getModelTableCellFromDomEvent(n)))})),this.listenTo(t.editing.view.document,"mousemove",((t,s)=>{if(!s.domEvent.buttons)return;if(!e)return;const a=this._getModelTableCellFromDomEvent(s);a&&tS(e,a)&&(n=a,i||n==e||(i=!0)),i&&(o=!0,r.setCellSelection(e,n),s.preventDefault())})),this.listenTo(t.editing.view.document,"mouseup",(()=>{i=!1,o=!1,e=null,n=null})),this.listenTo(t.editing.view.document,"selectionChange",(t=>{o&&t.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(t){const e=t.target,n=this.editor.editing.view.createPositionAt(e,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function tS(t,e){return t.parent.parent==e.parent.parent}var eS=o(9969),nS={attributes:{"data-cke":!0}};function iS(t){return oS(t)||rS(t)}function oS(t){const e=t.getSelectedElement();return e&&sS(e)?e:null}function rS(t){const e=t.getFirstPosition();if(!e)return null;let n=e.parent;for(;n;){if(n.is("element")&&sS(n))return n;n=n.parent}return null}function sS(t){return!!t.getCustomProperty("table")&&gw(t)}nS.setAttributes=Qo(),nS.insert=Ko().bind(null,"head"),nS.domAPI=qo(),nS.insertStyleElement=Jo(),Wo()(eS.A,nS),eS.A&&eS.A.locals&&eS.A.locals;const aS="superscript";class cS extends sr{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:aS}),t.model.schema.setAttributeProperties(aS,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:aS,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),t.commands.add(aS,new D_(t,aS))}}const lS="superscript";class dS extends sr{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=T_({editor:t,commandName:lS,plugin:this,icon:'',label:e("Superscript")});t.ui.componentFactory.add(lS,(()=>n(Lh))),t.ui.componentFactory.add("menuBar:"+lS,(()=>n(lm)))}}const uS="subscript";class hS extends sr{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:uS}),t.model.schema.setAttributeProperties(uS,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:uS,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),t.commands.add(uS,new D_(t,uS))}}const mS="subscript";class gS extends sr{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=T_({editor:t,commandName:mS,plugin:this,icon:'',label:e("Subscript")});t.ui.componentFactory.add(mS,(()=>n(Lh))),t.ui.componentFactory.add("menuBar:"+mS,(()=>n(lm)))}}const pS="strikethrough";class fS extends sr{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:pS}),t.model.schema.setAttributeProperties(pS,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:pS,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(pS,new D_(t,pS)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const kS="strikethrough";class bS extends sr{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=T_({editor:t,commandName:kS,plugin:this,icon:'',keystroke:"CTRL+SHIFT+X",label:e("Strikethrough")});t.ui.componentFactory.add(kS,(()=>n(Lh))),t.ui.componentFactory.add("menuBar:"+kS,(()=>n(lm)))}}const wS="underline";class _S extends sr{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:wS}),t.model.schema.setAttributeProperties(wS,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:wS,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(wS,new D_(t,wS)),t.keystrokes.set("CTRL+U","underline"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Underline text"),keystroke:"CTRL+U"}]})}}const AS="underline";class CS extends sr{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,n=T_({editor:t,commandName:AS,plugin:this,icon:'',label:e("Underline"),keystroke:"CTRL+U"});t.ui.componentFactory.add(AS,(()=>n(Lh))),t.ui.componentFactory.add("menuBar:"+AS,(()=>n(lm)))}}class vS extends cr{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,o=t.batch,r=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)}};o?e.enqueueChange(o,(t=>{r(t)})):e.change((t=>{r(t)}))}}const yS="fontSize",xS="fontFamily",ES="fontColor",DS="fontBackgroundColor";function SS(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 IS(t){return e=>e.getStyle(t).replace(/\s/g,"")}function TS(t){return(e,{writer:n})=>n.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}class BS extends vS{constructor(t){super(t,ES)}}class MS extends sr{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define(ES,{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:ES,value:IS("color")}}),t.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:ES,value:t=>t.getAttribute("color")}}),t.conversion.for("downcast").attributeToElement({model:ES,view:TS("color")}),t.commands.add(ES,new BS(t)),t.model.schema.extend("$text",{allowAttributes:ES}),t.model.schema.setAttributeProperties(ES,{isFormatting:!0,copyOnEnter:!0})}}class PS extends sr{constructor(t,{commandName:e,componentName:n,icon:i,dropdownLabel:o}){super(t),this.commandName=e,this.componentName=n,this.icon=i,this.dropdownLabel=o,this.columns=t.config.get(`${this.componentName}.columns`)}init(){const t=this.editor,e=t.locale,n=e.t,i=t.commands.get(this.commandName),o=t.config.get(this.componentName),r=Bm(e,Mm(o.colors)),s=o.documentColors,a=!1!==o.colorPicker;t.ui.componentFactory.add(this.componentName,(e=>{const c=tp(e);let l=!1;const d=function({dropdownView:t,colors:e,columns:n,removeButtonLabel:i,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:s,colorPickerViewConfig:a}){const c=t.locale,l=new Yp(c,{colors:e,columns:n,removeButtonLabel:i,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:s,colorPickerViewConfig:a});return t.colorSelectorView=l,t.panelView.children.add(l),l}({dropdownView:c,colors:r.map((t=>({label:t.label,color:t.model,options:{hasBorder:t.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==s?n("Document colors"):"",documentColorsCount:void 0===s?this.columns:s,colorPickerViewConfig:!!a&&(o.colorPicker||{})});return d.bind("selectedColor").to(i,"value"),c.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),c.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),c.bind("isEnabled").to(i),d.on("execute",((e,n)=>{c.isOpen&&t.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),"colorPicker"!==n.source&&t.editing.view.focus(),"colorPickerSaveButton"===n.source&&(c.isOpen=!1)})),d.on("colorPicker:show",(()=>{this._undoStepBatch=t.model.createBatch()})),d.on("colorPicker:cancel",(()=>{this._undoStepBatch.operations.length&&(c.isOpen=!1,t.execute("undo",this._undoStepBatch)),t.editing.view.focus()})),c.on("change:isOpen",((e,n,i)=>{l||(l=!0,c.colorSelectorView.appendUI()),i&&(0!==s&&d.updateDocumentColors(t.model,this.componentName),d.updateSelectedColors(),d.showColorGridsFragment())})),rp(c,(()=>c.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((t=>t.isOn)))),c})),t.ui.componentFactory.add(`menuBar:${this.componentName}`,(e=>{const o=new Pk(e);o.buttonView.set({label:this.dropdownLabel,icon:this.icon}),o.bind("isEnabled").to(i);let a=!1;const c=new Yp(e,{colors:r.map((t=>({label:t.label,color:t.model,options:{hasBorder:t.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==s?n("Document colors"):"",documentColorsCount:void 0===s?this.columns:s,colorPickerViewConfig:!1});return c.bind("selectedColor").to(i,"value"),c.delegate("execute").to(o),c.on("execute",((e,n)=>{t.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),t.editing.view.focus()})),o.on("change:isOpen",((e,n,i)=>{a||(a=!0,c.appendUI()),i&&(0!==s&&c.updateDocumentColors(t.model,this.componentName),c.updateSelectedColors(),c.showColorGridsFragment())})),o.panelView.children.add(c),o}))}}class NS extends PS{constructor(t){const e=t.locale.t;super(t,{commandName:ES,componentName:ES,icon:'',dropdownLabel:e("Font Color")})}static get pluginName(){return"FontColorUI"}}class LS extends vS{constructor(t){super(t,DS)}}class zS extends sr{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define(DS,{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(Wu),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:DS,value:IS("background-color")}}),t.conversion.for("downcast").attributeToElement({model:DS,view:TS("background-color")}),t.commands.add(DS,new LS(t)),t.model.schema.extend("$text",{allowAttributes:DS}),t.model.schema.setAttributeProperties(DS,{isFormatting:!0,copyOnEnter:!0})}}class OS extends PS{constructor(t){const e=t.locale.t;super(t,{commandName:DS,componentName:DS,icon:'',dropdownLabel:e("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}const VS=["left","right","center","justify"];function FS(t){return VS.includes(t)}function RS(t,e){return"rtl"==e.contentLanguageDirection?"right"===t:"left"===t}function jS(t){const e=t.map((t=>{let e;return e="string"==typeof t?{name:t}:t,e})).filter((t=>{const e=VS.includes(t.name);return e||T("alignment-config-name-not-recognized",{option:t}),e})),n=e.filter((t=>Boolean(t.className))).length;if(n&&n{const o=i.slice(n+1);if(o.some((t=>t.name==e.name)))throw new I("alignment-config-name-already-defined",{option:e,configuredOptions:t});if(e.className&&o.some((t=>t.className==e.className)))throw new I("alignment-config-classname-already-defined",{option:e,configuredOptions:t})})),e}const HS="alignment";class US extends cr{refresh(){const t=this.editor.locale,e=ro(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=Boolean(e)&&this._canBeAligned(e),this.isEnabled&&e.hasAttribute("alignment")?this.value=e.getAttribute("alignment"):this.value="rtl"===t.contentLanguageDirection?"right":"left"}execute(t={}){const e=this.editor,n=e.locale,i=e.model,o=i.document,r=t.value;i.change((t=>{const e=Array.from(o.selection.getSelectedBlocks()).filter((t=>this._canBeAligned(t))),i=e[0].getAttribute("alignment");RS(r,n)||i===r||!r?function(t,e){for(const n of t)e.removeAttribute(HS,n)}(e,t):function(t,e,n){for(const i of t)e.setAttribute(HS,n,i)}(e,t,r)}))}_canBeAligned(t){return this.editor.model.schema.checkAttribute(t,HS)}}class WS extends sr{static get pluginName(){return"AlignmentEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("alignment",{options:VS.map((t=>({name:t})))})}init(){const t=this.editor,e=t.locale,n=t.model.schema,i=jS(t.config.get("alignment.options")).filter((t=>FS(t.name)&&!RS(t.name,e))),o=i.some((t=>!!t.className));n.extend("$block",{allowAttributes:"alignment"}),t.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),o?t.conversion.attributeToAttribute(function(t){const e={};for(const n of t)e[n.name]={key:"class",value:n.className};return{model:{key:"alignment",values:t.map((t=>t.name))},view:e}}(i)):t.conversion.for("downcast").attributeToAttribute(function(t){const e={};for(const{name:n}of t)e[n]={key:"style",value:{"text-align":n}};return{model:{key:"alignment",values:t.map((t=>t.name))},view:e}}(i));const r=function(t){const e=[];for(const{name:n}of t)e.push({view:{key:"style",value:{"text-align":n}},model:{key:"alignment",value:n}});return e}(i);for(const e of r)t.conversion.for("upcast").attributeToAttribute(e);const s=function(t){const e=[];for(const{name:n}of t)e.push({view:{key:"align",value:n},model:{key:"alignment",value:n}});return e}(i);for(const e of s)t.conversion.for("upcast").attributeToAttribute(e);t.commands.add("alignment",new US(t))}}const GS=(()=>new Map([["left",Dh.alignLeft],["right",Dh.alignRight],["center",Dh.alignCenter],["justify",Dh.alignJustify]]))();class qS extends sr{get localizedOptionTitles(){const t=this.editor.t;return{left:t("Align left"),right:t("Align right"),center:t("Align center"),justify:t("Justify")}}static get pluginName(){return"AlignmentUI"}static get isOfficialPlugin(){return!0}init(){const t=jS(this.editor.config.get("alignment.options"));t.map((t=>t.name)).filter(FS).forEach((t=>this._addButton(t))),this._addToolbarDropdown(t),this._addMenuBarMenu(t)}_addButton(t){this.editor.ui.componentFactory.add(`alignment:${t}`,(e=>this._createButton(e,t)))}_createButton(t,e,n={}){const i=this.editor,o=i.commands.get("alignment"),r=new Lh(t);return r.set({label:this.localizedOptionTitles[e],icon:GS.get(e),tooltip:!0,isToggleable:!0,...n}),r.bind("isEnabled").to(o),r.bind("isOn").to(o,"value",(t=>t===e)),this.listenTo(r,"execute",(()=>{i.execute("alignment",{value:e}),i.editing.view.focus()})),r}_addToolbarDropdown(t){const e=this.editor;e.ui.componentFactory.add("alignment",(n=>{const i=tp(n),o="rtl"===n.uiLanguageDirection?"w":"e",r=n.t;ep(i,(()=>t.map((t=>this._createButton(n,t.name,{tooltipPosition:o})))),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:r("Text alignment toolbar")}),i.buttonView.set({label:r("Text alignment"),tooltip:!0}),i.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const s="rtl"===n.contentLanguageDirection?GS.get("right"):GS.get("left"),a=e.commands.get("alignment");return i.buttonView.bind("icon").to(a,"value",(t=>GS.get(t)||s)),i.bind("isEnabled").to(a,"isEnabled"),this.listenTo(i,"execute",(()=>{e.editing.view.focus()})),i}))}_addMenuBarMenu(t){const e=this.editor;e.ui.componentFactory.add("menuBar:alignment",(n=>{const i=e.commands.get("alignment"),o=n.t,r=new Pk(n),s=new Nk(n);r.bind("isEnabled").to(i),s.set({ariaLabel:o("Text alignment"),role:"menu"}),r.buttonView.set({label:o("Text alignment")});for(const o of t){const t=new Af(n,r),a=new lm(n);a.delegate("execute").to(r),a.set({label:this.localizedOptionTitles[o.name],icon:GS.get(o.name),role:"menuitemcheckbox",isToggleable:!0}),a.on("execute",(()=>{e.execute("alignment",{value:o.name}),e.editing.view.focus()})),a.bind("isOn").to(i,"value",(t=>t===o.name)),a.bind("isEnabled").to(i,"isEnabled"),t.children.add(a),s.items.add(t)}return r.panelView.children.add(s),r}))}}function $S(t){const e=t.t,n=t.config.get("codeBlock.languages");for(const t of n)"Plain text"===t.label&&(t.label=e("Plain text")),void 0===t.class&&(t.class=`language-${t.language}`);return n}function KS(t,e,n){const i={};for(const o of t)"class"===e?i[o[e].split(" ").shift()]=o[n]:i[o[e]]=o[n];return i}function YS(t){return t.data.match(/^(\s*)/)[0]}function QS(t){const e=t.document.selection,n=[];if(e.isCollapsed)return[e.anchor];const i=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:e}of i){let i=e.is("$textProxy")?e.textNode:e;const o=i.parent;if(!o.is("element","codeBlock")||i.is("element","softBreak"))continue;for(;i.previousSibling&&!i.previousSibling.is("element","softBreak");)i=i.previousSibling;const r=i.is("$text")?i.startOffset+YS(i).length:i.startOffset,s=t.createPositionAt(o,r);n.every((t=>!t.isEqual(s)))&&n.push(s)}return n}function ZS(t){const e=ro(t.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function JS(t,e){return!e.is("rootElement")&&!t.isLimit(e)&&t.checkChild(e.parent,"codeBlock")}function XS(t,e,n,i){const o=KS(e,"language","label"),r=n.getAttribute("language");if(r in o){return t("enter"===i?"Entering %0 code snippet":"Leaving %0 code snippet",o[r])}return t("enter"===i?"Entering code snippet":"Leaving code snippet")}function tI(t,e){for(t.textNode&&(t=e.createPositionBefore(t.textNode));t.nodeBefore&&!t.nodeBefore.is("element","softBreak");)t=e.createPositionBefore(t.nodeBefore);const n=t.nodeAfter;return n&&n.is("$text")?n:null}class eI extends cr{constructor(t){super(t),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor,n=e.model,i=n.document.selection,o=$S(e)[0],r=Array.from(i.getSelectedBlocks()),s=null==t.forceValue?!this.value:t.forceValue,a=function(t,e,n){return t.language?t.language:t.usePreviousLanguageChoice&&e?e:n}(t,this._lastLanguage,o.language);n.change((t=>{s?this._applyCodeBlock(t,r,a):this._removeCodeBlock(t,r)}))}_getValue(){const t=ro(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!t.is("element","codeBlock"))&&t.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=ro(t.getSelectedBlocks());return!!n&&JS(e,n)}_applyCodeBlock(t,e,n){this._lastLanguage=n;const i=this.editor.model.schema,o=e.filter((t=>JS(i,t)));for(const e of o)t.rename(e,"codeBlock"),t.setAttribute("language",n,e),i.removeDisallowedAttributes([e],t),Array.from(e.getChildren()).filter((t=>!i.checkChild(e,t))).forEach((e=>t.remove(e)));o.reverse().forEach(((e,n)=>{const i=o[n+1];e.previousSibling===i&&(t.appendElement("softBreak",i),t.merge(t.createPositionBefore(e)))}))}_removeCodeBlock(t,e){const n=e.filter((t=>t.is("element","codeBlock")));for(const e of n){const n=t.createRangeOn(e);for(const e of Array.from(n.getItems()).reverse())if(e.is("element","softBreak")&&e.parent.is("element","codeBlock")){const{position:n}=t.split(t.createPositionBefore(e)),i=n.nodeAfter;t.rename(i,"paragraph"),t.removeAttribute("language",i),t.remove(e)}t.rename(e,"paragraph"),t.removeAttribute("language",e)}}}class nI extends cr{constructor(t){super(t),this._indentSequence=t.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change((e=>{const n=QS(t);for(const i of n){const n=e.createText(this._indentSequence);t.insertContent(n,i)}}))}_checkEnabled(){return!!this._indentSequence&&ZS(this.editor.model.document.selection)}}class iI extends cr{constructor(t){super(t),this._indentSequence=t.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change((()=>{const e=QS(t);for(const n of e){const e=oI(t,n,this._indentSequence);e&&t.deleteContent(t.createSelection(e))}}))}_checkEnabled(){if(!this._indentSequence)return!1;const t=this.editor.model;return!!ZS(t.document.selection)&&QS(t).some((e=>oI(t,e,this._indentSequence)))}}function oI(t,e,n){const i=tI(e,t);if(!i)return null;const o=YS(i),r=o.lastIndexOf(n);if(r+n.length!==o.length)return null;if(-1===r)return null;const{parent:s,startOffset:a}=i;return t.createRange(t.createPositionAt(s,a+r),t.createPositionAt(s,a+r+n.length))}function rI(t,e,n=!1){const i=KS(e,"language","class"),o=KS(e,"language","label");return(e,r,s)=>{const{writer:a,mapper:c,consumable:l}=s;if(!l.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),u=c.toViewPosition(t.createPositionBefore(r.item)),h={};n&&(h["data-language"]=o[d],h.spellcheck="false");const m=i[d]?{class:i[d]}:void 0,g=a.createContainerElement("code",m),p=a.createContainerElement("pre",h,g);a.insert(u,p),c.bindElements(r.item,g)}}const sI="paragraph";class aI extends sr{static get pluginName(){return"CodeBlockEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[aw]}constructor(t){super(t),t.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const t=this.editor,e=t.model.schema,n=t.model,i=t.editing.view,o=$S(t);t.commands.add("codeBlock",new eI(t)),t.commands.add("indentCodeBlock",new nI(t)),t.commands.add("outdentCodeBlock",new iI(t)),this.listenTo(i.document,"tab",((e,n)=>{const i=n.shiftKey?"outdentCodeBlock":"indentCodeBlock";t.commands.get(i).isEnabled&&(t.execute(i),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"pre"}),e.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:!0}),e.addAttributeCheck(((t,n)=>{const i=t.getItem(t.length-2);if(e.getAttributeProperties(n).isFormatting&&i&&"codeBlock"==i.name)return!1})),t.editing.downcastDispatcher.on("insert:codeBlock",rI(n,o,!0)),t.data.downcastDispatcher.on("insert:codeBlock",rI(n,o)),t.data.downcastDispatcher.on("insert:softBreak",function(t){return(e,n,i)=>{if("codeBlock"!==n.item.parent.name)return;const{writer:o,mapper:r,consumable:s}=i;if(!s.consume(n.item,"insert"))return;const a=r.toViewPosition(t.createPositionBefore(n.item));o.insert(a,o.createText("\n"))}}(n),{priority:"high"}),t.data.upcastDispatcher.on("element:code",function(t,e){const n=KS(e,"class","language"),i=e[0].language;return(t,e,o)=>{const r=e.viewItem,s=r.parent;if(!s||!s.is("element","pre"))return;if(e.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:c}=o;if(!a.test(r,{name:!0}))return;const l=c.createElement("codeBlock"),d=[...r.getClassNames()];d.length||d.push("");for(const t of d){const e=n[t];if(e){c.setAttribute("language",e,l);break}}l.hasAttribute("language")||c.setAttribute("language",i,l),o.convertChildren(r,l),o.safeInsert(l,e.modelCursor)&&(a.consume(r,{name:!0}),o.updateConversionResult(l,e))}}(0,o)),t.data.upcastDispatcher.on("text",((t,e,{consumable:n,writer:i})=>{let o=e.modelCursor;if(!n.test(e.viewItem))return;if(!o.findAncestor("codeBlock"))return;n.consume(e.viewItem);const r=e.viewItem.data.split("\n").map((t=>i.createText(t))),s=r[r.length-1];for(const t of r)if(i.insert(t,o),o=o.getShiftedBy(t.offsetSize),t!==s){const t=i.createElement("softBreak");i.insert(t,o),o=i.createPositionAfter(t)}e.modelRange=i.createRange(e.modelCursor,o),e.modelCursor=o})),t.data.upcastDispatcher.on("element:pre",((t,e,{consumable:n})=>{const i=e.viewItem;if(i.findAncestor("pre"))return;const o=Array.from(i.getChildren()),r=o.find((t=>t.is("element","code")));if(r)for(const t of o)t!==r&&t.is("$text")&&n.consume(t,{name:!0})}),{priority:"high"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,i)=>{let o=n.createRange(n.document.selection.anchor);if(i.targetRanges&&(o=t.editing.mapper.toModelRange(i.targetRanges[0])),!o.start.parent.is("element","codeBlock"))return;const r=i.dataTransfer.getData("text/plain"),s=new bu(t.editing.view.document);i.content=function(t,e){const n=t.createDocumentFragment(),i=e.split("\n"),o=i.reduce(((e,n,o)=>(e.push(n),o{const o=t.model,r=o.document.selection;r.anchor.parent.is("element","codeBlock")&&o.change((t=>{const n=t.createRangeIn(i.content);for(const i of[...n.getItems()])i.is("node")&&!e.checkChild(r.anchor,i)&&t.remove(i)}))})),this.listenTo(n,"getSelectedContent",((t,[i])=>{const o=i.anchor;!i.isCollapsed&&o.parent.is("element","codeBlock")&&o.hasSameParentAs(i.focus)&&n.change((n=>{const r=t.return;if(o.parent.is("element")&&(r.childCount>1||i.containsEntireContent(o.parent))){const e=n.createElement("codeBlock",o.parent.getAttributes());n.append(r,e);const i=n.createDocumentFragment();return n.append(e,i),void(t.return=i)}const s=r.getChild(0);e.checkAttribute(s,"code")&&n.setAttribute("code",!0,s)}))}))}afterInit(){const t=this.editor,e=t.commands,n=e.get("indent"),i=e.get("outdent");n&&n.registerChildCommand(e.get("indentCodeBlock"),{priority:"highest"}),i&&i.registerChildCommand(e.get("outdentCodeBlock")),this.listenTo(t.editing.view.document,"enter",((e,n)=>{t.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(t,e){const n=t.model.document,i=t.editing.view,o=n.selection.getLastPosition(),r=o.nodeAfter;return!(e||!n.selection.isCollapsed||!o.isAtStart)&&(!!lI(r)&&(t.model.change((e=>{t.execute("enter");const i=n.selection.anchor.parent.previousSibling;e.rename(i,sI),e.setSelection(i,"in"),t.model.schema.removeDisallowedAttributes([i],e),e.remove(r)})),i.scrollToTheSelection(),!0))}(t,n.isSoft)||function(t,e){const n=t.model,i=n.document,o=t.editing.view,r=i.selection.getLastPosition(),s=r.nodeBefore;let a;if(e||!i.selection.isCollapsed||!r.isAtEnd||!s||!s.previousSibling)return!1;if(lI(s)&&lI(s.previousSibling))a=n.createRange(n.createPositionBefore(s.previousSibling),n.createPositionAfter(s));else if(cI(s)&&lI(s.previousSibling)&&lI(s.previousSibling.previousSibling))a=n.createRange(n.createPositionBefore(s.previousSibling.previousSibling),n.createPositionAfter(s));else{if(!(cI(s)&&lI(s.previousSibling)&&cI(s.previousSibling.previousSibling)&&s.previousSibling.previousSibling&&lI(s.previousSibling.previousSibling.previousSibling)))return!1;a=n.createRange(n.createPositionBefore(s.previousSibling.previousSibling.previousSibling),n.createPositionAfter(s))}return t.model.change((e=>{e.remove(a),t.execute("enter");const n=i.selection.anchor.parent;e.rename(n,sI),t.model.schema.removeDisallowedAttributes([n],e)})),o.scrollToTheSelection(),!0}(t,n.isSoft)||function(t){const e=t.model,n=e.document;let i;const o=tI(n.selection.getLastPosition(),e);o&&o.is("$text")&&(i=YS(o)),t.model.change((e=>{t.execute("shiftEnter"),i&&e.insertText(i,n.selection.anchor)}))}(t),n.preventDefault(),e.stop())}),{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){const{model:t,ui:e,t:n}=this.editor,i=$S(this.editor);let o=null;t.document.selection.on("change:range",(()=>{const r=t.document.selection.focus.parent;e&&o!==r&&r.is("element")&&(o&&o.is("element","codeBlock")&&e.ariaLiveAnnouncer.announce(XS(n,i,o,"leave")),r.is("element","codeBlock")&&e.ariaLiveAnnouncer.announce(XS(n,i,r,"enter")),o=r)}))}}function cI(t){return t&&t.is("$text")&&!t.data.match(/\S/)}function lI(t){return t&&t.is("element","softBreak")}var dI=o(2291),uI={attributes:{"data-cke":!0}};uI.setAttributes=Qo(),uI.insert=Ko().bind(null,"head"),uI.domAPI=qo(),uI.insertStyleElement=Jo(),Wo()(dI.A,uI),dI.A&&dI.A.locals&&dI.A.locals;class hI extends sr{static get pluginName(){return"CodeBlockUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t,n=t.ui.componentFactory,i=$S(t),o=this._getLanguageListItemDefinitions(i),r=t.commands.get("codeBlock");n.add("codeBlock",(n=>{const i=tp(n,Yg),s=i.buttonView,a=e("Insert code block");return s.set({label:a,tooltip:!0,icon:Dh.codeBlock,isToggleable:!0}),s.bind("isOn").to(r,"value",(t=>!!t)),s.on("execute",(()=>{t.execute("codeBlock",{usePreviousLanguageChoice:!0}),t.editing.view.focus()})),i.on("execute",(e=>{t.execute("codeBlock",{language:e.source._codeBlockLanguage,forceValue:!0}),t.editing.view.focus()})),i.class="ck-code-block-dropdown",i.bind("isEnabled").to(r),ip(i,o,{role:"menu",ariaLabel:a}),i})),n.add("menuBar:codeBlock",(n=>{const i=new Pk(n);i.buttonView.set({role:"menuitem",label:e("Code block"),icon:Dh.codeBlock}),i.bind("isEnabled").to(r);const s=new Nk(n);s.set({ariaLabel:e("Insert code block")});for(const e of o){const o=new Af(n,i),a=new lm(n);a.bind(...Object.keys(e.model)).to(e.model),a.set({isToggleable:!0,role:"menuitemcheckbox"}),a.delegate("execute").to(i),a.on("execute",(()=>{t.execute("codeBlock",{language:e.model._codeBlockLanguage,forceValue:r.value!=e.model._codeBlockLanguage}),t.editing.view.focus()})),o.children.add(a),s.items.add(o)}return i.panelView.children.add(s),i}))}_getLanguageListItemDefinitions(t){const e=this.editor.commands.get("codeBlock"),n=new oo;for(const i of t){const t={type:"button",model:new Gf({_codeBlockLanguage:i.language,label:i.label,role:"menuitemradio",withText:!0})};t.model.bind("isOn").to(e,"value",(e=>e===t.model._codeBlockLanguage)),n.add(t)}return n}}var mI=o(2221),gI={attributes:{"data-cke":!0}};gI.setAttributes=Qo(),gI.insert=Ko().bind(null,"head"),gI.domAPI=qo(),gI.insertStyleElement=Jo(),Wo()(mI.A,gI),mI.A&&mI.A.locals&&mI.A.locals;class pI extends er{constructor(t){super(t),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new so,this.keystrokes=new uo,rr({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>a.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(t,e){const n=new Lh(this.locale);return n.set({label:t,withText:!0,class:"ck-character-grid__tile"}),n.extendTemplate({attributes:{title:e},on:{mouseover:n.bindTemplate.to("mouseover"),focus:n.bindTemplate.to("focus")}}),n.on("mouseover",(()=>{this.fire("tileHover",{name:e,character:t})})),n.on("focus",(()=>{this.fire("tileFocus",{name:e,character:t})})),n.on("execute",(()=>{this.fire("execute",{name:e,character:t})})),n}render(){super.render();for(const t of this.tiles)this.focusTracker.add(t.element);this.tiles.on("change",((t,{added:e,removed:n})=>{if(e.length>0)for(const t of e)this.focusTracker.add(t.element);if(n.length>0)for(const t of n)this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}}var fI=o(3445),kI={attributes:{"data-cke":!0}};kI.setAttributes=Qo(),kI.insert=Ko().bind(null,"head"),kI.domAPI=qo(),kI.insertStyleElement=Jo(),Wo()(fI.A,kI),fI.A&&fI.A.locals&&fI.A.locals;class bI extends er{constructor(t){super(t);const e=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",wI),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:e.to("name",(t=>t||""))}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:e.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}}function wI(t){return null===t?"":"U+"+("0000"+t.codePointAt(0).toString(16)).slice(-4)}class _I extends er{constructor(t,e,n,i){super(t),this.categoriesView=e,this.gridView=n,this.infoView=i,this.items=this.createCollection(),this.focusTracker=new so,this.keystrokes=new uo,this._focusCycler=new Rh({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.categoriesView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.categoriesView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}var AI=o(7405),CI={attributes:{"data-cke":!0}};CI.setAttributes=Qo(),CI.insert=Ko().bind(null,"head"),CI.domAPI=qo(),CI.insertStyleElement=Jo(),Wo()(AI.A,CI),AI.A&&AI.A.locals&&AI.A.locals;class vI extends er{constructor(t,e){super(t),this.set("currentGroupName",Array.from(e.entries())[0][0]),this._groupNames=e,this._dropdownView=new $m(t,dp),this.setTemplate({tag:"div",attributes:{class:["ck","ck-character-categories"]},children:[this._dropdownView]})}render(){super.render(),this._setupDropdown()}focus(){this._dropdownView.focus()}_setupDropdown(){const t=new oo;for(const[e,n]of this._groupNames){const i={type:"button",model:new Gf({name:e,label:n,role:"menuitemradio",withText:!0})};i.model.bind("isOn").to(this,"currentGroupName",(t=>t===e)),t.add(i)}const e=(0,this.locale.t)("Category");this._dropdownView.set({label:e,isEmpty:!1}),this._dropdownView.fieldView.panelPosition="rtl"===this.locale.uiLanguageDirection?"se":"sw",this._dropdownView.fieldView.buttonView.set({withText:!0,tooltip:e,ariaLabel:e,ariaLabelledBy:void 0,isOn:!1}),this._dropdownView.fieldView.buttonView.bind("label").to(this,"currentGroupName",(t=>this._groupNames.get(t))),this._dropdownView.fieldView.on("execute",(({source:t})=>{this.currentGroupName=t.name})),ip(this._dropdownView.fieldView,t,{ariaLabel:e,role:"menu"})}}const yI="All";class xI extends sr{static get pluginName(){return"SpecialCharactersCurrency"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:e("Dollar sign")},{character:"€",title:e("Euro sign")},{character:"¥",title:e("Yen sign")},{character:"£",title:e("Pound sign")},{character:"¢",title:e("Cent sign")},{character:"₠",title:e("Euro-currency sign")},{character:"₡",title:e("Colon sign")},{character:"₢",title:e("Cruzeiro sign")},{character:"₣",title:e("French franc sign")},{character:"₤",title:e("Lira sign")},{character:"¤",title:e("Currency sign")},{character:"₿",title:e("Bitcoin sign")},{character:"₥",title:e("Mill sign")},{character:"₦",title:e("Naira sign")},{character:"₧",title:e("Peseta sign")},{character:"₨",title:e("Rupee sign")},{character:"₩",title:e("Won sign")},{character:"₪",title:e("New sheqel sign")},{character:"₫",title:e("Dong sign")},{character:"₭",title:e("Kip sign")},{character:"₮",title:e("Tugrik sign")},{character:"₯",title:e("Drachma sign")},{character:"₰",title:e("German penny sign")},{character:"₱",title:e("Peso sign")},{character:"₲",title:e("Guarani sign")},{character:"₳",title:e("Austral sign")},{character:"₴",title:e("Hryvnia sign")},{character:"₵",title:e("Cedi sign")},{character:"₶",title:e("Livre tournois sign")},{character:"₷",title:e("Spesmilo sign")},{character:"₸",title:e("Tenge sign")},{character:"₹",title:e("Indian rupee sign")},{character:"₺",title:e("Turkish lira sign")},{character:"₻",title:e("Nordic mark sign")},{character:"₼",title:e("Manat sign")},{character:"₽",title:e("Ruble sign")}],{label:e("Currency")})}}class EI extends sr{static get pluginName(){return"SpecialCharactersMathematical"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:e("Less-than sign")},{character:">",title:e("Greater-than sign")},{character:"≤",title:e("Less-than or equal to")},{character:"≥",title:e("Greater-than or equal to")},{character:"–",title:e("En dash")},{character:"—",title:e("Em dash")},{character:"¯",title:e("Macron")},{character:"‾",title:e("Overline")},{character:"°",title:e("Degree sign")},{character:"−",title:e("Minus sign")},{character:"±",title:e("Plus-minus sign")},{character:"÷",title:e("Division sign")},{character:"⁄",title:e("Fraction slash")},{character:"×",title:e("Multiplication sign")},{character:"ƒ",title:e("Latin small letter f with hook")},{character:"∫",title:e("Integral")},{character:"∑",title:e("N-ary summation")},{character:"∞",title:e("Infinity")},{character:"√",title:e("Square root")},{character:"∼",title:e("Tilde operator")},{character:"≅",title:e("Approximately equal to")},{character:"≈",title:e("Almost equal to")},{character:"≠",title:e("Not equal to")},{character:"≡",title:e("Identical to")},{character:"∈",title:e("Element of")},{character:"∉",title:e("Not an element of")},{character:"∋",title:e("Contains as member")},{character:"∏",title:e("N-ary product")},{character:"∧",title:e("Logical and")},{character:"∨",title:e("Logical or")},{character:"¬",title:e("Not sign")},{character:"∩",title:e("Intersection")},{character:"∪",title:e("Union")},{character:"∂",title:e("Partial differential")},{character:"∀",title:e("For all")},{character:"∃",title:e("There exists")},{character:"∅",title:e("Empty set")},{character:"∇",title:e("Nabla")},{character:"∗",title:e("Asterisk operator")},{character:"∝",title:e("Proportional to")},{character:"∠",title:e("Angle")},{character:"¼",title:e("Vulgar fraction one quarter")},{character:"½",title:e("Vulgar fraction one half")},{character:"¾",title:e("Vulgar fraction three quarters")}],{label:e("Mathematical")})}}class DI extends sr{static get pluginName(){return"SpecialCharactersArrows"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Arrows",[{title:e("leftwards simple arrow"),character:"←"},{title:e("rightwards simple arrow"),character:"→"},{title:e("upwards simple arrow"),character:"↑"},{title:e("downwards simple arrow"),character:"↓"},{title:e("leftwards double arrow"),character:"⇐"},{title:e("rightwards double arrow"),character:"⇒"},{title:e("upwards double arrow"),character:"⇑"},{title:e("downwards double arrow"),character:"⇓"},{title:e("leftwards dashed arrow"),character:"⇠"},{title:e("rightwards dashed arrow"),character:"⇢"},{title:e("upwards dashed arrow"),character:"⇡"},{title:e("downwards dashed arrow"),character:"⇣"},{title:e("leftwards arrow to bar"),character:"⇤"},{title:e("rightwards arrow to bar"),character:"⇥"},{title:e("upwards arrow to bar"),character:"⤒"},{title:e("downwards arrow to bar"),character:"⤓"},{title:e("up down arrow with base"),character:"↨"},{title:e("back with leftwards arrow above"),character:"🔙"},{title:e("end with leftwards arrow above"),character:"🔚"},{title:e("on with exclamation mark with left right arrow above"),character:"🔛"},{title:e("soon with rightwards arrow above"),character:"🔜"},{title:e("top with upwards arrow above"),character:"🔝"}],{label:e("Arrows")})}}class SI extends sr{static get pluginName(){return"SpecialCharactersLatin"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:e("Latin capital letter a with macron")},{character:"ā",title:e("Latin small letter a with macron")},{character:"Ă",title:e("Latin capital letter a with breve")},{character:"ă",title:e("Latin small letter a with breve")},{character:"Ą",title:e("Latin capital letter a with ogonek")},{character:"ą",title:e("Latin small letter a with ogonek")},{character:"Ć",title:e("Latin capital letter c with acute")},{character:"ć",title:e("Latin small letter c with acute")},{character:"Ĉ",title:e("Latin capital letter c with circumflex")},{character:"ĉ",title:e("Latin small letter c with circumflex")},{character:"Ċ",title:e("Latin capital letter c with dot above")},{character:"ċ",title:e("Latin small letter c with dot above")},{character:"Č",title:e("Latin capital letter c with caron")},{character:"č",title:e("Latin small letter c with caron")},{character:"Ď",title:e("Latin capital letter d with caron")},{character:"ď",title:e("Latin small letter d with caron")},{character:"Đ",title:e("Latin capital letter d with stroke")},{character:"đ",title:e("Latin small letter d with stroke")},{character:"Ē",title:e("Latin capital letter e with macron")},{character:"ē",title:e("Latin small letter e with macron")},{character:"Ĕ",title:e("Latin capital letter e with breve")},{character:"ĕ",title:e("Latin small letter e with breve")},{character:"Ė",title:e("Latin capital letter e with dot above")},{character:"ė",title:e("Latin small letter e with dot above")},{character:"Ę",title:e("Latin capital letter e with ogonek")},{character:"ę",title:e("Latin small letter e with ogonek")},{character:"Ě",title:e("Latin capital letter e with caron")},{character:"ě",title:e("Latin small letter e with caron")},{character:"Ĝ",title:e("Latin capital letter g with circumflex")},{character:"ĝ",title:e("Latin small letter g with circumflex")},{character:"Ğ",title:e("Latin capital letter g with breve")},{character:"ğ",title:e("Latin small letter g with breve")},{character:"Ġ",title:e("Latin capital letter g with dot above")},{character:"ġ",title:e("Latin small letter g with dot above")},{character:"Ģ",title:e("Latin capital letter g with cedilla")},{character:"ģ",title:e("Latin small letter g with cedilla")},{character:"Ĥ",title:e("Latin capital letter h with circumflex")},{character:"ĥ",title:e("Latin small letter h with circumflex")},{character:"Ħ",title:e("Latin capital letter h with stroke")},{character:"ħ",title:e("Latin small letter h with stroke")},{character:"Ĩ",title:e("Latin capital letter i with tilde")},{character:"ĩ",title:e("Latin small letter i with tilde")},{character:"Ī",title:e("Latin capital letter i with macron")},{character:"ī",title:e("Latin small letter i with macron")},{character:"Ĭ",title:e("Latin capital letter i with breve")},{character:"ĭ",title:e("Latin small letter i with breve")},{character:"Į",title:e("Latin capital letter i with ogonek")},{character:"į",title:e("Latin small letter i with ogonek")},{character:"İ",title:e("Latin capital letter i with dot above")},{character:"ı",title:e("Latin small letter dotless i")},{character:"IJ",title:e("Latin capital ligature ij")},{character:"ij",title:e("Latin small ligature ij")},{character:"Ĵ",title:e("Latin capital letter j with circumflex")},{character:"ĵ",title:e("Latin small letter j with circumflex")},{character:"Ķ",title:e("Latin capital letter k with cedilla")},{character:"ķ",title:e("Latin small letter k with cedilla")},{character:"ĸ",title:e("Latin small letter kra")},{character:"Ĺ",title:e("Latin capital letter l with acute")},{character:"ĺ",title:e("Latin small letter l with acute")},{character:"Ļ",title:e("Latin capital letter l with cedilla")},{character:"ļ",title:e("Latin small letter l with cedilla")},{character:"Ľ",title:e("Latin capital letter l with caron")},{character:"ľ",title:e("Latin small letter l with caron")},{character:"Ŀ",title:e("Latin capital letter l with middle dot")},{character:"ŀ",title:e("Latin small letter l with middle dot")},{character:"Ł",title:e("Latin capital letter l with stroke")},{character:"ł",title:e("Latin small letter l with stroke")},{character:"Ń",title:e("Latin capital letter n with acute")},{character:"ń",title:e("Latin small letter n with acute")},{character:"Ņ",title:e("Latin capital letter n with cedilla")},{character:"ņ",title:e("Latin small letter n with cedilla")},{character:"Ň",title:e("Latin capital letter n with caron")},{character:"ň",title:e("Latin small letter n with caron")},{character:"ʼn",title:e("Latin small letter n preceded by apostrophe")},{character:"Ŋ",title:e("Latin capital letter eng")},{character:"ŋ",title:e("Latin small letter eng")},{character:"Ō",title:e("Latin capital letter o with macron")},{character:"ō",title:e("Latin small letter o with macron")},{character:"Ŏ",title:e("Latin capital letter o with breve")},{character:"ŏ",title:e("Latin small letter o with breve")},{character:"Ő",title:e("Latin capital letter o with double acute")},{character:"ő",title:e("Latin small letter o with double acute")},{character:"Œ",title:e("Latin capital ligature oe")},{character:"œ",title:e("Latin small ligature oe")},{character:"Ŕ",title:e("Latin capital letter r with acute")},{character:"ŕ",title:e("Latin small letter r with acute")},{character:"Ŗ",title:e("Latin capital letter r with cedilla")},{character:"ŗ",title:e("Latin small letter r with cedilla")},{character:"Ř",title:e("Latin capital letter r with caron")},{character:"ř",title:e("Latin small letter r with caron")},{character:"Ś",title:e("Latin capital letter s with acute")},{character:"ś",title:e("Latin small letter s with acute")},{character:"Ŝ",title:e("Latin capital letter s with circumflex")},{character:"ŝ",title:e("Latin small letter s with circumflex")},{character:"Ş",title:e("Latin capital letter s with cedilla")},{character:"ş",title:e("Latin small letter s with cedilla")},{character:"Š",title:e("Latin capital letter s with caron")},{character:"š",title:e("Latin small letter s with caron")},{character:"Ţ",title:e("Latin capital letter t with cedilla")},{character:"ţ",title:e("Latin small letter t with cedilla")},{character:"Ť",title:e("Latin capital letter t with caron")},{character:"ť",title:e("Latin small letter t with caron")},{character:"Ŧ",title:e("Latin capital letter t with stroke")},{character:"ŧ",title:e("Latin small letter t with stroke")},{character:"Ũ",title:e("Latin capital letter u with tilde")},{character:"ũ",title:e("Latin small letter u with tilde")},{character:"Ū",title:e("Latin capital letter u with macron")},{character:"ū",title:e("Latin small letter u with macron")},{character:"Ŭ",title:e("Latin capital letter u with breve")},{character:"ŭ",title:e("Latin small letter u with breve")},{character:"Ů",title:e("Latin capital letter u with ring above")},{character:"ů",title:e("Latin small letter u with ring above")},{character:"Ű",title:e("Latin capital letter u with double acute")},{character:"ű",title:e("Latin small letter u with double acute")},{character:"Ų",title:e("Latin capital letter u with ogonek")},{character:"ų",title:e("Latin small letter u with ogonek")},{character:"Ŵ",title:e("Latin capital letter w with circumflex")},{character:"ŵ",title:e("Latin small letter w with circumflex")},{character:"Ŷ",title:e("Latin capital letter y with circumflex")},{character:"ŷ",title:e("Latin small letter y with circumflex")},{character:"Ÿ",title:e("Latin capital letter y with diaeresis")},{character:"Ź",title:e("Latin capital letter z with acute")},{character:"ź",title:e("Latin small letter z with acute")},{character:"Ż",title:e("Latin capital letter z with dot above")},{character:"ż",title:e("Latin small letter z with dot above")},{character:"Ž",title:e("Latin capital letter z with caron")},{character:"ž",title:e("Latin small letter z with caron")},{character:"ſ",title:e("Latin small letter long s")}],{label:e("Latin")})}}class II extends sr{static get pluginName(){return"SpecialCharactersText"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:e("Single left-pointing angle quotation mark")},{character:"›",title:e("Single right-pointing angle quotation mark")},{character:"«",title:e("Left-pointing double angle quotation mark")},{character:"»",title:e("Right-pointing double angle quotation mark")},{character:"‘",title:e("Left single quotation mark")},{character:"’",title:e("Right single quotation mark")},{character:"“",title:e("Left double quotation mark")},{character:"”",title:e("Right double quotation mark")},{character:"‚",title:e("Single low-9 quotation mark")},{character:"„",title:e("Double low-9 quotation mark")},{character:"¡",title:e("Inverted exclamation mark")},{character:"¿",title:e("Inverted question mark")},{character:"‥",title:e("Two dot leader")},{character:"…",title:e("Horizontal ellipsis")},{character:"‡",title:e("Double dagger")},{character:"‰",title:e("Per mille sign")},{character:"‱",title:e("Per ten thousand sign")},{character:"‼",title:e("Double exclamation mark")},{character:"⁈",title:e("Question exclamation mark")},{character:"⁉",title:e("Exclamation question mark")},{character:"⁇",title:e("Double question mark")},{character:"©",title:e("Copyright sign")},{character:"®",title:e("Registered sign")},{character:"™",title:e("Trade mark sign")},{character:"§",title:e("Section sign")},{character:"¶",title:e("Paragraph sign")},{character:"⁋",title:e("Reversed paragraph sign")}],{label:e("Text")})}}var TI=o(4307),BI={attributes:{"data-cke":!0}};BI.setAttributes=Qo(),BI.insert=Ko().bind(null,"head"),BI.domAPI=qo(),BI.insertStyleElement=Jo(),Wo()(TI.A,BI),TI.A&&TI.A.locals&&TI.A.locals;class MI extends er{constructor(t,e){super(t),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=e,this.focusTracker=new so,this._focusables=new Ao,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new uo,this._stillTyping=!1,this.focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((t,e,n)=>this._setInputValue(n)))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach((t=>{this.focusTracker.add(t.element),this._focusables.add(t)})),this.keystrokes.listenTo(this.element)}focus(t){-1===t?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const t=this.locale,e=t.t,n=this.bindTemplate,i=this._createColorSelector(t),o=tp(t),r=new er;return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:n.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",n.if("value","ck-hidden",(t=>""!=t))]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(r),o.buttonView.label=e("Color picker"),o.buttonView.tooltip=!0,o.panelPosition="rtl"===t.uiLanguageDirection?"se":"sw",o.panelView.children.add(i),o.bind("isEnabled").to(this,"isReadOnly",(t=>!t)),o.on("change:isOpen",((t,e,n)=>{n&&(i.updateSelectedColors(),i.showColorGridsFragment())})),o}_createInputTextView(){const t=this.locale,e=new Jm(t);return e.extendTemplate({on:{blur:e.bindTemplate.to("blur")}}),e.value=this.value,e.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(e),e.on("input",(()=>{const t=e.element.value,n=this.options.colorDefinitions.find((e=>t===e.label));this._stillTyping=!0,this.value=n&&n.color||t})),e.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(e.element.value)})),e.delegate("input").to(this),e}_createColorSelector(t){const e=t.t,n=this.options.defaultColorValue||"",i=e(n?"Restore default":"Remove color"),o=new Yp(t,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:e("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});o.appendUI(),o.on("execute",((t,e)=>{"colorPickerSaveButton"!==e.source?(this.value=e.value||n,this.fire("input"),"colorPicker"!==e.source&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1}));let r=this.value;return o.on("colorPicker:cancel",(()=>{this.value=r,this.fire("input"),this.dropdownView.isOpen=!1})),o.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{r=this.value})),o.bind("selectedColor").to(this,"value"),o}_setInputValue(t){if(!this._stillTyping){const e=PI(t),n=this.options.colorDefinitions.find((t=>e===PI(t.color)));this.inputView.value=n?n.label:t||""}}}function PI(t){return t.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const NI=t=>""===t;function LI(t){return{none:t("None"),solid:t("Solid"),dotted:t("Dotted"),dashed:t("Dashed"),double:t("Double"),groove:t("Groove"),ridge:t("Ridge"),inset:t("Inset"),outset:t("Outset")}}function zI(t){return t('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function OI(t){return t('The value is invalid. Try "10px" or "2em" or simply "2".')}function VI(t){return t=t.trim().toLowerCase(),NI(t)||Eu(t)}function FI(t){return t=t.trim(),NI(t)||GI(t)||Tu(t)||Mu(t)}function RI(t){return t=t.trim(),NI(t)||GI(t)||Tu(t)}function jI(t,e){const n=new oo,i=LI(t.t);for(const o in i){const r={type:"button",model:new Gf({_borderStyleValue:o,label:i[o],role:"menuitemradio",withText:!0})};"none"===o?r.model.bind("isOn").to(t,"borderStyle",(t=>"none"===e?!t:t===o)):r.model.bind("isOn").to(t,"borderStyle",(t=>t===o)),n.add(r)}return n}function HI(t){const{view:e,icons:n,toolbar:i,labels:o,propertyName:r,nameToValue:s,defaultValue:a}=t;for(const t in o){const c=new Lh(e.locale);c.set({role:"radio",isToggleable:!0,label:o[t],icon:n[t],tooltip:o[t]});const l=s?s(t):t;c.bind("isOn").to(e,r,(t=>{let e=t;return""===t&&a&&(e=a),l===e})),c.on("execute",(()=>{e[r]=l})),i.items.add(c)}}const UI=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function WI(t){return(e,n,i)=>{const o=new MI(e.locale,{colorDefinitions:(r=t.colorConfig,r.map((t=>({color:t.model,label:t.label,options:{hasBorder:t.hasBorder}})))),columns:t.columns,defaultColorValue:t.defaultColorValue,colorPickerConfig:t.colorPickerConfig});var r;return o.inputView.set({id:n,ariaDescribedById:i}),o.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.bind("hasError").to(e,"errorText",(t=>!!t)),o.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused").to(o),o}}function GI(t){const e=parseFloat(t);return!Number.isNaN(e)&&t===String(e)}var qI=o(6016),$I={attributes:{"data-cke":!0}};$I.setAttributes=Qo(),$I.insert=Ko().bind(null,"head"),$I.domAPI=qo(),$I.insertStyleElement=Jo(),Wo()(qI.A,$I),qI.A&&qI.A.locals&&qI.A.locals;class KI extends er{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 YI=o(1806),QI={attributes:{"data-cke":!0}};QI.setAttributes=Qo(),QI.insert=Ko().bind(null,"head"),QI.domAPI=qo(),QI.insertStyleElement=Jo(),Wo()(YI.A,QI),YI.A&&YI.A.locals&&YI.A.locals;var ZI=o(5704),JI={attributes:{"data-cke":!0}};JI.setAttributes=Qo(),JI.insert=Ko().bind(null,"head"),JI.domAPI=qo(),JI.insertStyleElement=Jo(),Wo()(ZI.A,JI),ZI.A&&ZI.A.locals&&ZI.A.locals;var XI=o(6701),tT={attributes:{"data-cke":!0}};tT.setAttributes=Qo(),tT.insert=Ko().bind(null,"head"),tT.domAPI=qo(),tT.insertStyleElement=Jo(),Wo()(XI.A,tT),XI.A&&XI.A.locals&&XI.A.locals;class eT extends er{constructor(t,e){super(t),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=e;const{borderStyleDropdown:n,borderWidthInput:i,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:l,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new so,this.keystrokes=new uo,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=i,this.borderColorInput=o,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this._focusables=new Ao,this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Fh(t,{label:this.t("Cell properties")})),this.children.add(new KI(t,{labelView:r,children:[r,n,o,i],class:"ck-table-form__border-row"})),this.children.add(new KI(t,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new KI(t,{children:[new KI(t,{labelView:u,children:[u,c,l,d],class:"ck-table-form__dimensions-row"}),new KI(t,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new KI(t,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new KI(t,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),or({view:this}),[this.borderColorInput,this.backgroundInput].forEach((t=>{this._focusCycler.chain(t.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((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()}_createBorderFields(){const t=this.options.defaultTableCellProperties,e={style:t.borderStyle,width:t.borderWidth,color:t.borderColor},n=WI({colorConfig:this.options.borderColors,columns:5,defaultColorValue:e.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,o=this.t,r=o("Style"),s=new hm(i);s.text=o("Border");const a=LI(o),c=new $m(i,dp);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",(t=>a[t||"none"])),c.fieldView.on("execute",(t=>{this.borderStyle=t.source._borderStyleValue})),c.bind("isEmpty").to(this,"borderStyle",(t=>!t)),ip(c.fieldView,jI(this,e.style),{role:"menu",ariaLabel:r});const l=new $m(i,cp);l.set({label:o("Width"),class:"ck-table-form__border-width"}),l.fieldView.bind("value").to(this,"borderWidth"),l.bind("isEnabled").to(this,"borderStyle",nT),l.fieldView.on("input",(()=>{this.borderWidth=l.fieldView.element.value}));const d=new $m(i,n);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",nT),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((t,n,i,o)=>{nT(i)||(this.borderColor="",this.borderWidth=""),nT(o)||(this.borderColor=e.color,this.borderWidth=e.width)})),{borderRowLabel:s,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:l}}_createBackgroundFields(){const t=this.locale,e=this.t,n=new hm(t);n.text=e("Background");const i=WI({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new $m(t,i);return o.set({label:e("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:n,backgroundInput:o}}_createDimensionFields(){const t=this.locale,e=this.t,n=new hm(t);n.text=e("Dimensions");const i=new $m(t,cp);i.set({label:e("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));const o=new er(t);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new $m(t,cp);return r.set({label:e("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",(()=>{this.height=r.fieldView.element.value})),{dimensionsLabel:n,widthInput:i,operatorLabel:o,heightInput:r}}_createPaddingField(){const t=this.locale,e=this.t,n=new $m(t,cp);return n.set({label:e("Padding"),class:"ck-table-cell-properties-form__padding"}),n.fieldView.bind("value").to(this,"padding"),n.fieldView.on("input",(()=>{this.padding=n.fieldView.element.value})),n}_createAlignmentFields(){const t=this.locale,e=this.t,n=new hm(t),i={left:Dh.alignLeft,center:Dh.alignCenter,right:Dh.alignRight,justify:Dh.alignJustify,top:Dh.alignTop,middle:Dh.alignMiddle,bottom:Dh.alignBottom};n.text=e("Table cell text alignment");const o=new Ug(t),r="rtl"===t.contentLanguageDirection;o.set({isCompact:!0,role:"radiogroup",ariaLabel:e("Horizontal text alignment toolbar")}),HI({view:this,icons:i,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:t=>{if(r){if("left"===t)return"right";if("right"===t)return"left"}return t},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const s=new Ug(t);return s.set({isCompact:!0,role:"radiogroup",ariaLabel:e("Vertical text alignment toolbar")}),HI({view:this,icons:i,toolbar:s,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:s,alignmentLabel:n}}_createActionButtons(){const t=this.locale,e=this.t,n=new Lh(t),i=new Lh(t),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:e("Save"),icon:Dh.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(o,"errorText",((...t)=>t.every((t=>!t)))),i.set({label:e("Cancel"),icon:Dh.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _horizontalAlignmentLabels(){const t=this.locale,e=this.t,n=e("Align cell text to the left"),i=e("Align cell text to the center"),o=e("Align cell text to the right"),r=e("Justify cell text");return"rtl"===t.uiLanguageDirection?{right:o,center:i,left:n,justify:r}:{left:n,center:i,right:o,justify:r}}get _verticalAlignmentLabels(){const t=this.t;return{top:t("Align cell text to the top"),middle:t("Align cell text to the middle"),bottom:t("Align cell text to the bottom")}}}function nT(t){return"none"!==t}const iT=(()=>[Ig.defaultPositions.northArrowSouth,Ig.defaultPositions.northArrowSouthWest,Ig.defaultPositions.northArrowSouthEast,Ig.defaultPositions.southArrowNorth,Ig.defaultPositions.southArrowNorthWest,Ig.defaultPositions.southArrowNorthEast,Ig.defaultPositions.viewportStickyNorth])();function oT(t,e){const n=t.plugins.get("ContextualBalloon"),i=t.editing.view.document.selection;let o;"cell"===e?rS(i)&&(o=sT(t)):iS(i)&&(o=rT(t)),o&&n.updatePosition(o)}function rT(t){const e=DE(t.model.document.selection),n=t.editing.mapper.toViewElement(e);return{target:t.editing.view.domConverter.mapViewToDom(n),positions:iT}}function sT(t){const e=t.editing.mapper,n=t.editing.view.domConverter,i=t.model.document.selection;if(i.rangeCount>1)return{target:()=>function(t,e){const n=e.editing.mapper,i=e.editing.view.domConverter,o=Array.from(t).map((t=>{const e=aT(t.start),o=n.toViewElement(e);return new oi(i.mapViewToDom(o))}));return oi.getBoundingRect(o)}(i.getRanges(),t),positions:iT};const o=aT(i.getFirstPosition()),r=e.toViewElement(o);return{target:n.mapViewToDom(r),positions:iT}}function aT(t){return t.nodeAfter&&t.nodeAfter.is("element","tableCell")?t.nodeAfter:t.findAncestor("tableCell")}function cT(t){if(!t||!G(t))return t;const{top:e,right:n,bottom:i,left:o}=t;return e==n&&n==i&&i==o?e:void 0}function lT(t,e){const n=parseFloat(t);return Number.isNaN(n)||String(n)!==String(t)?t:`${n}${e}`}function dT(t,e={}){const n={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...t};return e.includeAlignmentProperty&&!n.alignment&&(n.alignment="center"),e.includePaddingProperty&&!n.padding&&(n.padding=""),e.includeVerticalAlignmentProperty&&!n.verticalAlignment&&(n.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!n.horizontalAlignment&&(n.horizontalAlignment=e.isRightToLeftContent?"right":"left"),n}function uT(t,e){return dT({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...t},e)}function hT(t,e){return dT({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...t},e)}const mT={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class gT extends sr{static get requires(){return[Zf]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("table.tableCellProperties",{borderColors:UI,backgroundColors:UI})}init(){const t=this.editor,e=t.t;this._defaultTableCellProperties=hT(t.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===t.locale.contentLanguageDirection}),this._balloon=t.plugins.get(Zf),this.view=null,this._isReady=!1,t.ui.componentFactory.add("tableCellProperties",(n=>{const i=new Lh(n);i.set({label:e("Cell properties"),icon:'',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));const o=Object.values(mT).map((e=>t.commands.get(e)));return i.bind("isEnabled").toMany(o,"isEnabled",((...t)=>t.some((t=>t)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const t=this.editor,e=t.config.get("table.tableCellProperties"),n=Mm(e.borderColors),i=Bm(t.locale,n),o=Mm(e.backgroundColors),r=Bm(t.locale,o),s=!1!==e.colorPicker,a=new eT(t.locale,{borderColors:i,backgroundColors:r,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!s&&(e.colorPicker||{})}),c=t.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((t,e)=>{this._hideView(),e()})),nr({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const l=zI(c),d=OI(c);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:l,validator:VI})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:RI})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:FI})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:FI})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:FI})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:l,validator:VI})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const t=this.editor.commands,e=t.get("tableCellBorderStyle");Object.entries(mT).map((([e,n])=>{const i=this._defaultTableCellProperties[e]||"";return[e,t.get(n).value||i]})).forEach((([t,n])=>{("borderColor"!==t&&"borderWidth"!==t||"none"!==e.value)&&this.view.set(t,n)})),this._isReady=!0}_showView(){const t=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(t.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:sT(t)}),this._undoStepBatch=t.model.createBatch(),this.view.focus()}_hideView(){const t=this.editor;this.stopListening(t.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const t=this.editor;rS(t.editing.view.document.selection)?this._isViewVisible&&oT(t,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(t){return(e,n,i)=>{this._isReady&&this.editor.execute(t,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(t){const{commandName:e,viewField:n,validator:i,errorText:o}=t,r=Ha((()=>{n.errorText=o}),500);return(t,o,s)=>{r.cancel(),this._isReady&&(i(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),n.errorText=null):r())}}}class pT extends cr{constructor(t,e,n){super(t),this.attributeName=e,this._defaultValue=n}refresh(){const t=this.editor,e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(t={}){const{value:e,batch:n}=t,i=this.editor.model,o=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),r=this._getValueToSet(e);i.enqueueChange(n,(t=>{r?o.forEach((e=>t.setAttribute(this.attributeName,r,e))):o.forEach((e=>t.removeAttribute(this.attributeName,e)))}))}_getAttribute(t){if(!t)return;const e=t.getAttribute(this.attributeName);return e!==this._defaultValue?e:void 0}_getValueToSet(t){if(t!==this._defaultValue)return t}_getSingleValue(t){const e=this._getAttribute(t[0]);return t.every((t=>this._getAttribute(t)===e))?e:void 0}}class fT extends pT{constructor(t,e){super(t,"tableCellWidth",e)}_getValueToSet(t){if((t=lT(t,"px"))!==this._defaultValue)return t}}class kT extends sr{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[OD]}init(){const t=this.editor,e=hT(t.config.get("table.tableCellProperties.defaultProperties"));EE(t.model.schema,t.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:e.width}),t.commands.add("tableCellWidth",new fT(t,e.width))}}class bT extends pT{constructor(t,e){super(t,"tableCellPadding",e)}_getAttribute(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}_getValueToSet(t){const e=lT(t,"px");if(e!==this._defaultValue)return e}}class wT extends pT{constructor(t,e){super(t,"tableCellHeight",e)}_getValueToSet(t){const e=lT(t,"px");if(e!==this._defaultValue)return e}}class _T extends pT{constructor(t,e){super(t,"tableCellBackgroundColor",e)}}class AT extends pT{constructor(t,e){super(t,"tableCellVerticalAlignment",e)}}class CT extends pT{constructor(t,e){super(t,"tableCellHorizontalAlignment",e)}}class vT extends pT{constructor(t,e){super(t,"tableCellBorderStyle",e)}_getAttribute(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class yT extends pT{constructor(t,e){super(t,"tableCellBorderColor",e)}_getAttribute(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class xT extends pT{constructor(t,e){super(t,"tableCellBorderWidth",e)}_getAttribute(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}_getValueToSet(t){const e=lT(t,"px");if(e!==this._defaultValue)return e}}const ET=/^(top|middle|bottom)$/,DT=/^(left|center|right|justify)$/;class ST extends sr{static get pluginName(){return"TableCellPropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[OD,kT]}init(){const t=this.editor,e=t.model.schema,n=t.conversion;t.config.define("table.tableCellProperties.defaultProperties",{});const i=hT(t.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===t.locale.contentLanguageDirection});t.data.addStyleProcessorRules(Gu),function(t,e,n){const i={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};t.extend("tableCell",{allowAttributes:Object.values(i)}),wE(e,"td",i,n),wE(e,"th",i,n),_E(e,{modelElement:"tableCell",modelAttribute:i.style,styleName:"border-style"}),_E(e,{modelElement:"tableCell",modelAttribute:i.color,styleName:"border-color"}),_E(e,{modelElement:"tableCell",modelAttribute:i.width,styleName:"border-width"})}(e,n,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),t.commands.add("tableCellBorderStyle",new vT(t,i.borderStyle)),t.commands.add("tableCellBorderColor",new yT(t,i.borderColor)),t.commands.add("tableCellBorderWidth",new xT(t,i.borderWidth)),EE(e,n,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:i.height}),t.commands.add("tableCellHeight",new wT(t,i.height)),t.data.addStyleProcessorRules(eh),EE(e,n,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),t.commands.add("tableCellPadding",new bT(t,i.padding)),t.data.addStyleProcessorRules(Wu),EE(e,n,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),t.commands.add("tableCellBackgroundColor",new _T(t,i.backgroundColor)),function(t,e,n){t.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:t=>({key:"style",value:{"text-align":t}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":DT}},model:{key:"tableCellHorizontalAlignment",value:t=>{const e=t.getStyle("text-align");return e===n?null:e}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:DT}},model:{key:"tableCellHorizontalAlignment",value:t=>{const e=t.getAttribute("align");return e===n?null:e}}})}(e,n,i.horizontalAlignment),t.commands.add("tableCellHorizontalAlignment",new CT(t,i.horizontalAlignment)),function(t,e,n){t.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:t=>({key:"style",value:{"vertical-align":t}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":ET}},model:{key:"tableCellVerticalAlignment",value:t=>{const e=t.getStyle("vertical-align");return e===n?null:e}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:ET}},model:{key:"tableCellVerticalAlignment",value:t=>{const e=t.getAttribute("valign");return e===n?null:e}}})}(e,n,i.verticalAlignment),t.commands.add("tableCellVerticalAlignment",new AT(t,i.verticalAlignment))}}class IT extends cr{constructor(t,e,n){super(t),this.attributeName=e,this._defaultValue=n}refresh(){const t=DE(this.editor.model.document.selection);this.isEnabled=!!t,this.value=this._getValue(t)}execute(t={}){const e=this.editor.model,n=e.document.selection,{value:i,batch:o}=t,r=DE(n),s=this._getValueToSet(i);e.enqueueChange(o,(t=>{s?t.setAttribute(this.attributeName,s,r):t.removeAttribute(this.attributeName,r)}))}_getValue(t){if(!t)return;const e=t.getAttribute(this.attributeName);return e!==this._defaultValue?e:void 0}_getValueToSet(t){if(t!==this._defaultValue)return t}}class TT extends IT{constructor(t,e){super(t,"tableBackgroundColor",e)}}class BT extends IT{constructor(t,e){super(t,"tableBorderColor",e)}_getValue(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class MT extends IT{constructor(t,e){super(t,"tableBorderStyle",e)}_getValue(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class PT extends IT{constructor(t,e){super(t,"tableBorderWidth",e)}_getValue(t){if(!t)return;const e=cT(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}_getValueToSet(t){const e=lT(t,"px");if(e!==this._defaultValue)return e}}class NT extends IT{constructor(t,e){super(t,"tableWidth",e)}_getValueToSet(t){if((t=lT(t,"px"))!==this._defaultValue)return t}}class LT extends IT{constructor(t,e){super(t,"tableHeight",e)}_getValueToSet(t){if((t=lT(t,"px"))!==this._defaultValue)return t}}class zT extends IT{constructor(t,e){super(t,"tableAlignment",e)}}const OT=/^(left|center|right)$/,VT=/^(left|none|right)$/;class FT extends sr{static get pluginName(){return"TablePropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[OD]}init(){const t=this.editor,e=t.model.schema,n=t.conversion;t.config.define("table.tableProperties.defaultProperties",{});const i=uT(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});t.data.addStyleProcessorRules(Gu),function(t,e,n){const i={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};t.extend("table",{allowAttributes:Object.values(i)}),wE(e,"table",i,n),AE(e,{modelAttribute:i.color,styleName:"border-color"}),AE(e,{modelAttribute:i.style,styleName:"border-style"}),AE(e,{modelAttribute:i.width,styleName:"border-width"})}(e,n,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),t.commands.add("tableBorderColor",new BT(t,i.borderColor)),t.commands.add("tableBorderStyle",new MT(t,i.borderStyle)),t.commands.add("tableBorderWidth",new PT(t,i.borderWidth)),function(t,e,n){t.extend("table",{allowAttributes:["tableAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:t=>({key:"style",value:{float:"center"===t?"none":t}}),converterPriority:"high"}),e.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:VT}},model:{key:"tableAlignment",value:t=>{let e=t.getStyle("float");return"none"===e&&(e="center"),e===n?null:e}}}).attributeToAttribute({view:{attributes:{align:OT}},model:{name:"table",key:"tableAlignment",value:t=>{const e=t.getAttribute("align");return e===n?null:e}}})}(e,n,i.alignment),t.commands.add("tableAlignment",new zT(t,i.alignment)),RT(e,n,{modelAttribute:"tableWidth",styleName:"width",defaultValue:i.width}),t.commands.add("tableWidth",new NT(t,i.width)),RT(e,n,{modelAttribute:"tableHeight",styleName:"height",defaultValue:i.height}),t.commands.add("tableHeight",new LT(t,i.height)),t.data.addStyleProcessorRules(Wu),function(t,e,n){const{modelAttribute:i}=n;t.extend("table",{allowAttributes:[i]}),bE(e,{viewElement:"table",...n}),AE(e,n)}(e,n,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),t.commands.add("tableBackgroundColor",new TT(t,i.backgroundColor))}}function RT(t,e,n){const{modelAttribute:i}=n;t.extend("table",{allowAttributes:[i]}),bE(e,{viewElement:/^(table|figure)$/,shouldUpcast:t=>!("table"==t.name&&"figure"==t.parent.name),...n}),_E(e,{modelElement:"table",...n})}var jT=o(4001),HT={attributes:{"data-cke":!0}};HT.setAttributes=Qo(),HT.insert=Ko().bind(null,"head"),HT.domAPI=qo(),HT.insertStyleElement=Jo(),Wo()(jT.A,HT),jT.A&&jT.A.locals&&jT.A.locals;class UT extends er{constructor(t,e){super(t),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=e;const{borderStyleDropdown:n,borderWidthInput:i,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:l,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new so,this.keystrokes=new uo,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=i,this.borderColorInput=o,this.backgroundInput=a,this.widthInput=c,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new Ao,this._focusCycler=new Rh({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Fh(t,{label:this.t("Table properties")})),this.children.add(new KI(t,{labelView:r,children:[r,n,o,i],class:"ck-table-form__border-row"})),this.children.add(new KI(t,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new KI(t,{children:[new KI(t,{labelView:u,children:[u,c,l,d],class:"ck-table-form__dimensions-row"}),new KI(t,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new KI(t,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),or({view:this}),[this.borderColorInput,this.backgroundInput].forEach((t=>{this._focusCycler.chain(t.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,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()}_createBorderFields(){const t=this.options.defaultTableProperties,e={style:t.borderStyle,width:t.borderWidth,color:t.borderColor},n=WI({colorConfig:this.options.borderColors,columns:5,defaultColorValue:e.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,o=this.t,r=o("Style"),s=new hm(i);s.text=o("Border");const a=LI(o),c=new $m(i,dp);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",(t=>a[t||"none"])),c.fieldView.on("execute",(t=>{this.borderStyle=t.source._borderStyleValue})),c.bind("isEmpty").to(this,"borderStyle",(t=>!t)),ip(c.fieldView,jI(this,e.style),{role:"menu",ariaLabel:r});const l=new $m(i,cp);l.set({label:o("Width"),class:"ck-table-form__border-width"}),l.fieldView.bind("value").to(this,"borderWidth"),l.bind("isEnabled").to(this,"borderStyle",WT),l.fieldView.on("input",(()=>{this.borderWidth=l.fieldView.element.value}));const d=new $m(i,n);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",WT),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((t,n,i,o)=>{WT(i)||(this.borderColor="",this.borderWidth=""),WT(o)||(this.borderColor=e.color,this.borderWidth=e.width)})),{borderRowLabel:s,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:l}}_createBackgroundFields(){const t=this.locale,e=this.t,n=new hm(t);n.text=e("Background");const i=WI({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new $m(t,i);return o.set({label:e("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:n,backgroundInput:o}}_createDimensionFields(){const t=this.locale,e=this.t,n=new hm(t);n.text=e("Dimensions");const i=new $m(t,cp);i.set({label:e("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));const o=new er(t);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new $m(t,cp);return r.set({label:e("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",(()=>{this.height=r.fieldView.element.value})),{dimensionsLabel:n,widthInput:i,operatorLabel:o,heightInput:r}}_createAlignmentFields(){const t=this.locale,e=this.t,n=new hm(t);n.text=e("Alignment");const i=new Ug(t);return i.set({role:"radiogroup",isCompact:!0,ariaLabel:e("Table alignment toolbar")}),HI({view:this,icons:{left:Dh.objectLeft,center:Dh.objectCenter,right:Dh.objectRight},toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:i}}_createActionButtons(){const t=this.locale,e=this.t,n=new Lh(t),i=new Lh(t),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:e("Save"),icon:Dh.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(o,"errorText",((...t)=>t.every((t=>!t)))),i.set({label:e("Cancel"),icon:Dh.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _alignmentLabels(){const t=this.locale,e=this.t,n=e("Align table to the left"),i=e("Center table"),o=e("Align table to the right");return"rtl"===t.uiLanguageDirection?{right:o,center:i,left:n}:{left:n,center:i,right:o}}}function WT(t){return"none"!==t}const GT={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class qT extends sr{static get requires(){return[Zf]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this.view=null,t.config.define("table.tableProperties",{borderColors:UI,backgroundColors:UI})}init(){const t=this.editor,e=t.t;this._defaultTableProperties=uT(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=t.plugins.get(Zf),t.ui.componentFactory.add("tableProperties",(n=>{const i=new Lh(n);i.set({label:e("Table properties"),icon:'',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));const o=Object.values(GT).map((e=>t.commands.get(e)));return i.bind("isEnabled").toMany(o,"isEnabled",((...t)=>t.some((t=>t)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const t=this.editor,e=t.config.get("table.tableProperties"),n=Mm(e.borderColors),i=Bm(t.locale,n),o=Mm(e.backgroundColors),r=Bm(t.locale,o),s=!1!==e.colorPicker,a=new UT(t.locale,{borderColors:i,backgroundColors:r,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!s&&(e.colorPicker||{})}),c=t.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((t,e)=>{this._hideView(),e()})),nr({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const l=zI(c),d=OI(c);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:l,validator:VI})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:RI})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:l,validator:VI})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:FI})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:FI})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const t=this.editor.commands,e=t.get("tableBorderStyle");Object.entries(GT).map((([e,n])=>{const i=e,o=this._defaultTableProperties[i]||"";return[i,t.get(n).value||o]})).forEach((([t,n])=>{("borderColor"!==t&&"borderWidth"!==t||"none"!==e.value)&&this.view.set(t,n)})),this._isReady=!0}_showView(){const t=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(t.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:rT(t)}),this._undoStepBatch=t.model.createBatch(),this.view.focus()}_hideView(){const t=this.editor;this.stopListening(t.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const t=this.editor;iS(t.editing.view.document.selection)?this._isViewVisible&&oT(t,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(t){return(e,n,i)=>{this._isReady&&this.editor.execute(t,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(t){const{commandName:e,viewField:n,validator:i,errorText:o}=t,r=Ha((()=>{n.errorText=o}),500);return(t,o,s)=>{r.cancel(),this._isReady&&(i(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),n.errorText=null):r())}}}var $T=o(7406),KT={attributes:{"data-cke":!0}};KT.setAttributes=Qo(),KT.insert=Ko().bind(null,"head"),KT.domAPI=qo(),KT.insertStyleElement=Jo(),Wo()($T.A,KT),$T.A&&$T.A.locals&&$T.A.locals;class YT extends cr{refresh(){this.isEnabled=!0}execute(t={}){const{model:e,plugins:n}=this.editor;let{table:i=e.document.selection.getSelectedElement(),columnWidths:o,tableWidth:r}=t;o&&(o=Array.isArray(o)?o:o.split(",")),e.change((t=>{r?t.setAttribute("tableWidth",r,i):t.removeAttribute("tableWidth",i);const e=n.get("TableColumnResizeEditing").getColumnGroupElement(i);if(!o&&!e)return;if(!o)return t.remove(e);const s=uD(o);if(e)Array.from(e.getChildren()).forEach(((e,n)=>t.setAttribute("columnWidth",s[n],e)));else{const e=t.createElement("tableColumnGroup");s.forEach((n=>t.appendElement("tableColumn",{columnWidth:n},e))),t.append(e,i)}}))}}class QT extends sr{static get requires(){return[OD,fD]}static get pluginName(){return"TableColumnResizeEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(Kn()),this._tableUtilsPlugin=t.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",((e,n,i)=>{const o=i?"removeClass":"addClass";t.editing.view.change((e=>{for(const n of t.editing.view.document.roots)e[o]("ck-column-resize_disabled",t.editing.view.document.getRoot(n.rootName))}))}))}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const t=this.editor,e=t.plugins.get("TableColumnResize");t.plugins.get("TableEditing").registerAdditionalSlot({filter:t=>t.is("element","tableColumnGroup"),positionOffset:0});const n=new YT(t);t.commands.add("resizeTableWidth",n),t.commands.add("resizeColumnWidths",n),this.bind("_isResizingAllowed").to(t,"isReadOnly",e,"isEnabled",n,"isEnabled",((t,e,n)=>!t&&e&&n))}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(t){return gD(t)}getTableColumnElements(t){return pD(t)}getTableColumnsWidths(t){return function(t){return pD(t).map((t=>t.getAttribute("columnWidth")))}(t)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){const t=this.editor.model;function e(t,e,n){const i=n._tableUtilsPlugin.getColumns(e);if(0==i-t.length)return t;const o=t.map((t=>Number(t.replace("%","")))),r=function(t,e){const n=new Set;for(const i of t.getChanges())if("insert"==i.type&&i.position.nodeAfter&&"tableCell"==i.position.nodeAfter.name&&i.position.nodeAfter.getAncestors().includes(e))n.add(i.position.nodeAfter);else if("remove"==i.type){const t=i.position.nodeBefore||i.position.nodeAfter;"tableCell"==t.name&&t.getAncestors().includes(e)&&n.add(t)}return n}(n.editor.model.document.differ,e);for(const t of r){const r=i-o.length;if(0===r)continue;const a=r>0,c=n._tableUtilsPlugin.getCellLocation(t).column;if(a){const t=(s=rD(e,n.editor),Array(r).fill(s));o.splice(c,0,...t)}else{const t=o.splice(c,Math.abs(r));o[c]+=dD(t)}}var s;return o.map((t=>t+"%"))}t.document.registerPostFixer((n=>{let i=!1;for(const o of function(t){const e=new Set;for(const n of t.document.differ.getChanges()){let i=null;switch(n.type){case"insert":i=["table","tableRow","tableCell"].includes(n.name)?n.position:null;break;case"remove":i=["tableRow","tableCell"].includes(n.name)?n.position:null;break;case"attribute":n.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(n.range.start.nodeAfter.name)?n.range.start:null)}if(!i)continue;const o=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAncestor("table");for(const n of t.createRangeOn(o).getItems())n.is("element","table")&&gD(n)&&e.add(n)}return e}(t)){const t=this.getColumnGroupElement(o),r=this.getTableColumnElements(t),s=this.getTableColumnsWidths(t);let a=uD(s);a=e(a,o,this),ld(s,a)||(mD(r,t,a,n),i=!0)}return i}))}_registerConverters(){const t=this.editor.conversion;var e;t.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:t=>t.getStyle("width")}}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:t=>({name:"figure",key:"style",value:{width:t}})}),t.elementToElement({model:"tableColumnGroup",view:"colgroup"}),t.elementToElement({model:"tableColumn",view:"col"}),t.for("downcast").add((t=>t.on("insert:table",((t,e,n)=>{const i=n.writer,o=e.item,r=n.mapper.toViewElement(o),s=r.is("element","table")?r:Array.from(r.getChildren()).find((t=>t.is("element","table")));gD(o)?i.addClass("ck-table-resized",s):i.removeClass("ck-table-resized",s)}),{priority:"low"}))),t.for("upcast").add((e=this._tableUtilsPlugin,t=>t.on("element:colgroup",((t,n,i)=>{const o=n.modelCursor.findAncestor("table"),r=gD(o);if(!r)return;const s=pD(r),a=e.getColumns(o);let c=(l=r,d=i.writer,pD(l).reduce(((t,e)=>{const n=e.getAttribute("columnWidth"),i=e.getAttribute("colSpan");if(!i)return t.push(n),t;for(let e=0;ec[e]||"auto")),(c.length!=s.length||c.includes("auto"))&&mD(s,r,uD(c),i.writer)}),{priority:"low"}))),t.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:t=>{const e=t.getStyle("width");return e&&(e.endsWith("%")||e.endsWith("pt"))?e:"auto"}}}),t.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),t.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:t=>({key:"style",value:{width:t}})})}_registerResizingListeners(){const t=this.editor.editing.view;t.addObserver(JD),t.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(a.window.document,"mousemove",ih(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(a.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(t,e){const n=e.target;if(!n.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const i=this.editor,o=i.editing.mapper.toModelElement(n.findAncestor("figure"));if(!i.model.canEditAt(o))return;e.preventDefault(),t.stop();const r=function(t,e,n){const i=Array(e.getColumns(t)),o=new TE(t);for(const t of o){const e=n.editing.mapper.toViewElement(t.cell),o=hD(n.editing.view.domConverter.mapViewToDom(e));(!i[t.column]||ot.is("element","colgroup")))||a.change((t=>{!function(t,e,n){const i=t.createContainerElement("colgroup");for(let n=0;nfunction(t,e,n){const i=n.widths.viewFigureWidth/n.widths.viewFigureParentWidth;t.addClass("ck-table-resized",e),t.addClass("ck-table-column-resizer__active",n.elements.viewResizer),t.setStyle("width",`${lD(100*i)}%`,e.findAncestor("figure"))}(t,s,this._resizingData)))}_onMouseMoveHandler(t,e){if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:n,flags:{isRightEdge:i,isTableCentered:o,isLtrContent:r},elements:{viewFigure:s,viewLeftColumn:a,viewRightColumn:c},widths:{viewFigureParentWidth:l,tableWidth:d,leftColumnWidth:u,rightColumnWidth:h}}=this._resizingData,m=40-u,g=i?l-d:h-40,p=(r?1:-1)*(i&&o?2:1),f=(k=(e.clientX-n)*p,b=Math.min(m,0),w=Math.max(g,0),lD(k<=b?b:k>=w?w:k));var k,b,w;0!==f&&this.editor.editing.view.change((t=>{const e=lD(100*(u+f)/d);if(t.setStyle("width",`${e}%`,a),i){const e=lD(100*(d+f)/l);t.setStyle("width",`${e}%`,s)}else{const e=lD(100*(h-f)/d);t.setStyle("width",`${e}%`,c)}}))}_onMouseUpHandler(){if(!this._isResizingActive)return;const{viewResizer:t,modelTable:e,viewFigure:n,viewColgroup:i}=this._resizingData.elements,o=this.editor,r=o.editing.view,s=this.getColumnGroupElement(e),a=Array.from(i.getChildren()).filter((t=>t.is("view:element"))),c=s?this.getTableColumnsWidths(s):null,l=a.map((t=>t.getStyle("width"))),d=!ld(c,l),u=e.getAttribute("tableWidth"),h=n.getStyle("width"),m=u!==h;(d||m)&&(this._isResizingAllowed?o.execute("resizeTableWidth",{table:e,tableWidth:`${lD(h)}%`,columnWidths:l}):r.change((t=>{if(c)for(const e of a)t.setStyle("width",c.shift(),e);else t.remove(i);m&&(u?t.setStyle("width",u,n):t.removeStyle("width",n)),c||u||t.removeClass("ck-table-resized",[...n.getChildren()].find((t=>"table"===t.name)))}))),r.change((e=>{e.removeClass("ck-table-column-resizer__active",t)})),this._isResizingActive=!1,this._resizingData=null}_getResizingData(t,e){const n=this.editor,i=t.domEvent.clientX,o=t.target,r=o.findAncestor("td")||o.findAncestor("th"),s=n.editing.mapper.toModelElement(r),a=s.findAncestor("table"),c=function(t,e){const n=e.getCellLocation(t).column;return{leftEdge:n,rightEdge:n+(t.getAttribute("colspan")||1)-1}}(s,this._tableUtilsPlugin).rightEdge,l=c===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),u="rtl"!==n.locale.contentLanguageDirection,h=r.findAncestor("table"),m=h.findAncestor("figure"),g=[...h.getChildren()].find((t=>t.is("element","colgroup"))),p=g.getChild(c),f=l?void 0:g.getChild(c+1);return{columnPosition:i,flags:{isRightEdge:l,isTableCentered:d,isLtrContent:u},elements:{viewResizer:o,modelTable:a,viewFigure:m,viewColgroup:g,viewLeftColumn:p,viewRightColumn:f},widths:{viewFigureParentWidth:cD(n.editing.view.domConverter.mapViewToDom(m.parent)),viewFigureWidth:cD(n.editing.view.domConverter.mapViewToDom(m)),tableWidth:sD(a,n),leftColumnWidth:e[c],rightColumnWidth:l?void 0:e[c+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add((t=>{t.on("insert:tableCell",((t,e,n)=>{const i=e.item,o=n.mapper.toViewElement(i),r=n.writer;r.insert(r.createPositionAt(o,"end"),r.createUIElement("div",{class:"ck-table-column-resizer"}))}),{priority:"lowest"})}))}}var ZT=o(4204),JT={attributes:{"data-cke":!0}};JT.setAttributes=Qo(),JT.insert=Ko().bind(null,"head"),JT.domAPI=qo(),JT.insertStyleElement=Jo(),Wo()(ZT.A,JT),ZT.A&&ZT.A.locals&&ZT.A.locals;class XT extends vS{constructor(t){super(t,xS)}}function tB(t){return t.map(eB).filter((t=>void 0!==t))}function eB(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(nB).join(", ");return{title:n,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}(t):void 0}function nB(t){return(t=t.trim()).indexOf(" ")>0&&(t=`'${t}'`),t}class iB extends sr{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define(xS,{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:xS}),t.model.schema.setAttributeProperties(xS,{isFormatting:!0,copyOnEnter:!0});const e=tB(t.config.get("fontFamily.options")).filter((t=>t.model)),n=SS(xS,e);t.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(n),t.commands.add(xS,new XT(t))}_prepareAnyValueConverters(){const t=this.editor;t.conversion.for("downcast").attributeToElement({model:xS,view:(t,{writer:e})=>e.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),t.conversion.for("upcast").elementToAttribute({model:{key:xS,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:xS,value:t=>t.getAttribute("face")}})}}const oB='';class rB extends sr{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),i=t.commands.get(xS),o=e("Font Family"),r=function(t,e){const n=new oo;for(const i of t){const t={type:"button",model:new Gf({commandName:xS,commandParam:i.model,label:i.title,role:"menuitemradio",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&&"string"!=typeof i.view&&i.view.styles&&t.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),n.add(t)}return n}(n,i);t.ui.componentFactory.add(xS,(e=>{const n=tp(e);return ip(n,r,{role:"menu",ariaLabel:o}),n.buttonView.set({label:o,icon:oB,tooltip:!0}),n.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),n})),t.ui.componentFactory.add(`menuBar:${xS}`,(e=>{const n=new Pk(e);n.buttonView.set({label:o,icon:oB}),n.bind("isEnabled").to(i);const s=new Nk(e);for(const i of r){const o=new Af(e,n),r=new lm(e);r.set({role:"menuitemradio",isToggleable:!0}),r.bind(...Object.keys(i.model)).to(i.model),r.delegate("execute").to(n),r.on("execute",(()=>{t.execute(i.model.commandName,{value:i.model.commandParam}),t.editing.view.focus()})),o.children.add(r),s.items.add(o)}return n.panelView.children.add(s),n}))}_getLocalizedOptions(){const t=this.editor,e=t.t;return tB(t.config.get(xS).options).map((t=>("Default"===t.title&&(t.title=e("Default")),t)))}}class sB extends vS{constructor(t){super(t,yS)}}function aB(t){return t.map((t=>function(t){if("number"==typeof t&&(t=String(t)),"object"==typeof t&&((e=t).title&&e.model&&e.view))return lB(t);var e;const n=function(t){return"string"==typeof t?cB[t]:cB[t.model]}(t);return n?lB(n):"default"===t?{model:void 0,title:"Default"}:function(t){let e;if("object"==typeof t){if(!t.model)throw new I("font-size-invalid-definition",null,t);e=parseFloat(t.model)}else e=parseFloat(t);return isNaN(e)}(t)?void 0:function(t){return"string"==typeof t&&(t={title:t,model:`${parseFloat(t)}px`}),t.view={name:"span",styles:{"font-size":t.model}},lB(t)}(t)}(t))).filter((t=>void 0!==t))}const cB={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 lB(t){return t.view&&"string"!=typeof t.view&&!t.view.priority&&(t.view.priority=7),t}const dB=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class uB extends sr{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define(yS,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:yS}),t.model.schema.setAttributeProperties(yS,{isFormatting:!0,copyOnEnter:!0});const e=t.config.get("fontSize.supportAllValues"),n=aB(this.editor.config.get("fontSize.options")).filter((t=>t.model)),i=SS(yS,n);e?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(i),t.commands.add(yS,new sB(t))}_prepareAnyValueConverters(t){const e=this.editor,n=t.model.values.filter((t=>!Tu(String(t))&&!Mu(String(t))));if(n.length)throw new I("font-size-invalid-use-of-named-presets",null,{presets:n});e.conversion.for("downcast").attributeToElement({model:yS,view:(t,{writer:e})=>{if(t)return e.createAttributeElement("span",{style:"font-size:"+t},{priority:7})}}),e.conversion.for("upcast").elementToAttribute({model:{key:yS,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:yS,value:t=>{const e=t.getAttribute("size"),n="-"===e[0]||"+"===e[0];let i=parseInt(e,10);n&&(i=3+i);const o=dB.length-1,r=Math.min(Math.max(i,0),o);return dB[r]}}})}}var hB=o(9465),mB={attributes:{"data-cke":!0}};mB.setAttributes=Qo(),mB.insert=Ko().bind(null,"head"),mB.domAPI=qo(),mB.insertStyleElement=Jo(),Wo()(hB.A,mB),hB.A&&hB.A.locals&&hB.A.locals;const gB='';class pB extends sr{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),i=t.commands.get(yS),o=e("Font Size"),r=function(t,e){const n=new oo;for(const i of t){const t={type:"button",model:new Gf({commandName:yS,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&"string"!=typeof i.view&&(i.view.styles&&t.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),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);t.ui.componentFactory.add(yS,(e=>{const n=tp(e);return ip(n,r,{role:"menu",ariaLabel:o}),n.buttonView.set({label:o,icon:gB,tooltip:!0}),n.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),n})),t.ui.componentFactory.add(`menuBar:${yS}`,(e=>{const n=new Pk(e);n.buttonView.set({label:o,icon:gB}),n.bind("isEnabled").to(i);const s=new Nk(e);for(const i of r){const o=new Af(e,n),r=new lm(e);r.set({role:"menuitemradio",isToggleable:!0}),r.bind(...Object.keys(i.model)).to(i.model),r.delegate("execute").to(n),r.on("execute",(()=>{t.execute(i.model.commandName,{value:i.model.commandParam}),t.editing.view.focus()})),o.children.add(r),s.items.add(o)}return n.panelView.children.add(s),n}))}_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 aB(t.config.get(yS).options).map((t=>{const e=n[t.title];return e&&e!=t.title&&(t=Object.assign({},t,{title:e})),t}))}}class fB extends cr{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=_w(t,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(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 kB=o(1799),bB={attributes:{"data-cke":!0}};bB.setAttributes=Qo(),bB.insert=Ko().bind(null,"head"),bB.domAPI=qo(),bB.insertStyleElement=Jo(),Wo()(kB.A,bB),kB.A&&kB.A.locals&&kB.A.locals;class wB extends sr{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}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),pw(t,e,{label:n})}(o,e,i)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new fB(t))}}class _B extends sr{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("horizontalLine",(()=>{const t=this._createButton(Lh);return t.set({tooltip:!0}),t})),t.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(lm)))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("horizontalLine"),o=new t(e.locale),r=n.t;return o.set({label:r("Horizontal line"),icon:Dh.horizontalLine}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{e.execute("horizontalLine"),e.editing.view.focus()})),o}}class AB extends Gk{}class CB extends Yk{}class vB extends nb{}const yB=[class extends sr{static get requires(){return[bm,c_,iw,g_,aw,zb,C_]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[Lb]}static get pluginName(){return"Autoformat"}static get isOfficialPlugin(){return!0}afterInit(){const t=this.editor,e=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Revert autoformatting action"),keystroke:"Backspace"}]})}_addListAutoformats(){const t=this.editor.commands;t.get("bulletedList")&&v_(this.editor,this,/^[*-]\s$/,"bulletedList"),t.get("numberedList")&&v_(this.editor,this,/^1[.|)]\s$/,"numberedList"),t.get("todoList")&&v_(this.editor,this,/^\[\s?\]\s$/,"todoList"),t.get("checkTodoList")&&v_(this.editor,this,/^\[\s?x\s?\]\s$/,(()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")}))}_addBasicStylesAutoformats(){const t=this.editor.commands;if(t.get("bold")){const t=E_(this.editor,"bold");y_(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),y_(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(t.get("italic")){const t=E_(this.editor,"italic");y_(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),y_(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(t.get("code")){const t=E_(this.editor,"code");y_(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(t.get("strikethrough")){const t=E_(this.editor,"strikethrough");y_(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const t=this.editor.commands.get("heading");t&&t.modelElements.filter((t=>t.match(/^heading[1-6]$/))).forEach((e=>{const n=e[7],i=new RegExp(`^(#{${n}})\\s$`);v_(this.editor,this,i,(()=>{if(!t.isEnabled||t.value===e)return!1;this.editor.execute("heading",{value:e})}))}))}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&v_(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const t=this.editor,e=t.model.document.selection;t.commands.get("codeBlock")&&v_(t,this,/^```$/,(()=>{if(e.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})}))}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&v_(this.editor,this,/^---$/,"horizontalLine")}},class extends sr{static get requires(){return[I_,M_]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}},c_,class extends sr{static get requires(){return[N_,z_]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[_S,CS]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[fS,bS]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[hS,gS]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[cS,dS]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[j_,W_]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[X_,nA]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[aA,lA,zw]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[qA,KA]}static get pluginName(){return"Image"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[ZA,JA]}static get pluginName(){return"ImageCaption"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[cC,uC]}static get pluginName(){return"ImageStyle"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[Ow,kA]}static get pluginName(){return"ImageToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const t=this.editor,e=t.t,n=t.plugins.get(Ow),i=t.plugins.get("ImageUtils");var o;n.register("image",{ariaLabel:e("Image toolbar"),items:(o=t.config.get("image.toolbar")||[],o.map((t=>G(t)?t.name:t))),getRelatedElement:t=>i.getClosestSelectedImageWidget(t)})}},class extends sr{static get pluginName(){return"ImageUpload"}static get isOfficialPlugin(){return!0}static get requires(){return[NC,kC,DC]}},class extends sr{static get requires(){return[jC,KC,ev,UC]}static get pluginName(){return"ImageResize"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[Hv,ey]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}},class extends sr{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[oy,ry]}},class extends sr{static get requires(){return[jv,Xv,ay]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[Xy,ix]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[_x,Ex]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}},class extends sr{static get requires(){return[Rx,qx,Hx,zw]}static get pluginName(){return"MediaEmbed"}static get isOfficialPlugin(){return!0}},Y_,class extends sr{static get pluginName(){return"PasteFromOffice"}static get isOfficialPlugin(){return!0}static get requires(){return[bb]}init(){const t=this.editor,e=t.plugins.get("ClipboardPipeline"),n=t.editing.view.document,i=[],o=this.editor.plugins.has("MultiLevelList");i.push(new sE(n,o)),i.push(new dE(n)),i.push(new hE(n)),e.on("inputTransformation",((e,o)=>{if(o._isTransformedWithPasteFromOffice)return;if(t.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const r=o.dataTransfer.getData("text/html"),s=i.find((t=>t.isActive(r)));s&&(o._parsedData||(o._parsedData=function(t,e){const n=new DOMParser,i=function(t){return mE(mE(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n=t.indexOf(e);if(n<0)return t;const i=t.indexOf("