import{Plugin as f,Command as S}from"@ckeditor/ckeditor5-core";import{Clipboard as mi,ClipboardPipeline as K}from"@ckeditor/ckeditor5-clipboard";import{ModelLivePosition as J,ModelLiveRange as gi,Observer as ui,ViewUpcastWriter as X,enableViewPlaceholder as di,ModelElement as hi}from"@ckeditor/ckeditor5-engine";import{Undo as fi}from"@ckeditor/ckeditor5-undo";import{Delete as pi}from"@ckeditor/ckeditor5-typing";import{first as F,DomEmitterMixin as bi,global as j,FocusTracker as Z,KeystrokeHandler as D,logWarning as T,toArray as Oe,env as Ii,CKEditorError as ki,Collection as wi,Rect as _i}from"@ckeditor/ckeditor5-utils";import{toWidget as yi,isWidget as vi,findOptimalInsertionRange as Ei,Widget as ze,toWidgetEditable as Ci,WidgetResize as Y,calculateResizeHostAncestorWidth as Pe,WidgetToolbarRepository as Re}from"@ckeditor/ckeditor5-widget";import{View as L,FormRowView as Ne,ViewCollection as Q,FocusCycler as ee,submitHandler as M,ButtonView as v,FormHeaderView as Fe,LabeledFieldView as te,createLabeledInputText as je,BalloonPanelView as Si,ContextualBalloon as De,CssTransitionDisablerMixin as Le,clickOutsideHandler as Me,CollapsibleView as Ti,SplitButtonView as We,createDropdown as ie,MenuBarMenuView as Ai,MenuBarMenuListView as Ui,MenuBarMenuListItemView as xi,FileDialogButtonView as qe,MenuBarMenuListItemFileDialogButtonView as Bi,Notification as He,Dialog as Vi,MenuBarMenuListItemButtonView as Oi,UIModel as Ge,DropdownButtonView as zi,addListToDropdown as Pi,createLabeledInputNumber as Ri,addToolbarToDropdown as Ni}from"@ckeditor/ckeditor5-ui";import{IconPreviousArrow as $e,IconTextAlternative as Fi,IconImage as ji,IconCaption as Di,IconImageUpload as Li,IconImageUrl as Mi,IconObjectSizeFull as Wi,IconObjectSizeCustom as qi,IconObjectSizeLarge as Hi,IconObjectSizeMedium as Gi,IconObjectSizeSmall as $i,IconObjectInline as Ke,IconObjectInlineRight as ne,IconObjectInlineLeft as Je,IconObjectCenter as oe,IconObjectRight as Xe,IconObjectLeft as Ze,IconObjectFullWidth as Ki}from"@ckeditor/ckeditor5-icons";import{FileRepository as A}from"@ckeditor/ckeditor5-upload";/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function Ye(o){return o.createContainerElement("span",{class:"image-inline"},o.createEmptyElement("img"))}function se(o){return o.createContainerElement("figure",{class:"image"},[o.createEmptyElement("img"),o.createSlot("children")])}function ae(o,e){const t=o.plugins.get("ImageUtils"),i=o.plugins.has("ImageInlineEditing")&&o.plugins.has("ImageBlockEditing");return a=>t.isInlineImageView(a)?i&&(a.getStyle("display")=="block"||a.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:n(a):null;function n(a){const s={name:!0};return a.hasAttribute("src")&&(s.attributes=["src"]),s}}function W(o,e){const t=F(e.getSelectedBlocks());return!t||o.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function B(o){return o&&o.endsWith("px")?parseInt(o):null}function V(o){const e=B(o.getStyle("width")),t=B(o.getStyle("height"));return!!(e&&t)}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/const Ji=/^(image|image-inline)$/;class I extends f{_domEmitter=new(bi());static get pluginName(){return"ImageUtils"}static get isOfficialPlugin(){return!0}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null,n={}){const a=this.editor,s=a.model,r=s.document.selection,m=Qe(a,t||r,i);e={...Object.fromEntries(r.getAttributes()),...e};for(const c in e)s.schema.checkAttribute(m,c)||delete e[c];return s.change(c=>{const{setImageSizes:l=!0}=n,g=c.createElement(m,e);return s.insertObject(g,t,null,{setSelection:"on",findOptimalPosition:!t&&m!="imageInline"?"auto":void 0}),g.parent?(l&&this.setImageNaturalSizeAttributes(g),g):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(i=>{const n=new j.window.Image;this._domEmitter.listenTo(n,"load",()=>{!e.getAttribute("width")&&!e.getAttribute("height")&&this.editor.model.enqueueChange(i.batch,a=>{a.setAttribute("width",n.naturalWidth,e),a.setAttribute("height",n.naturalHeight,e)}),this._domEmitter.stopListening(n,"load")}),n.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let n=t.parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:Ji})}isImageAllowed(){const t=this.editor.model.document.selection;return Xi(this.editor,t)&&Zi(t)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),yi(e,t,{label:()=>{const s=this.findViewImgElement(e).getAttribute("alt");return s?`${s} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&vi(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function Xi(o,e){if(Qe(o,e,null)=="imageBlock"){const i=Yi(e,o.model);if(o.model.schema.checkChild(i,"imageBlock"))return!0}else if(o.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}function Zi(o){return[...o.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function Yi(o,e){const i=Ei(o,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function Qe(o,e,t){const i=o.model.schema,n=o.config.get("image.insert.type");return o.plugins.has("ImageBlockEditing")?o.plugins.has("ImageInlineEditing")?t||(n==="inline"?"imageInline":n!=="auto"?"imageBlock":e.is("selection")?W(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/const Qi=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class en extends f{static get requires(){return[mi,I,fi,pi]}static get pluginName(){return"AutoImage"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const n=t.selection.getFirstRange(),a=J.fromPosition(n.start);a.stickiness="toPrevious";const s=J.fromPosition(n.end);s.stickiness="toNext",t.once("change:data",()=>{this._embedImageBetweenPositions(a,s),a.detach(),s.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(j.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedImageBetweenPositions(e,t){const i=this.editor,n=new gi(e,t),a=n.getWalker({ignoreElementEnd:!0}),s=Object.fromEntries(i.model.document.selection.getAttributes()),r=this.editor.plugins.get("ImageUtils");let m="";for(const c of a)c.item.is("$textProxy")&&(m+=c.item.data);if(m=m.trim(),!m.match(Qi)){n.detach();return}this._positionToInsert=J.fromPosition(e),this._timeoutId=setTimeout(()=>{if(!i.commands.get("insertImage").isEnabled){n.detach();return}i.model.change(g=>{this._timeoutId=null,g.remove(n),n.detach();let u;this._positionToInsert.root.rootName!=="$graveyard"&&(u=this._positionToInsert.toPosition()),r.insertImage({...s,src:m},u),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get("Delete").requestUndoOnBackspace()},100)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class et extends S{refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled&&i.hasAttribute("alt")?this.value=i.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n=t.model,a=i.getClosestSelectedImageElement(n.document.selection);n.change(s=>{s.setAttribute("alt",e.newValue,a)})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class tt extends f{static get requires(){return[I]}static get pluginName(){return"ImageTextAlternativeEditing"}static get isOfficialPlugin(){return!0}init(){this.editor.commands.add("imageTextAlternative",new et(this.editor))}}function _(o,{insertAt:e}={}){if(!o||typeof document>"u")return;const t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",window.litNonce&&i.setAttribute("nonce",window.litNonce),e==="top"&&t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.styleSheet?i.styleSheet.cssText=o:i.appendChild(document.createTextNode(o))}_(":root{--ck-text-alternative-form-width:340px}@media screen and (max-width:600px){:root{--ck-text-alternative-form-width:300px}}.ck.ck-text-alternative-form.ck-responsive-form{width:var(--ck-text-alternative-form-width)}"),_('.ck-vertical-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck-vertical-form .ck-button:focus:after{display:none}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck.ck-responsive-form .ck-button:focus:after{display:none}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-number,.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border-radius:0;margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}.ck.ck-responsive-form>.ck-button:last-child:not(:focus),.ck.ck-responsive-form>.ck-button:nth-last-child(2):not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}'),_(":root{--ck-form-default-width:340px}.ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form.ck-form_default-width{width:var(--ck-form-default-width)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-number,.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}@media screen and (max-width:600px){.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit{align-items:stretch;flex-direction:column;padding:0}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit>.ck{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_with-submit .ck-button_with-text{justify-content:center}.ck.ck-form.ck-responsive-form .ck.ck-form__row.ck-form__row_large-bottom-padding{padding-bottom:var(--ck-spacing-large)}}[dir=ltr] .ck.ck-form.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-form.ck-responsive-form>:not(:last-child){margin-left:0}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class it extends L{focusTracker;keystrokes;labeledInput;backButtonView;saveButtonView;children;_focusables;_focusCycler;constructor(e){super(e),this.focusTracker=new Z,this.keystrokes=new D,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new Ne(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new Q,this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new ee({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),M({view:this}),[this.backButtonView,this.labeledInput,this.saveButtonView].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()}_createBackButton(){const e=this.locale.t,t=new v(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:$e,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new v(this.locale);return t.set({label:e("Save"),withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Fe(this.locale,{label:e("Text Alternative")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){const e=this.locale.t,t=new te(this.locale,je);return t.label=e("Text alternative"),t.class="ck-labeled-field-view_full-width",t}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function nt(o){const e=o.plugins.get("ContextualBalloon");if(o.plugins.get("ImageUtils").getClosestSelectedImageWidget(o.editing.view.document.selection)){const i=q(o);e.updatePosition(i)}}function q(o){const e=o.editing.view,t=Si.defaultPositions,i=o.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ot extends f{_balloon;_form;static get requires(){return[De]}static get pluginName(){return"ImageTextAlternativeUI"}static get isOfficialPlugin(){return!0}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const n=e.commands.get("imageTextAlternative"),a=new v(i);return a.set({label:t("Change image text alternative"),icon:Fi,tooltip:!0}),a.bind("isEnabled").to(n,"isEnabled"),a.bind("isOn").to(n,"value",s=>!!s),this.listenTo(a,"execute",()=>{this._showForm()}),a})}_createForm(){const e=this.editor,i=e.editing.view.document,n=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Le(it))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this.listenTo(e.ui,"update",()=>{n.getClosestSelectedImageWidget(i.selection)?this._isVisible&&nt(e):this._hideForm(!0)}),Me({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:q(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class re extends f{static get requires(){return[tt,ot]}static get pluginName(){return"ImageTextAlternative"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function st(o){const e=(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const a=o.findViewImgElement(i.viewItem);if(!a||!n.consumable.test(a,{name:!0}))return;n.consumable.consume(i.viewItem,{name:!0,classes:"image"});const s=n.convertItem(a,i.modelCursor),r=F(s.modelRange.getItems());if(!r){n.consumable.revert(i.viewItem,{name:!0,classes:"image"});return}n.convertChildren(i.viewItem,r),n.updateConversionResult(r,i)};return t=>{t.on("element:figure",e)}}function at(o){const e=["srcset","media","type","sizes"],t=(i,n,a)=>{const s=n.viewItem;if(!a.consumable.test(s,{name:!0}))return;const r=new Map;for(const l of s.getChildren())if(l.is("element","source")){const g={};for(const u of e)l.hasAttribute(u)&&a.consumable.test(l,{attributes:u})&&(g[u]=l.getAttribute(u));Object.keys(g).length&&r.set(l,g)}const m=o.findViewImgElement(s);if(!m)return;let c=n.modelCursor.parent;if(!c.is("element","imageBlock")){const l=a.convertItem(m,n.modelCursor);n.modelRange=l.modelRange,n.modelCursor=l.modelCursor,c=F(l.modelRange.getItems())}a.consumable.consume(s,{name:!0});for(const[l,g]of r)a.consumable.consume(l,{attributes:Object.keys(g)});r.size&&a.writer.setAttribute("sources",Array.from(r.values()),c),a.convertChildren(s,c)};return i=>{i.on("element:picture",t)}}function le(o,e){const t=(i,n,a)=>{if(!a.consumable.consume(n.item,i.name))return;const s=a.writer,r=a.mapper.toViewElement(n.item),m=o.findViewImgElement(r);n.attributeNewValue===null?(s.removeAttribute("srcset",m),s.removeAttribute("sizes",m)):n.attributeNewValue&&(s.setAttribute("srcset",n.attributeNewValue,m),s.setAttribute("sizes","100vw",m))};return i=>{i.on(`attribute:srcset:${e}`,t)}}function rt(o){const e=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const a=n.writer,s=n.mapper.toViewElement(i.item),r=o.findViewImgElement(s),m=i.attributeNewValue;if(m&&m.length){const c=[];let l=r.parent;for(;l&&l.is("attributeElement");){const d=l.parent;a.unwrap(a.createRangeOn(r),l),c.unshift(l),l=d}const g=r.parent.is("element","picture"),u=g?r.parent:a.createContainerElement("picture",null);g||a.insert(a.createPositionBefore(r),u),a.remove(a.createRangeIn(u)),a.insert(a.createPositionAt(u,"end"),m.map(d=>a.createEmptyElement("source",d))),a.move(a.createRangeOn(r),a.createPositionAt(u,"end"));for(const d of c)a.wrap(a.createRangeOn(u),d)}else if(r.parent.is("element","picture")){const c=r.parent;a.move(a.createRangeOn(r),a.createPositionBefore(c)),a.remove(c)}};return t=>{t.on("attribute:sources:imageBlock",e),t.on("attribute:sources:imageInline",e)}}function O(o,e,t){const i=(n,a,s)=>{if(!s.consumable.consume(a.item,n.name))return;const r=s.writer,m=s.mapper.toViewElement(a.item),c=o.findViewImgElement(m);r.setAttribute(a.attributeKey,a.attributeNewValue||"",c)};return n=>{n.on(`attribute:${t}:${e}`,i)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class H extends ui{observe(e){this.listenTo(e,"load",(t,i)=>{const n=i.target;this.checkShouldIgnoreEventFromTarget(n)||n.tagName=="IMG"&&this._fireEvents(i)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class lt extends S{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&T("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&T("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=Oe(e.source),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),a=Object.fromEntries(i.getAttributes());t.forEach((s,r)=>{const m=i.getSelectedElement();if(typeof s=="string"&&(s={src:s}),r&&m&&n.isImage(m)){const c=this.editor.model.createPositionAfter(m);n.insertImage({...s,...a},c,e.imageType)}else e.breakBlock?n.insertImage({...s,...a},i.getFirstPosition(),e.imageType):n.insertImage({...s,...a},null,e.imageType)})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ct extends S{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(i),this.value=this.isEnabled?i.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change(n=>{n.setAttribute("src",e.source,t),this.cleanupImage(n,t),i.setImageNaturalSizeAttributes(t)})}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class G extends f{static get requires(){return[I]}static get pluginName(){return"ImageEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(H),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new lt(e),n=new ct(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",n),e.commands.add("imageInsert",i)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ce extends f{static get requires(){return[I]}static get pluginName(){return"ImageSizeAttributes"}static get isOfficialPlugin(){return!0}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n=e==="imageBlock"?"figure":"img";t.conversion.for("upcast").attributeToAttribute({view:{name:n,styles:{width:/.+/}},model:{key:"width",value:s=>V(s)?B(s.getStyle("width")):null}}).attributeToAttribute({view:{name:n,key:"width"},model:"width"}).attributeToAttribute({view:{name:n,styles:{height:/.+/}},model:{key:"height",value:s=>V(s)?B(s.getStyle("height")):null}}).attributeToAttribute({view:{name:n,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(s=>{a(s,"width","width",!0,!0),a(s,"height","height",!0,!0)}),t.conversion.for("dataDowncast").add(s=>{a(s,"width","width",!1),a(s,"height","height",!1)}),t.conversion.for("upcast").add(s=>{s.on("element:img",(r,m,c)=>{const l=m.viewItem.getAttribute("width"),g=m.viewItem.getAttribute("height");l&&g&&c.consumable.consume(m.viewItem,{styles:["aspect-ratio"]})})});function a(s,r,m,c,l=!1){s.on(`attribute:${r}:${e}`,(g,u,d)=>{if(!d.consumable.consume(u.item,g.name))return;const h=d.writer,p=d.mapper.toViewElement(u.item),w=i.findViewImgElement(p);u.attributeNewValue!==null?h.setAttribute(m,u.attributeNewValue,w):h.removeAttribute(m,w);const b=u.item.getAttribute("width"),k=u.item.getAttribute("height"),y=b&&k;if(y&&l&&h.setAttribute("loading","lazy",w),u.item.hasAttribute("sources"))return;const E=u.item.hasAttribute("resizedWidth");e==="imageInline"&&!E&&!c||y&&h.setStyle("aspect-ratio",`${b}/${k}`,w)})}}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class me extends S{_modelElementName;constructor(e,t){super(e),this._modelElementName=t}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(i):this.isEnabled=t.isBlockImage(i)}execute(e={}){const t=this.editor,i=this.editor.model,n=t.plugins.get("ImageUtils"),a=n.getClosestSelectedImageElement(i.document.selection),s=Object.fromEntries(a.getAttributes());return!s.src&&!s.uploadId?null:i.change(r=>{const{setImageSizes:m=!0}=e,c=Array.from(i.markers).filter(u=>u.getRange().containsItem(a)),l=n.insertImage(s,i.createSelection(a,"on"),this._modelElementName,{setImageSizes:m});if(!l)return null;const g=r.createRangeOn(l);for(const u of c){const d=u.getRange(),h=d.root.rootName!="$graveyard"?d.getJoined(g,!0):g;r.updateMarker(u,{range:h})}return{oldElement:a,newElement:l}})}}_(".ck.ck-editor__editable img.image_placeholder{background-size:100% 100%}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ge extends f{static get requires(){return[I]}static get pluginName(){return"ImagePlaceholder"}static get isOfficialPlugin(){return!0}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add(n=>{n.on("attribute:placeholder",(a,s,r)=>{if(!r.consumable.test(s.item,a.name)||!s.item.is("element","imageBlock")&&!s.item.is("element","imageInline"))return;r.consumable.consume(s.item,a.name);const m=r.writer,c=r.mapper.toViewElement(s.item),l=i.findViewImgElement(c);s.attributeNewValue?(m.addClass("image_placeholder",l),m.setStyle("background-image",`url(${s.attributeNewValue})`,l),m.setCustomProperty("editingPipeline:doNotReuseOnce",!0,l)):(m.removeClass("image_placeholder",l),m.removeStyle("background-image",l))})})}_setupLoadListener(){const e=this.editor,t=e.model,i=e.editing,n=i.view,a=e.plugins.get("ImageUtils");n.addObserver(H),this.listenTo(n.document,"imageLoaded",(s,r)=>{const m=n.domConverter.mapDomToView(r.target);if(!m)return;const c=a.getImageWidgetFromImageView(m);if(!c)return;const l=i.mapper.toModelElement(c);!l||!l.hasAttribute("placeholder")||t.enqueueChange({isUndoable:!1},g=>{g.removeAttribute("placeholder",l)})})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ue extends f{static get requires(){return[G,ce,I,ge,K]}static get pluginName(){return"ImageBlockEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new me(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(a,{writer:s})=>se(s)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(a,{writer:s})=>n.toImageWidget(se(s),s,t("image widget"))}),i.for("downcast").add(O(n,"imageBlock","src")).add(O(n,"imageBlock","alt")).add(le(n,"imageBlock")),i.for("upcast").elementToElement({view:ae(e,"imageBlock"),model:(a,{writer:s})=>s.createElement("imageBlock",a.hasAttribute("src")?{src:a.getAttribute("src")}:void 0)}).add(st(n))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),a=e.plugins.get("ClipboardPipeline");this.listenTo(a,"inputTransformation",(s,r)=>{const m=Array.from(r.content.getChildren());let c;if(!m.every(n.isInlineImageView))return;r.targetRanges?c=e.editing.mapper.toModelRange(r.targetRanges[0]):c=t.document.selection.getFirstRange();const l=t.createSelection(c);if(W(t.schema,l)==="imageBlock"){const g=new X(i.document),u=m.map(d=>g.createElement("figure",{class:"image"},d));r.content=g.createDocumentFragment(u)}}),this.listenTo(a,"contentInsertion",(s,r)=>{r.method==="paste"&&t.change(m=>{const c=m.createRangeIn(r.content);for(const l of c.getItems())l.is("element","imageBlock")&&n.setImageNaturalSizeAttributes(l)})})}}_(".ck.ck-image-insert-url{padding:var(--ck-spacing-large) var(--ck-spacing-large) 0;width:400px}.ck.ck-image-insert-url .ck-image-insert-url__action-row{display:grid;grid-template-columns:repeat(2,1fr)}:root{--ck-image-insert-insert-by-url-width:250px}.ck.ck-image-insert-url{--ck-input-width:100%}.ck.ck-image-insert-url .ck-image-insert-url__action-row{grid-column-gap:var(--ck-spacing-large);margin-top:var(--ck-spacing-large)}.ck.ck-image-insert-url .ck-image-insert-url__action-row .ck-button-cancel,.ck.ck-image-insert-url .ck-image-insert-url__action-row .ck-button-save{justify-content:center;min-width:auto}.ck.ck-image-insert-url .ck-image-insert-url__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}.ck.ck-image-insert-form>.ck.ck-button{display:block;width:100%}[dir=ltr] .ck.ck-image-insert-form>.ck.ck-button{text-align:left}[dir=rtl] .ck.ck-image-insert-form>.ck.ck-button{text-align:right}.ck.ck-image-insert-form>.ck.ck-collapsible{min-width:var(--ck-image-insert-insert-by-url-width)}.ck.ck-image-insert-form>.ck.ck-collapsible:not(:first-child){border-top:1px solid var(--ck-color-base-border)}.ck.ck-image-insert-form>.ck.ck-collapsible:not(:last-child){border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-image-insert-form>.ck.ck-image-insert-url{min-width:var(--ck-image-insert-insert-by-url-width);padding:var(--ck-spacing-large)}.ck.ck-image-insert-form:focus{outline:none}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class mt extends L{focusTracker;keystrokes;_focusables;_focusCycler;children;constructor(e,t=[]){super(e),this.focusTracker=new Z,this.keystrokes=new D,this._focusables=new Q,this.children=this.createCollection(),this._focusCycler=new ee({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const i of t)this.children.add(i),this._focusables.add(i),i instanceof Ti&&this._focusables.addMany(i.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),M({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class U extends f{static get pluginName(){return"ImageInsertUI"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}dropdownView;_integrations=new Map;constructor(e){super(e),e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=i.isImage(t.getSelectedElement())});const n=s=>this._createToolbarComponent(s),a=s=>this._createMenuBarComponent(s);e.ui.componentFactory.add("insertImage",n),e.ui.componentFactory.add("imageInsert",n),e.ui.componentFactory.add("menuBar:insertImage",a)}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:n,menuBarButtonViewCreator:a,requiresForm:s=!1,override:r=!1}){this._integrations.has(e)&&!r&&T("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,menuBarButtonViewCreator:a,formViewCreator:n,requiresForm:s})}_createToolbarComponent(e){const t=this.editor,i=e.t,n=this._prepareIntegrations();if(!n.length)return null;let a;const s=n[0];if(n.length==1){if(!s.requiresForm)return s.buttonViewCreator(!0);a=s.buttonViewCreator(!0)}else{const c=s.buttonViewCreator(!1);a=new We(e,c),a.tooltip=!0,a.bind("label").to(this,"isImageSelected",l=>i(l?"Replace image":"Insert image"))}const r=this.dropdownView=ie(e,a),m=n.map(({observable:c})=>typeof c=="function"?c():c);return r.bind("isEnabled").toMany(m,"isEnabled",(...c)=>c.some(l=>l)),r.once("change:isOpen",()=>{const c=n.flatMap(({formViewCreator:g})=>g(n.length==1)),l=new mt(t.locale,c);r.panelView.children.add(l)}),r}_createMenuBarComponent(e){const t=e.t,i=this._prepareIntegrations();if(!i.length)return null;const n=i.flatMap(({menuBarButtonViewCreator:r})=>r(i.length==1)),a=new Ai(e),s=new Ui(e);a.panelView.children.add(s),a.buttonView.set({icon:ji,label:t("Image")});for(const r of n){const m=new xi(e,a);m.children.add(r),s.items.add(m),r.delegate("execute").to(a)}return a}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),i=[];if(!t.length)return T("image-insert-integrations-not-specified"),i;for(const n of t){if(!this._integrations.has(n)){["upload","assetManager","url"].includes(n)||T("image-insert-unknown-integration",{item:n});continue}i.push(this._integrations.get(n))}return i.length||T("image-insert-integrations-not-registered"),i}}_(".ck-content .image{clear:both;display:table;margin:.9em auto;min-width:50px;text-align:center}.ck-content .image img{display:block;height:auto;margin:0 auto;max-width:100%;min-width:100%}.ck-content .image-inline{align-items:flex-start;display:inline-flex;max-width:100%}.ck-content .image-inline picture{display:flex}.ck-content .image-inline img,.ck-content .image-inline picture{flex-grow:1;flex-shrink:1;max-width:100%}.ck.ck-editor__editable .image>figcaption.ck-placeholder:before{overflow:hidden;padding-left:inherit;padding-right:inherit;text-overflow:ellipsis;white-space:nowrap}.ck.ck-editor__editable .image{z-index:1}.ck.ck-editor__editable .image.ck-widget_selected{z-index:2}.ck.ck-editor__editable .image-inline{z-index:1}.ck.ck-editor__editable .image-inline.ck-widget_selected{z-index:2}.ck.ck-editor__editable .image-inline.ck-widget_selected ::selection{display:none}.ck.ck-editor__editable .image-inline img{height:auto}.ck.ck-editor__editable td .image-inline img,.ck.ck-editor__editable th .image-inline img{max-width:none}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class gt extends f{static get requires(){return[ue,ze,re,U]}static get pluginName(){return"ImageBlock"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ut extends f{static get requires(){return[G,ce,I,ge,K]}static get pluginName(){return"ImageInlineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new me(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(a,{writer:s})=>s.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(a,{writer:s})=>n.toImageWidget(Ye(s),s,t("image widget"))}),i.for("downcast").add(O(n,"imageInline","src")).add(O(n,"imageInline","alt")).add(le(n,"imageInline")),i.for("upcast").elementToElement({view:ae(e,"imageInline"),model:(a,{writer:s})=>s.createElement("imageInline",a.hasAttribute("src")?{src:a.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),a=e.plugins.get("ClipboardPipeline");this.listenTo(a,"inputTransformation",(s,r)=>{const m=Array.from(r.content.getChildren());let c;if(!m.every(n.isBlockImageView))return;r.targetRanges?c=e.editing.mapper.toModelRange(r.targetRanges[0]):c=t.document.selection.getFirstRange();const l=t.createSelection(c);if(W(t.schema,l)==="imageInline"){const g=new X(i.document),u=m.map(d=>d.childCount===1?(Array.from(d.getAttributes()).forEach(h=>g.setAttribute(...h,n.findViewImgElement(d))),d.getChild(0)):d);r.content=g.createDocumentFragment(u)}}),this.listenTo(a,"contentInsertion",(s,r)=>{r.method==="paste"&&t.change(m=>{const c=m.createRangeIn(r.content);for(const l of c.getItems())l.is("element","imageInline")&&n.setImageNaturalSizeAttributes(l)})})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class dt extends f{static get requires(){return[ut,ze,re,U]}static get pluginName(){return"ImageInline"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class tn extends f{static get requires(){return[gt,dt]}static get pluginName(){return"Image"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class de extends f{static get pluginName(){return"ImageCaptionUtils"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return e.name=="figcaption"&&t.isBlockImageView(e.parent)?{name:!0}:null}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ht extends S{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(ue)){this.isEnabled=!1,this.value=!1;return}const n=e.model.document.selection,a=n.getSelectedElement();if(!a){const s=t.getCaptionFromModelSelection(n);this.isEnabled=!!s,this.value=!!s;return}this.isEnabled=i.isImage(a),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(a):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(i=>{this.value?this._hideImageCaption(i):this._showImageCaption(i,t)})}_showImageCaption(e,t){const n=this.editor.model.document.selection,a=this.editor.plugins.get("ImageCaptionEditing"),s=this.editor.plugins.get("ImageUtils");let r=n.getSelectedElement();const m=a._getSavedCaption(r);s.isInlineImage(r)&&(this.editor.execute("imageTypeBlock"),r=n.getSelectedElement());const c=m||e.createElement("caption");e.append(c,r),t&&e.setSelection(c,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,n=t.plugins.get("ImageCaptionEditing"),a=t.plugins.get("ImageCaptionUtils");let s=i.getSelectedElement(),r;s?r=a.getCaptionFromImageModelElement(s):(r=a.getCaptionFromModelSelection(i),s=r.parent),n._saveCaption(s,r),e.setSelection(s,"on"),e.remove(r)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ft extends f{static get requires(){return[I,de]}static get pluginName(){return"ImageCaptionEditing"}static get isOfficialPlugin(){return!0}_savedCaptionsMap;constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new ht(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),a=e.t;e.conversion.for("upcast").elementToElement({view:s=>n.matchImageCaptionViewElement(s),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(s,{writer:r})=>i.isBlockImage(s.parent)?r.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(s,{writer:r})=>{if(!i.isBlockImage(s.parent))return null;const m=r.createEditableElement("figcaption");r.setCustomProperty("imageCaption",!0,m),m.placeholder=a("Enter image caption"),di({view:t,element:m,keepOnFocus:!0});const c=s.parent.getAttribute("alt"),l=c?a("Caption for image: %0",[c]):a("Caption for the image");return Ci(m,r,{label:l})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),n=e.commands.get("imageTypeInline"),a=e.commands.get("imageTypeBlock"),s=r=>{if(!r.return)return;const{oldElement:m,newElement:c}=r.return;/* istanbul ignore if: paranoid check -- @preserve */if(!m)return;if(t.isBlockImage(m)){const g=i.getCaptionFromImageModelElement(m);if(g){this._saveCaption(c,g);return}}const l=this._getSavedCaption(m);l&&this._saveCaption(c,l)};n&&this.listenTo(n,"execute",s,{priority:"low"}),a&&this.listenTo(a,"execute",s,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?hi.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const a=t.document.differ.getChanges();for(const s of a){if(s.attributeKey!=="alt")continue;const r=s.range.start.nodeAfter;if(i.isBlockImage(r)){const m=n.getCaptionFromImageModelElement(r);if(!m)return;e.editing.reconvertItem(m)}}})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class pt extends f{static get requires(){return[de]}static get pluginName(){return"ImageCaptionUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),n=e.t;e.ui.componentFactory.add("toggleImageCaption",a=>{const s=e.commands.get("toggleImageCaption"),r=new v(a);return r.set({icon:Di,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),r.bind("label").to(s,"value",m=>n(m?"Toggle caption off":"Toggle caption on")),this.listenTo(r,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const m=i.getCaptionFromModelSelection(e.model.document.selection);if(m){const c=e.editing.mapper.toViewElement(m);t.scrollToTheSelection(),t.change(l=>{l.addClass("image__caption_highlighted",c)})}e.editing.view.focus()}),r})}}_(":root{--ck-content-color-image-caption-background:#f7f7f7;--ck-content-color-image-caption-text:#333;--ck-color-image-caption-highlighted-background:#fd0}.ck-content .image>figcaption{background-color:var(--ck-content-color-image-caption-background);break-before:avoid;caption-side:bottom;color:var(--ck-content-color-image-caption-text);display:table-caption;font-size:.75em;outline-offset:-1px;overflow-wrap:anywhere;padding:.6em;word-break:normal}@media (forced-colors:active){.ck-content .image>figcaption{background-color:unset;color:unset}}@media (forced-colors:none){.ck.ck-editor__editable .image>figcaption.image__caption_highlighted{animation:ck-image-caption-highlight .6s ease-out}}@media (prefers-reduced-motion:reduce){.ck.ck-editor__editable .image>figcaption.image__caption_highlighted{animation:none}}@keyframes ck-image-caption-highlight{0%{background-color:var(--ck-color-image-caption-highlighted-background)}to{background-color:var(--ck-content-color-image-caption-background)}}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class nn extends f{static get requires(){return[ft,pt]}static get pluginName(){return"ImageCaption"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function he(o){const e=o.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function bt(o){return new Promise((e,t)=>{const i=o.getAttribute("src");fetch(i).then(n=>n.blob()).then(n=>{const a=kt(n,i),r=`image.${a.replace("image/","")}`,m=new File([n],r,{type:a});e(m)}).catch(n=>n&&n.name==="TypeError"?on(i).then(e).catch(t):t(n))})}function It(o,e){return!o.isInlineImageView(e)||!e.getAttribute("src")?!1:!!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!e.getAttribute("src").match(/^blob:/g)}function kt(o,e){return o.type?o.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function on(o){return sn(o).then(e=>{const t=kt(e,o),n=`image.${t.replace("image/","")}`;return new File([e],n,{type:t})})}function sn(o){return new Promise((e,t)=>{const i=j.document.createElement("img");i.addEventListener("load",()=>{const n=j.document.createElement("canvas");n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0),n.toBlob(s=>s?e(s):t())}),i.addEventListener("error",()=>t()),i.src=o})}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class wt extends f{static get pluginName(){return"ImageUploadUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("uploadImage",()=>this._createToolbarButton()),e.ui.componentFactory.add("imageUpload",()=>this._createToolbarButton()),e.ui.componentFactory.add("menuBar:uploadImage",()=>this._createMenuBarButton("standalone")),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:t=>this._createMenuBarButton(t?"insertOnly":"insertNested")})}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("uploadImage"),a=t.config.get("image.upload.types"),s=he(a),r=new e(t.locale),m=i.t;return r.set({acceptedType:a.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:m("Upload from computer"),icon:Li}),r.bind("isEnabled").to(n),r.on("done",(c,l)=>{const g=Array.from(l).filter(u=>s.test(u.type));g.length&&(t.execute("uploadImage",{file:g}),t.editing.view.focus())}),r}_createToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this.editor.commands.get("uploadImage"),n=this._createButton(qe);return n.tooltip=!0,n.bind("label").to(t,"isImageSelected",i,"isAccessAllowed",(a,s)=>e(s?a?"Replace image from computer":"Upload image from computer":"You have no image upload permissions.")),n}_createDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(qe);return i.withText=!0,i.bind("label").to(t,"isImageSelected",n=>e(n?"Replace from computer":"Upload from computer")),i.on("execute",()=>{t.dropdownView.isOpen=!1}),i}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createButton(Bi);switch(i.withText=!0,e){case"standalone":i.label=t("Image from computer");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("From computer");break}return i}}_(".ck.ck-editor__editable .image,.ck.ck-editor__editable .image-inline{position:relative}.ck.ck-editor__editable .image .ck-progress-bar,.ck.ck-editor__editable .image-inline .ck-progress-bar{left:0;position:absolute;top:0}.ck.ck-editor__editable .image-inline.ck-appear,.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}@media (prefers-reduced-motion:reduce){.ck.ck-editor__editable .image-inline.ck-appear,.ck.ck-editor__editable .image.ck-appear{animation:none;opacity:1}}.ck.ck-editor__editable .image .ck-progress-bar,.ck.ck-editor__editable .image-inline .ck-progress-bar{background:var(--ck-color-upload-bar-background);height:2px;transition:width .1s;width:0}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"),_('.ck-image-upload-complete-icon{border-radius:50%;display:block;position:absolute;right:min(var(--ck-spacing-medium),6%);top:min(var(--ck-spacing-medium),6%);z-index:1}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20;--ck-image-upload-icon-width:2px;--ck-image-upload-icon-is-visible:clamp(0px,100% - 50px,1px)}.ck-image-upload-complete-icon{animation-delay:0s,3s;animation-duration:.5s,.5s;animation-fill-mode:forwards,forwards;animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;background:var(--ck-color-image-upload-icon-background);font-size:calc(1px*var(--ck-image-upload-icon-size));height:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size));opacity:0;overflow:hidden;width:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size))}.ck-image-upload-complete-icon:after{animation-delay:.5s;animation-duration:.5s;animation-fill-mode:forwards;animation-name:ck-upload-complete-icon-check;border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);box-sizing:border-box;height:0;left:25%;opacity:0;top:50%;transform:scaleX(-1) rotate(135deg);transform-origin:left top;width:0}@media (prefers-reduced-motion:reduce){.ck-image-upload-complete-icon{animation-duration:0s}.ck-image-upload-complete-icon:after{animation:none;height:.45em;opacity:1;width:.3em}}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{height:0;opacity:1;width:0}33%{height:0;width:.3em}to{height:.45em;opacity:1;width:.3em}}'),_('.ck .ck-upload-placeholder-loader{align-items:center;display:flex;justify-content:center;left:0;position:absolute;top:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px;--ck-upload-placeholder-image-aspect-ratio:2.8}.ck .ck-image-upload-placeholder{margin:0;width:100%}.ck .ck-image-upload-placeholder.image-inline{width:calc(var(--ck-upload-placeholder-loader-size)*2*var(--ck-upload-placeholder-image-aspect-ratio))}.ck .ck-image-upload-placeholder img{aspect-ratio:var(--ck-upload-placeholder-image-aspect-ratio)}.ck .ck-upload-placeholder-loader{height:100%;width:100%}.ck .ck-upload-placeholder-loader:before{animation:ck-upload-placeholder-loader 1s linear infinite;border-radius:50%;border-right:2px solid transparent;border-top:3px solid var(--ck-color-upload-placeholder-loader);height:var(--ck-upload-placeholder-loader-size);width:var(--ck-upload-placeholder-loader-size)}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}');/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class _t extends f{static get pluginName(){return"ImageUploadProgress"}static get isOfficialPlugin(){return!0}placeholder;constructor(e){super(e),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}uploadStatusChange=(e,t,i)=>{const n=this.editor,a=t.item,s=a.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const r=n.plugins.get("ImageUtils"),m=n.plugins.get(A),c=s?t.attributeNewValue:null,l=this.placeholder,g=n.editing.mapper.toViewElement(a),u=i.writer;if(c=="reading"){yt(g,u),vt(r,l,g,u);return}if(c=="uploading"){const d=m.loaders.get(s);yt(g,u),d?(Et(g,u),rn(g,u,d,n.editing.view),un(r,g,u,d)):vt(r,l,g,u);return}c=="complete"&&m.loaders.get(s)&&cn(g,u,n.editing.view),ln(g,u),Et(g,u),an(g,u)}}function yt(o,e){o.hasClass("ck-appear")||e.addClass("ck-appear",o)}function an(o,e){e.removeClass("ck-appear",o)}function vt(o,e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);const n=o.findViewImgElement(t);n.getAttribute("src")!==e&&i.setAttribute("src",e,n),Ct(t,"placeholder")||i.insert(i.createPositionAfter(n),gn(i))}function Et(o,e){o.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",o),St(o,e,"placeholder")}function rn(o,e,t,i){const n=mn(e);e.insert(e.createPositionAt(o,"end"),n),t.on("change:uploadedPercent",(a,s,r)=>{i.change(m=>{m.setStyle("width",r+"%",n)})})}function ln(o,e){St(o,e,"progressBar")}function cn(o,e,t){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(o,"end"),i),setTimeout(()=>{t.change(n=>n.remove(n.createRangeOn(i)))},3e3)}function mn(o){const e=o.createUIElement("div",{class:"ck-progress-bar"});return o.setCustomProperty("progressBar",!0,e),e}function gn(o){const e=o.createUIElement("div",{class:"ck-upload-placeholder-loader"});return o.setCustomProperty("placeholder",!0,e),e}function Ct(o,e){for(const t of o.getChildren())if(t.getCustomProperty(e))return t}function St(o,e,t){const i=Ct(o,t);i&&e.remove(e.createRangeOn(i))}function un(o,e,t,i){if(i.data){const n=o.findViewImgElement(e);t.setAttribute("src",i.data,n)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Tt extends S{constructor(e){super(e),this.set("isAccessAllowed",!0)}refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=Oe(e.file),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),a=Object.fromEntries(i.getAttributes());t.forEach((s,r)=>{const m=i.getSelectedElement();if(r&&m&&n.isImage(m)){const c=this.editor.model.createPositionAfter(m);this._uploadImage(s,a,c)}else this._uploadImage(s,a)})}_uploadImage(e,t,i){const n=this.editor,s=n.plugins.get(A).createLoader(e),r=n.plugins.get("ImageUtils");s&&r.insertImage({...t,uploadId:s.id},i)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class At extends f{static get requires(){return[A,He,K,I]}static get pluginName(){return"ImageUploadEditing"}static get isOfficialPlugin(){return!0}_uploadImageElements;_uploadedImages=new Map;constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,n=e.plugins.get(A),a=e.plugins.get("ImageUtils"),s=e.plugins.get("ClipboardPipeline"),r=he(e.config.get("image.upload.types")),m=new Tt(e);e.commands.add("uploadImage",m),e.commands.add("imageUpload",m),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add(c=>c.on("element:img",(l,g,u)=>{if(!u.consumable.test(g.viewItem,{attributes:["data-ck-upload-id"]}))return;const d=g.viewItem.getAttribute("data-ck-upload-id");if(!d)return;const[h]=Array.from(g.modelRange.getItems({shallow:!0})),p=n.loaders.get(d);h&&(u.writer.setAttribute("uploadId",d,h),u.consumable.consume(g.viewItem,{attributes:["data-ck-upload-id"]}),p&&p.data&&u.writer.setAttribute("uploadStatus",p.status,h))},{priority:"low"})),this.listenTo(e.editing.view.document,"clipboardInput",(c,l)=>{if(Ut(l.dataTransfer))return;const g=Array.from(l.dataTransfer.files).filter(d=>d?r.test(d.type):!1);if(!g.length)return;if(c.stop(),e.model.change(d=>{l.targetRanges&&d.setSelection(l.targetRanges.map(h=>e.editing.mapper.toModelRange(h))),e.execute("uploadImage",{file:g})}),!e.commands.get("uploadImage").isAccessAllowed){const d=e.plugins.get("Notification"),h=e.locale.t;d.showWarning(h("You have no image upload permissions."),{namespace:"image"})}}),this.listenTo(s,"inputTransformation",(c,l)=>{const g=Array.from(e.editing.view.createRangeIn(l.content)).map(d=>d.item).filter(d=>It(a,d)&&!d.getAttribute("uploadProcessed")).map(d=>({promise:bt(d),imageElement:d}));if(!g.length)return;const u=new X(e.editing.view.document);for(const d of g){u.setAttribute("uploadProcessed",!0,d.imageElement);const h=n.createLoader(d.promise);h&&(u.setAttribute("src","",d.imageElement),u.setAttribute("uploadId",h.id,d.imageElement))}}),e.editing.view.document.on("dragover",(c,l)=>{l.preventDefault()}),t.on("change",()=>{const c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),l=new Set;for(const g of c)if(g.type=="insert"&&g.name!="$text"){const u=g.position.nodeAfter,d=g.position.root.rootName=="$graveyard";for(const h of dn(e,u)){const p=h.getAttribute("uploadId"),w=h.getAttribute("uploadStatus");if(!p||w=="complete")continue;const b=n.loaders.get(p);if(!b){!d&&this._uploadedImages.has(p)&&e.model.enqueueChange({isUndoable:!1},k=>{k.setAttribute("uploadStatus","complete",h),this.fire("uploadComplete",{data:this._uploadedImages.get(p),imageElement:h})});continue}d?l.has(p)||Array.from(this._uploadImageElements.get(p)).every(y=>y.root.rootName=="$graveyard")&&b.abort():(l.add(p),this._uploadImageElements.has(p)?this._uploadImageElements.get(p).add(h):this._uploadImageElements.set(p,new Set([h])),b.status=="idle"&&this._readAndUpload(b))}}}),this.on("uploadComplete",(c,{imageElement:l,data:g})=>{const u=g.urls?g.urls:g;this.editor.model.change(d=>{d.setAttribute("src",u.default,l),this._parseAndSetSrcsetAttributeOnImage(u,l,d),a.setImageNaturalSizeAttributes(l)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"))}_readAndUpload(e){const t=this.editor,i=t.model,n=t.locale.t,a=t.plugins.get(A),s=t.plugins.get(He),r=t.plugins.get("ImageUtils"),m=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},l=>{const g=m.get(e.id);for(const u of g)l.setAttribute("uploadStatus","reading",u)}),e.read().then(()=>{const l=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Uploading image"));for(const g of m.get(e.id)){/* istanbul ignore next -- @preserve */if(Ii.isSafari){const u=t.editing.mapper.toViewElement(g),d=r.findViewImgElement(u);t.editing.view.once("render",()=>{if(!d.parent)return;const h=t.editing.view.domConverter.mapViewToDom(d.parent);if(!h)return;const p=h.style.display;h.style.display="none",h._ckHack=h.offsetHeight,h.style.display=p})}i.enqueueChange({isUndoable:!1},u=>{u.setAttribute("uploadStatus","uploading",g)})}return l}).then(l=>{i.enqueueChange({isUndoable:!1},g=>{for(const u of m.get(e.id))g.setAttribute("uploadStatus","complete",u),this.fire("uploadComplete",{data:l,imageElement:u});t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Image upload complete")),this._uploadedImages.set(e.id,l)}),c()}).catch(l=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Error during image upload")),e.status!=="error"&&e.status!=="aborted")throw l;e.status=="error"&&l&&s.showWarning(l,{title:n("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},g=>{for(const u of m.get(e.id))u.root.rootName!=="$graveyard"&&g.remove(u)}),c()});function c(){i.enqueueChange({isUndoable:!1},l=>{for(const g of m.get(e.id))l.removeAttribute("uploadId",g),l.removeAttribute("uploadStatus",g);m.delete(e.id)}),a.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0;const a=Object.keys(e).filter(s=>{const r=parseInt(s,10);if(!isNaN(r))return n=Math.max(n,r),!0}).map(s=>`${e[s]} ${s}w`).join(", ");if(a!=""){const s={srcset:a};!t.hasAttribute("width")&&!t.hasAttribute("height")&&(s.width=n),i.setAttributes(s,t)}}_registerConverters(e){const{conversion:t,plugins:i}=this.editor,n=i.get(A),a=i.get(I);t.for("dataDowncast").add(s=>{s.on(`attribute:uploadId:${e}`,(r,m,c)=>{if(!c.consumable.test(m.item,r.name))return;const l=n.loaders.get(m.attributeNewValue);if(!l||!l.data)return null;const g=c.mapper.toViewElement(m.item),u=a.findViewImgElement(g);u&&(c.consumable.consume(m.item,r.name),c.writer.setAttribute("data-ck-upload-id",l.id,u))})})}}function Ut(o){return Array.from(o.types).includes("text/html")&&o.getData("text/html")!==""}function dn(o,e){const t=o.plugins.get("ImageUtils");return Array.from(o.model.createRangeOn(e)).filter(i=>t.isImage(i.item)).map(i=>i.item)}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class xt extends f{static get pluginName(){return"ImageUpload"}static get isOfficialPlugin(){return!0}static get requires(){return[At,wt,_t]}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Bt extends L{urlInputView;keystrokes;constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new D,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-url"],tabindex:"-1"},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),M({view:this}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){const e=this.locale,t=e.t,i=new te(e,je);return i.bind("label").to(this,"isImageSelected",n=>t(n?"Update image URL":"Insert image via URL")),i.bind("isEnabled").to(this),i.fieldView.inputMode="url",i.fieldView.placeholder="https://example.com/image.png",i.fieldView.bind("value").to(this,"imageURLInputValue",n=>n||""),i.fieldView.on("input",()=>{this.imageURLInputValue=i.fieldView.element.value.trim()}),i}focus(){this.urlInputView.focus()}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Vt extends f{_imageInsertUI;_formView;static get pluginName(){return"ImageInsertViaUrlUI"}static get isOfficialPlugin(){return!0}static get requires(){return[U,Vi]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",()=>this._createToolbarButton()),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",()=>this._createMenuBarButton("standalone"))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon=Mi,t.on("execute",()=>{this._showModal()}),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(v);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",i=>e(i?"Update image URL":"Insert image via URL")),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(v);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",i=>e(i?"Update image URL":"Insert via URL")),t}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createInsertUrlButton(Oi);switch(i.withText=!0,e){case"standalone":i.label=t("Image via URL");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("Via URL");break}return i}_createInsertUrlView(){const e=this.editor,t=e.locale,i=e.commands.get("replaceImageSource"),n=e.commands.get("insertImage"),a=new Bt(t);return a.bind("isImageSelected").to(this._imageInsertUI),a.bind("isEnabled").toMany([n,i],"isEnabled",(...s)=>s.some(r=>r)),a}_showModal(){const e=this.editor,i=e.locale.t,n=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",()=>this._handleSave()));const a=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=a.value||"",n.show({id:"insertImageViaUrl",title:i("Image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:i("Cancel"),withText:!0,onExecute:()=>n.hide()},{label:this._imageInsertUI.isImageSelected?i("Save"):i("Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Ot extends f{static get pluginName(){return"ImageInsertViaUrl"}static get isOfficialPlugin(){return!0}static get requires(){return[Vt,U]}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class hn extends f{static get pluginName(){return"ImageInsert"}static get isOfficialPlugin(){return!0}static get requires(){return[xt,Ot,U]}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class zt extends S{refresh(){const e=this.editor,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!i,!i||!i.hasAttribute("resizedWidth")?this.value=null:this.value={width:i.getAttribute("resizedWidth"),height:null}}execute(e){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils"),a=n.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},a&&i.change(s=>{s.setAttribute("resizedWidth",e.width,a),s.removeAttribute("resizedHeight",a),n.setImageNaturalSizeAttributes(a)})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class fe extends f{static get requires(){return[I]}static get pluginName(){return"ImageResizeEditing"}static get licenseFeatureCode(){return"IR"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.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 e=this.editor,t=new zt(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),e.setAttributeProperties("resizedWidth",{isFormatting:!0}),e.setAttributeProperties("resizedHeight",{isFormatting:!0})),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]}),e.setAttributeProperties("resizedWidth",{isFormatting:!0}),e.setAttributeProperties("resizedHeight",{isFormatting:!0}))}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add(n=>n.on(`attribute:resizedWidth:${e}`,(a,s,r)=>{if(!r.consumable.consume(s.item,a.name))return;const m=r.writer,c=r.mapper.toViewElement(s.item);s.attributeNewValue!==null?(m.setStyle("width",s.attributeNewValue,c),m.addClass("image_resized",c)):(m.removeStyle("width",c),m.removeClass("image_resized",c))})),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:n=>({key:"style",value:{height:n}})}),t.conversion.for("editingDowncast").add(n=>n.on(`attribute:resizedHeight:${e}`,(a,s,r)=>{if(!r.consumable.consume(s.item,a.name))return;const m=r.writer,c=r.mapper.toViewElement(s.item),l=e==="imageInline"?i.findViewImgElement(c):c;s.attributeNewValue!==null?m.setStyle("height",s.attributeNewValue,l):m.removeStyle("height",l)})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:n=>V(n)?null:n.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:n=>V(n)?null:n.getStyle("height")}}),t.conversion.for("upcast").add(n=>{n.on(`element:${e==="imageBlock"?"figure":"img"}`,(a,s,r)=>{r.consumable.consume(s.viewItem,{classes:["image_resized"]})})})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/const pe={small:$i,medium:Gi,large:Hi,custom:qi,original:Wi};class Pt extends f{static get requires(){return[fe]}static get pluginName(){return"ImageResizeButtons"}static get isOfficialPlugin(){return!0}_resizeUnit;constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const n of t)this._registerImageResizeButton(n);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:n,icon:a}=e;t.ui.componentFactory.add(i,s=>{const r=new v(s),m=t.commands.get("resizeImage"),c=this._getOptionLabelValue(e,!0);if(!pe[a])throw new ki("imageresizebuttons-missing-icon",t,e);if(r.set({label:c,icon:pe[a],tooltip:c,isToggleable:!0}),r.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&z(e)){const l=t.plugins.get("ImageCustomResizeUI");this.listenTo(r,"execute",()=>{l._showForm(this._resizeUnit)})}else{const l=n?n+this._resizeUnit:null;r.bind("isOn").to(m,"value",m,"isEnabled",be(l)),this.listenTo(r,"execute",()=>{t.execute("resizeImage",{width:l})})}return r})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,n=e.find(s=>!s.value),a=s=>{const r=t.commands.get("resizeImage"),m=ie(s,zi),c=m.buttonView,l=i("Resize image");return c.set({tooltip:l,commandValue:n.value,icon:pe.medium,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button",ariaLabel:l,ariaLabelledBy:void 0}),c.bind("label").to(r,"value",g=>g&&g.width?g.width:this._getOptionLabelValue(n)),m.bind("isEnabled").to(this),Pi(m,()=>this._getResizeDropdownListItemDefinitions(e,r),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(m,"execute",g=>{"onClick"in g.source?g.source.onClick():(t.execute(g.source.commandName,{width:g.source.commandValue}),t.editing.view.focus())}),m};t.ui.componentFactory.add("resizeImage",a),t.ui.componentFactory.add("imageResize",a)}_getOptionLabelValue(e,t=!1){const i=this.editor.t;return e.label?e.label:t?z(e)?i("Custom image size"):e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):z(e)?i("Custom"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const{editor:i}=this,n=new wi,a=e.map(s=>z(s)?{...s,valueWithUnits:"custom"}:s.value?{...s,valueWithUnits:`${s.value}${this._resizeUnit}`}:{...s,valueWithUnits:null});for(const s of a){let r=null;if(i.plugins.has("ImageCustomResizeUI")&&z(s)){const m=i.plugins.get("ImageCustomResizeUI");r={type:"button",model:new Ge({label:this._getOptionLabelValue(s),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{m._showForm(this._resizeUnit)}})};const c=Object.values(a).map(l=>l.valueWithUnits);r.model.bind("isOn").to(t,"value",t,"isEnabled",fn(c))}else r={type:"button",model:new Ge({commandName:"resizeImage",commandValue:s.valueWithUnits,label:this._getOptionLabelValue(s),role:"menuitemradio",withText:!0,icon:null})},r.model.bind("isOn").to(t,"value",t,"isEnabled",be(s.valueWithUnits));r.model.bind("isEnabled").to(t,"isEnabled"),n.add(r)}return n}}function z(o){return o.value==="custom"}function be(o){return(e,t)=>{const i=e;return i===void 0||!t?!1:o===null&&i===o?!0:i!==null&&i.width===o}}function fn(o){return(e,t)=>!o.some(i=>be(i)(e,t))}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/const pn="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",Ie="image_resized";class Rt extends f{static get requires(){return[Y,I]}static get pluginName(){return"ImageResizeHandles"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(H),this.listenTo(t.document,"imageLoaded",(n,a)=>{if(!a.target.matches(pn))return;const s=e.editing.view.domConverter,r=s.domToView(a.target),m=i.getImageWidgetFromImageView(r);let c=this.editor.plugins.get(Y).getResizerByViewElement(m);if(c){c.redraw();return}const l=e.editing.mapper,g=l.toModelElement(m);c=e.plugins.get(Y).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:g,viewElement:m,editor:e,getHandleHost(u){return u.querySelector("img")},getResizeHost(){return s.mapViewToDom(l.toViewElement(g))},isCentered(){return g.getAttribute("imageStyle")=="alignCenter"},onCommit(u){t.change(d=>{d.removeClass(Ie,m)}),e.execute("resizeImage",{width:u})}}),c.on("updateSize",()=>{m.hasClass(Ie)||t.change(d=>{d.addClass(Ie,m)});const u=g.name==="imageInline"?r:m;u.getStyle("height")&&t.change(d=>{d.removeStyle("height",u)})}),c.bind("isEnabled").to(this)})}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function ke(o){if(!o)return null;const[,e,t]=o.trim().match(/([.,\d]+)(%|px)$/)||[],i=Number.parseFloat(e);return Number.isNaN(i)?null:{value:i,unit:t}}function we(o,e,t){return t==="px"?{value:e.value,unit:"px"}:{value:e.value/o*100,unit:"%"}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function _e(o){const{editing:e}=o,i=o.plugins.get("ImageUtils").getClosestSelectedImageElement(o.model.document.selection);if(!i)return null;const n=e.mapper.toViewElement(i),a=e.view.domConverter.mapViewToDom(n);return{model:i,view:n,dom:a}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function Nt(o,e){const t=_e(o);if(!t)return null;const i=ke(t.model.getAttribute("resizedWidth")||null);if(!i)return null;if(i.unit===e)return i;const n=Pe(t.dom),a={value:new _i(t.dom).width};return we(n,a,e)}_(":root{--ck-image-custom-resize-form-width:340px}@media screen and (max-width:600px){:root{--ck-image-custom-resize-form-width:300px}}.ck.ck-image-custom-resize-form.ck-responsive-form{width:var(--ck-image-custom-resize-form-width)}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Ft extends L{focusTracker;keystrokes;unit;backButtonView;saveButtonView;labeledInput;children;_focusables;_focusCycler;_validators;constructor(e,t,i){super(e),this.focusTracker=new Z,this.keystrokes=new D,this.unit=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new Ne(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new Q,this._validators=i,this.keystrokes.set("Esc",(n,a)=>{this.fire("cancel"),a()}),this._focusCycler=new ee({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),M({view:this}),[this.backButtonView,this.labeledInput,this.saveButtonView].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()}_createBackButton(){const e=this.locale.t,t=new v(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:$e,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new v(this.locale);return t.set({label:e("Save"),withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Fe(this.locale,{label:e("Image Resize")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){const e=this.locale.t,t=new te(this.locale,Ri);return t.label=e("Resize image (in %0)",this.unit),t.class="ck-labeled-field-view_full-width",t.fieldView.set({step:.1}),t}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){const{rawSize:e}=this;if(e===null)return null;const t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){const{parsedSize:e,unit:t}=this;return e===null?null:`${e}${t}`}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function jt(o,e){const t=_e(o);if(!t)return null;const i=Pe(t.dom),n=ke(window.getComputedStyle(t.dom).minWidth)||{value:1},a=Math.max(.1,we(i,n,e).value);return{unit:e,lower:a,upper:e==="px"?i:100}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Dt extends f{_balloon;_form;static get requires(){return[De]}static get pluginName(){return"ImageCustomResizeUI"}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){const t=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Le(Ft))(t.locale,e,bn(t)),this._form.render(),this.listenTo(this._form,"submit",()=>{this._form.isValid()&&(t.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))}),this.listenTo(this._form.labeledInput,"change:errorText",()=>{t.ui.update()}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),Me({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(e){if(this._isVisible)return;this._form||this._createForm(e);const t=this.editor,i=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:q(t)});const n=Nt(t,e),a=n?n.value.toFixed(1):"",s=jt(t,e);i.fieldView.value=i.fieldView.element.value=a,s&&Object.assign(i.fieldView,{min:s.lower.toFixed(1),max:Math.ceil(s.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}function bn(o){const e=o.t;return[t=>{if(t.rawSize.trim()==="")return e("The value must not be empty.");if(t.parsedSize===null)return e("The value should be a plain number.")}]}_(".ck-content img.image_resized{height:auto}.ck-content .image.image_resized{box-sizing:border-box;display:block;max-width:100%}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}.ck.ck-editor__editable td .image-inline.image_resized img,.ck.ck-editor__editable th .image-inline.image_resized img{max-width:100%}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class In extends f{static get requires(){return[fe,Rt,Dt,Pt]}static get pluginName(){return"ImageResize"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Lt extends S{_defaultStyles;_styles;constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(const n of i.modelElements)this._defaultStyles[n]=i.name;return[i.name,i]}))}refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled?i.hasAttribute("imageStyle")?this.value=i.getAttribute("imageStyle"):this.value=this._defaultStyles[i.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils");i.change(a=>{const s=e.value,{setImageSizes:r=!0}=e;let m=n.getClosestSelectedImageElement(i.document.selection);s&&this.shouldConvertImageType(s,m)&&(this.editor.execute(n.isBlockImage(m)?"imageTypeInline":"imageTypeBlock",{setImageSizes:r}),m=n.getClosestSelectedImageElement(i.document.selection)),!s||this._styles.get(s).isDefault?a.removeAttribute("imageStyle",m):a.setAttribute("imageStyle",s,m),r&&n.setImageNaturalSizeAttributes(m)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/const P={get inline(){return{name:"inline",title:"In line",icon:Ke,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Je,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Ze,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:oe,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:ne,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Xe,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:oe,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:ne,modelElements:["imageBlock"],className:"image-style-side"}}},Mt={full:Ki,left:Ze,right:Xe,center:oe,inlineLeft:Je,inlineRight:ne,inline:Ke},Wt=[{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 kn(o){return(o.configuredStyles.options||[]).map(i=>yn(i)).filter(i=>vn(i,o))}function wn(o,e){return o&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:o?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function _n(o){return o.has("ImageBlockEditing")&&o.has("ImageInlineEditing")?[...Wt]:[]}function yn(o){return typeof o=="string"?P[o]?o={...P[o]}:o={name:o}:o=En(P[o.name],o),typeof o.icon=="string"&&(o.icon=Mt[o.icon]||o.icon),o}function vn(o,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){const{modelElements:i,name:n}=o;if(!i||!i.length||!n)return qt({style:o}),!1;{const a=[e?"imageBlock":null,t?"imageInline":null];if(!i.some(s=>a.includes(s)))return T("image-style-missing-dependency",{style:o,missingPlugins:i.map(s=>s==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function En(o,e){const t={...e};for(const i in o)Object.prototype.hasOwnProperty.call(e,i)||(t[i]=o[i]);return t}function qt(o){T("image-style-configuration-definition-invalid",o)}const R={normalizeStyles:kn,getDefaultStylesConfiguration:wn,getDefaultDropdownDefinitions:_n,warnInvalidStyle:qt};function Cn(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var ye={},ve={},Ee={},Ht;function Sn(){return Ht||(Ht=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});function e(t){if(!t||typeof t!="object")return!1;const i=Object.getPrototypeOf(t);return i===null||i===Object.prototype||Object.getPrototypeOf(i)===null?Object.prototype.toString.call(t)==="[object Object]":!1}o.isPlainObject=e}(Ee)),Ee}var Ce={},Gt;function Tn(){return Gt||(Gt=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});function e(t){return Object.getOwnPropertySymbols(t).filter(i=>Object.prototype.propertyIsEnumerable.call(t,i))}o.getSymbols=e}(Ce)),Ce}var Se={},$t;function An(){return $t||($t=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});function e(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}o.getTag=e}(Se)),Se}var Te={},Kt;function Un(){return Kt||(Kt=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});const e="[object RegExp]",t="[object String]",i="[object Number]",n="[object Boolean]",a="[object Arguments]",s="[object Symbol]",r="[object Date]",m="[object Map]",c="[object Set]",l="[object Array]",g="[object Function]",u="[object ArrayBuffer]",d="[object Object]",h="[object Error]",p="[object DataView]",w="[object Uint8Array]",b="[object Uint8ClampedArray]",k="[object Uint16Array]",y="[object Uint32Array]",E="[object BigUint64Array]",C="[object Int8Array]",x="[object Int16Array]",$="[object Int32Array]",ri="[object BigInt64Array]",li="[object Float32Array]",ci="[object Float64Array]";o.argumentsTag=a,o.arrayBufferTag=u,o.arrayTag=l,o.bigInt64ArrayTag=ri,o.bigUint64ArrayTag=E,o.booleanTag=n,o.dataViewTag=p,o.dateTag=r,o.errorTag=h,o.float32ArrayTag=li,o.float64ArrayTag=ci,o.functionTag=g,o.int16ArrayTag=x,o.int32ArrayTag=$,o.int8ArrayTag=C,o.mapTag=m,o.numberTag=i,o.objectTag=d,o.regexpTag=e,o.setTag=c,o.stringTag=t,o.symbolTag=s,o.uint16ArrayTag=k,o.uint32ArrayTag=y,o.uint8ArrayTag=w,o.uint8ClampedArrayTag=b}(Te)),Te}var Ae={},Jt;function xn(){return Jt||(Jt=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});function e(t,i){return t===i||Number.isNaN(t)&&Number.isNaN(i)}o.eq=e}(Ae)),Ae}var Xt;function Bn(){return Xt||(Xt=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});const e=Sn(),t=Tn(),i=An(),n=Un(),a=xn();function s(c,l,g){return r(c,l,void 0,void 0,void 0,void 0,g)}function r(c,l,g,u,d,h,p){const w=p(c,l,g,u,d,h);if(w!==void 0)return w;if(typeof c==typeof l)switch(typeof c){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return c===l;case"number":return c===l||Object.is(c,l);case"function":return c===l;case"object":return m(c,l,h,p)}return m(c,l,h,p)}function m(c,l,g,u){if(Object.is(c,l))return!0;let d=i.getTag(c),h=i.getTag(l);if(d===n.argumentsTag&&(d=n.objectTag),h===n.argumentsTag&&(h=n.objectTag),d!==h)return!1;switch(d){case n.stringTag:return c.toString()===l.toString();case n.numberTag:{const b=c.valueOf(),k=l.valueOf();return a.eq(b,k)}case n.booleanTag:case n.dateTag:case n.symbolTag:return Object.is(c.valueOf(),l.valueOf());case n.regexpTag:return c.source===l.source&&c.flags===l.flags;case n.functionTag:return c===l}g=g??new Map;const p=g.get(c),w=g.get(l);if(p!=null&&w!=null)return p===l;g.set(c,l),g.set(l,c);try{switch(d){case n.mapTag:{if(c.size!==l.size)return!1;for(const[b,k]of c.entries())if(!l.has(b)||!r(k,l.get(b),b,c,l,g,u))return!1;return!0}case n.setTag:{if(c.size!==l.size)return!1;const b=Array.from(c.values()),k=Array.from(l.values());for(let y=0;y<b.length;y++){const E=b[y],C=k.findIndex(x=>r(E,x,void 0,c,l,g,u));if(C===-1)return!1;k.splice(C,1)}return!0}case n.arrayTag:case n.uint8ArrayTag:case n.uint8ClampedArrayTag:case n.uint16ArrayTag:case n.uint32ArrayTag:case n.bigUint64ArrayTag:case n.int8ArrayTag:case n.int16ArrayTag:case n.int32ArrayTag:case n.bigInt64ArrayTag:case n.float32ArrayTag:case n.float64ArrayTag:{if(typeof Buffer<"u"&&Buffer.isBuffer(c)!==Buffer.isBuffer(l)||c.length!==l.length)return!1;for(let b=0;b<c.length;b++)if(!r(c[b],l[b],b,c,l,g,u))return!1;return!0}case n.arrayBufferTag:return c.byteLength!==l.byteLength?!1:m(new Uint8Array(c),new Uint8Array(l),g,u);case n.dataViewTag:return c.byteLength!==l.byteLength||c.byteOffset!==l.byteOffset?!1:m(new Uint8Array(c),new Uint8Array(l),g,u);case n.errorTag:return c.name===l.name&&c.message===l.message;case n.objectTag:{if(!(m(c.constructor,l.constructor,g,u)||e.isPlainObject(c)&&e.isPlainObject(l)))return!1;const k=[...Object.keys(c),...t.getSymbols(c)],y=[...Object.keys(l),...t.getSymbols(l)];if(k.length!==y.length)return!1;for(let E=0;E<k.length;E++){const C=k[E],x=c[C];if(!Object.hasOwn(l,C))return!1;const $=l[C];if(!r(x,$,C,c,l,g,u))return!1}return!0}default:return!1}}finally{g.delete(c),g.delete(l)}}o.isEqualWith=s}(ve)),ve}var Ue={},Zt;function Vn(){return Zt||(Zt=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});function e(){}o.noop=e}(Ue)),Ue}var Yt;function On(){return Yt||(Yt=1,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});const e=Bn(),t=Vn();function i(n,a){return e.isEqualWith(n,a,t.noop)}o.isEqual=i}(ye)),ye}var xe,Qt;function zn(){return Qt||(Qt=1,xe=On().isEqual),xe}var Pn=zn(),Rn=Cn(Pn);/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/function ei(o){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=Be(t.attributeNewValue,o),a=Be(t.attributeOldValue,o),s=i.mapper.toViewElement(t.item),r=i.writer;a&&r.removeClass(a.className,s),n&&r.addClass(n.className,s)}}function ti(o){const e={imageInline:o.filter(t=>!t.isDefault&&t.modelElements.includes("imageInline")),imageBlock:o.filter(t=>!t.isDefault&&t.modelElements.includes("imageBlock"))};return(t,i,n)=>{if(!i.modelRange)return;const a=i.viewItem,s=F(i.modelRange.getItems());if(s&&n.schema.checkAttribute(s,"imageStyle")){for(const r of e[s.name])n.consumable.consume(a,{classes:r.className})&&n.writer.setAttribute("imageStyle",r.name,s);Nn(n,a,s,o)}}}function Nn(o,e,t,i){if(!o.consumable.test(e,{styles:["float"]}))return;let n=null;switch(e.getStyle("float")){case"left":n="alignLeft";break;case"right":n="alignRight";break}if(!n)return;const a=Be(n,i);if(!a)return;const s=P[a.name];Rn(a,s)&&(o.writer.setAttribute("imageStyle",n,t),o.consumable.consume(e,{styles:["float"]}))}function Be(o,e){for(const t of e)if(t.name===o)return t}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Ve extends f{static get pluginName(){return"ImageStyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[I]}normalizedStyles;init(){const e=this.editor,t=e.plugins.has("ImageBlockEditing"),i=e.plugins.has("ImageInlineEditing");e.config.define("image.styles",R.getDefaultStylesConfiguration(t,i)),this.normalizedStyles=R.normalizeStyles({configuredStyles:e.config.get("image.styles"),isBlockPluginLoaded:t,isInlinePluginLoaded:i}),this._setupConversion(t,i),this._setupPostFixer(),e.commands.add("imageStyle",new Lt(e,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,n=i.model.schema,a=ei(this.normalizedStyles),s=ti(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",a),i.data.downcastDispatcher.on("attribute:imageStyle",a),e&&(n.extend("imageBlock",{allowAttributes:"imageStyle"}),n.setAttributeProperties("imageStyle",{isFormatting:!0}),i.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),t&&(n.extend("imageInline",{allowAttributes:"imageStyle"}),n.setAttributeProperties("imageStyle",{isFormatting:!0}),i.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(I),n=new Map(this.normalizedStyles.map(a=>[a.name,a]));t.registerPostFixer(a=>{let s=!1;for(const r of t.differ.getChanges())if(r.type=="insert"||r.type=="attribute"&&r.attributeKey=="imageStyle"){let m=r.type=="insert"?r.position.nodeAfter:r.range.start.nodeAfter;if(m&&m.is("element","paragraph")&&m.childCount>0&&(m=m.getChild(0)),!i.isImage(m))continue;const c=m.getAttribute("imageStyle");if(!c)continue;const l=n.get(c);(!l||!l.modelElements.includes(m.name))&&(a.removeAttribute("imageStyle",m),s=!0)}return s})}}function ii(o){return o!==null&&(typeof o=="object"||typeof o=="function")}function N(o){return o}_(":root{--ck-content-image-style-spacing:1.5em;--ck-content-inline-image-style-spacing:calc(var(--ck-content-image-style-spacing)/2)}.ck-content .image.image-style-block-align-left,.ck-content .image.image-style-block-align-right{max-width:calc(100% - var(--ck-content-image-style-spacing))}.ck-content .image.image-style-align-left,.ck-content .image.image-style-align-right{clear:none}.ck-content .image.image-style-side{float:right;margin-left:var(--ck-content-image-style-spacing);max-width:50%}.ck-content .image.image-style-align-left{float:left;margin-right:var(--ck-content-image-style-spacing)}.ck-content .image.image-style-align-right{float:right;margin-left:var(--ck-content-image-style-spacing)}.ck-content .image.image-style-block-align-right{margin-left:auto;margin-right:0}.ck-content .image.image-style-block-align-left{margin-left:0;margin-right:auto}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-content-image-style-spacing)}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-content-image-style-spacing)}.ck-content p+.image.image-style-align-left,.ck-content p+.image.image-style-align-right,.ck-content p+.image.image-style-side{margin-top:0}.ck-content .image-inline.image-style-align-left,.ck-content .image-inline.image-style-align-right{margin-bottom:var(--ck-content-inline-image-style-spacing);margin-top:var(--ck-content-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-left{margin-right:var(--ck-content-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-right{margin-left:var(--ck-content-inline-image-style-spacing)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-background)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after{display:none}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-hover-background)}");/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class ni extends f{static get requires(){return[Ve]}static get pluginName(){return"ImageStyleUI"}static get isOfficialPlugin(){return!0}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=e.get("ImageStyleEditing"),n=oi(i.normalizedStyles,this.localizedDefaultStylesTitles);for(const s of n)this._createButton(s);const a=oi([...t.filter(ii),...R.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const s of a)this._createDropdown(s,n)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,n=>{let a;const{defaultItem:s,items:r,title:m}=e,c=r.filter(d=>t.find(({name:h})=>si(h)===d)).map(d=>{const h=i.create(d);return d===s&&(a=h),h});r.length!==c.length&&R.warnInvalidStyle({dropdown:e});const l=ie(n,We),g=l.buttonView,u=g.arrowView;return Ni(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),g.set({label:ai(m,a.label),class:null,tooltip:!0}),u.unbind("label"),u.set({label:m}),g.bind("icon").toMany(c,"isOn",(...d)=>{const h=d.findIndex(N);return h<0?a.icon:c[h].icon}),g.bind("label").toMany(c,"isOn",(...d)=>{const h=d.findIndex(N);return ai(m,h<0?a.label:c[h].label)}),g.bind("isOn").toMany(c,"isOn",(...d)=>d.some(N)),g.bind("class").toMany(c,"isOn",(...d)=>d.some(N)?"ck-splitbutton_flatten":void 0),g.on("execute",()=>{c.some(({isOn:d})=>d)?l.isOpen=!l.isOpen:a.fire("execute")}),l.bind("isEnabled").toMany(c,"isEnabled",(...d)=>d.some(N)),this.listenTo(l,"execute",()=>{this.editor.editing.view.focus()}),l})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(si(t),i=>{const n=this.editor.commands.get("imageStyle"),a=new v(i);return a.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),a.bind("isEnabled").to(n,"isEnabled"),a.bind("isOn").to(n,"value",s=>s===t),a.on("execute",this._executeCommand.bind(this,t)),a})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function oi(o,e){for(const t of o)e[t.title]&&(t.title=e[t.title]);return o}function si(o){return`imageStyle:${o}`}function ai(o,e){return(o?o+": ":"")+e}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Fn extends f{static get requires(){return[Ve,ni]}static get pluginName(){return"ImageStyle"}static get isOfficialPlugin(){return!0}}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class jn extends f{static get requires(){return[Re,I]}static get pluginName(){return"ImageToolbar"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Re),n=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:Dn(e.config.get("image.toolbar")||[]),getRelatedElement:a=>n.getClosestSelectedImageWidget(a)})}}function Dn(o){return o.map(e=>ii(e)?e.name:e)}/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/class Ln extends f{static get requires(){return[G,I]}static get pluginName(){return"PictureEditing"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("upcast").add(at(i)),t.for("downcast").add(rt(i))}_setupImageUploadEditingIntegration(){const e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;const t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",(i,{imageElement:n,data:a})=>{const s=a.sources;s&&e.model.change(r=>{r.setAttributes({sources:s},n)})})}}export{en as AutoImage,tn as Image,gt as ImageBlock,ue as ImageBlockEditing,nn as ImageCaption,ft as ImageCaptionEditing,pt as ImageCaptionUI,de as ImageCaptionUtils,Dt as ImageCustomResizeUI,G as ImageEditing,dt as ImageInline,ut as ImageInlineEditing,hn as ImageInsert,U as ImageInsertUI,Ot as ImageInsertViaUrl,Vt as ImageInsertViaUrlUI,H as ImageLoadObserver,ge as ImagePlaceholder,In as ImageResize,Pt as ImageResizeButtons,fe as ImageResizeEditing,Rt as ImageResizeHandles,ce as ImageSizeAttributes,Fn as ImageStyle,Lt as ImageStyleCommand,Ve as ImageStyleEditing,ni as ImageStyleUI,re as ImageTextAlternative,et as ImageTextAlternativeCommand,tt as ImageTextAlternativeEditing,ot as ImageTextAlternativeUI,jn as ImageToolbar,me as ImageTypeCommand,xt as ImageUpload,At as ImageUploadEditing,_t as ImageUploadProgress,wt as ImageUploadUI,I as ImageUtils,lt as InsertImageCommand,Ln as PictureEditing,ct as ReplaceImageSourceCommand,zt as ResizeImageCommand,ht as ToggleImageCaptionCommand,Tt as UploadImageCommand,Wt as _IMAGE_DEFAULT_DROPDOWN_DEFINITIONS,Mt as _IMAGE_DEFAULT_ICONS,P as _IMAGE_DEFAULT_OPTIONS,Ft as _ImageCustomResizeFormView,mt as _ImageInsertFormView,Bt as _ImageInsertUrlView,R as _ImageStyleUtils,it as _ImageTextAlternativeFormView,V as _checkIfImageWidthAndHeightStylesAreBothSet,se as _createBlockImageViewElement,Ye as _createInlineImageViewElement,W as _determineImageTypeForInsertionAtSelection,O as _downcastImageAttribute,rt as _downcastImageSourcesAttribute,le as _downcastImageSrcsetAttribute,bt as _fetchLocalImage,q as _getImageBalloonPositionData,B as _getImageSizeValueIfInPx,ae as _getImageViewElementMatcher,_e as _getSelectedImageEditorNodes,jt as _getSelectedImagePossibleResizeRange,Nt as _getSelectedImageWidthInUnits,It as _isLocalImage,ei as _modelToViewImageStyleAttribute,nt as _repositionImageContextualBalloon,we as _tryCastImageDimensionsToUnit,ke as _tryParseImageDimensionWithUnit,st as _upcastImageFigure,at as _upcastImagePicture,ti as _viewToModelImageStyleAttribute,he as createImageTypeRegExp,Ut as isHtmlInDataTransfer};
