diff --git a/assets/AppLayout-cb021fc1.js b/assets/AppLayout-3f548cf6.js
similarity index 99%
rename from assets/AppLayout-cb021fc1.js
rename to assets/AppLayout-3f548cf6.js
index 176a26c..21410b0 100644
--- a/assets/AppLayout-cb021fc1.js
+++ b/assets/AppLayout-3f548cf6.js
@@ -1,4 +1,4 @@
-import{r as M,R as oi,d as ls,e as cs,c as fs,f as ds,j as C,B as _s,u as zn,N as Mn,L as En,O as ms,b as ps}from"./index-2fb86547.js";import{L as vs,T as gs}from"./Title-32f6af34.js";import{S as ys}from"./Storage-1d28fdda.js";function kn(f,c){const a=M.useRef(c);M.useEffect(function(){c!==a.current&&f.attributionControl!=null&&(a.current!=null&&f.attributionControl.removeAttribution(a.current),c!=null&&f.attributionControl.addAttribution(c)),a.current=c},[f,c])}const ws=1;function xs(f){return Object.freeze({__version:ws,map:f})}function Ps(f,c){return Object.freeze({...f,...c})}const On=M.createContext(null),Zn=On.Provider;function hi(){const f=M.useContext(On);if(f==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return f}function Ls(f){function c(a,d){const{instance:_,context:S}=f(a).current;return M.useImperativeHandle(d,()=>_),a.children==null?null:oi.createElement(Zn,{value:S},a.children)}return M.forwardRef(c)}function bs(f){function c(a,d){const[_,S]=M.useState(!1),{instance:p}=f(a,S).current;M.useImperativeHandle(d,()=>p),M.useEffect(function(){_&&p.update()},[p,_,a.children]);const R=p._contentNode;return R?ls.createPortal(a.children,R):null}return M.forwardRef(c)}function Ts(f){function c(a,d){const{instance:_}=f(a).current;return M.useImperativeHandle(d,()=>_),null}return M.forwardRef(c)}function In(f,c){const a=M.useRef();M.useEffect(function(){return c!=null&&f.instance.on(c),a.current=c,function(){a.current!=null&&f.instance.off(a.current),a.current=null}},[f,c])}function ui(f,c){const a=f.pane??c.pane;return a?{...f,pane:a}:f}function Cs(f,c){return function(d,_){const S=hi(),p=f(ui(d,S),S);return kn(S.map,d.attribution),In(p.current,d.eventHandlers),c(p.current,S,d,_),p}}var si={exports:{}};/* @preserve
+import{r as M,R as oi,d as ls,e as cs,c as fs,f as ds,j as C,B as _s,u as zn,N as Mn,L as En,O as ms,b as ps}from"./index-f6be71a9.js";import{L as vs,T as gs}from"./Title-b7c7a7ef.js";import{S as ys}from"./Storage-23dae41d.js";function kn(f,c){const a=M.useRef(c);M.useEffect(function(){c!==a.current&&f.attributionControl!=null&&(a.current!=null&&f.attributionControl.removeAttribution(a.current),c!=null&&f.attributionControl.addAttribution(c)),a.current=c},[f,c])}const ws=1;function xs(f){return Object.freeze({__version:ws,map:f})}function Ps(f,c){return Object.freeze({...f,...c})}const On=M.createContext(null),Zn=On.Provider;function hi(){const f=M.useContext(On);if(f==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return f}function Ls(f){function c(a,d){const{instance:_,context:S}=f(a).current;return M.useImperativeHandle(d,()=>_),a.children==null?null:oi.createElement(Zn,{value:S},a.children)}return M.forwardRef(c)}function bs(f){function c(a,d){const[_,S]=M.useState(!1),{instance:p}=f(a,S).current;M.useImperativeHandle(d,()=>p),M.useEffect(function(){_&&p.update()},[p,_,a.children]);const R=p._contentNode;return R?ls.createPortal(a.children,R):null}return M.forwardRef(c)}function Ts(f){function c(a,d){const{instance:_}=f(a).current;return M.useImperativeHandle(d,()=>_),null}return M.forwardRef(c)}function In(f,c){const a=M.useRef();M.useEffect(function(){return c!=null&&f.instance.on(c),a.current=c,function(){a.current!=null&&f.instance.off(a.current),a.current=null}},[f,c])}function ui(f,c){const a=f.pane??c.pane;return a?{...f,pane:a}:f}function Cs(f,c){return function(d,_){const S=hi(),p=f(ui(d,S),S);return kn(S.map,d.attribution),In(p.current,d.eventHandlers),c(p.current,S,d,_),p}}var si={exports:{}};/* @preserve
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/(function(f,c){(function({},a){a(c)})(cs,function(a){var d="1.9.4";function _(t){var e,i,n,o;for(i=1,n=arguments.length;i"u"||!L||!L.Mixin)){t=st(t)?t:[t];for(var e=0;e0?Math.floor(t):Math.ceil(t)};x.prototype={clone:function(){return new x(this.x,this.y)},add:function(t){return this.clone()._add(w(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(w(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new x(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new x(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=mi(this.x),this.y=mi(this.y),this},distanceTo:function(t){t=w(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=w(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=w(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+Q(this.x)+", "+Q(this.y)+")"}};function w(t,e,i){return t instanceof x?t:st(t)?new x(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new x(t.x,t.y):new x(t,e,i)}function B(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=Y(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,r=o.y>=e.y&&n.y<=i.y;return s&&r},overlaps:function(t){t=Y(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.xe.y&&n.y=e.lat&&o.lat<=i.lat&&n.lng>=e.lng&&o.lng<=i.lng},intersects:function(t){t=H(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,r=o.lng>=e.lng&&n.lng<=i.lng;return s&&r},overlaps:function(t){t=H(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.late.lng&&n.lng1,$n=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",A,e),window.removeEventListener("testPassiveEventSupport",A,e)}catch{}return t}(),Qn=function(){return!!document.createElement("canvas").getContext}(),ke=!!(document.createElementNS&&vi("svg").createSVGRect),to=!!ke&&function(){var t=document.createElement("div");return t.innerHTML="",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),eo=!ke&&function(){try{var t=document.createElement("div");t.innerHTML='';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&typeof e.adj=="object"}catch{return!1}}(),io=navigator.platform.indexOf("Mac")===0,no=navigator.platform.indexOf("Linux")===0;function ht(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var v={ie:ee,ielt9:Hn,edge:yi,webkit:Se,android:wi,android23:xi,androidStock:Wn,opera:ze,chrome:Pi,gecko:Li,safari:jn,phantom:bi,opera12:Ti,win:Un,ie3d:Ci,webkit3d:Ee,gecko3d:Mi,any3d:Gn,mobile:Dt,mobileWebkit:Vn,mobileWebkit3d:qn,msPointer:Si,pointer:zi,touch:Kn,touchNative:Ei,mobileOpera:Yn,mobileGecko:Xn,retina:Jn,passiveEvents:$n,canvas:Qn,svg:ke,vml:eo,inlineSvg:to,mac:io,linux:no},ki=v.msPointer?"MSPointerDown":"pointerdown",Oi=v.msPointer?"MSPointerMove":"pointermove",Zi=v.msPointer?"MSPointerUp":"pointerup",Ii=v.msPointer?"MSPointerCancel":"pointercancel",Oe={touchstart:ki,touchmove:Oi,touchend:Zi,touchcancel:Ii},Ai={touchstart:uo,touchmove:ie,touchend:ie,touchcancel:ie},St={},Bi=!1;function oo(t,e,i){return e==="touchstart"&&ho(),Ai[e]?(i=Ai[e].bind(this,i),t.addEventListener(Oe[e],i,!1),i):(console.warn("wrong event specified:",e),A)}function so(t,e,i){if(!Oe[e]){console.warn("wrong event specified:",e);return}t.removeEventListener(Oe[e],i,!1)}function ro(t){St[t.pointerId]=t}function ao(t){St[t.pointerId]&&(St[t.pointerId]=t)}function Ni(t){delete St[t.pointerId]}function ho(){Bi||(document.addEventListener(ki,ro,!0),document.addEventListener(Oi,ao,!0),document.addEventListener(Zi,Ni,!0),document.addEventListener(Ii,Ni,!0),Bi=!0)}function ie(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){e.touches=[];for(var i in St)e.touches.push(St[i]);e.changedTouches=[e],t(e)}}function uo(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&G(e),ie(t,e)}function lo(t){var e={},i,n;for(n in t)i=t[n],e[n]=i&&i.bind?i.bind(t):i;return t=e,e.type="dblclick",e.detail=2,e.isTrusted=!1,e._simulated=!0,e}var co=200;function fo(t,e){t.addEventListener("dblclick",e);var i=0,n;function o(s){if(s.detail!==1){n=s.detail;return}if(!(s.pointerType==="mouse"||s.sourceCapabilities&&!s.sourceCapabilities.firesTouchEvents)){var r=Wi(s);if(!(r.some(function(u){return u instanceof HTMLLabelElement&&u.attributes.for})&&!r.some(function(u){return u instanceof HTMLInputElement||u instanceof HTMLSelectElement}))){var h=Date.now();h-i<=co?(n++,n===2&&e(lo(s))):n=1,i=h}}}return t.addEventListener("click",o),{dblclick:e,simDblclick:o}}function _o(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var Ze=se(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Ht=se(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Ri=Ht==="webkitTransition"||Ht==="OTransition"?Ht+"End":"transitionend";function Di(t){return typeof t=="string"?document.getElementById(t):t}function Ft(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||i==="auto")&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return i==="auto"?null:i}function k(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function N(t){var e=t.parentNode;e&&e.removeChild(t)}function ne(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function zt(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function Et(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function Ie(t,e){if(t.classList!==void 0)return t.classList.contains(e);var i=oe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function b(t,e){if(t.classList!==void 0)for(var i=ft(e),n=0,o=i.length;n0?2*window.devicePixelRatio:1;function Ui(t){return v.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/vo:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function Ve(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch{return!1}return i!==t}var go={__proto__:null,on:P,off:I,stopPropagation:Tt,disableScrollPropagation:Ge,disableClickPropagation:Gt,preventDefault:G,stop:Ct,getPropagationPath:Wi,getMousePosition:ji,getWheelDelta:Ui,isExternalTarget:Ve,addListener:P,removeListener:I},Gi=Nt.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=bt(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=K(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=this._duration*1e3;ethis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,H(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var i=w(e.paddingTopLeft||e.padding||[0,0]),n=w(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),s=this.project(t),r=this.getPixelBounds(),h=Y([r.min.add(i),r.max.subtract(n)]),u=h.getSize();if(!h.contains(s)){this._enforcingBounds=!0;var l=s.subtract(h.getCenter()),m=h.extend(s).getSize().subtract(u);o.x+=l.x<0?-m.x:m.x,o.y+=l.y<0?-m.y:m.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=_({animate:!1,pan:!0},t===!0?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),o=i.divideBy(2).round(),s=n.subtract(o);return!s.x&&!s.y?this:(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(p(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=_({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=p(this._handleGeolocationResponse,this),i=p(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var e=t.code,i=t.message||(e===1?"permission denied":e===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=t.coords.latitude,i=t.coords.longitude,n=new O(e,i),o=n.toBounds(t.coords.accuracy*2),s=this._locateOptions;if(s.setView){var r=this.getBoundsZoom(o);this.setView(n,s.maxZoom?Math.min(r,s.maxZoom):r)}var h={latlng:n,bounds:o,timestamp:t.timestamp};for(var u in t.coords)typeof t.coords[u]=="number"&&(h[u]=t.coords[u]);this.fire("locationfound",h)}},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),N(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(tt(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)N(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),n=k("div",i,e||this._mapPane);return t&&(this._panes[t]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),i=this.unproject(t.getTopRight());return new X(e,i)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=H(t),i=w(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),h=t.getSouthEast(),u=this.getSize().subtract(i),l=Y(this.project(h,n),this.project(r,n)).getSize(),m=v.any3d?this.options.zoomSnap:1,y=u.x/l.x,T=u.y/l.y,q=e?Math.max(y,T):Math.min(y,T);return n=this.getScaleZoom(q,n),m&&(n=Math.round(n/(m/100))*(m/100),n=e?Math.ceil(n/m)*m:Math.floor(n/m)*m),Math.max(o,Math.min(s,n))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new x(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new B(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=e===void 0?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=e===void 0?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.latLngToPoint(z(t),e)},unproject:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.pointToLatLng(w(t),e)},layerPointToLatLng:function(t){var e=w(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(z(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(z(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(H(t))},distance:function(t,e){return this.options.crs.distance(z(t),z(e))},containerPointToLayerPoint:function(t){return w(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return w(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(w(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(z(t)))},mouseEventToContainerPoint:function(t){return ji(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=Di(t);if(e){if(e._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");P(e,"scroll",this._onScroll,this),this._containerId=g(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&v.any3d,b(t,"leaflet-container"+(v.touch?" leaflet-touch":"")+(v.retina?" leaflet-retina":"")+(v.ielt9?" leaflet-oldie":"")+(v.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=Ft(t,"position");e!=="absolute"&&e!=="relative"&&e!=="fixed"&&e!=="sticky"&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),F(this._mapPane,new x(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(b(t.markerPane,"leaflet-zoom-hide"),b(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){F(this._mapPane,new x(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var o=this._zoom!==e;this._moveStart(o,i)._move(t,e)._moveEnd(o),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i,n){e===void 0&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((o||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return tt(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){F(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[g(this._container)]=this;var e=t?I:P;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),v.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){tt(this._resizeRequest),this._resizeRequest=K(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i=[],n,o=e==="mouseout"||e==="mouseover",s=t.target||t.srcElement,r=!1;s;){if(n=this._targets[g(s)],n&&(e==="click"||e==="preclick")&&this._draggableMoved(n)){r=!0;break}if(n&&n.listens(e,!0)&&(o&&!Ve(s,t)||(i.push(n),o))||s===this._container)break;s=s.parentNode}return!i.length&&!r&&!o&&this.listens(e,!0)&&(i=[this]),i},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e=t.target||t.srcElement;if(!(!this._loaded||e._leaflet_disable_events||t.type==="click"&&this._isClickDisabled(e))){var i=t.type;i==="mousedown"&&He(e),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if(t.type==="click"){var n=_({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}var o=this._findEventTargets(t,e);if(i){for(var s=[],r=0;r0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=v.any3d?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){D(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return(e&&e.animate)!==!0&&!this.getSize().contains(i)?!1:(this.panBy(i,e),!0)},_createAnimProxy:function(){var t=this._proxy=k("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(e){var i=Ze,n=this._proxy.style[i];Lt(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){N(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();Lt(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n);return i.animate!==!0&&!this.getSize().contains(o)?!1:(K(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(t,e,!0)},this),!0)},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,b(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(p(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&D(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function yo(t,e){return new E(t,e)}var rt=dt.extend({options:{position:"topright"},initialize:function(t){Z(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return b(e,"leaflet-control"),i.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(N(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),Vt=function(t){return new rt(t)};E.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=k("div",e+"control-container",this._container);function n(o,s){var r=e+o+" "+e+s;t[o+s]=k("div",r,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)N(this._controlCorners[t]);N(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Vi=rt.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(g(t.target)),i=e.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),n;t.overlay?(n=document.createElement("input"),n.type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=i):n=this._createRadioElement("leaflet-base-layers_"+g(this),i),this._layerControlInputs.push(n),n.layerId=g(t.layer),P(n,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("span");e.appendChild(s),s.appendChild(n),s.appendChild(o);var r=t.overlay?this._overlaysList:this._baseLayersList;return r.appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,e,i,n=[],o=[];this._handlingClick=!0;for(var s=t.length-1;s>=0;s--)e=t[s],i=this._getLayer(e.layerId).layer,e.checked?n.push(i):e.checked||o.push(i);for(s=0;s=0;o--)e=t[o],i=this._getLayer(e.layerId).layer,e.disabled=i.options.minZoom!==void 0&&ni.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,P(t,"click",G),this.expand();var e=this;setTimeout(function(){I(t,"click",G),e._preventClick=!1})}}),wo=function(t,e,i){return new Vi(t,e,i)},qe=rt.extend({options:{position:"topleft",zoomInText:'+',zoomInTitle:"Zoom in",zoomOutText:'−',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=k("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){var s=k("a",i,n);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),Gt(s),P(s,"click",Ct),P(s,"click",o,this),P(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";D(this._zoomInButton,e),D(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(b(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(b(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});E.mergeOptions({zoomControl:!0}),E.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new qe,this.addControl(this.zoomControl))});var xo=function(t){return new qe(t)},qi=rt.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=k("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=k("div",e,i)),t.imperial&&(this._iScale=k("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e=t*3.2808399,i,n,o;e>5280?(i=e/5280,n=this._getRoundNum(i),this._updateScale(this._iScale,n+" mi",n/i)):(o=this._getRoundNum(e),this._updateScale(this._iScale,o+" ft",o/e))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,e*i}}),Po=function(t){return new qi(t)},Lo='',Ke=rt.extend({options:{position:"bottomright",prefix:''+(v.inlineSvg?Lo+" ":"")+"Leaflet"},initialize:function(t){Z(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=k("div","leaflet-control-attribution"),Gt(this._container);for(var e in t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(' | ')}}});E.mergeOptions({attributionControl:!0}),E.addInitHook(function(){this.options.attributionControl&&new Ke().addTo(this)});var bo=function(t){return new Ke(t)};rt.Layers=Vi,rt.Zoom=qe,rt.Scale=qi,rt.Attribution=Ke,Vt.layers=wo,Vt.zoom=xo,Vt.scale=Po,Vt.attribution=bo;var lt=dt.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});lt.addTo=function(t,e){return t.addHandler(e,this),this};var To={Events:$},Ki=v.touch?"touchstart mousedown":"mousedown",wt=Nt.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){Z(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(P(this._dragStartTarget,Ki,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(wt._dragging===this&&this.finishDrag(!0),I(this._dragStartTarget,Ki,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!Ie(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){wt._dragging===this&&this.finishDrag();return}if(!(wt._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(wt._dragging=this,this._preventOutline&&He(this._element),Ne(),Wt(),!this._moving)){this.fire("down");var e=t.touches?t.touches[0]:t,i=Hi(this._element);this._startPoint=new x(e.clientX,e.clientY),this._startPos=bt(this._element),this._parentScale=Fe(i);var n=t.type==="mousedown";P(document,n?"mousemove":"touchmove",this._onMove,this),P(document,n?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var e=t.touches&&t.touches.length===1?t.touches[0]:t,i=new x(e.clientX,e.clientY)._subtract(this._startPoint);!i.x&&!i.y||Math.abs(i.x)+Math.abs(i.y)s&&(r=h,s=u);s>i&&(e[r]=1,Xe(t,e,i,n,r),Xe(t,e,i,r,o))}function zo(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;ne&&(i.push(t[n]),o=n);return oe.max.x&&(i|=2),t.ye.max.y&&(i|=8),i}function Eo(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function qt(t,e,i,n){var o=e.x,s=e.y,r=i.x-o,h=i.y-s,u=r*r+h*h,l;return u>0&&(l=((t.x-o)*r+(t.y-s)*h)/u,l>1?(o=i.x,s=i.y):l>0&&(o+=r*l,s+=h*l)),r=t.x-o,h=t.y-s,n?r*r+h*h:new x(o,s)}function it(t){return!st(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function en(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),it(t)}function nn(t,e){var i,n,o,s,r,h,u,l;if(!t||t.length===0)throw new Error("latlngs not passed");it(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var m=z([0,0]),y=H(t),T=y.getNorthWest().distanceTo(y.getSouthWest())*y.getNorthEast().distanceTo(y.getNorthWest());T<1700&&(m=Ye(t));var q=t.length,j=[];for(i=0;in){u=(s-n)/o,l=[h.x-u*(h.x-r.x),h.y-u*(h.y-r.y)];break}var J=e.unproject(w(l));return z([J.lat+m.lat,J.lng+m.lng])}var ko={__proto__:null,simplify:Ji,pointToSegmentDistance:$i,closestPointOnSegment:Mo,clipSegment:tn,_getEdgeIntersection:he,_getBitCode:Mt,_sqClosestPointOnSegment:qt,isFlat:it,_flat:en,polylineCenter:nn},Je={project:function(t){return new x(t.lng,t.lat)},unproject:function(t){return new O(t.y,t.x)},bounds:new B([-180,-90],[180,90])},$e={R:6378137,R_MINOR:6356752314245179e-9,bounds:new B([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),r=s*Math.sin(n),h=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-i*Math.log(Math.max(h,1e-10)),new x(t.lng*e*i,n)},unproject:function(t){for(var e=180/Math.PI,i=this.R,n=this.R_MINOR/i,o=Math.sqrt(1-n*n),s=Math.exp(-t.y/i),r=Math.PI/2-2*Math.atan(s),h=0,u=.1,l;h<15&&Math.abs(u)>1e-7;h++)l=o*Math.sin(r),l=Math.pow((1-l)/(1+l),o/2),u=Math.PI/2-2*Math.atan(s*l)-r,r+=u;return new O(r*e,t.x*e/i)}},Oo={__proto__:null,LonLat:Je,Mercator:$e,SphericalMercator:be},Zo=_({},yt,{code:"EPSG:3395",projection:$e,transformation:function(){var t=.5/(Math.PI*$e.R);return Rt(t,.5,-t,.5)}()}),on=_({},yt,{code:"EPSG:4326",projection:Je,transformation:Rt(1/180,1,-1/180,.5)}),Io=_({},_t,{projection:Je,transformation:Rt(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});_t.Earth=yt,_t.EPSG3395=Zo,_t.EPSG3857=Ce,_t.EPSG900913=Dn,_t.EPSG4326=on,_t.Simple=Io;var at=Nt.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[g(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[g(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",function(){e.off(i,this)},this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});E.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=g(t);return this._layers[e]?this:(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var e=g(t);return this._layers[e]?(this._loaded&&t.onRemove(this),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return g(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){t=t?st(t)?t:[t]:[];for(var e=0,i=t.length;ethis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&e[0]instanceof O&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){pt.prototype._setLatLngs.call(this,t),it(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return it(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new x(e,e);if(t=new B(t.min.subtract(i),t.max.add(i)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var n=0,o=this._rings.length,s;nt.y!=o.y>t.y&&t.x<(o.x-n.x)*(t.y-n.y)/(o.y-n.y)+n.x&&(e=!e);return e||pt.prototype._containsPoint.call(this,t,!0)}});function Wo(t,e){return new Zt(t,e)}var vt=mt.extend({initialize:function(t,e){Z(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e=st(t)?t:t.features,i,n,o;if(e){for(i=0,n=e.length;i0&&o.push(o[0].slice()),o}function It(t,e){return t.feature?_({},t.feature,{geometry:e}):_e(e)}function _e(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var ii={toGeoJSON:function(t){return It(this,{type:"Point",coordinates:ei(this.getLatLng(),t)})}};ue.include(ii),Qe.include(ii),le.include(ii),pt.include({toGeoJSON:function(t){var e=!it(this._latlngs),i=de(this._latlngs,e?1:0,!1,t);return It(this,{type:(e?"Multi":"")+"LineString",coordinates:i})}}),Zt.include({toGeoJSON:function(t){var e=!it(this._latlngs),i=e&&!it(this._latlngs[0]),n=de(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),It(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),kt.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(i){e.push(i.toGeoJSON(t).geometry.coordinates)}),It(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(e==="MultiPoint")return this.toMultiPoint(t);var i=e==="GeometryCollection",n=[];return this.eachLayer(function(o){if(o.toGeoJSON){var s=o.toGeoJSON(t);if(i)n.push(s.geometry);else{var r=_e(s);r.type==="FeatureCollection"?n.push.apply(n,r.features):n.push(r)}}}),i?It(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});function an(t,e){return new vt(t,e)}var jo=an,me=at.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=H(e),Z(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(b(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){N(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&zt(this._image),this},bringToBack:function(){return this._map&&Et(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=H(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=this._url.tagName==="IMG",e=this._image=t?this._url:k("img");if(b(e,"leaflet-image-layer"),this._zoomAnimated&&b(e,"leaflet-zoom-animated"),this.options.className&&b(e,this.options.className),e.onselectstart=A,e.onmousemove=A,e.onload=p(this.fire,this,"load"),e.onerror=p(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(e.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=e.src;return}e.src=this._url,e.alt=this.options.alt},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Lt(this._image,i,e)},_reset:function(){var t=this._image,e=new B(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();F(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){et(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Uo=function(t,e,i){return new me(t,e,i)},hn=me.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",e=this._image=t?this._url:k("video");if(b(e,"leaflet-image-layer"),this._zoomAnimated&&b(e,"leaflet-zoom-animated"),this.options.className&&b(e,this.options.className),e.onselectstart=A,e.onmousemove=A,e.onloadeddata=p(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],o=0;o0?n:[e.src];return}st(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted,e.playsInline=!!this.options.playsInline;for(var s=0;s×',P(n,"click",function(o){G(o),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&n>o?(e.height=o+"px",b(t,s)):D(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();F(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,e=parseInt(Ft(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,o=new x(this._containerLeft,-i-this._containerBottom);o._add(bt(this._container));var s=t.layerPointToContainerPoint(o),r=w(this.options.autoPanPadding),h=w(this.options.autoPanPaddingTopLeft||r),u=w(this.options.autoPanPaddingBottomRight||r),l=t.getSize(),m=0,y=0;s.x+n+u.x>l.x&&(m=s.x+n-l.x+u.x),s.x-m-h.x<0&&(m=s.x-h.x),s.y+i+u.y>l.y&&(y=s.y+i-l.y+u.y),s.y-y-h.y<0&&(y=s.y-h.y),(m||y)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([m,y]))}},_getAnchor:function(){return w(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),qo=function(t,e){return new pe(t,e)};E.mergeOptions({closePopupOnClick:!0}),E.include({openPopup:function(t,e,i){return this._initOverlay(pe,t,e,i).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),at.include({bindPopup:function(t,e){return this._popup=this._initOverlay(pe,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof mt||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){Ct(t);var e=t.layer||t.target;if(this._popup._source===e&&!(e instanceof xt)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=e,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var ve=ct.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){ct.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){ct.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=ct.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",e=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=k("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+g(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i,n=this._map,o=this._container,s=n.latLngToContainerPoint(n.getCenter()),r=n.layerPointToContainerPoint(t),h=this.options.direction,u=o.offsetWidth,l=o.offsetHeight,m=w(this.options.offset),y=this._getAnchor();h==="top"?(e=u/2,i=l):h==="bottom"?(e=u/2,i=0):h==="center"?(e=u/2,i=l/2):h==="right"?(e=0,i=l/2):h==="left"?(e=u,i=l/2):r.xthis.options.maxZoom||in?this._retainParent(o,s,r,n):!1)},_retainChildren:function(t,e,i,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var r=new x(o,s);r.z=i+1;var h=this._tileCoordsToKey(r),u=this._tiles[h];if(u&&u.active){u.retain=!0;continue}else u&&u.loaded&&(u.retain=!0);i+1this.options.maxZoom||this.options.minZoom!==void 0&&o1){this._setView(t,i);return}for(var y=o.min.y;y<=o.max.y;y++)for(var T=o.min.x;T<=o.max.x;T++){var q=new x(T,y);if(q.z=this._tileZoom,!!this._isValidTile(q)){var j=this._tiles[this._tileCoordsToKey(q)];j?j.current=!0:r.push(q)}}if(r.sort(function(J,Bt){return J.distanceTo(s)-Bt.distanceTo(s)}),r.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var nt=document.createDocumentFragment();for(T=0;Ti.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return H(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),o=n.add(i),s=e.unproject(n,t.z),r=e.unproject(o,t.z);return[s,r]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new X(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new x(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(N(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){b(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=A,t.onmousemove=A,v.ielt9&&this.options.opacity<1&&et(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),p(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&K(p(this._tileReady,this,t,null,o)),F(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);i=this._tiles[n],i&&(i.loaded=+new Date,this._map._fadeAnimated?(et(i.el,0),tt(this._fadeFrame),this._fadeFrame=K(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(b(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),v.ielt9||!this._map._fadeAnimated?K(this._pruneTiles,this):setTimeout(p(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new x(this._wrapX?U(t.x,this._wrapX):t.x,this._wrapY?U(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new B(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Xo(t){return new Yt(t)}var At=Yt.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,e=Z(this,e),e.detectRetina&&v.retina&&e.maxZoom>0?(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom=Math.min(e.maxZoom,e.minZoom+1)):(e.zoomOffset++,e.maxZoom=Math.max(e.minZoom,e.maxZoom-1)),e.minZoom=Math.max(0,e.minZoom)):e.zoomReverse?e.minZoom=Math.min(e.maxZoom,e.minZoom):e.maxZoom=Math.max(e.minZoom,e.maxZoom),typeof e.subdomains=="string"&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&e===void 0&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return P(i,"load",p(this._tileOnLoad,this,e,i)),P(i,"error",p(this._tileOnError,this,e,i)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(i.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:v.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return Pt(this._url,_(e,this.options))},_tileOnLoad:function(t,e){v.ielt9?setTimeout(p(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,i=this.options.zoomReverse,n=this.options.zoomOffset;return i&&(t=e-t),t+n},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&(e=this._tiles[t].el,e.onload=A,e.onerror=A,!e.complete)){e.src=te;var i=this._tiles[t].coords;N(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:i})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",te),Yt.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(!(!this._map||i&&i.getAttribute("src")===te))return Yt.prototype._tileReady.call(this,t,e,i)}});function cn(t,e){return new At(t,e)}var fn=At.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=_({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);e=Z(this,e);var o=e.detectRetina&&v.retina?2:1,s=this.getTileSize();i.width=s.x*o,i.height=s.y*o,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,At.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=Y(i.project(e[0]),i.project(e[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===on?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),h=At.prototype.getTileUrl.call(this,t);return h+$t(this.wmsParams,h,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return _(this.wmsParams,t),e||this.redraw(),this}});function Jo(t,e){return new fn(t,e)}At.WMS=fn,cn.wms=Jo;var gt=at.extend({options:{padding:.1},initialize:function(t){Z(this,t),g(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),b(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),s=n.multiplyBy(-i).add(o).subtract(this._map._getNewPixelOrigin(t,e));v.any3d?Lt(this._container,s,i):F(this._container,s)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new B(i,i.add(e.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),dn=gt.extend({options:{tolerance:0},getEvents:function(){var t=gt.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){gt.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");P(t,"mousemove",this._onMouseMove,this),P(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),P(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){tt(this._redrawRequest),delete this._ctx,N(this._container),I(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var e in this._layers)t=this._layers[e],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){gt.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=v.retina?2:1;F(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",v.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){gt.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[g(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[g(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(typeof t.options.dashArray=="string"){var e=t.options.dashArray.split(/[, ]+/),i=[],n,o;for(o=0;o')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),$o={_initContainer:function(){this._container=k("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(gt.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Xt("shape");b(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Xt("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[g(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;N(e),t.removeInteractiveTarget(e),delete this._layers[g(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e||(e=t._stroke=Xt("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=st(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=Xt("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,"+65535*360)},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){zt(t._container)},_bringToBack:function(t){Et(t._container)}},ge=v.vml?Xt:vi,Jt=gt.extend({_initContainer:function(){this._container=ge("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=ge("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){N(this._container),I(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){gt.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;(!this._svgSize||!this._svgSize.equals(e))&&(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),F(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=ge("path");t.options.className&&b(e,t.options.className),t.options.interactive&&b(e,"leaflet-interactive"),this._updateStyle(t),this._layers[g(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){N(t._path),t.removeInteractiveTarget(t._path),delete this._layers[g(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,gi(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n=Math.max(Math.round(t._radiusY),1)||i,o="a"+i+","+n+" 0 1,0 ",s=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+o+i*2+",0 "+o+-i*2+",0 ";this._setPath(t,s)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){zt(t._path)},_bringToBack:function(t){Et(t._path)}});v.vml&&Jt.include($o);function mn(t){return v.svg||v.vml?new Jt(t):null}E.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if(t==="overlayPane"||t===void 0)return!1;var e=this._paneRenderers[t];return e===void 0&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&_n(t)||mn(t)}});var pn=Zt.extend({initialize:function(t,e){Zt.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=H(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Qo(t,e){return new pn(t,e)}Jt.create=ge,Jt.pointsToPath=gi,vt.geometryToLayer=ce,vt.coordsToLatLng=ti,vt.coordsToLatLngs=fe,vt.latLngToCoords=ei,vt.latLngsToCoords=de,vt.getFeature=It,vt.asFeature=_e,E.mergeOptions({boxZoom:!0});var vn=lt.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){P(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){I(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){N(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Wt(),Ne(),this._startPoint=this._map.mouseEventToContainerPoint(t),P(document,{contextmenu:Ct,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=k("div","leaflet-zoom-box",this._container),b(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new B(this._point,this._startPoint),i=e.getSize();F(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(N(this._box),D(this._container,"leaflet-crosshair")),jt(),Re(),I(document,{contextmenu:Ct,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(p(this._resetState,this),0);var e=new X(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});E.addInitHook("addHandler","boxZoom",vn),E.mergeOptions({doubleClickZoom:!0});var gn=lt.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,o=t.originalEvent.shiftKey?i-n:i+n;e.options.doubleClickZoom==="center"?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});E.addInitHook("addHandler","doubleClickZoom",gn),E.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var yn=lt.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new wt(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}b(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){D(this._map._container,"leaflet-grab"),D(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=H(this._map.options.maxBounds);this._offsetLimit=Y(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.xe.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,r=Math.abs(o+i)0?s:-s))-e;this._delta=0,this._startTime=null,r&&(t.options.scrollWheelZoom==="center"?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});E.addInitHook("addHandler","scrollWheelZoom",xn);var ts=600;E.mergeOptions({tapHold:v.touchNative&&v.safari&&v.mobile,tapTolerance:15});var Pn=lt.extend({addHooks:function(){P(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){I(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var e=t.touches[0];this._startPos=this._newPos=new x(e.clientX,e.clientY),this._holdTimeout=setTimeout(p(function(){this._cancel(),this._isTapValid()&&(P(document,"touchend",G),P(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))},this),ts),P(document,"touchend touchcancel contextmenu",this._cancel,this),P(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){I(document,"touchend",G),I(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),I(document,"touchend touchcancel contextmenu",this._cancel,this),I(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new x(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var i=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});i._simulated=!0,e.target.dispatchEvent(i)}});E.addInitHook("addHandler","tapHold",Pn),E.mergeOptions({touchZoom:v.touch,bounceAtZoomLimits:!0});var Ln=lt.extend({addHooks:function(){b(this._map._container,"leaflet-touch-zoom"),P(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){D(this._map._container,"leaflet-touch-zoom"),I(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(!(!t.touches||t.touches.length!==2||e._animatingZoom||this._zooming)){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),e.options.touchZoom!=="center"&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),P(document,"touchmove",this._onTouchMove,this),P(document,"touchend touchcancel",this._onTouchEnd,this),G(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoome.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),e.options.touchZoom==="center"){if(this._center=this._startLatLng,o===1)return}else{var s=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(o===1&&s.x===0&&s.y===0)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),tt(this._animRequest);var r=p(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=K(r,this,!0),G(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,tt(this._animRequest),I(document,"touchmove",this._onTouchMove,this),I(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});E.addInitHook("addHandler","touchZoom",Ln),E.BoxZoom=vn,E.DoubleClickZoom=gn,E.Drag=yn,E.Keyboard=wn,E.ScrollWheelZoom=xn,E.TapHold=Pn,E.TouchZoom=Ln,a.Bounds=B,a.Browser=v,a.CRS=_t,a.Canvas=dn,a.Circle=Qe,a.CircleMarker=le,a.Class=dt,a.Control=rt,a.DivIcon=ln,a.DivOverlay=ct,a.DomEvent=go,a.DomUtil=po,a.Draggable=wt,a.Evented=Nt,a.FeatureGroup=mt,a.GeoJSON=vt,a.GridLayer=Yt,a.Handler=lt,a.Icon=Ot,a.ImageOverlay=me,a.LatLng=O,a.LatLngBounds=X,a.Layer=at,a.LayerGroup=kt,a.LineUtil=ko,a.Map=E,a.Marker=ue,a.Mixin=To,a.Path=xt,a.Point=x,a.PolyUtil=Co,a.Polygon=Zt,a.Polyline=pt,a.Popup=pe,a.PosAnimation=Gi,a.Projection=Oo,a.Rectangle=pn,a.Renderer=gt,a.SVG=Jt,a.SVGOverlay=un,a.TileLayer=At,a.Tooltip=ve,a.Transformation=Te,a.Util=Nn,a.VideoOverlay=hn,a.bind=p,a.bounds=Y,a.canvas=_n,a.circle=Ho,a.circleMarker=Do,a.control=Vt,a.divIcon=Yo,a.extend=_,a.featureGroup=Bo,a.geoJSON=an,a.geoJson=jo,a.gridLayer=Xo,a.icon=No,a.imageOverlay=Uo,a.latLng=z,a.latLngBounds=H,a.layerGroup=Ao,a.map=yo,a.marker=Ro,a.point=w,a.polygon=Wo,a.polyline=Fo,a.popup=qo,a.rectangle=Qo,a.setOptions=Z,a.stamp=g,a.svg=mn,a.svgOverlay=Vo,a.tileLayer=cn,a.tooltip=Ko,a.transformation=Rt,a.version=d,a.videoOverlay=Go;var es=window.L;a.noConflict=function(){return window.L=es,this},window.L=a})})(si,si.exports);var we=si.exports;function li(f,c,a){return Object.freeze({instance:f,context:c,container:a})}function ci(f,c){return c==null?function(d,_){const S=M.useRef();return S.current||(S.current=f(d,_)),S}:function(d,_){const S=M.useRef();S.current||(S.current=f(d,_));const p=M.useRef(d),{instance:R}=S.current;return M.useEffect(function(){p.current!==d&&(c(R,d,p.current),p.current=d)},[R,d,_]),S}}function Ms(f,c){M.useEffect(function(){return(c.layerContainer??c.map).addLayer(f.instance),function(){c.layerContainer?.removeLayer(f.instance),c.map.removeLayer(f.instance)}},[c,f])}function An(f){return function(a){const d=hi(),_=f(ui(a,d),d);return kn(d.map,a.attribution),In(_.current,a.eventHandlers),Ms(_.current,d),_}}function Ss(f,c){const a=ci(f,c),d=An(a);return Ls(d)}function zs(f,c){const a=ci(f),d=Cs(a,c);return bs(d)}function Es(f,c){const a=ci(f,c),d=An(a);return Ts(d)}function ks(f,c,a){const{opacity:d,zIndex:_}=c;d!=null&&d!==a.opacity&&f.setOpacity(d),_!=null&&_!==a.zIndex&&f.setZIndex(_)}function Bn(){return hi().map}function Os(f){const c=Bn();return M.useEffect(function(){return c.on(f),function(){c.off(f)}},[c,f]),c}function ri(){return ri=Object.assign||function(f){for(var c=1;cot?.map??null,[ot]);const Z=M.useCallback(Qt=>{if(Qt!==null&&ot===null){const Pt=new we.Map(Qt,U);a!=null&&V!=null?Pt.setView(a,V):f!=null&&Pt.fitBounds(f,c),g!=null&&Pt.whenReady(g),ft(xs(Pt))}},[]);M.useEffect(()=>()=>{ot?.map.remove()},[ot]);const $t=ot?oi.createElement(Zn,{value:ot},d):p??null;return oi.createElement("div",ri({},Q,{ref:Z}),$t)}const Is=M.forwardRef(Zs),As=Ss(function({position:c,...a},d){const _=new we.Marker(c,a);return li(_,Ps(d,{overlayContainer:_}))},function(c,a,d){a.position!==d.position&&c.setLatLng(a.position),a.icon!=null&&a.icon!==d.icon&&c.setIcon(a.icon),a.zIndexOffset!=null&&a.zIndexOffset!==d.zIndexOffset&&c.setZIndexOffset(a.zIndexOffset),a.opacity!=null&&a.opacity!==d.opacity&&c.setOpacity(a.opacity),c.dragging!=null&&a.draggable!==d.draggable&&(a.draggable===!0?c.dragging.enable():c.dragging.disable())}),Bs=zs(function(c,a){const d=new we.Popup(c,a.overlayContainer);return li(d,a)},function(c,a,{position:d},_){M.useEffect(function(){const{instance:p}=c;function R(V){V.popup===p&&(p.update(),_(!0))}function g(V){V.popup===p&&_(!1)}return a.map.on({popupopen:R,popupclose:g}),a.overlayContainer==null?(d!=null&&p.setLatLng(d),p.openOn(a.map)):a.overlayContainer.bindPopup(p),function(){a.map.off({popupopen:R,popupclose:g}),a.overlayContainer?.unbindPopup(),a.map.removeLayer(p)}},[c,a,_,d])}),Ns=Es(function({url:c,...a},d){const _=new we.TileLayer(c,ui(a,d));return li(_,d)},function(c,a,d){ks(c,a,d);const{url:_}=a;_!=null&&_!==d.url&&c.setUrl(_)});function Rs(f=null){const[c,a]=M.useState(!1),[d,_]=M.useState(f),[S,p]=M.useState(null);function R(){if(!navigator.geolocation)return p("Your browser does not support geolocation");a(!0),navigator.geolocation.getCurrentPosition(g=>{_({lat:g.coords.latitude,lng:g.coords.longitude}),a(!1)},g=>{p(g.message),a(!1)})}return{isLoading:c,position:d,error:S,getPosition:R}}const Ds="_mapContainer_1lbr8_1",Hs="_map_1lbr8_1",Sn={mapContainer:Ds,map:Hs};function Fs({markersRef:f}){const{cities:c}=fs(),[a,d]=M.useState([51,-114]),{isLoading:_,position:S,getPosition:p}=Rs(),[R,g]=ds();M.useEffect(function(){R&&g&&d([R,g])},[R,g]),M.useEffect(function(){S&&d([S.lat,S.lng])},[S]);let V=!0;return window.innerWidth<975&&(V=!1),C.jsxs("div",{className:Sn.mapContainer,children:[!S&&C.jsx(_s,{type:"position",onClick:p,children:_?"Loading...":"Use your position"}),C.jsxs(Is,{center:a,zoom:6,scrollWheelZoom:V,className:Sn.map,zoomControl:!V,children:[C.jsx(Ns,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png"}),c.map(U=>C.jsx(As,{position:[U.position.lat,U.position.lng],ref:A=>f.current[U.id]=A,eventHandlers:{click:()=>window.location=`#/app/cities/${U.id}?lat=${U.position.lat}&lng=${U.position.lng}`},children:C.jsxs(Bs,{children:[C.jsx("span",{children:U.emoji})," ",C.jsx("span",{children:U.cityName})]})},U.id)),C.jsx(Ws,{position:a}),C.jsx(js,{})]})]})}function Ws({position:f}){return Bn().setView(f),null}function js(){const f=zn();Os({click:c=>f(`form?lat=${c.latlng.lat}&lng=${c.latlng.lng}`)})}const Us="_nav_89j0t_1",Gs={nav:Us};function Vs(){return C.jsx("nav",{className:Gs.nav,children:C.jsxs("ul",{children:[C.jsx("li",{children:C.jsx(Mn,{to:"cities",children:"Cities"})}),C.jsx("li",{children:C.jsx(Mn,{to:"countries",children:"Countries"})})]})})}const qs="_sidebar_wjzwv_1",Ks="_footer_wjzwv_53",Ys="_copyright_wjzwv_67",ai={sidebar:qs,footer:Ks,copyright:Ys};function Xs(){return C.jsx("footer",{className:ai.footer,children:C.jsxs("p",{className:ai.copyright,children:["© ",new Date().getFullYear()," by GeoNotes"]})})}function Js({markersRef:f}){return C.jsxs("div",{className:ai.sidebar,children:[C.jsxs(En,{to:"/app/cities",children:[C.jsx(vs,{}),C.jsx(gs,{})]}),C.jsx(Vs,{}),C.jsx(ms,{context:f}),C.jsx(Xs,{})]})}function $s(f){return C.jsx("svg",{viewBox:"0 0 512 512",fill:"white",height:"1em",width:"1em",...f,children:C.jsx("path",{fill:"none",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:32,d:"M262.29 192.31a64 64 0 1057.4 57.4 64.13 64.13 0 00-57.4-57.4zM416.39 256a154.34 154.34 0 01-1.53 20.79l45.21 35.46a10.81 10.81 0 012.45 13.75l-42.77 74a10.81 10.81 0 01-13.14 4.59l-44.9-18.08a16.11 16.11 0 00-15.17 1.75A164.48 164.48 0 01325 400.8a15.94 15.94 0 00-8.82 12.14l-6.73 47.89a11.08 11.08 0 01-10.68 9.17h-85.54a11.11 11.11 0 01-10.69-8.87l-6.72-47.82a16.07 16.07 0 00-9-12.22 155.3 155.3 0 01-21.46-12.57 16 16 0 00-15.11-1.71l-44.89 18.07a10.81 10.81 0 01-13.14-4.58l-42.77-74a10.8 10.8 0 012.45-13.75l38.21-30a16.05 16.05 0 006-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 00-6.07-13.94l-38.19-30A10.81 10.81 0 0149.48 186l42.77-74a10.81 10.81 0 0113.14-4.59l44.9 18.08a16.11 16.11 0 0015.17-1.75A164.48 164.48 0 01187 111.2a15.94 15.94 0 008.82-12.14l6.73-47.89A11.08 11.08 0 01213.23 42h85.54a11.11 11.11 0 0110.69 8.87l6.72 47.82a16.07 16.07 0 009 12.22 155.3 155.3 0 0121.46 12.57 16 16 0 0015.11 1.71l44.89-18.07a10.81 10.81 0 0113.14 4.58l42.77 74a10.8 10.8 0 01-2.45 13.75l-38.21 30a16.05 16.05 0 00-6.05 14.08c.33 4.14.55 8.3.55 12.47z"})})}const Qs="_user_b6zpr_1",tr={user:Qs};function er(){const[f,c]=M.useState(""),{user:a,logout:d,isReadOnly:_}=ps(),S=zn();let{attributes:p}=a;p||(p=a.challengeParam.userAttributes),M.useEffect(()=>{async function g(){const V=await ys.get(p.picture,{level:"private"});c(V)}p.picture!=="demo.jpg"&&g()},[p.picture]);function R(){d(),S("/")}return C.jsxs("div",{className:tr.user,children:[C.jsx("img",{src:f||"/assets/img/no-profile.png",alt:p.name,title:p.name}),C.jsxs("span",{children:["Welcome, ",p.name]}),C.jsx("button",{onClick:R,children:"Logout"}),_?null:C.jsx(En,{to:"/update-profile",title:"Update profile",style:{padding:"0 10px"},children:C.jsx($s,{})})]})}const ir="_app_9qm7f_1",nr={app:ir};function ar(){const f=M.useRef([]);return C.jsxs("div",{className:nr.app,children:[C.jsx(Js,{markersRef:f}),C.jsx(Fs,{markersRef:f}),C.jsx(er,{})]})}export{ar as default};
diff --git a/assets/Confirm-b9445469.js b/assets/Confirm-e656eb9e.js
similarity index 80%
rename from assets/Confirm-b9445469.js
rename to assets/Confirm-e656eb9e.js
index 369b957..1cfe4bc 100644
--- a/assets/Confirm-b9445469.js
+++ b/assets/Confirm-e656eb9e.js
@@ -1 +1 @@
-import{r as p,a as x,u as d,j as t,B as h,I as g,A as j,_ as a,s as r}from"./index-2fb86547.js";import{s as i,F as y}from"./FormRow-8cffbd9d.js";import{P as v}from"./PageNav-01d4a54f.js";import"./Title-32f6af34.js";function F(){const[s,e]=p.useState(""),{state:c}=x(),m=d(),n=c.email,l={htmlFor:"code",text:"Enter Code:",type:"text",id:"code",handleFn:e,value:s};async function f(u){u.preventDefault();try{const o=await j.confirmSignUp(n,s);console.log(o),a.success("Confirmation successful!",{style:{fontSize:"20px"}}),await r(2500),m("/login")}catch(o){a.error(o,{style:{fontSize:"20px"}}),console.log("Error confirming sign up",o),await r(2500)}e("")}return t.jsxs("main",{className:i.login,children:[t.jsx(v,{}),t.jsx("h1",{children:`Confirmation email sent to ${n}.`}),t.jsxs("form",{className:i.form,onSubmit:f,children:[t.jsx(y,{...l}),t.jsx("div",{children:t.jsx(h,{type:"primary",children:"Confirm"})})]}),t.jsx(g,{position:"bottom-center"})]})}export{F as default};
+import{r as p,a as x,u as d,j as t,B as h,I as g,A as j,_ as a,s as r}from"./index-f6be71a9.js";import{s as i,F as y}from"./FormRow-c86a29ab.js";import{P as v}from"./PageNav-171a5a02.js";import"./Title-b7c7a7ef.js";function F(){const[s,e]=p.useState(""),{state:c}=x(),m=d(),n=c.email,l={htmlFor:"code",text:"Enter Code:",type:"text",id:"code",handleFn:e,value:s};async function f(u){u.preventDefault();try{const o=await j.confirmSignUp(n,s);console.log(o),a.success("Confirmation successful!",{style:{fontSize:"20px"}}),await r(2500),m("/login")}catch(o){a.error(o,{style:{fontSize:"20px"}}),console.log("Error confirming sign up",o),await r(2500)}e("")}return t.jsxs("main",{className:i.login,children:[t.jsx(v,{}),t.jsx("h1",{children:`Confirmation email sent to ${n}.`}),t.jsxs("form",{className:i.form,onSubmit:f,children:[t.jsx(y,{...l}),t.jsx("div",{children:t.jsx(h,{type:"primary",children:"Confirm"})})]}),t.jsx(g,{position:"bottom-center"})]})}export{F as default};
diff --git a/assets/FormRow-8cffbd9d.js b/assets/FormRow-c86a29ab.js
similarity index 83%
rename from assets/FormRow-8cffbd9d.js
rename to assets/FormRow-c86a29ab.js
index 1605a2b..793c640 100644
--- a/assets/FormRow-8cffbd9d.js
+++ b/assets/FormRow-c86a29ab.js
@@ -1 +1 @@
-import{j as o}from"./index-2fb86547.js";const c="_login_tvskx_1",i="_form_tvskx_41",x="_row_tvskx_97",f={login:c,form:i,row:x};function _({htmlFor:s,text:r,type:t,id:n,handleFn:l,value:e}){return o.jsxs("div",{className:_.row,children:[o.jsx("label",{htmlFor:s,children:r}),o.jsx("input",{style:{color:"black"},type:t,id:n,onChange:a=>l(a.target.value),value:e})]})}export{_ as F,f as s};
+import{j as o}from"./index-f6be71a9.js";const c="_login_tvskx_1",i="_form_tvskx_41",x="_row_tvskx_97",f={login:c,form:i,row:x};function _({htmlFor:s,text:r,type:t,id:n,handleFn:l,value:e}){return o.jsxs("div",{className:_.row,children:[o.jsx("label",{htmlFor:s,children:r}),o.jsx("input",{style:{color:"black"},type:t,id:n,onChange:a=>l(a.target.value),value:e})]})}export{_ as F,f as s};
diff --git a/assets/Homepage-a1972118.js b/assets/Homepage-a40f4570.js
similarity index 81%
rename from assets/Homepage-a1972118.js
rename to assets/Homepage-a40f4570.js
index 4e2b9b2..1751d94 100644
--- a/assets/Homepage-a1972118.js
+++ b/assets/Homepage-a40f4570.js
@@ -1 +1 @@
-import{j as e,L as o}from"./index-2fb86547.js";import{P as r}from"./PageNav-01d4a54f.js";import"./Title-32f6af34.js";const s="_homepage_tvfkc_1",t={homepage:s};function c(){return e.jsxs("main",{className:t.homepage,children:[e.jsx(r,{}),e.jsxs("section",{children:[e.jsxs("h1",{children:["You travel the world.",e.jsx("br",{}),"GeoNotes keeps track of your adventures."]}),e.jsx("h2",{children:"A world map that tracks your footsteps into every city you can think of. Never forget your wonderful experiences, and show your friends & family how you have wandered the world."}),e.jsx(o,{to:"/login",className:"cta",children:"Start tracking now"})]})]})}export{c as default};
+import{j as e,L as o}from"./index-f6be71a9.js";import{P as r}from"./PageNav-171a5a02.js";import"./Title-b7c7a7ef.js";const s="_homepage_tvfkc_1",t={homepage:s};function c(){return e.jsxs("main",{className:t.homepage,children:[e.jsx(r,{}),e.jsxs("section",{children:[e.jsxs("h1",{children:["You travel the world.",e.jsx("br",{}),"GeoNotes keeps track of your adventures."]}),e.jsx("h2",{children:"A world map that tracks your footsteps into every city you can think of. Never forget your wonderful experiences, and show your friends & family how you have wandered the world."}),e.jsx(o,{to:"/login",className:"cta",children:"Start tracking now"})]})]})}export{c as default};
diff --git a/assets/Login-d6dfd937.js b/assets/Login-814e488d.js
similarity index 87%
rename from assets/Login-d6dfd937.js
rename to assets/Login-814e488d.js
index 45e5164..f5f4462 100644
--- a/assets/Login-d6dfd937.js
+++ b/assets/Login-814e488d.js
@@ -1 +1 @@
-import{r as a,b as g,c as j,u as v,j as s,S as y,B as S}from"./index-2fb86547.js";import{P as w}from"./PageNav-01d4a54f.js";import{s as p,F}from"./FormRow-8cffbd9d.js";import"./Title-32f6af34.js";function P(){const[t,m]=a.useState(""),[i,u]=a.useState(""),[c,o]=a.useState(!1),{login:h,isAuthenticated:n,dispatch:r}=g(),{dispatch:d}=j(),l=v();function f(e){o(!0),e.preventDefault(),t&&i&&h(t,i),setTimeout(()=>o(!1),1500)}a.useEffect(function(){if(n){const e=t.split("@")[0];d({type:"db/load",payload:e}),e!=="demo"&&r({type:"user/approved"}),l("/app",{replace:!0})}},[n,l,r,d,t]);const x=[{htmlFor:"email",text:"Email Address",type:"email",id:"email",handleFn:m,value:t},{htmlFor:"password",text:"Password",type:"password",id:"password",handleFn:u,value:i}];return s.jsxs("main",{className:p.login,children:[s.jsx(w,{}),s.jsx("h1",{children:"Login"}),s.jsxs("form",{className:p.form,onSubmit:f,children:[x.map(e=>s.jsx(F,{...e},e.id)),s.jsx("div",{children:c?s.jsx(y,{}):s.jsx(S,{type:"primary",children:"Sign in"})})]})]})}export{P as default};
+import{r as a,b as g,c as j,u as v,j as s,S as y,B as S}from"./index-f6be71a9.js";import{P as w}from"./PageNav-171a5a02.js";import{s as p,F}from"./FormRow-c86a29ab.js";import"./Title-b7c7a7ef.js";function P(){const[t,m]=a.useState(""),[i,u]=a.useState(""),[c,o]=a.useState(!1),{login:h,isAuthenticated:n,dispatch:r}=g(),{dispatch:d}=j(),l=v();function f(e){o(!0),e.preventDefault(),t&&i&&h(t,i),setTimeout(()=>o(!1),1500)}a.useEffect(function(){if(n){const e=t.split("@")[0];d({type:"db/load",payload:e}),e!=="demo"&&r({type:"user/approved"}),l("/app",{replace:!0})}},[n,l,r,d,t]);const x=[{htmlFor:"email",text:"Email Address",type:"email",id:"email",handleFn:m,value:t},{htmlFor:"password",text:"Password",type:"password",id:"password",handleFn:u,value:i}];return s.jsxs("main",{className:p.login,children:[s.jsx(w,{}),s.jsx("h1",{children:"Login"}),s.jsxs("form",{className:p.form,onSubmit:f,children:[x.map(e=>s.jsx(F,{...e},e.id)),s.jsx("div",{children:c?s.jsx(y,{}):s.jsx(S,{type:"primary",children:"Sign in"})})]})]})}export{P as default};
diff --git a/assets/PageNav-01d4a54f.js b/assets/PageNav-171a5a02.js
similarity index 80%
rename from assets/PageNav-01d4a54f.js
rename to assets/PageNav-171a5a02.js
index 5003be6..db62544 100644
--- a/assets/PageNav-01d4a54f.js
+++ b/assets/PageNav-171a5a02.js
@@ -1 +1 @@
-import{j as n,L as t,N as s}from"./index-2fb86547.js";import{L as c,T as e}from"./Title-32f6af34.js";const l="_nav_1by9v_1",r="_ctaLink_1by9v_81",i={nav:l,ctaLink:r};function x(){return n.jsxs("nav",{className:i.nav,children:[n.jsxs(t,{to:"/",style:{display:"flex",justifyContent:"center"},children:[n.jsx(c,{}),n.jsx(e,{})]}),n.jsxs("ul",{children:[n.jsx("li",{children:n.jsx(s,{to:"/pricing",children:"Pricing"})}),n.jsx("li",{children:n.jsx(s,{to:"/product",children:"Product"})}),n.jsx("li",{children:n.jsx(s,{to:"/signup",children:"Sign Up"})}),n.jsx("li",{children:n.jsx(s,{to:"/login",className:i.ctaLink,children:"Login"})})]})]})}export{x as P};
+import{j as n,L as t,N as s}from"./index-f6be71a9.js";import{L as c,T as e}from"./Title-b7c7a7ef.js";const l="_nav_1by9v_1",r="_ctaLink_1by9v_81",i={nav:l,ctaLink:r};function x(){return n.jsxs("nav",{className:i.nav,children:[n.jsxs(t,{to:"/",style:{display:"flex",justifyContent:"center"},children:[n.jsx(c,{}),n.jsx(e,{})]}),n.jsxs("ul",{children:[n.jsx("li",{children:n.jsx(s,{to:"/pricing",children:"Pricing"})}),n.jsx("li",{children:n.jsx(s,{to:"/product",children:"Product"})}),n.jsx("li",{children:n.jsx(s,{to:"/signup",children:"Sign Up"})}),n.jsx("li",{children:n.jsx(s,{to:"/login",className:i.ctaLink,children:"Login"})})]})]})}export{x as P};
diff --git a/assets/PageNotFound-1925303c.js b/assets/PageNotFound-671b74ba.js
similarity index 57%
rename from assets/PageNotFound-1925303c.js
rename to assets/PageNotFound-671b74ba.js
index 978185e..b683cbe 100644
--- a/assets/PageNotFound-1925303c.js
+++ b/assets/PageNotFound-671b74ba.js
@@ -1 +1 @@
-import{j as n}from"./index-2fb86547.js";function t(){return n.jsx("div",{children:n.jsx("h1",{children:"Page not found 😢"})})}export{t as default};
+import{j as n}from"./index-f6be71a9.js";function t(){return n.jsx("div",{children:n.jsx("h1",{children:"Page not found 😢"})})}export{t as default};
diff --git a/assets/Pricing-1a3b556a.js b/assets/Pricing-8ab14912.js
similarity index 76%
rename from assets/Pricing-1a3b556a.js
rename to assets/Pricing-8ab14912.js
index 3f4bbf9..c5f499b 100644
--- a/assets/Pricing-1a3b556a.js
+++ b/assets/Pricing-8ab14912.js
@@ -1 +1 @@
-import{j as e}from"./index-2fb86547.js";import{P as s}from"./PageNav-01d4a54f.js";import{s as i}from"./Product.module-e3f440f7.js";import"./Title-32f6af34.js";function l(){return e.jsxs("main",{className:i.product,children:[e.jsx(s,{}),e.jsxs("section",{children:[e.jsxs("div",{children:[e.jsx("h2",{style:{marginBottom:"0px"},children:"Simple pricing. Free."}),e.jsx("span",{style:{fontSize:"10px",color:"grey"},children:"(For friends & family of Colin Huber)"}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("p",{children:"I believe in making travel experiences accessible to all, which is why the travel journal web app is free."})]}),e.jsx("img",{src:"/WorldWise/assets/img/img-2.jpg",alt:"overview of a large city with skyscrapers",style:{maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"}})]})]})}export{l as default};
+import{j as e}from"./index-f6be71a9.js";import{P as s}from"./PageNav-171a5a02.js";import{s as i}from"./Product.module-e3f440f7.js";import"./Title-b7c7a7ef.js";function l(){return e.jsxs("main",{className:i.product,children:[e.jsx(s,{}),e.jsxs("section",{children:[e.jsxs("div",{children:[e.jsx("h2",{style:{marginBottom:"0px"},children:"Simple pricing. Free."}),e.jsx("span",{style:{fontSize:"10px",color:"grey"},children:"(For friends & family of Colin Huber)"}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("p",{children:"I believe in making travel experiences accessible to all, which is why the travel journal web app is free."})]}),e.jsx("img",{src:"/WorldWise/assets/img/img-2.jpg",alt:"overview of a large city with skyscrapers",style:{maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"}})]})]})}export{l as default};
diff --git a/assets/Product-90b3b715.js b/assets/Product-610b0a9f.js
similarity index 83%
rename from assets/Product-90b3b715.js
rename to assets/Product-610b0a9f.js
index 4c4f620..3b9d46b 100644
--- a/assets/Product-90b3b715.js
+++ b/assets/Product-610b0a9f.js
@@ -1 +1 @@
-import{j as e}from"./index-2fb86547.js";import{P as o}from"./PageNav-01d4a54f.js";import{s as i}from"./Product.module-e3f440f7.js";import"./Title-32f6af34.js";function n({name:t,href:r}){const s={textDecoration:"inherit",color:"inherit"};return e.jsx("a",{href:r,rel:"noopener noreferrer",target:"_blank",style:s,children:e.jsx("li",{children:t})})}const a=[{name:"👉 AWS Amplify",href:"https://aws.amazon.com/amplify"},{name:"👉 React 18",href:"https://react.dev/"},{name:"👉 Vite",href:"https://vitejs.dev/"},{name:"👉 Pockethost.io",href:"https://pockethost.io/"},{name:"👉 Leaflet",href:"https://leafletjs.com/"},{name:"👉 CKEditor",href:"https://ckeditor.com/"}];function p(){return e.jsxs("main",{className:i.product,children:[e.jsx(o,{}),e.jsxs("section",{children:[e.jsx("img",{src:"/WorldWise/assets/img/img-1.jpg",alt:"person with dog overlooking mountain with sunset"}),e.jsxs("div",{children:[e.jsx("h2",{children:"About GeoNotes."}),e.jsx("p",{children:"GeoNotes is powered by:"}),e.jsx("ul",{style:{fontSize:"15px",listStyleType:"none"},children:a.map((t,r)=>e.jsx(n,{...t},`provider-${r}`))})]})]})]})}export{p as default};
+import{j as e}from"./index-f6be71a9.js";import{P as o}from"./PageNav-171a5a02.js";import{s as i}from"./Product.module-e3f440f7.js";import"./Title-b7c7a7ef.js";function n({name:t,href:r}){const s={textDecoration:"inherit",color:"inherit"};return e.jsx("a",{href:r,rel:"noopener noreferrer",target:"_blank",style:s,children:e.jsx("li",{children:t})})}const a=[{name:"👉 AWS Amplify",href:"https://aws.amazon.com/amplify"},{name:"👉 React 18",href:"https://react.dev/"},{name:"👉 Vite",href:"https://vitejs.dev/"},{name:"👉 Pockethost.io",href:"https://pockethost.io/"},{name:"👉 Leaflet",href:"https://leafletjs.com/"},{name:"👉 CKEditor",href:"https://ckeditor.com/"}];function p(){return e.jsxs("main",{className:i.product,children:[e.jsx(o,{}),e.jsxs("section",{children:[e.jsx("img",{src:"/WorldWise/assets/img/img-1.jpg",alt:"person with dog overlooking mountain with sunset"}),e.jsxs("div",{children:[e.jsx("h2",{children:"About GeoNotes."}),e.jsx("p",{children:"GeoNotes is powered by:"}),e.jsx("ul",{style:{fontSize:"15px",listStyleType:"none"},children:a.map((t,r)=>e.jsx(n,{...t},`provider-${r}`))})]})]})]})}export{p as default};
diff --git a/assets/SignUp-249e213e.js b/assets/SignUp-4d680bac.js
similarity index 91%
rename from assets/SignUp-249e213e.js
rename to assets/SignUp-4d680bac.js
index 6e09885..3860f8a 100644
--- a/assets/SignUp-249e213e.js
+++ b/assets/SignUp-4d680bac.js
@@ -1 +1 @@
-import{r as o,u as R,j as s,S as _,B as z,_ as i,A as B,s as p}from"./index-2fb86547.js";import{p as K,A as G}from"./index-7090c0c1.js";import{P as M}from"./PageNav-01d4a54f.js";import{s as b,F as T}from"./FormRow-8cffbd9d.js";import{S as W}from"./Storage-1d28fdda.js";import"./Title-32f6af34.js";const l={fontSize:"20px"},q="cbhuber@gmail.com,demo@demo.com".split(",");function u(e){i.error(e,{style:l}),p(2500)}function H(e){var t=/\S+@\S+\.\S+/;return t.test(e)}function m(e,t){return e?!0:(i.error(`${t} cannot be empty`,{style:l}),!1)}function J(e,t,c){return!m(e,"Email")||!m(t,"Password")||!m(c,"Password confirmation")?!1:H(e)?t!==c?(i.error("Passwords to not match",{style:l}),!1):!0:(i.error("Invalid email.",{style:l}),!1)}function O(e,t){return!(!m(e,"First name cannot be empty")||!m(t,"Last name cannot be empty"))}function te(){const[e,t]=o.useState(""),[c,f]=o.useState(""),[h,y]=o.useState(""),[w,P]=o.useState(""),[x,j]=o.useState(""),[E,N]=o.useState(""),[U,S]=o.useState(!1),A=R();async function k(a,r,v,g,F,$,d,L,D){if(a.preventDefault(),!!J(r,F,$)&&O(v,g)){if(!q.includes(r)){console.log(`${r} not allowed`),i.error(`User ${r} does not have permission. Contact the app admin for access.`,{style:l});return}try{S(!0),await B.signUp({username:r,password:F,attributes:{email:r,name:v,family_name:g,picture:d.name}}),await W.put(d.name,d,{level:"private",contentType:"image/*",completeCallback:n=>{console.log(`Successfully uploaded ${n.key}`)},errorCallback:n=>{console.error("Unexpected error while uploading",n)}}),i.success("Successfully signed up!",{style:l}),await p(2500),A("/confirm",{state:{email:r}})}catch(n){switch(S(!1),n.name){case"UsernameExistsException":u(`User account email ${r} already exists. Use a different email.`);break;case"InvalidAccessKeyId":u("Invalid AWS Access Key ID. Contact your app administrator.");break;case"InvalidPasswordException":u("Passwords did not confirm to the policy: min 8 characters, with at least: 1 uppercase, 1 lowercase");break;default:throw console.log("Unknown exception: ",n),u(n),await p(2500),n}L(""),D("")}}}async function C(a){N(a.target.files[0])}const I=[{htmlFor:"email",text:"Email Address",type:"email",id:"email",handleFn:t,value:e},{htmlFor:"first",text:"First Name",type:"text",id:"first",handleFn:P,value:w},{htmlFor:"last",text:"Last Name",type:"text",id:"last",handleFn:j,value:x},{htmlFor:"password",text:K("Password
Min 8 characters, containing at least: 1 uppercase, 1 lowercase, 1 numeric"),type:"password",id:"password",handleFn:f,value:c},{htmlFor:"passwordConfirm",text:"Password Confirm",type:"password",id:"passwordConfirm",handleFn:y,value:h}];return s.jsxs("main",{className:b.login,children:[s.jsx(M,{}),s.jsx("h1",{children:"Sign up for GeoNotes!"}),s.jsxs("form",{className:b.form,onSubmit:a=>k(a,e,w,x,c,h,E,f,y),children:[I.map(a=>s.jsx(T,{...a},a.id)),s.jsx(G,{handleFile:C}),s.jsx("div",{children:U?s.jsx(_,{}):s.jsx(z,{type:"primary",children:"Sign Up"})})]})]})}export{te as default};
+import{r as o,u as R,j as s,S as _,B as z,_ as i,A as B,s as p}from"./index-f6be71a9.js";import{p as K,A as G}from"./index-b6740a27.js";import{P as M}from"./PageNav-171a5a02.js";import{s as b,F as T}from"./FormRow-c86a29ab.js";import{S as W}from"./Storage-23dae41d.js";import"./Title-b7c7a7ef.js";const l={fontSize:"20px"},q="cbhuber@gmail.com,demo@demo.com".split(",");function u(e){i.error(e,{style:l}),p(2500)}function H(e){var t=/\S+@\S+\.\S+/;return t.test(e)}function m(e,t){return e?!0:(i.error(`${t} cannot be empty`,{style:l}),!1)}function J(e,t,c){return!m(e,"Email")||!m(t,"Password")||!m(c,"Password confirmation")?!1:H(e)?t!==c?(i.error("Passwords to not match",{style:l}),!1):!0:(i.error("Invalid email.",{style:l}),!1)}function O(e,t){return!(!m(e,"First name cannot be empty")||!m(t,"Last name cannot be empty"))}function te(){const[e,t]=o.useState(""),[c,f]=o.useState(""),[h,y]=o.useState(""),[w,P]=o.useState(""),[x,j]=o.useState(""),[E,N]=o.useState(""),[U,S]=o.useState(!1),A=R();async function k(a,r,v,g,F,$,d,L,D){if(a.preventDefault(),!!J(r,F,$)&&O(v,g)){if(!q.includes(r)){console.log(`${r} not allowed`),i.error(`User ${r} does not have permission. Contact the app admin for access.`,{style:l});return}try{S(!0),await B.signUp({username:r,password:F,attributes:{email:r,name:v,family_name:g,picture:d.name}}),await W.put(d.name,d,{level:"private",contentType:"image/*",completeCallback:n=>{console.log(`Successfully uploaded ${n.key}`)},errorCallback:n=>{console.error("Unexpected error while uploading",n)}}),i.success("Successfully signed up!",{style:l}),await p(2500),A("/confirm",{state:{email:r}})}catch(n){switch(S(!1),n.name){case"UsernameExistsException":u(`User account email ${r} already exists. Use a different email.`);break;case"InvalidAccessKeyId":u("Invalid AWS Access Key ID. Contact your app administrator.");break;case"InvalidPasswordException":u("Passwords did not confirm to the policy: min 8 characters, with at least: 1 uppercase, 1 lowercase");break;default:throw console.log("Unknown exception: ",n),u(n),await p(2500),n}L(""),D("")}}}async function C(a){N(a.target.files[0])}const I=[{htmlFor:"email",text:"Email Address",type:"email",id:"email",handleFn:t,value:e},{htmlFor:"first",text:"First Name",type:"text",id:"first",handleFn:P,value:w},{htmlFor:"last",text:"Last Name",type:"text",id:"last",handleFn:j,value:x},{htmlFor:"password",text:K("Password
Min 8 characters, containing at least: 1 uppercase, 1 lowercase, 1 numeric"),type:"password",id:"password",handleFn:f,value:c},{htmlFor:"passwordConfirm",text:"Password Confirm",type:"password",id:"passwordConfirm",handleFn:y,value:h}];return s.jsxs("main",{className:b.login,children:[s.jsx(M,{}),s.jsx("h1",{children:"Sign up for GeoNotes!"}),s.jsxs("form",{className:b.form,onSubmit:a=>k(a,e,w,x,c,h,E,f,y),children:[I.map(a=>s.jsx(T,{...a},a.id)),s.jsx(G,{handleFile:C}),s.jsx("div",{children:U?s.jsx(_,{}):s.jsx(z,{type:"primary",children:"Sign Up"})})]})]})}export{te as default};
diff --git a/assets/Storage-1d28fdda.js b/assets/Storage-23dae41d.js
similarity index 99%
rename from assets/Storage-1d28fdda.js
rename to assets/Storage-23dae41d.js
index cda705b..ba80652 100644
--- a/assets/Storage-1d28fdda.js
+++ b/assets/Storage-23dae41d.js
@@ -1,4 +1,4 @@
-import{g as an,h as Jt,i as sn,k as on,l as un,C as _e,m as ot,p as X,n as ln,o as cn,q as fn,t as dn,v as hn,w as Qt,x as At,y as W,U as gn,H as er,z as pn,D as Ce,E as ve,F as vn,G as tr,J as yn}from"./index-2fb86547.js";var rr=function(r){return Object.keys(r).map(function(n){return n.toLowerCase()}).sort().join(";")},bn="X-Amz-Algorithm",nr="X-Amz-Date",mn="X-Amz-Credential",wn="X-Amz-Expires",En="X-Amz-Signature",_n="X-Amz-SignedHeaders",ir="X-Amz-Security-Token",Sn="authorization",ut="host",Tn=nr.toLowerCase(),Cn=ir.toLowerCase(),ar="aws4_request",wt="AWS4-HMAC-SHA256",xn="AWS4",sr="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",Nn="UNSIGNED-PAYLOAD",Pn=function(r,n,e){return"".concat(r,"/").concat(n,"/").concat(e,"/").concat(ar)},On=function(r){var n=r.toISOString().replace(/[:\-]|\.\d{3}/g,"");return{longDate:n,shortDate:n.slice(0,8)}},or=function(r){var n=r.credentials,e=r.signingDate,a=e===void 0?new Date:e,i=r.signingRegion,t=r.signingService,o=r.uriEscapePath,u=o===void 0?!0:o,c=n.accessKeyId,s=n.secretAccessKey,l=n.sessionToken,f=On(a),h=f.longDate,d=f.shortDate,g=Pn(d,i,t);return{accessKeyId:c,credentialScope:g,longDate:h,secretAccessKey:s,sessionToken:l,shortDate:d,signingRegion:i,signingService:t,uriEscapePath:u}},ur={};for(var Fe=0;Fe<256;Fe++){var Ge=Fe.toString(16).toLowerCase();Ge.length===1&&(Ge="0"+Ge),ur[Fe]=Ge}function An(r){for(var n="",e=0;e0)&&!(i=a.next()).done;)t.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return t},Un=function(r){return Object.entries(r).map(function(n){var e,a=kn(n,2),i=a[0],t=a[1];return{key:i.toLowerCase(),value:(e=t?.trim().replace(/\s+/g," "))!==null&&e!==void 0?e:""}}).sort(function(n,e){return n.key0)&&!(i=a.next()).done;)t.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return t},Un=function(r){return Object.entries(r).map(function(n){var e,a=kn(n,2),i=a[0],t=a[1];return{key:i.toLowerCase(),value:(e=t?.trim().replace(/\s+/g," "))!==null&&e!==void 0?e:""}}).sort(function(n,e){return n.key0)&&!(i=a.next()).done;)t.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return t},Ln=function(r){return Array.from(r).sort(function(n,e){var a=it(n,2),i=a[0],t=a[1],o=it(e,2),u=o[0],c=o[1];return i===u?t0)&&!(i=a.next()).done;)t.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return t},Vn=function(r,n){var e,a,i,t,o=r.body,u=r.method,c=u===void 0?"GET":u,s=r.url,l=n.expiration,f=Fn(n,["expiration"]),h=or(f),d=h.accessKeyId,g=h.credentialScope,p=h.longDate,v=h.sessionToken,m=new URL(s);Object.entries(He(He((e={},e[bn]=wt,e[mn]="".concat(d,"/").concat(g),e[nr]=p,e[_n]=ut,e),l&&(a={},a[wn]=l.toString(),a)),v&&(i={},i[ir]=v,i))).forEach(function(E){var x=Gn(E,2),H=x[0],M=x[1];m.searchParams.append(H,M)});var y={body:o,headers:(t={},t[ut]=s.host,t),method:c,url:m},S=cr(y,h);return m.searchParams.append(En,S),m},fr=function(r){return new Date(Date.now()+r)},Dn=5*60*1e3,Hn=function(r,n){return Math.abs(fr(n).getTime()-r)>=Dn},qn=function(r,n){return Hn(r,n)?r-Date.now():n},Xn=globalThis&&globalThis.__awaiter||function(r,n,e,a){function i(t){return t instanceof e?t:new e(function(o){o(t)})}return new(e||(e=Promise))(function(t,o){function u(l){try{s(a.next(l))}catch(f){o(f)}}function c(l){try{s(a.throw(l))}catch(f){o(f)}}function s(l){l.done?t(l.value):i(l.value).then(u,c)}s((a=a.apply(r,n||[])).next())})},Wn=globalThis&&globalThis.__generator||function(r,n){var e={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,i,t,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(s){return function(l){return c([s,l])}}function c(s){if(a)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(e=0)),e;)try{if(a=1,i&&(t=s[0]&2?i.return:s[0]?i.throw||((t=i.return)&&t.call(i),0):i.next)&&!(t=t.call(i,s[1])).done)return t;switch(i=0,t&&(s=[s[0]&2,t.value]),s[0]){case 0:case 1:t=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,i=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(t=e.trys,!(t=t.length>0&&t[t.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!t||s[1]>t[0]&&s[1]0&&t[t.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!t||s[1]>t[0]&&s[1]"u")};r.isExist=function(u){return typeof u<"u"},r.isEmptyObject=function(u){return Object.keys(u).length===0},r.merge=function(u,c,s){if(c){const l=Object.keys(c),f=l.length;for(let h=0;h"&&r[t]!==" "&&r[t]!==" "&&r[t]!==`
diff --git a/assets/Title-32f6af34.js b/assets/Title-32f6af34.js
deleted file mode 100644
index f0278d1..0000000
--- a/assets/Title-32f6af34.js
+++ /dev/null
@@ -1 +0,0 @@
-import{j as o}from"./index-2fb86547.js";const t="_logo_v4r9o_1",e={logo:t};function r(){return o.jsx("img",{src:"/WorldWise/assets/img/logo.png",alt:"GeoNotes logo",className:e.logo})}function a(){return o.jsx("h1",{style:{fontSize:"48px",background:"-webkit-linear-gradient(left, #cfbdaa, #b5a370)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontFamily:"'Brandmark Serif 6'",fontStyle:"normal",fontWeight:"normal",fontVariantLigatures:"normal"},children:"GeoNotes"})}export{r as L,a as T};
diff --git a/assets/Title-b7c7a7ef.js b/assets/Title-b7c7a7ef.js
new file mode 100644
index 0000000..558b439
--- /dev/null
+++ b/assets/Title-b7c7a7ef.js
@@ -0,0 +1 @@
+import{j as o}from"./index-f6be71a9.js";const t="_logo_v4r9o_1",e={logo:t};function r(){return o.jsx("img",{src:"/assets/img/logo.png",alt:"GeoNotes logo",className:e.logo})}function a(){return o.jsx("h1",{style:{fontSize:"48px",background:"-webkit-linear-gradient(left, #cfbdaa, #b5a370)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontFamily:"'Brandmark Serif 6'",fontStyle:"normal",fontWeight:"normal",fontVariantLigatures:"normal"},children:"GeoNotes"})}export{r as L,a as T};
diff --git a/assets/UpdateProfile-f05b5ed5.js b/assets/UpdateProfile-13dd0d98.js
similarity index 91%
rename from assets/UpdateProfile-f05b5ed5.js
rename to assets/UpdateProfile-13dd0d98.js
index dba37a2..de8cd27 100644
--- a/assets/UpdateProfile-f05b5ed5.js
+++ b/assets/UpdateProfile-13dd0d98.js
@@ -1 +1 @@
-import{u as O,b as W,r as o,j as e,B as C,L as M,S as T,A as d,_ as n,s as u}from"./index-2fb86547.js";import{p as q,A as G}from"./index-7090c0c1.js";import{P as H}from"./PageNav-01d4a54f.js";import{s as N,F as J}from"./FormRow-8cffbd9d.js";import"./Title-32f6af34.js";const i={fontSize:"20px"};function f(t){n.error(t,{style:i}),u(2500)}function U(t,s){return t?!0:(n.error(`${s} cannot be empty`,{style:i}),!1)}function Q(t,s){return t!==s?(n.error("Passwords to not match",{style:i}),!1):!0}function V(t,s){return!(!U(t,"First name cannot be empty")||!U(s,"Last name cannot be empty"))}const c=await d.currentAuthenticatedUser();function ae(){const t=O(),{attributes:s}=c,{isAuthenticated:y}=W();o.useEffect(function(){y||t("/")},[y,t]);const[w,h]=o.useState(""),[x,k]=o.useState(""),[v,F]=o.useState(""),[S,L]=o.useState(s.name),[g,E]=o.useState(s.family_name),[I,_]=o.useState(""),[R,P]=o.useState(!1);async function $(a,b,j,A,p,X,l,D,K){if(a.preventDefault(),!!Q(p,A)&&V(b,j))try{if(P(!0),await d.updateUserAttributes(c,{name:b,family_name:j}),p)try{await d.changePassword(c,A,p),n.success("Successfully updated password!",{style:i}),await u(2500)}catch(r){console.log(r)}if(l){await d.updateUserAttributes(c,{picture:l.picture});const r=await Storage.put(l.name,l,{level:"private",contentType:"image/*",completeCallback:m=>{console.log(`Successfully uploaded ${m.key}`)},errorCallback:m=>{console.error("Unexpected error while uploading",m)}});console.log(r)}n.success("Successfully updated profile!",{style:i}),await u(2500),t("/login")}catch(r){switch(P(!1),r.name){case"InvalidAccessKeyId":f("Invalid AWS Access Key ID. Contact your app administrator.");break;case"InvalidPasswordException":f("Passwords did not confirm to the policy: min 8 characters, with at least: 1 uppercase, 1 lowercase");break;default:throw console.log("Unknown exception: ",r),f(r),await u(2500),r}D(""),K("")}}async function z(a){_(a.target.files[0])}const B=[{htmlFor:"first",text:"First Name",type:"text",id:"first",handleFn:L,value:S},{htmlFor:"last",text:"Last Name",type:"text",id:"last",handleFn:E,value:g},{htmlFor:"oldPassword",text:"Old Password",type:"password",id:"oldPassword",handleFn:k,value:x},{htmlFor:"password",text:q("Update Password
Min 8 characters, containing at least: 1 uppercase, 1 lowercase, 1 numeric"),type:"password",id:"password",handleFn:h,value:w},{htmlFor:"passwordConfirm",text:"Password Confirm",type:"password",id:"passwordConfirm",handleFn:F,value:v}];return e.jsxs("main",{className:N.login,children:[e.jsx(H,{}),e.jsx("h1",{children:`Update your profile for: ${s.email}`}),e.jsxs("form",{className:N.form,onSubmit:a=>$(a,S,g,w,x,v,I,h,F),children:[B.map(a=>e.jsx(J,{...a},a.id)),e.jsx(G,{handleFile:z}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx(C,{type:"primary",children:"Update Profile"}),e.jsx(M,{to:"/app/cities",children:R?e.jsx(T,{}):e.jsx(C,{type:"primary",children:"Cancel"})})]})]}),e.jsx("h2",{children:"Want to delete your account? Contact your app administrator."})]})}export{ae as default};
+import{u as O,b as W,r as o,j as e,B as C,L as M,S as T,A as d,_ as n,s as u}from"./index-f6be71a9.js";import{p as q,A as G}from"./index-b6740a27.js";import{P as H}from"./PageNav-171a5a02.js";import{s as N,F as J}from"./FormRow-c86a29ab.js";import"./Title-b7c7a7ef.js";const i={fontSize:"20px"};function f(t){n.error(t,{style:i}),u(2500)}function U(t,s){return t?!0:(n.error(`${s} cannot be empty`,{style:i}),!1)}function Q(t,s){return t!==s?(n.error("Passwords to not match",{style:i}),!1):!0}function V(t,s){return!(!U(t,"First name cannot be empty")||!U(s,"Last name cannot be empty"))}const c=await d.currentAuthenticatedUser();function ae(){const t=O(),{attributes:s}=c,{isAuthenticated:y}=W();o.useEffect(function(){y||t("/")},[y,t]);const[w,h]=o.useState(""),[x,k]=o.useState(""),[v,F]=o.useState(""),[S,L]=o.useState(s.name),[g,E]=o.useState(s.family_name),[I,_]=o.useState(""),[R,P]=o.useState(!1);async function $(a,b,j,A,p,X,l,D,K){if(a.preventDefault(),!!Q(p,A)&&V(b,j))try{if(P(!0),await d.updateUserAttributes(c,{name:b,family_name:j}),p)try{await d.changePassword(c,A,p),n.success("Successfully updated password!",{style:i}),await u(2500)}catch(r){console.log(r)}if(l){await d.updateUserAttributes(c,{picture:l.picture});const r=await Storage.put(l.name,l,{level:"private",contentType:"image/*",completeCallback:m=>{console.log(`Successfully uploaded ${m.key}`)},errorCallback:m=>{console.error("Unexpected error while uploading",m)}});console.log(r)}n.success("Successfully updated profile!",{style:i}),await u(2500),t("/login")}catch(r){switch(P(!1),r.name){case"InvalidAccessKeyId":f("Invalid AWS Access Key ID. Contact your app administrator.");break;case"InvalidPasswordException":f("Passwords did not confirm to the policy: min 8 characters, with at least: 1 uppercase, 1 lowercase");break;default:throw console.log("Unknown exception: ",r),f(r),await u(2500),r}D(""),K("")}}async function z(a){_(a.target.files[0])}const B=[{htmlFor:"first",text:"First Name",type:"text",id:"first",handleFn:L,value:S},{htmlFor:"last",text:"Last Name",type:"text",id:"last",handleFn:E,value:g},{htmlFor:"oldPassword",text:"Old Password",type:"password",id:"oldPassword",handleFn:k,value:x},{htmlFor:"password",text:q("Update Password
Min 8 characters, containing at least: 1 uppercase, 1 lowercase, 1 numeric"),type:"password",id:"password",handleFn:h,value:w},{htmlFor:"passwordConfirm",text:"Password Confirm",type:"password",id:"passwordConfirm",handleFn:F,value:v}];return e.jsxs("main",{className:N.login,children:[e.jsx(H,{}),e.jsx("h1",{children:`Update your profile for: ${s.email}`}),e.jsxs("form",{className:N.form,onSubmit:a=>$(a,S,g,w,x,v,I,h,F),children:[B.map(a=>e.jsx(J,{...a},a.id)),e.jsx(G,{handleFile:z}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx(C,{type:"primary",children:"Update Profile"}),e.jsx(M,{to:"/app/cities",children:R?e.jsx(T,{}):e.jsx(C,{type:"primary",children:"Cancel"})})]})]}),e.jsx("h2",{children:"Want to delete your account? Contact your app administrator."})]})}export{ae as default};
diff --git a/assets/index-7090c0c1.js b/assets/index-b6740a27.js
similarity index 99%
rename from assets/index-7090c0c1.js
rename to assets/index-b6740a27.js
index d1e3fd7..c9de0cf 100644
--- a/assets/index-7090c0c1.js
+++ b/assets/index-b6740a27.js
@@ -1,2 +1,2 @@
-import{j as A,e as m,r as Te,K as Ve}from"./index-2fb86547.js";import{s as Ge}from"./FormRow-8cffbd9d.js";const Xe=({handleFile:e})=>A.jsxs("div",{className:Ge.row,children:[A.jsxs("label",{htmlFor:"avatar",children:["Avatar ",A.jsx("br",{}),A.jsx("span",{style:{fontSize:"11px",color:"silver"},children:"Optional"})]}),A.jsx("input",{style:{color:"black"},type:"file",id:"avatar",accept:"image",required:!1,onChange:t=>e(t)})]}),Kt=Xe;var _e={},W={},q={};Object.defineProperty(q,"__esModule",{value:!0});var oe="html",le="head",R="body",Ue=/<([a-zA-Z]+[0-9]?)/,se=//i,ce=//i,I=function(e,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},U=function(e,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},ue=typeof window=="object"&&window.DOMParser;if(typeof ue=="function"){var $e=new ue,We="text/html";U=function(e,t){return t&&(e="<".concat(t,">").concat(e,"").concat(t,">")),$e.parseFromString(e,We)},I=U}if(typeof document=="object"&&document.implementation){var N=document.implementation.createHTMLDocument();I=function(e,t){if(t){var r=N.documentElement.querySelector(t);return r&&(r.innerHTML=e),N}return N.documentElement.innerHTML=e,N}}var M=typeof document=="object"&&document.createElement("template"),$;M&&M.content&&($=function(e){return M.innerHTML=e,M.content.childNodes});function qe(e){var t,r,n=e.match(Ue),i=n&&n[1]?n[1].toLowerCase():"";switch(i){case oe:{var s=U(e);if(!se.test(e)){var f=s.querySelector(le);(t=f?.parentNode)===null||t===void 0||t.removeChild(f)}if(!ce.test(e)){var f=s.querySelector(R);(r=f?.parentNode)===null||r===void 0||r.removeChild(f)}return s.querySelectorAll(oe)}case le:case R:{var l=I(e).querySelectorAll(i);return ce.test(e)&&se.test(e)?l[0].parentNode.childNodes:l}default:{if($)return $(e);var f=I(e,R).querySelector(R);return f.childNodes}}}q.default=qe;var O={},Y={},Z={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(n){n.Root="root",n.Text="text",n.Directive="directive",n.Comment="comment",n.Script="script",n.Style="style",n.Tag="tag",n.CDATA="cdata",n.Doctype="doctype"})(t=e.ElementType||(e.ElementType={}));function r(n){return n.type===t.Tag||n.type===t.Script||n.type===t.Style}e.isTag=r,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype})(Z);var p={},b=m&&m.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),w=m&&m.__assign||function(){return w=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(r){this.children=r},enumerable:!1,configurable:!0}),t}(K);p.NodeWithChildren=j;var Oe=function(e){b(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=E.ElementType.CDATA,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(j);p.CDATA=Oe;var Ae=function(e){b(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=E.ElementType.Root,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(j);p.Document=Ae;var ke=function(e){b(t,e);function t(r,n,i,s){i===void 0&&(i=[]),s===void 0&&(s=r==="script"?E.ElementType.Script:r==="style"?E.ElementType.Style:E.ElementType.Tag);var f=e.call(this,i)||this;return f.name=r,f.attribs=n,f.type=s,f}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(r){this.name=r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var r=this;return Object.keys(this.attribs).map(function(n){var i,s;return{name:n,value:r.attribs[n],namespace:(i=r["x-attribsNamespace"])===null||i===void 0?void 0:i[n],prefix:(s=r["x-attribsPrefix"])===null||s===void 0?void 0:s[n]}})},enumerable:!1,configurable:!0}),t}(j);p.Element=ke;function we(e){return(0,E.isTag)(e)}p.isTag=we;function xe(e){return e.type===E.ElementType.CDATA}p.isCDATA=xe;function Pe(e){return e.type===E.ElementType.Text}p.isText=Pe;function Re(e){return e.type===E.ElementType.Comment}p.isComment=Re;function Ne(e){return e.type===E.ElementType.Directive}p.isDirective=Ne;function Me(e){return e.type===E.ElementType.Root}p.isDocument=Me;function Ye(e){return Object.prototype.hasOwnProperty.call(e,"children")}p.hasChildren=Ye;function J(e,t){t===void 0&&(t=!1);var r;if(Pe(e))r=new be(e.data);else if(Re(e))r=new Se(e.data);else if(we(e)){var n=t?G(e.children):[],i=new ke(e.name,w({},e.attribs),n);n.forEach(function(a){return a.parent=i}),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]=w({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]=w({},e["x-attribsPrefix"])),r=i}else if(xe(e)){var n=t?G(e.children):[],s=new Oe(n);n.forEach(function(o){return o.parent=s}),r=s}else if(Me(e)){var n=t?G(e.children):[],f=new Ae(n);n.forEach(function(o){return o.parent=f}),e["x-mode"]&&(f["x-mode"]=e["x-mode"]),r=f}else if(Ne(e)){var l=new Ce(e.name,e.data);e["x-name"]!=null&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),r=l}else throw new Error("Not implemented yet: ".concat(e.type));return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}p.cloneNode=J;function G(e){for(var t=e.map(function(n){return J(n,!0)}),r=1;r/;function nt(e){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];var t=e.match(rt),r=t?t[1]:void 0;return(0,tt.formatDOM)((0,et.default)(e),null,r)}W.default=nt;var F={},T={},H={},it=0;H.SAME=it;var at=1;H.CAMELCASE=at;H.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1};const je=0,S=1,B=2,z=3,Q=4,Fe=5,He=6;function ot(e){return v.hasOwnProperty(e)?v[e]:null}function g(e,t,r,n,i,s,f){this.acceptsBooleans=t===B||t===z||t===Q,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=f}const v={},lt=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];lt.forEach(e=>{v[e]=new g(e,je,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([e,t])=>{v[e]=new g(e,S,!1,t,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(e=>{v[e]=new g(e,B,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(e=>{v[e]=new g(e,B,!1,e,null,!1,!1)});["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(e=>{v[e]=new g(e,z,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(e=>{v[e]=new g(e,z,!0,e,null,!1,!1)});["capture","download"].forEach(e=>{v[e]=new g(e,Q,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(e=>{v[e]=new g(e,He,!1,e,null,!1,!1)});["rowSpan","start"].forEach(e=>{v[e]=new g(e,Fe,!1,e.toLowerCase(),null,!1,!1)});const ee=/[\-\:]([a-z])/g,te=e=>e[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(e=>{const t=e.replace(ee,te);v[t]=new g(t,S,!1,e,null,!1,!1)});["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(e=>{const t=e.replace(ee,te);v[t]=new g(t,S,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(e=>{const t=e.replace(ee,te);v[t]=new g(t,S,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(e=>{v[e]=new g(e,S,!1,e.toLowerCase(),null,!1,!1)});const st="xlinkHref";v[st]=new g("xlinkHref",S,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(e=>{v[e]=new g(e,S,!1,e.toLowerCase(),null,!0,!0)});const{CAMELCASE:ct,SAME:ut,possibleStandardNames:fe}=H,ft=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",dt=ft+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",pt=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+dt+"]*$")),ht=Object.keys(fe).reduce((e,t)=>{const r=fe[t];return r===ut?e[t]=t:r===ct?e[t.toLowerCase()]=t:e[t]=r,e},{});T.BOOLEAN=z;T.BOOLEANISH_STRING=B;T.NUMERIC=Fe;T.OVERLOADED_BOOLEAN=Q;T.POSITIVE_NUMERIC=He;T.RESERVED=je;T.STRING=S;T.getPropertyInfo=ot;T.isCustomAttribute=pt;T.possibleStandardNames=ht;var re={},ne={},ie={},de=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,mt=/\n/g,vt=/^\s*/,gt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,yt=/^:\s*/,Et=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Tt=/^[;\s]*/,_t=/^\s+|\s+$/g,bt=`
+import{j as A,e as m,r as Te,K as Ve}from"./index-f6be71a9.js";import{s as Ge}from"./FormRow-c86a29ab.js";const Xe=({handleFile:e})=>A.jsxs("div",{className:Ge.row,children:[A.jsxs("label",{htmlFor:"avatar",children:["Avatar ",A.jsx("br",{}),A.jsx("span",{style:{fontSize:"11px",color:"silver"},children:"Optional"})]}),A.jsx("input",{style:{color:"black"},type:"file",id:"avatar",accept:"image",required:!1,onChange:t=>e(t)})]}),Kt=Xe;var _e={},W={},q={};Object.defineProperty(q,"__esModule",{value:!0});var oe="html",le="head",R="body",Ue=/<([a-zA-Z]+[0-9]?)/,se=//i,ce=//i,I=function(e,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},U=function(e,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},ue=typeof window=="object"&&window.DOMParser;if(typeof ue=="function"){var $e=new ue,We="text/html";U=function(e,t){return t&&(e="<".concat(t,">").concat(e,"").concat(t,">")),$e.parseFromString(e,We)},I=U}if(typeof document=="object"&&document.implementation){var N=document.implementation.createHTMLDocument();I=function(e,t){if(t){var r=N.documentElement.querySelector(t);return r&&(r.innerHTML=e),N}return N.documentElement.innerHTML=e,N}}var M=typeof document=="object"&&document.createElement("template"),$;M&&M.content&&($=function(e){return M.innerHTML=e,M.content.childNodes});function qe(e){var t,r,n=e.match(Ue),i=n&&n[1]?n[1].toLowerCase():"";switch(i){case oe:{var s=U(e);if(!se.test(e)){var f=s.querySelector(le);(t=f?.parentNode)===null||t===void 0||t.removeChild(f)}if(!ce.test(e)){var f=s.querySelector(R);(r=f?.parentNode)===null||r===void 0||r.removeChild(f)}return s.querySelectorAll(oe)}case le:case R:{var l=I(e).querySelectorAll(i);return ce.test(e)&&se.test(e)?l[0].parentNode.childNodes:l}default:{if($)return $(e);var f=I(e,R).querySelector(R);return f.childNodes}}}q.default=qe;var O={},Y={},Z={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(n){n.Root="root",n.Text="text",n.Directive="directive",n.Comment="comment",n.Script="script",n.Style="style",n.Tag="tag",n.CDATA="cdata",n.Doctype="doctype"})(t=e.ElementType||(e.ElementType={}));function r(n){return n.type===t.Tag||n.type===t.Script||n.type===t.Style}e.isTag=r,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype})(Z);var p={},b=m&&m.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),w=m&&m.__assign||function(){return w=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(r){this.children=r},enumerable:!1,configurable:!0}),t}(K);p.NodeWithChildren=j;var Oe=function(e){b(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=E.ElementType.CDATA,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(j);p.CDATA=Oe;var Ae=function(e){b(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=E.ElementType.Root,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(j);p.Document=Ae;var ke=function(e){b(t,e);function t(r,n,i,s){i===void 0&&(i=[]),s===void 0&&(s=r==="script"?E.ElementType.Script:r==="style"?E.ElementType.Style:E.ElementType.Tag);var f=e.call(this,i)||this;return f.name=r,f.attribs=n,f.type=s,f}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(r){this.name=r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var r=this;return Object.keys(this.attribs).map(function(n){var i,s;return{name:n,value:r.attribs[n],namespace:(i=r["x-attribsNamespace"])===null||i===void 0?void 0:i[n],prefix:(s=r["x-attribsPrefix"])===null||s===void 0?void 0:s[n]}})},enumerable:!1,configurable:!0}),t}(j);p.Element=ke;function we(e){return(0,E.isTag)(e)}p.isTag=we;function xe(e){return e.type===E.ElementType.CDATA}p.isCDATA=xe;function Pe(e){return e.type===E.ElementType.Text}p.isText=Pe;function Re(e){return e.type===E.ElementType.Comment}p.isComment=Re;function Ne(e){return e.type===E.ElementType.Directive}p.isDirective=Ne;function Me(e){return e.type===E.ElementType.Root}p.isDocument=Me;function Ye(e){return Object.prototype.hasOwnProperty.call(e,"children")}p.hasChildren=Ye;function J(e,t){t===void 0&&(t=!1);var r;if(Pe(e))r=new be(e.data);else if(Re(e))r=new Se(e.data);else if(we(e)){var n=t?G(e.children):[],i=new ke(e.name,w({},e.attribs),n);n.forEach(function(a){return a.parent=i}),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]=w({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]=w({},e["x-attribsPrefix"])),r=i}else if(xe(e)){var n=t?G(e.children):[],s=new Oe(n);n.forEach(function(o){return o.parent=s}),r=s}else if(Me(e)){var n=t?G(e.children):[],f=new Ae(n);n.forEach(function(o){return o.parent=f}),e["x-mode"]&&(f["x-mode"]=e["x-mode"]),r=f}else if(Ne(e)){var l=new Ce(e.name,e.data);e["x-name"]!=null&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),r=l}else throw new Error("Not implemented yet: ".concat(e.type));return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}p.cloneNode=J;function G(e){for(var t=e.map(function(n){return J(n,!0)}),r=1;r/;function nt(e){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];var t=e.match(rt),r=t?t[1]:void 0;return(0,tt.formatDOM)((0,et.default)(e),null,r)}W.default=nt;var F={},T={},H={},it=0;H.SAME=it;var at=1;H.CAMELCASE=at;H.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1};const je=0,S=1,B=2,z=3,Q=4,Fe=5,He=6;function ot(e){return v.hasOwnProperty(e)?v[e]:null}function g(e,t,r,n,i,s,f){this.acceptsBooleans=t===B||t===z||t===Q,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=f}const v={},lt=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];lt.forEach(e=>{v[e]=new g(e,je,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([e,t])=>{v[e]=new g(e,S,!1,t,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(e=>{v[e]=new g(e,B,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(e=>{v[e]=new g(e,B,!1,e,null,!1,!1)});["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(e=>{v[e]=new g(e,z,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(e=>{v[e]=new g(e,z,!0,e,null,!1,!1)});["capture","download"].forEach(e=>{v[e]=new g(e,Q,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(e=>{v[e]=new g(e,He,!1,e,null,!1,!1)});["rowSpan","start"].forEach(e=>{v[e]=new g(e,Fe,!1,e.toLowerCase(),null,!1,!1)});const ee=/[\-\:]([a-z])/g,te=e=>e[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(e=>{const t=e.replace(ee,te);v[t]=new g(t,S,!1,e,null,!1,!1)});["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(e=>{const t=e.replace(ee,te);v[t]=new g(t,S,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(e=>{const t=e.replace(ee,te);v[t]=new g(t,S,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(e=>{v[e]=new g(e,S,!1,e.toLowerCase(),null,!1,!1)});const st="xlinkHref";v[st]=new g("xlinkHref",S,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(e=>{v[e]=new g(e,S,!1,e.toLowerCase(),null,!0,!0)});const{CAMELCASE:ct,SAME:ut,possibleStandardNames:fe}=H,ft=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",dt=ft+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",pt=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+dt+"]*$")),ht=Object.keys(fe).reduce((e,t)=>{const r=fe[t];return r===ut?e[t]=t:r===ct?e[t.toLowerCase()]=t:e[t]=r,e},{});T.BOOLEAN=z;T.BOOLEANISH_STRING=B;T.NUMERIC=Fe;T.OVERLOADED_BOOLEAN=Q;T.POSITIVE_NUMERIC=He;T.RESERVED=je;T.STRING=S;T.getPropertyInfo=ot;T.isCustomAttribute=pt;T.possibleStandardNames=ht;var re={},ne={},ie={},de=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,mt=/\n/g,vt=/^\s*/,gt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,yt=/^:\s*/,Et=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Tt=/^[;\s]*/,_t=/^\s+|\s+$/g,bt=`
`,pe="/",he="*",C="",St="comment",Ct="declaration",Ot=function(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(h){var u=h.match(mt);u&&(r+=u.length);var y=h.lastIndexOf(bt);n=~y?h.length-y:n+h.length}function s(){var h={line:r,column:n};return function(u){return u.position=new f(h),o(),u}}function f(h){this.start=h,this.end={line:r,column:n},this.source=t.source}f.prototype.content=e;function l(h){var u=new Error(t.source+":"+r+":"+n+": "+h);if(u.reason=h,u.filename=t.source,u.line=r,u.column=n,u.source=e,!t.silent)throw u}function a(h){var u=h.exec(e);if(u){var y=u[0];return i(y),e=e.slice(y.length),u}}function o(){a(vt)}function c(h){var u;for(h=h||[];u=d();)u!==!1&&h.push(u);return h}function d(){var h=s();if(!(pe!=e.charAt(0)||he!=e.charAt(1))){for(var u=2;C!=e.charAt(u)&&(he!=e.charAt(u)||pe!=e.charAt(u+1));)++u;if(u+=2,C===e.charAt(u-1))return l("End of comment missing");var y=e.slice(2,u-2);return n+=2,i(y),e=e.slice(u),n+=2,h({type:St,comment:y})}}function _(){var h=s(),u=a(gt);if(u){if(d(),!a(yt))return l("property missing ':'");var y=a(Et),ze=h({type:Ct,property:me(u[0].replace(de,C)),value:y?me(y[0].replace(de,C)):C});return a(Tt),ze}}function P(){var h=[];c(h);for(var u;u=_();)u!==!1&&(h.push(u),c(h));return h}return o(),P()};function me(e){return e?e.replace(_t,C):C}var At=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ie,"__esModule",{value:!0});var kt=At(Ot);function wt(e,t){var r=null;if(!e||typeof e!="string")return r;var n=(0,kt.default)(e),i=typeof t=="function";return n.forEach(function(s){if(s.type==="declaration"){var f=s.property,l=s.value;i?t(f,l,s):l&&(r=r||{},r[f]=l)}}),r}ie.default=wt;var V={};Object.defineProperty(V,"__esModule",{value:!0});V.camelCase=void 0;var xt=/^--[a-zA-Z0-9-]+$/,Pt=/-([a-z])/g,Rt=/^[^-]+$/,Nt=/^-(webkit|moz|ms|o|khtml)-/,Mt=/^-(ms)-/,Dt=function(e){return!e||Rt.test(e)||xt.test(e)},It=function(e,t){return t.toUpperCase()},ve=function(e,t){return"".concat(t,"-")},Lt=function(e,t){return t===void 0&&(t={}),Dt(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Mt,ve):e=e.replace(Nt,ve),e.replace(Pt,It))};V.camelCase=Lt;var jt=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ne,"__esModule",{value:!0});var Ft=jt(ie),Ht=V;function Bt(e,t){var r={};return!e||typeof e!="string"||(0,Ft.default)(e,function(n,i){n&&i&&(r[(0,Ht.camelCase)(n,t)]=i)}),r}ne.default=Bt;(function(e){var t=m&&m.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=e.setStyleProp=e.isCustomComponent=void 0;var r=Te,n=t(ne),i=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function s(c,d){return c.indexOf("-")===-1?!!(d&&typeof d.is=="string"):!i.has(c)}e.isCustomComponent=s;var f={reactCompat:!0};function l(c,d){if(typeof c=="string"){if(!c.trim()){d.style={};return}try{d.style=(0,n.default)(c,f)}catch{d.style={}}}}e.setStyleProp=l,e.PRESERVE_CUSTOM_ATTRIBUTES=Number(r.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var a=function(c){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(c.name)};e.canTextBeChildOfNode=a;var o=function(c){return c};e.returnFirstArg=o})(re);Object.defineProperty(F,"__esModule",{value:!0});var k=T,ge=re,zt=["checked","value"],Vt=["input","select","textarea"],Gt={reset:!0,submit:!0};function Xt(e,t){e===void 0&&(e={});var r={},n=!!(e.type&&Gt[e.type]);for(var i in e){var s=e[i];if((0,k.isCustomAttribute)(i)){r[i]=s;continue}var f=i.toLowerCase(),l=ye(f);if(l){var a=(0,k.getPropertyInfo)(l);switch(zt.indexOf(l)!==-1&&Vt.indexOf(t)!==-1&&!n&&(l=ye("default"+f)),r[l]=s,a&&a.type){case k.BOOLEAN:r[l]=!0;break;case k.OVERLOADED_BOOLEAN:s===""&&(r[l]=!0);break}continue}ge.PRESERVE_CUSTOM_ATTRIBUTES&&(r[i]=s)}return(0,ge.setStyleProp)(e.style,r),r}F.default=Xt;function ye(e){return k.possibleStandardNames[e]}var ae={},Ut=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ae,"__esModule",{value:!0});var X=Te,$t=Ut(F),x=re,Wt={cloneElement:X.cloneElement,createElement:X.createElement,isValidElement:X.isValidElement};function Be(e,t){for(var r=[],n=typeof t?.replace=="function",i=t?.transform||x.returnFirstArg,s=t?.library||Wt,f=s.cloneElement,l=s.createElement,a=s.isValidElement,o=e.length,c=0;c1&&(_=f(_,{key:_.key||c})),r.push(i(_,d,c));continue}}if(d.type==="text"){var P=!d.data.trim().length;if(P&&d.parent&&!(0,x.canTextBeChildOfNode)(d.parent)||t?.trim&&P)continue;r.push(i(d.data,d,c));continue}var h=d,u={};qt(h)?((0,x.setStyleProp)(h.attribs.style,h.attribs),u=h.attribs):h.attribs&&(u=(0,$t.default)(h.attribs,h.name));var y=void 0;switch(d.type){case"script":case"style":d.children[0]&&(u.dangerouslySetInnerHTML={__html:d.children[0].data});break;case"tag":d.name==="textarea"&&d.children[0]?u.defaultValue=d.children[0].data:d.children&&d.children.length&&(y=Be(d.children,t));break;default:continue}o>1&&(u.key=c),r.push(i(l(d.name,u,y),d,c))}return r.length===1?r[0]:r}ae.default=Be;function qt(e){return x.PRESERVE_CUSTOM_ATTRIBUTES&&e.type==="tag"&&(0,x.isCustomComponent)(e.name,e.attribs)}(function(e){var t=m&&m.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0;var r=t(W);e.htmlToDOM=r.default;var n=t(F);e.attributesToProps=n.default;var i=t(ae);e.domToReact=i.default;var s=Y;Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return s.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return s.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return s.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return s.Text}});var f={lowerCaseAttributeNames:!1};function l(a,o){if(typeof a!="string")throw new TypeError("First argument must be a string");return a?(0,i.default)((0,r.default)(a,o?.htmlparser2||f),o):[]}e.default=l})(_e);const Ee=Ve(_e),Jt=Ee.default||Ee;export{Kt as A,Jt as p};
diff --git a/assets/index-2fb86547.js b/assets/index-f6be71a9.js
similarity index 99%
rename from assets/index-2fb86547.js
rename to assets/index-f6be71a9.js
index 2b17b1c..928937c 100644
--- a/assets/index-2fb86547.js
+++ b/assets/index-f6be71a9.js
@@ -7448,4 +7448,4 @@ Read more: ${Q}#error-${c}`}function Me(c,e){const t=Ce(c);return e?[c,e,t]:[c,t
`;else{let t=null;for(const i of c.getChildren()){const l=fx(i);t&&(t.is("containerElement")||i.is("containerElement"))&&(px.includes(t.name)||px.includes(i.name)?e+=`
`:e+=`
-`),e+=l,t=i}}return e}class Ko extends pe{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Ou),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,i){const l=this.editor.model.getSelectedContent(t);this.fire("outputTransformation",{dataTransfer:e,content:l,method:i})}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,l=i.document;this.listenTo(l,"clipboardInput",(d,p)=>{p.method!="paste"||e.model.canEditAt(e.model.document.selection)||d.stop()},{priority:"highest"}),this.listenTo(l,"clipboardInput",(d,p)=>{const g=p.dataTransfer;let b;if(p.content)b=p.content;else{let A="";g.getData("text/html")?A=function(E){return E.replace(/(\s+)<\/span>/g,(D,M)=>M.length==1?" ":M).replace(//g,"")}(g.getData("text/html")):g.getData("text/plain")&&(((w=(w=g.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||w.includes("
"))&&(w=`
${w}
`),A=w),b=this.editor.data.htmlProcessor.toView(A)}var w;const y=new I(this,"inputTransformation");this.fire(y,{content:b,dataTransfer:g,targetRanges:p.targetRanges,method:p.method}),y.stop.called&&d.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(d,p)=>{if(p.content.isEmpty)return;const g=this.editor.data.toModel(p.content,"$clipboardHolder");g.childCount!=0&&(d.stop(),t.change(()=>{this.fire("contentInsertion",{content:g,method:p.method,dataTransfer:p.dataTransfer,targetRanges:p.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(d,p)=>{p.resultRange=t.insertContent(p.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,l=(d,p)=>{const g=p.dataTransfer;p.preventDefault(),this._fireOutputTransformationEvent(g,t.selection,d.name)};this.listenTo(i,"copy",l,{priority:"low"}),this.listenTo(i,"cut",(d,p)=>{e.model.canEditAt(e.model.document.selection)?l(d,p):p.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(d,p)=>{const g=e.data.toView(p.content);i.fire("clipboardOutput",{dataTransfer:p.dataTransfer,content:g,method:p.method})},{priority:"low"}),this.listenTo(i,"clipboardOutput",(d,p)=>{p.content.isEmpty||(p.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(p.content)),p.dataTransfer.setData("text/plain",fx(p.content))),p.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}class gx{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(i,l)=>{l.isLocal&&l.isUndoable&&l!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class _L extends nt{constructor(e,t){super(e),this._buffer=new gx(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,l=e.text||"",d=l.length;let p=i.selection;if(e.selection?p=e.selection:e.range&&(p=t.createSelection(e.range)),!t.canEditAt(p))return;const g=e.resultRange;t.enqueueChange(this._buffer.batch,b=>{this._buffer.lock(),t.deleteContent(p),l&&t.insertContent(b.createText(l,i.selection.getAttributes()),p),g?b.setSelection(g):p.is("documentSelection")||b.setSelection(p),this._buffer.unlock(),this._buffer.input(d)})}}const mx=["insertText","insertReplacementText"];class CL extends $o{constructor(e){super(e),this.focusObserver=e.getObserver(cp),_.isAndroid&&mx.push("insertCompositionText");const t=e.document;t.on("beforeinput",(i,l)=>{if(!this.isEnabled)return;const{data:d,targetRanges:p,inputType:g,domEvent:b}=l;if(!mx.includes(g))return;this.focusObserver.flush();const w=new I(t,"insertText");t.fire(w,new Cc(e,b,{text:d,selection:e.createSelection(p)})),w.stop.called&&i.stop()}),t.on("compositionend",(i,{data:l,domEvent:d})=>{this.isEnabled&&!_.isAndroid&&l&&t.fire("insertText",new Cc(e,d,{text:l,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}class kx extends pe{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,l=t.document.selection;i.addObserver(CL);const d=new _L(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",d),e.commands.add("input",d),this.listenTo(i.document,"insertText",(p,g)=>{i.document.isComposing||g.preventDefault();const{text:b,selection:w,resultRange:y}=g,A=Array.from(w.getRanges()).map(M=>e.editing.mapper.toModelRange(M));let E=b;if(_.isAndroid){const M=Array.from(A[0].getItems()).reduce((R,U)=>R+(U.is("$textProxy")?U.data:""),"");M&&(M.length<=E.length?E.startsWith(M)&&(E=E.substring(M.length),A[0].start=A[0].start.getShiftedBy(M.length)):M.startsWith(E)&&(A[0].start=A[0].start.getShiftedBy(E.length),E=""))}const D={text:E,selection:t.createSelection(A)};y&&(D.resultRange=e.editing.mapper.toModelRange(y)),e.execute("insertText",D),i.scrollToTheSelection()}),_.isAndroid?this.listenTo(i.document,"keydown",(p,g)=>{!l.isCollapsed&&g.keyCode==229&&i.document.isComposing&&bx(t,d)}):this.listenTo(i.document,"compositionstart",()=>{l.isCollapsed||bx(t,d)})}}function bx(c,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),c.enqueueChange(t.batch,()=>{c.deleteContent(c.document.selection)}),t.unlock()}class wx extends nt{constructor(e,t){super(e),this.direction=t,this._buffer=new gx(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const d=l.createSelection(e.selection||i.selection);if(!t.canEditAt(d))return;const p=e.sequence||1,g=d.isCollapsed;if(d.isCollapsed&&t.modifySelection(d,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(p))return void this._replaceEntireContentWithParagraph(l);if(this._shouldReplaceFirstBlockWithParagraph(d,p))return void this.editor.execute("paragraph",{selection:d});if(d.isCollapsed)return;let b=0;d.getFirstRange().getMinimalFlatRanges().forEach(w=>{b+=$(w.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(d,{doNotResetEntireContent:g,direction:this.direction}),this._buffer.input(b),l.setSelection(d),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,l=t.schema.getLimitElement(i);if(!(i.isCollapsed&&i.containsEntireContent(l))||!t.schema.checkChild(l,"paragraph"))return!1;const d=l.getChild(0);return!d||!d.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,l=t.schema.getLimitElement(i),d=e.createElement("paragraph");e.remove(e.createRangeIn(l)),e.insert(d,l),e.setSelection(d,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const l=e.getFirstPosition(),d=i.schema.getLimitElement(l),p=d.getChild(0);return l.parent==p&&!!e.containsEntireContent(p)&&!!i.schema.checkChild(d,"paragraph")&&p.name!="paragraph"}}const vx="word",ls="selection",Tc="backward",Bu="forward",yx={deleteContent:{unit:ls,direction:Tc},deleteContentBackward:{unit:"codePoint",direction:Tc},deleteWordBackward:{unit:vx,direction:Tc},deleteHardLineBackward:{unit:ls,direction:Tc},deleteSoftLineBackward:{unit:ls,direction:Tc},deleteContentForward:{unit:"character",direction:Bu},deleteWordForward:{unit:vx,direction:Bu},deleteHardLineForward:{unit:ls,direction:Bu},deleteSoftLineForward:{unit:ls,direction:Bu}};class AL extends $o{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",()=>{i++}),t.on("keyup",()=>{i=0}),t.on("beforeinput",(l,d)=>{if(!this.isEnabled)return;const{targetRanges:p,domEvent:g,inputType:b}=d,w=yx[b];if(!w)return;const y={direction:w.direction,unit:w.unit,sequence:i};y.unit==ls&&(y.selectionToRemove=e.createSelection(p[0])),b==="deleteContentBackward"&&(_.isAndroid&&(y.sequence=1),function(E){if(E.length!=1||E[0].isCollapsed)return!1;const D=E[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let M=0;for(const{nextPosition:R}of D){if(R.parent.is("$text")){const U=R.parent.data,W=R.offset;if(ck(U,W)||lk(U,W)||C_(U,W))continue;M++}else M++;if(M>1)return!0}return!1}(p)&&(y.unit=ls,y.selectionToRemove=e.createSelection(p)));const A=new yc(t,"delete",p[0]);t.fire(A,new Cc(e,g,y)),A.stop.called&&l.stop()}),_.isBlink&&function(l){const d=l.view,p=d.document;let g=null,b=!1;function w(A){return A==dt.backspace||A==dt.delete}function y(A){return A==dt.backspace?Tc:Bu}p.on("keydown",(A,{keyCode:E})=>{g=E,b=!1}),p.on("keyup",(A,{keyCode:E,domEvent:D})=>{const M=p.selection,R=l.isEnabled&&E==g&&w(E)&&!M.isCollapsed&&!b;if(g=null,R){const U=M.getFirstRange(),W=new yc(p,"delete",U),J={unit:ls,direction:y(E),selectionToRemove:M};p.fire(W,new Cc(d,D,J))}}),p.on("beforeinput",(A,{inputType:E})=>{const D=yx[E];w(g)&&D&&D.direction==y(g)&&(b=!0)},{priority:"high"}),p.on("beforeinput",(A,{inputType:E,data:D})=>{g==dt.delete&&E=="insertText"&&D==""&&A.stop()},{priority:"high"})}(this)}observe(){}stopObserving(){}}class bi extends pe{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,l=e.model.document;t.addObserver(AL),this._undoOnBackspace=!1;const d=new wx(e,"forward");e.commands.add("deleteForward",d),e.commands.add("forwardDelete",d),e.commands.add("delete",new wx(e,"backward")),this.listenTo(i,"delete",(p,g)=>{i.isComposing||g.preventDefault();const{direction:b,sequence:w,selectionToRemove:y,unit:A}=g,E=b==="forward"?"deleteForward":"delete",D={sequence:w};if(A=="selection"){const M=Array.from(y.getRanges()).map(R=>e.editing.mapper.toModelRange(R));D.selection=e.model.createSelection(M)}else D.unit=A;e.execute(E,D),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(p,g)=>{this._undoOnBackspace&&g.direction=="backward"&&g.sequence==1&&g.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),g.preventDefault(),p.stop())},{context:"$capture"}),this.listenTo(l,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class xL extends pe{static get requires(){return[kx,bi]}static get pluginName(){return"Typing"}}function _x(c,e){let t=c.start;return{text:Array.from(c.getWalker({ignoreElementEnd:!1})).reduce((i,{item:l})=>l.is("$text")||l.is("$textProxy")?i+l.data:(t=e.createPositionAfter(l),""),""),range:e.createRange(t,c.end)}}class Cx extends Ve(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))}),this.listenTo(e,"change:data",(t,i)=>{!i.isUndo&&i.isLocal&&this._evaluateTextBeforeSelection("data",{batch:i})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,l=i.document.selection,d=i.createRange(i.createPositionAt(l.focus.parent,0),l.focus),{text:p,range:g}=_x(d,i),b=this.testCallback(p);if(!b&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!b,b){const w=Object.assign(t,{text:p,range:g});typeof b=="object"&&Object.assign(w,b),this.fire(`matched:${e}`,w)}}}class Ax extends pe{constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}init(){const e=this.editor,t=e.model,i=e.editing.view,l=e.locale,d=t.document.selection;this.listenTo(i.document,"arrowKey",(p,g)=>{if(!d.isCollapsed||g.shiftKey||g.altKey||g.ctrlKey)return;const b=g.keyCode==dt.arrowright,w=g.keyCode==dt.arrowleft;if(!b&&!w)return;const y=l.contentLanguageDirection;let A=!1;A=y==="ltr"&&b||y==="rtl"&&w?this._handleForwardMovement(g):this._handleBackwardMovement(g),A===!0&&p.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(d,"change:range",(p,g)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!g.directChange&&Ep(d.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model.document.selection,l=i.getFirstPosition();return!this._isGravityOverridden&&(!l.isAtStart||!pb(i,t))&&!!Ep(l,t)&&(xp(e),this._overrideGravity(),!0)}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,l=i.document.selection,d=l.getFirstPosition();return this._isGravityOverridden?(xp(e),this._restoreGravity(),fb(i,t,d),!0):d.isAtStart?!!pb(l,t)&&(xp(e),fb(i,t,d),!0):!!function(p,g){const b=p.getShiftedBy(-1);return Ep(b,g)}(d,t)&&(d.isAtEnd&&!pb(l,t)&&Ep(d,t)?(xp(e),fb(i,t,d),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function pb(c,e){for(const t of e)if(c.hasAttribute(t))return!0;return!1}function fb(c,e,t){const i=t.nodeBefore;c.change(l=>{if(i){const d=[],p=c.schema.isObject(i)&&c.schema.isInline(i);for(const[g,b]of i.getAttributes())!c.schema.checkAttribute("$text",g)||p&&c.schema.getAttributeProperties(g).copyFromObject===!1||d.push([g,b]);l.setSelectionAttribute(d)}else l.removeSelectionAttribute(e)})}function xp(c){c.preventDefault()}function Ep(c,e){const{nodeBefore:t,nodeAfter:i}=c;for(const l of e){const d=t?t.getAttribute(l):void 0;if((i?i.getAttribute(l):void 0)!==d)return!0}return!1}const xx={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:Ic('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Ic("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Ic("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Ic('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Ic('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Ic("'"),to:[null,"‚",null,"’"]}},Ex={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},EL=["symbols","mathematical","typography","quotes"];function SL(c){return typeof c=="string"?new RegExp(`(${Q1(c)})$`):c}function DL(c){return typeof c=="string"?()=>[c]:c instanceof Array?()=>c:c}function TL(c){return(c.textNode?c.textNode:c.nodeAfter).getAttributes()}function Ic(c){return new RegExp(`(^|\\s)(${c})([^${c}]*)(${c})$`)}function Mc(c,e,t,i){return i.createRange(Sx(c,e,t,!0,i),Sx(c,e,t,!1,i))}function Sx(c,e,t,i,l){let d=c.textNode||(i?c.nodeBefore:c.nodeAfter),p=null;for(;d&&d.getAttribute(e)==t;)p=d,d=i?d.previousSibling:d.nextSibling;return p?l.createPositionAt(p,i?"before":"after"):c}function*Dx(c,e){for(const t of e)t&&c.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}class IL extends nt{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,i=t.document.selection,l=t.schema,d=i.isCollapsed,p=i.getFirstRange(),g=p.start.parent,b=p.end.parent;if(l.isLimit(g)||l.isLimit(b))return d||g!=b||t.deleteContent(i),!1;if(d){const w=Dx(e.model.schema,i.getAttributes());return Tx(e,p.start),e.setSelectionAttribute(w),!0}{const w=!(p.start.isAtStart&&p.end.isAtEnd),y=g==b;if(t.deleteContent(i,{leaveUnmerged:w}),w){if(y)return Tx(e,i.focus),!0;e.setSelection(b,0)}}return!1}}function Tx(c,e){c.split(e),c.setSelection(e.parent.nextSibling,0)}const ML={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Ix extends $o{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",(l,d)=>{i=d.shiftKey}),t.on("beforeinput",(l,d)=>{if(!this.isEnabled)return;let p=d.inputType;_.isSafari&&i&&p=="insertParagraph"&&(p="insertLineBreak");const g=d.domEvent,b=ML[p];if(!b)return;const w=new yc(t,"enter",d.targetRanges[0]);t.fire(w,new Cc(e,g,{isSoft:b.isSoft})),w.stop.called&&l.stop()})}observe(){}stopObserving(){}}class Sp extends pe{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(Ix),e.commands.add("enter",new IL(e)),this.listenTo(i,"enter",(l,d)=>{i.isComposing||d.preventDefault(),d.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class PL extends nt{execute(){const e=this.editor.model,t=e.document;e.change(i=>{(function(l,d,p){const g=p.isCollapsed,b=p.getFirstRange(),w=b.start.parent,y=b.end.parent,A=w==y;if(g){const E=Dx(l.schema,p.getAttributes());Mx(l,d,b.end),d.removeSelectionAttribute(p.getAttributeKeys()),d.setSelectionAttribute(E)}else{const E=!(b.start.isAtStart&&b.end.isAtEnd);l.deleteContent(p,{leaveUnmerged:E}),A?Mx(l,d,p.focus):E&&d.setSelection(y,0)}})(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(i,l){if(l.rangeCount>1)return!1;const d=l.anchor;if(!d||!i.checkChild(d,"softBreak"))return!1;const p=l.getFirstRange(),g=p.start.parent,b=p.end.parent;return!((gb(g,i)||gb(b,i))&&g!==b)}(e.schema,t.selection)}}function Mx(c,e,t){const i=e.createElement("softBreak");c.insertContent(i,t),e.setSelection(i,"after")}function gb(c,e){return!c.is("rootElement")&&(e.isLimit(c)||gb(c.parent,e))}class NL extends pe{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,l=e.editing.view,d=l.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(p,{writer:g})=>g.createEmptyElement("br")}),l.addObserver(Ix),e.commands.add("shiftEnter",new PL(e)),this.listenTo(d,"enter",(p,g)=>{d.isComposing||g.preventDefault(),g.isSoft&&(e.execute("shiftEnter"),l.scrollToTheSelection())},{priority:"low"})}}class OL extends ge(){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,l=i[0];this._insertDescriptor(e);const d=i[0];l===d||mb(l,d)||this.fire("change:top",{oldDescriptor:l,newDescriptor:d,writer:t})}remove(e,t){const i=this._stack,l=i[0];this._removeDescriptor(e);const d=i[0];l===d||mb(l,d)||this.fire("change:top",{oldDescriptor:l,newDescriptor:d,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(d=>d.id===e.id);if(mb(e,t[i]))return;i>-1&&t.splice(i,1);let l=0;for(;t[l]&&BL(t[l],e);)l++;t.splice(l,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(l=>l.id===e);i>-1&&t.splice(i,1)}}function mb(c,e){return c&&e&&c.priority==e.priority&&Dp(c.classes)==Dp(e.classes)}function BL(c,e){return c.priority>e.priority||!(c.priorityDp(e.classes)}function Dp(c){return Array.isArray(c)?c.sort().join(","):c}const RL='',LL="ck-widget",Px="ck-widget_selected";function An(c){return!!c.is("element")&&!!c.getCustomProperty("widget")}function kb(c,e,t={}){if(!c.is("containerElement"))throw new z("widget-to-widget-wrong-element-type",null,{element:c});return e.setAttribute("contenteditable","false",c),e.addClass(LL,c),e.setCustomProperty("widget",!0,c),c.getFillerOffset=FL,e.setCustomProperty("widgetLabel",[],c),t.label&&function(i,l){i.getCustomProperty("widgetLabel").push(l)}(c,t.label),t.hasSelectionHandle&&function(i,l){const d=l.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(p){const g=this.toDomElement(p),b=new ea;return b.set("content",RL),b.render(),g.appendChild(b.element),g});l.insert(l.createPositionAt(i,0),d),l.addClass(["ck-widget_with-selection-handle"],i)}(c,e),Nx(c,e),c}function jL(c,e,t){if(e.classes&&t.addClass(Sn(e.classes),c),e.attributes)for(const i in e.attributes)t.setAttribute(i,e.attributes[i],c)}function zL(c,e,t){if(e.classes&&t.removeClass(Sn(e.classes),c),e.attributes)for(const i in e.attributes)t.removeAttribute(i,c)}function Nx(c,e,t=jL,i=zL){const l=new OL;l.on("change:top",(d,p)=>{p.oldDescriptor&&i(c,p.oldDescriptor,p.writer),p.newDescriptor&&t(c,p.newDescriptor,p.writer)}),e.setCustomProperty("addHighlight",(d,p,g)=>l.add(p,g),c),e.setCustomProperty("removeHighlight",(d,p,g)=>l.remove(p,g),c)}function Ox(c,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],c),e.setAttribute("role","textbox",c),t.label&&e.setAttribute("aria-label",t.label,c),e.setAttribute("contenteditable",c.isReadOnly?"false":"true",c),c.on("change:isReadOnly",(i,l,d)=>{e.setAttribute("contenteditable",d?"false":"true",c)}),c.on("change:isFocused",(i,l,d)=>{d?e.addClass("ck-editor__nested-editable_focused",c):e.removeClass("ck-editor__nested-editable_focused",c)}),Nx(c,e),c}function Bx(c,e){const t=c.getSelectedElement();if(t){const i=us(c);if(i)return e.createRange(e.createPositionAt(t,i))}return n1(c,e)}function FL(){return null}const wi="widget-type-around";function ha(c,e,t){return!!c&&An(c)&&!t.isInline(e)}function us(c){return c.getAttribute(wi)}var Rx=a(4921),UL={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Rx.Z,UL),Rx.Z.locals;const Lx=["before","after"],VL=new DOMParser().parseFromString('',"image/svg+xml").firstChild,jx="ck-widget__type-around_disabled";class HL extends pe{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Sp,bi]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,l,d)=>{t.change(p=>{for(const g of t.document.roots)d?p.removeClass(jx,g):p.addClass(jx,g)}),d||e.model.change(p=>{p.removeSelectionAttribute(wi)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,l=i.editing.view,d=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:d}),l.focus(),l.scrollToTheSelection()}_listenToIfEnabled(e,t,i,l){this.listenTo(e,t,(...d)=>{this.isEnabled&&i(...d)},l)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=us(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,l={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(d,p,g)=>{const b=g.mapper.toViewElement(p.item);b&&ha(b,p.item,t)&&(function(w,y,A){const E=w.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(D){const M=this.toDomElement(D);return function(R,U){for(const W of Lx){const J=new ho({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${W}`],title:U[W],"aria-hidden":"true"},children:[R.ownerDocument.importNode(VL,!0)]});R.appendChild(J.render())}}(M,y),function(R){const U=new ho({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});R.appendChild(U.render())}(M),M});w.insert(w.createPositionAt(A,"end"),E)}(g.writer,l,b),b.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,l=t.schema,d=e.editing.view;function p(g){return`ck-widget_type-around_show-fake-caret_${g}`}this._listenToIfEnabled(d.document,"arrowKey",(g,b)=>{this._handleArrowKeyPress(g,b)},{context:[An,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(g,b)=>{b.directChange&&e.model.change(w=>{w.removeSelectionAttribute(wi)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const g=i.getSelectedElement();g&&ha(e.editing.mapper.toViewElement(g),g,l)||e.model.change(b=>{b.removeSelectionAttribute(wi)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(g,b,w)=>{const y=w.writer;if(this._currentFakeCaretModelElement){const M=w.mapper.toViewElement(this._currentFakeCaretModelElement);M&&(y.removeClass(Lx.map(p),M),this._currentFakeCaretModelElement=null)}const A=b.selection.getSelectedElement();if(!A)return;const E=w.mapper.toViewElement(A);if(!ha(E,A,l))return;const D=us(b.selection);D&&(y.addClass(p(D),E),this._currentFakeCaretModelElement=A)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(g,b,w)=>{w||e.model.change(y=>{y.removeSelectionAttribute(wi)})})}_handleArrowKeyPress(e,t){const i=this.editor,l=i.model,d=l.document.selection,p=l.schema,g=i.editing.view,b=function(A,E){const D=sk(A,E);return D==="down"||D==="right"}(t.keyCode,i.locale.contentLanguageDirection),w=g.document.selection.getSelectedElement();let y;ha(w,i.editing.mapper.toModelElement(w),p)?y=this._handleArrowKeyPressOnSelectedWidget(b):d.isCollapsed?y=this._handleArrowKeyPressWhenSelectionNextToAWidget(b):t.shiftKey||(y=this._handleArrowKeyPressWhenNonCollapsedSelection(b)),y&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=us(t.document.selection);return t.change(l=>i?i!==(e?"after":"before")?(l.removeSelectionAttribute(wi),!0):!1:(l.setSelectionAttribute(wi,e?"after":"before"),!0))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,l=i.schema,d=t.plugins.get("Widget"),p=d._getObjectElementNextToSelection(e);return!!ha(t.editing.mapper.toViewElement(p),p,l)&&(i.change(g=>{d._setSelectionOverElement(p),g.setSelectionAttribute(wi,e?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,l=i.schema,d=t.editing.mapper,p=i.document.selection,g=e?p.getLastPosition().nodeBefore:p.getFirstPosition().nodeAfter;return!!ha(d.toViewElement(g),g,l)&&(i.change(b=>{b.setSelection(g,"on"),b.setSelectionAttribute(wi,e?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,l)=>{const d=l.domTarget.closest(".ck-widget__type-around__button");if(!d)return;const p=function(w){return w.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(d),g=function(w,y){const A=w.closest(".ck-widget");return y.mapDomToView(A)}(d,t.domConverter),b=e.editing.mapper.toModelElement(g);this._insertParagraph(b,p),l.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(l,d)=>{if(l.eventPhase!="atTarget")return;const p=t.getSelectedElement(),g=e.editing.mapper.toViewElement(p),b=e.model.schema;let w;this._insertParagraphAccordingToFakeCaretPosition()?w=!0:ha(g,p,b)&&(this._insertParagraph(p,d.isSoft?"before":"after"),w=!0),w&&(d.preventDefault(),l.stop())},{context:An})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,i)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(i.selection=e.selection)},{priority:"high"}),_.isAndroid?this._listenToIfEnabled(e,"keydown",(t,i)=>{i.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,l=i.schema;this._listenToIfEnabled(t.document,"delete",(d,p)=>{if(d.eventPhase!="atTarget")return;const g=us(i.document.selection);if(!g)return;const b=p.direction,w=i.document.selection.getSelectedElement(),y=b=="forward";if(g==="before"===y)e.execute("delete",{selection:i.createSelection(w,"on")});else{const A=l.getNearestSelectionRange(i.createPositionAt(w,g),b);if(A)if(A.isCollapsed){const E=i.createSelection(A.start);if(i.modifySelection(E,{direction:b}),E.focus.isEqual(A.start)){const D=function(M,R){let U=R;for(const W of R.getAncestors({parentFirst:!0})){if(W.childCount>1||M.isLimit(W))break;U=W}return U}(l,A.start.parent);i.deleteContent(i.createSelection(D,"on"),{doNotAutoparagraph:!0})}else i.change(D=>{D.setSelection(A),e.execute(y?"deleteForward":"delete")})}else i.change(E=>{E.setSelection(A),e.execute(y?"deleteForward":"delete")})}p.preventDefault(),d.stop()},{context:An})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(l,[d,p])=>{if(p&&!p.is("documentSelection"))return;const g=us(i);return g?(l.stop(),t.change(b=>{const w=i.getSelectedElement(),y=t.createPositionAt(w,g),A=b.createSelection(y),E=t.insertContent(d,A);return b.setSelection(A),E})):void 0},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(i,l)=>{const[,d,p={}]=l;if(d&&!d.is("documentSelection"))return;const g=us(t);g&&(p.findOptimalPosition=g,l[3]=p)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(i,[l])=>{l&&!l.is("documentSelection")||us(t)&&i.stop()},{priority:"high"})}}function WL(c){const e=c.model;return(t,i)=>{const l=i.keyCode==dt.arrowup,d=i.keyCode==dt.arrowdown,p=i.shiftKey,g=e.document.selection;if(!l&&!d)return;const b=d;if(p&&function(y,A){return!y.isCollapsed&&y.isBackward==A}(g,b))return;const w=function(y,A,E){const D=y.model;if(E){const M=A.isCollapsed?A.focus:A.getLastPosition(),R=zx(D,M,"forward");if(!R)return null;const U=D.createRange(M,R),W=Fx(D.schema,U,"backward");return W?D.createRange(M,W):null}{const M=A.isCollapsed?A.focus:A.getFirstPosition(),R=zx(D,M,"backward");if(!R)return null;const U=D.createRange(R,M),W=Fx(D.schema,U,"forward");return W?D.createRange(W,M):null}}(c,g,b);if(w){if(w.isCollapsed&&(g.isCollapsed||p))return;(w.isCollapsed||function(y,A,E){const D=y.model,M=y.view.domConverter;if(E){const ie=D.createSelection(A.start);D.modifySelection(ie),ie.focus.isAtEnd||A.start.isEqual(ie.focus)||(A=D.createRange(ie.focus,A.end))}const R=y.mapper.toViewRange(A),U=M.viewRangeToDom(R),W=ft.getDomRangeRects(U);let J;for(const ie of W)if(J!==void 0){if(Math.round(ie.top)>=J)return!1;J=Math.max(J,Math.round(ie.bottom))}else J=Math.round(ie.bottom);return!0}(c,w,b))&&(e.change(y=>{const A=b?w.end:w.start;if(p){const E=e.createSelection(g.anchor);E.setFocus(A),y.setSelection(E)}else y.setSelection(A)}),t.stop(),i.preventDefault(),i.stopPropagation())}}}function zx(c,e,t){const i=c.schema,l=c.createRangeIn(e.root),d=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:p,item:g,type:b}of l.getWalker({startPosition:e,direction:t})){if(i.isLimit(g)&&!i.isInline(g))return p;if(b==d&&i.isBlock(g))return null}return null}function Fx(c,e,t){const i=t=="backward"?e.end:e.start;if(c.checkChild(i,"$text"))return i;for(const{nextPosition:l}of e.getWalker({direction:t}))if(c.checkChild(l,"$text"))return l;return null}var Ux=a(3488),$L={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Ux.Z,$L),Ux.Z.locals;class Ru extends pe{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[HL,bi]}init(){const e=this.editor,t=e.editing.view,i=t.document;this.editor.editing.downcastDispatcher.on("selection",(l,d,p)=>{const g=p.writer,b=d.selection;if(b.isCollapsed)return;const w=b.getSelectedElement();if(!w)return;const y=e.editing.mapper.toViewElement(w);var A;An(y)&&p.consumable.consume(b,"selection")&&g.setSelection(g.createRangeOn(y),{fake:!0,label:(A=y,A.getCustomProperty("widgetLabel").reduce((E,D)=>typeof D=="function"?E?E+". "+D():D():E?E+". "+D:D,""))})}),this.editor.editing.downcastDispatcher.on("selection",(l,d,p)=>{this._clearPreviouslySelectedWidgets(p.writer);const g=p.writer,b=g.document.selection;let w=null;for(const y of b.getRanges())for(const A of y){const E=A.item;An(E)&&!YL(E,w)&&(g.addClass(Px,E),this._previouslySelected.add(E),w=E)}},{priority:"low"}),t.addObserver(Kk),this.listenTo(i,"mousedown",(...l)=>this._onMousedown(...l)),this.listenTo(i,"arrowKey",(...l)=>{this._handleSelectionChangeOnArrowKeyPress(...l)},{context:[An,"$text"]}),this.listenTo(i,"arrowKey",(...l)=>{this._preventDefaultOnArrowKeyPress(...l)},{context:"$root"}),this.listenTo(i,"arrowKey",WL(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(l,d)=>{this._handleDelete(d.direction=="forward")&&(d.preventDefault(),l.stop())},{context:"$root"})}_onMousedown(e,t){const i=this.editor,l=i.editing.view,d=l.document;let p=t.target;if(function(b){let w=b;for(;w;){if(w.is("editableElement")&&!w.is("rootElement"))return!0;if(An(w))return!1;w=w.parent}return!1}(p)){if((_.isSafari||_.isGecko)&&t.domEvent.detail>=3){const b=i.editing.mapper,w=p.is("attributeElement")?p.findAncestor(A=>!A.is("attributeElement")):p,y=b.toModelElement(w);t.preventDefault(),this.editor.model.change(A=>{A.setSelection(y,"in")})}return}if(!An(p)&&(p=p.findAncestor(An),!p))return;_.isAndroid&&t.preventDefault(),d.isFocused||l.focus();const g=i.editing.mapper.toModelElement(p);this._setSelectionOverElement(g)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,l=this.editor.model,d=l.schema,p=l.document.selection,g=p.getSelectedElement(),b=sk(i,this.editor.locale.contentLanguageDirection),w=b=="down"||b=="right",y=b=="up"||b=="down";if(g&&d.isObject(g)){const E=w?p.getLastPosition():p.getFirstPosition(),D=d.getNearestSelectionRange(E,w?"forward":"backward");return void(D&&(l.change(M=>{M.setSelection(D)}),t.preventDefault(),e.stop()))}if(!p.isCollapsed&&!t.shiftKey){const E=p.getFirstPosition(),D=p.getLastPosition(),M=E.nodeAfter,R=D.nodeBefore;return void((M&&d.isObject(M)||R&&d.isObject(R))&&(l.change(U=>{U.setSelection(w?D:E)}),t.preventDefault(),e.stop()))}if(!p.isCollapsed)return;const A=this._getObjectElementNextToSelection(w);if(A&&d.isObject(A)){if(d.isInline(A)&&y)return;this._setSelectionOverElement(A),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,l=i.schema,d=i.document.selection.getSelectedElement();d&&l.isObject(d)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t)||!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change(l=>{let d=t.anchor.parent;for(;d.isEmpty;){const p=d;d=p.parent,l.remove(p)}this._setSelectionOverElement(i)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,l=t.document.selection,d=t.createSelection(l);if(t.modifySelection(d,{direction:e?"forward":"backward"}),d.isEqual(l))return null;const p=e?d.focus.nodeBefore:d.focus.nodeAfter;return p&&i.isObject(p)?p:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Px,t);this._previouslySelected.clear()}}function YL(c,e){return!!e&&Array.from(c.getAncestors()).includes(e)}class Tp extends pe{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[yp]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",i=>{(function(l){const d=l.getSelectedElement();return!(!d||!An(d))})(e.editing.view.document.selection)&&i.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:l,balloonClassName:d="ck-toolbar-container"}){if(!i.length)return void te("widget-toolbar-no-items",{toolbarId:e});const p=this.editor,g=p.t,b=new Qk(p.locale);if(b.ariaLabel=t||g("Widget toolbar"),this._toolbarDefinitions.has(e))throw new z("widget-toolbar-duplicated",this,{toolbarId:e});const w={view:b,getRelatedElement:l,balloonClassName:d,itemsConfig:i,initialized:!1};p.ui.addToolbar(b,{isContextual:!0,beforeFocus:()=>{const y=l(p.editing.view.document.selection);y&&this._showToolbar(w,y)},afterBlur:()=>{this._hideToolbar(w)}}),this._toolbarDefinitions.set(e,w)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const l of this._toolbarDefinitions.values()){const d=l.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&d)if(this.editor.ui.focusTracker.isFocused){const p=d.getAncestors().length;p>e&&(e=p,t=d,i=l)}else this._isToolbarVisible(l)&&this._hideToolbar(l);else this._isToolbarInBalloon(l)&&this._hideToolbar(l)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Vx(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Hx(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const i of this._toolbarDefinitions.values())if(this._isToolbarVisible(i)){const l=i.getRelatedElement(this.editor.editing.view.document.selection);Vx(this.editor,l)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Vx(c,e){const t=c.plugins.get("ContextualBalloon"),i=Hx(c,e);t.updatePosition(i)}function Hx(c,e){const t=c.editing.view,i=fr.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}var Wx=a(8506),qL={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Wx.Z,qL),Wx.Z.locals;const bb=pu("px");class KL extends Ke{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>bb(t)),top:e.to("top",t=>bb(t)),width:e.to("width",t=>bb(t))}}})}}class Ip extends pe{constructor(){super(...arguments),this.removeDropMarkerDelayed=ak(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=wp(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=wp(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new KL,this._domEmitter=new(Hr()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,l,d){this.removeDropMarkerDelayed.cancel();const p=$x(this.editor,e,t,i,l,d);p&&this._updateDropMarkerThrottled(p)}getFinalDropRange(e,t,i,l,d){const p=$x(this.editor,e,t,i,l,d);return this.removeDropMarker(),p}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(l=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||l.updateMarker("drop-target",{range:e}):l.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){const i=this.toDomElement(t);return i.append("",t.createElement("span"),""),i})}_updateDropTargetLine(e){const t=this.editor.editing,i=e.start.nodeBefore,l=e.start.nodeAfter,d=e.start.parent,p=i?t.mapper.toViewElement(i):null,g=p?t.view.domConverter.mapViewToDom(p):null,b=l?t.mapper.toViewElement(l):null,w=b?t.view.domConverter.mapViewToDom(b):null,y=t.mapper.toViewElement(d),A=t.view.domConverter.mapViewToDom(y),E=this._getScrollableRect(y),{scrollX:D,scrollY:M}=Oe.window,R=g?new ft(g):null,U=w?new ft(w):null,W=new ft(A).excludeScrollbarsAndBorders(),J=R?R.bottom:W.top,ie=U?U.top:W.bottom,ve=Oe.window.getComputedStyle(A),Be=J<=ie?(J+ie)/2:ie;if(E.topE.is("element")&&!GL(c,E));let y=0,A=w.length;if(A==0)return p.createRange(p.createPositionAt(b,"end"));for(;ye in c?QL(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;class tj extends pe{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(Hr())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,i,l)=>{l?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),_.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",(i,l)=>this._handleBlockDragStart(l)),this._domEmitter.listenTo(Oe.document,"dragover",(i,l)=>this._handleBlockDragging(l)),this._domEmitter.listenTo(Oe.document,"drop",(i,l)=>this._handleBlockDragging(l)),this._domEmitter.listenTo(Oe.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",(i,l,d)=>{t.setAttribute("draggable",d?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,l=this.editor.editing.view,d=Array.from(i.getSelectedBlocks()),p=t.createRange(t.createPositionBefore(d[0]),t.createPositionAfter(d[d.length-1]));t.change(g=>g.setSelection(p)),this._isBlockDragging=!0,l.focus(),l.getObserver(Ou).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),i=e.clientY,l=document.elementFromPoint(t,i),d=this.editor.editing.view;var p,g;l&&l.closest(".ck-editor__editable")&&d.getObserver(Ou).onDomEvent((p=((b,w)=>{for(var y in w||(w={}))XL.call(w,y)&&Gx(b,y,w[y]);if(Kx)for(var y of Kx(w))ej.call(w,y)&&Gx(b,y,w[y]);return b})({},e),g={type:e.type,dataTransfer:e.dataTransfer,target:l,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()},ZL(p,JL(g))))}_handleBlockDragEnd(){this._isBlockDragging=!1}}var Qx=a(903),nj={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Qx.Z,nj),Qx.Z.locals;class rj extends pe{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=ak(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(Hr())}static get pluginName(){return"DragDrop"}static get requires(){return[Ko,Ru,Ip,tj]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(Ou),t.addObserver(Kk),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(i,l,d)=>{d?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(i,l,d)=>{d||this._finalizeDragging(!1)}),_.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=e.editing.view,l=i.document,d=e.plugins.get(Ip);this.listenTo(l,"dragstart",(p,g)=>{if(g.target&&g.target.is("editableElement")||(this._prepareDraggedRange(g.target),!this._draggedRange))return void g.preventDefault();this._draggingUid=V(),g.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",g.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const b=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(g.dataTransfer,b,"dragstart");const{dataTransfer:w,domTarget:y,domEvent:A}=g,{clientX:E}=A;this._updatePreview({dataTransfer:w,domTarget:y,clientX:E}),g.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(l,"dragend",(p,g)=>{this._finalizeDragging(!g.dataTransfer.isCanceled&&g.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(Oe.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(l,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(l,"dragleave",()=>{d.removeDropMarkerDelayed()}),this.listenTo(l,"dragging",(p,g)=>{if(!this.isEnabled)return void(g.dataTransfer.dropEffect="none");const{clientX:b,clientY:w}=g.domEvent;d.updateDropMarker(g.target,g.targetRanges,b,w,this._blockMode),this._draggedRange||(g.dataTransfer.dropEffect="copy"),_.isGecko||(g.dataTransfer.effectAllowed=="copy"?g.dataTransfer.dropEffect="copy":["all","copyMove"].includes(g.dataTransfer.effectAllowed)&&(g.dataTransfer.dropEffect="move")),p.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get(Ip);this.listenTo(t,"clipboardInput",(l,d)=>{if(d.method!="drop")return;const{clientX:p,clientY:g}=d.domEvent,b=i.getFinalDropRange(d.target,d.targetRanges,p,g,this._blockMode);if(!b)return this._finalizeDragging(!1),void l.stop();if(this._draggedRange&&this._draggingUid!=d.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),Zx(d.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(b,!0))return this._finalizeDragging(!1),void l.stop();d.targetRanges=[e.editing.mapper.toViewRange(b)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Ko);e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const l=i.targetRanges.map(d=>this.editor.editing.mapper.toModelRange(d));this.editor.model.change(d=>d.setSelection(l))},{priority:"high"}),e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const l=Zx(i.dataTransfer)=="move",d=!i.resultRange||!i.resultRange.isCollapsed;this._finalizeDragging(d&&l)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(l,d)=>{if(_.isAndroid||!d)return;this._clearDraggableAttributesDelayed.cancel();let p=Jx(d.target);if(_.isBlink&&!e.isReadOnly&&!p&&!i.selection.isCollapsed){const g=i.selection.getSelectedElement();g&&An(g)||(p=i.selection.editableElement)}p&&(t.change(g=>{g.setAttribute("draggable","true",p)}),this._draggableElement=e.editing.mapper.toModelElement(p))}),this.listenTo(i,"mouseup",()=>{_.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,i=t.model;t.plugins.get(Ip).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change(l=>{const d=i.createSelection(this._draggedRange);i.deleteContent(d,{doNotAutoparagraph:!0});const p=d.getFirstPosition().parent;p.isEmpty&&!i.schema.checkChild(p,"$text")&&i.schema.checkChild(p,"paragraph")&&l.insertElement("paragraph",p,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,i=t.model,l=i.document.selection,d=e?Jx(e):null;if(d){const w=t.editing.mapper.toModelElement(d);this._draggedRange=Sr.fromRange(i.createRangeOn(w)),this._blockMode=i.schema.isBlock(w),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(l.isCollapsed&&!l.getFirstPosition().parent.isEmpty)return;const p=Array.from(l.getSelectedBlocks()),g=l.getFirstRange();if(p.length==0)return void(this._draggedRange=Sr.fromRange(g));const b=Xx(i,p);if(p.length>1)this._draggedRange=Sr.fromRange(b),this._blockMode=!0;else if(p.length==1){const w=g.start.isTouching(b.start)&&g.end.isTouching(b.end);this._draggedRange=Sr.fromRange(w?b:g),this._blockMode=w}i.change(w=>w.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){const l=this.editor.editing.view,d=l.document.selection.editableElement,p=l.domConverter.mapViewToDom(d),g=Oe.window.getComputedStyle(p);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Oo(Oe.document,"div",{style:"position: fixed; left: -999999px;"}),Oe.document.body.appendChild(this._previewContainer));const b=new ft(p);if(p.contains(t))return;const w=parseFloat(g.paddingLeft),y=Oo(Oe.document,"div");y.className="ck ck-content",y.style.width=g.width,y.style.paddingLeft=`${b.left-i+w}px`,_.isiOS&&(y.style.backgroundColor="white"),y.innerHTML=e.getData("text/html"),e.setDragImage(y,0,0),this._previewContainer.appendChild(y)}}function Zx(c){return _.isGecko?c.dropEffect:["all","copyMove"].includes(c.effectAllowed)?"move":"copy"}function Jx(c){if(c.is("editableElement"))return null;if(c.hasClass("ck-widget__selection-handle"))return c.findAncestor(An);if(An(c))return c;const e=c.findAncestor(t=>An(t)||t.is("editableElement"));return An(e)?e:null}function Xx(c,e){const t=e[0],i=e[e.length-1],l=t.getCommonAncestor(i),d=c.createPositionBefore(t),p=c.createPositionAfter(i);if(l&&l.is("element")&&!c.schema.isLimit(l)){const g=c.createRangeOn(l),b=d.isTouching(g.start),w=p.isTouching(g.end);if(b&&w)return Xx(c,[l])}return c.createRange(d,p)}class oj extends pe{static get pluginName(){return"PastePlainText"}static get requires(){return[Ko]}init(){const e=this.editor,t=e.model,i=e.editing.view,l=i.document,d=t.document.selection;let p=!1;i.addObserver(Ou),this.listenTo(l,"keydown",(g,b)=>{p=b.shiftKey}),e.plugins.get(Ko).on("contentInsertion",(g,b)=>{(p||function(w,y){if(w.childCount>1)return!1;const A=w.getChild(0);return y.isObject(A)?!1:Array.from(A.getAttributeKeys()).length==0}(b.content,t.schema))&&t.change(w=>{const y=Array.from(d.getAttributes()).filter(([E])=>t.schema.getAttributeProperties(E).isFormatting);d.isCollapsed||t.deleteContent(d,{doNotAutoparagraph:!0}),y.push(...d.getAttributes());const A=w.createRangeIn(b.content);for(const E of A.getItems())E.is("$textProxy")&&w.setAttributes(y,E)})})}}class eE extends pe{static get pluginName(){return"Clipboard"}static get requires(){return[Ko,rj,oj]}}class ij extends nt{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!tE(e.schema,i))do if(i=i.parent,!i)return;while(!tE(e.schema,i));e.change(l=>{l.setSelection(i,"in")})}}function tE(c,e){return c.isLimit(e)&&(c.checkChild(e,"$text")||c.checkChild(e,"paragraph"))}const sj=gu("Ctrl+A");class aj extends pe{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new ij(e)),this.listenTo(t,"keydown",(i,l)=>{wc(l)===sj&&(e.execute("selectAll"),l.preventDefault())})}}class cj extends pe{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const i=e.commands.get("selectAll"),l=new zt(t),d=t.t;return l.set({label:d("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),l.bind("isEnabled").to(i,"isEnabled"),this.listenTo(l,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),l})}}class lj extends pe{static get requires(){return[aj,cj]}static get pluginName(){return"SelectAll"}}var uj=Object.defineProperty,nE=Object.getOwnPropertySymbols,dj=Object.prototype.hasOwnProperty,hj=Object.prototype.propertyIsEnumerable,rE=(c,e,t)=>e in c?uj(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;class oE extends nt{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,i)=>{i[1]=((d,p)=>{for(var g in p||(p={}))dj.call(p,g)&&rE(d,g,p[g]);if(nE)for(var g of nE(p))hj.call(p,g)&&rE(d,g,p[g]);return d})({},i[1]);const l=i[1];l.batchType||(l.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,i)=>{i[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const l=this.editor.model,d=l.document,p=[],g=e.map(w=>w.getTransformedByOperations(i)),b=g.flat();for(const w of g){const y=w.filter(A=>A.root!=d.graveyard).filter(A=>!fj(A,b));y.length&&(pj(y),p.push(y[0]))}p.length&&l.change(w=>{w.setSelection(p,{backward:t})})}_undo(e,t){const i=this.editor.model,l=i.document;this._createdBatches.add(t);const d=e.operations.slice().filter(p=>p.isDocumentOperation);d.reverse();for(const p of d){const g=p.baseVersion+1,b=Array.from(l.history.getOperations(g)),w=gB([p.getReversed()],b,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let y of w){const A=y.affectedSelectable;A&&!i.canEditAt(A)&&(y=new yn(y.baseVersion)),t.addOperation(y),i.applyOperation(y),l.history.setOperationAsUndone(p,y)}}}}function pj(c){c.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;et!==c&&t.containsRange(c,!0))}class gj extends oE{execute(e=null){const t=e?this._stack.findIndex(d=>d.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],l=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(l,()=>{this._undo(i.batch,l);const d=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,d)}),this.fire("revert",i.batch,l),this.refresh()}}class mj extends oE{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,l=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,l),this._undo(e.batch,t)}),this.refresh()}}class kj extends pe{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor;this._undoCommand=new gj(e),this._redoCommand=new mj(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(t,i)=>{const l=i[0];if(!l.isDocumentOperation)return;const d=l.batch,p=this._redoCommand.createdBatches.has(d),g=this._undoCommand.createdBatches.has(d);this._batchRegistry.has(d)||(this._batchRegistry.add(d),d.isUndoable&&(p?this._undoCommand.addBatch(d):g||(this._undoCommand.addBatch(d),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,i,l)=>{this._redoCommand.addBatch(l)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}const iE='',sE='';class bj extends pe{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,l=t.uiLanguageDirection=="ltr"?iE:sE,d=t.uiLanguageDirection=="ltr"?sE:iE;this._addButton("undo",i("Undo"),"CTRL+Z",l),this._addButton("redo",i("Redo"),"CTRL+Y",d)}_addButton(e,t,i,l){const d=this.editor;d.ui.componentFactory.add(e,p=>{const g=d.commands.get(e),b=new zt(p);return b.set({label:t,icon:l,keystroke:i,tooltip:!0}),b.bind("isEnabled").to(g,"isEnabled"),this.listenTo(b,"execute",()=>{d.execute(e),d.editing.view.focus()}),b})}}class aE extends pe{static get requires(){return[kj,bj]}static get pluginName(){return"Undo"}}class wj extends Ve(){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,l)=>{t.onload=()=>{const d=t.result;this._data=d,i(d)},t.onerror=()=>{l("error")},t.onabort=()=>{l("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}class bo extends pe{constructor(){super(...arguments),this.loaders=new lo,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[r1]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return te("filerepository-no-upload-adapter"),null;const t=new cE(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(i=>{this._loadersMap.set(i,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let i=0;for(const l of this.loaders)i+=l.uploaded;this.uploaded=i}),t.on("change:uploadTotal",()=>{let i=0;for(const l of this.loaders)l.uploadTotal&&(i+=l.uploadTotal);this.uploadTotal=i}),t}destroyLoader(e){const t=e instanceof cE?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((i,l)=>{i===t&&this._loadersMap.delete(l)})}_updatePendingAction(){const e=this.editor.plugins.get(r1);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=l=>`${t("Upload in progress")} ${parseInt(l)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}class cE extends Ve(){constructor(e,t){super(),this.id=V(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new wj,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(i,l)=>l?i/l*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new z("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new z("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,l)=>{t.rejecter=l,t.isFulfilled=!1,e.then(d=>{t.isFulfilled=!0,i(d)}).catch(d=>{t.isFulfilled=!0,l(d)})}),t}}class vj extends Ke{constructor(e){super(e),this.buttonView=new zt(e),this._fileInputView=new yj(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class yj extends Ke{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}const lE="ckCsrfToken",uE="abcdefghijklmnopqrstuvwxyz0123456789";function _j(){let c=function(i){i=i.toLowerCase();const l=document.cookie.split(";");for(const d of l){const p=d.split("=");if(decodeURIComponent(p[0].trim().toLowerCase())===i)return decodeURIComponent(p[1])}return null}(lE);var e,t;return c&&c.length==40||(c=function(i){let l="";const d=new Uint8Array(i);window.crypto.getRandomValues(d);for(let p=0;p.5?g.toUpperCase():g}return l}(40),e=lE,t=c,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/"),c}class Cj{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const l=this.xhr,d=this.loader,p=(0,this.t)("Cannot upload file:")+` ${i.name}.`;l.addEventListener("error",()=>t(p)),l.addEventListener("abort",()=>t()),l.addEventListener("load",()=>{const g=l.response;if(!g||!g.uploaded)return t(g&&g.error&&g.error.message?g.error.message:p);e({default:g.url})}),l.upload&&l.upload.addEventListener("progress",g=>{g.lengthComputable&&(d.uploadTotal=g.total,d.uploaded=g.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",_j()),this.xhr.send(t)}}function ds(c,e,t,i){let l,d=null;typeof i=="function"?l=i:(d=c.commands.get(i),l=()=>{c.execute(i)}),c.model.document.on("change:data",(p,g)=>{if(d&&!d.isEnabled||!e.isEnabled)return;const b=vn(c.model.document.selection.getRanges());if(!b.isCollapsed||g.isUndo||!g.isLocal)return;const w=Array.from(c.model.document.differ.getChanges()),y=w[0];if(w.length!=1||y.type!=="insert"||y.name!="$text"||y.length!=1)return;const A=y.position.parent;if(A.is("element","codeBlock")||A.is("element","listItem")&&typeof i!="function"&&!["numberedList","bulletedList","todoList"].includes(i)||d&&d.value===!0)return;const E=A.getChild(0),D=c.model.createRangeOn(E);if(!D.containsRange(b)&&!b.end.isEqual(D.end))return;const M=t.exec(E.data.substr(0,b.end.offset));M&&c.model.enqueueChange(R=>{const U=R.createPositionAt(A,0),W=R.createPositionAt(A,M[0].length),J=new Sr(U,W);if(l({match:M})!==!1){R.remove(J);const ie=c.model.document.selection.getFirstRange(),ve=R.createRangeIn(A);!A.isEmpty||ve.isEqual(ie)||ve.containsRange(ie,!0)||R.remove(A)}J.detach(),c.model.enqueueChange(()=>{c.plugins.get("Delete").requestUndoOnBackspace()})})})}function Pc(c,e,t,i){let l,d;t instanceof RegExp?l=t:d=t,d=d||(p=>{let g;const b=[],w=[];for(;(g=l.exec(p))!==null&&!(g&&g.length<4);){let{index:y,1:A,2:E,3:D}=g;const M=A+E+D;y+=g[0].length-M.length;const R=[y,y+A.length],U=[y+A.length+E.length,y+A.length+E.length+D.length];b.push(R),b.push(U),w.push([y+A.length,y+A.length+E.length])}return{remove:b,format:w}}),c.model.document.on("change:data",(p,g)=>{if(g.isUndo||!g.isLocal||!e.isEnabled)return;const b=c.model,w=b.document.selection;if(!w.isCollapsed)return;const y=Array.from(b.document.differ.getChanges()),A=y[0];if(y.length!=1||A.type!=="insert"||A.name!="$text"||A.length!=1)return;const E=w.focus,D=E.parent,{text:M,range:R}=function(ie,ve){let Be=ie.start;return{text:Array.from(ie.getItems()).reduce((at,rn)=>!rn.is("$text")&&!rn.is("$textProxy")||rn.getAttribute("code")?(Be=ve.createPositionAfter(rn),""):at+rn.data,""),range:ve.createRange(Be,ie.end)}}(b.createRange(b.createPositionAt(D,0),E),b),U=d(M),W=dE(R.start,U.format,b),J=dE(R.start,U.remove,b);W.length&&J.length&&b.enqueueChange(ie=>{if(i(ie,W)!==!1){for(const ve of J.reverse())ie.remove(ve);b.enqueueChange(()=>{c.plugins.get("Delete").requestUndoOnBackspace()})}})})}function dE(c,e,t){return e.filter(i=>i[0]!==void 0&&i[1]!==void 0).map(i=>t.createRange(c.getShiftedBy(i[0]),c.getShiftedBy(i[1])))}function Pp(c,e){return(t,i)=>{if(!c.commands.get(e).isEnabled)return!1;const l=c.model.schema.getValidRanges(i,e);for(const d of l)t.setAttribute(e,!0,d);t.removeSelectionAttribute(e)}}class hE extends nt{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,l=e.forceValue===void 0?!this.value:e.forceValue;t.change(d=>{if(i.isCollapsed)l?d.setSelectionAttribute(this.attributeKey,!0):d.removeSelectionAttribute(this.attributeKey);else{const p=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const g of p)l?d.setAttribute(this.attributeKey,l,g):d.removeAttribute(this.attributeKey,g)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const l of i.getRanges())for(const d of l.getItems())if(t.checkAttribute(d,this.attributeKey))return d.hasAttribute(this.attributeKey);return!1}}const Nc="bold";class Aj extends pe{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Nc}),e.model.schema.setAttributeProperties(Nc,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Nc,view:"strong",upcastAlso:["b",t=>{const i=t.getStyle("font-weight");return i&&(i=="bold"||Number(i)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Nc,new hE(e,Nc)),e.keystrokes.set("CTRL+B",Nc)}}const wb="bold";class xj extends pe{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(wb,i=>{const l=e.commands.get(wb),d=new zt(i);return d.set({label:t("Bold"),icon:Wt.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),d.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(d,"execute",()=>{e.execute(wb),e.editing.view.focus()}),d})}}var pE=a(8603),Ej={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(pE.Z,Ej),pE.Z.locals;const Oc="italic";class Sj extends pe{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Oc}),e.model.schema.setAttributeProperties(Oc,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Oc,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Oc,new hE(e,Oc)),e.keystrokes.set("CTRL+I",Oc)}}const vb="italic";class Dj extends pe{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(vb,i=>{const l=e.commands.get(vb),d=new zt(i);return d.set({label:t("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),d.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(d,"execute",()=>{e.execute(vb),e.editing.view.focus()}),d})}}class Tj extends nt{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,l=t.document.selection,d=Array.from(l.getSelectedBlocks()),p=e.forceValue===void 0?!this.value:e.forceValue;t.change(g=>{if(p){const b=d.filter(w=>Np(w)||gE(i,w));this._applyQuote(g,b)}else this._removeQuote(g,d.filter(Np))})}_getValue(){const e=vn(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Np(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=vn(e.getSelectedBlocks());return!!i&&gE(t,i)}_removeQuote(e,t){fE(e,t).reverse().forEach(i=>{if(i.start.isAtStart&&i.end.isAtEnd)return void e.unwrap(i.start.parent);if(i.start.isAtStart){const d=e.createPositionBefore(i.start.parent);return void e.move(i,d)}i.end.isAtEnd||e.split(i.end);const l=e.createPositionAfter(i.end.parent);e.move(i,l)})}_applyQuote(e,t){const i=[];fE(e,t).reverse().forEach(l=>{let d=Np(l.start);d||(d=e.createElement("blockQuote"),e.wrap(l,d)),i.push(d)}),i.reverse().reduce((l,d)=>l.nextSibling==d?(e.merge(e.createPositionAfter(l)),l):d)}}function Np(c){return c.parent.name=="blockQuote"?c.parent:null}function fE(c,e){let t,i=0;const l=[];for(;i{const g=e.model.document.differ.getChanges();for(const b of g)if(b.type=="insert"){const w=b.position.nodeAfter;if(!w)continue;if(w.is("element","blockQuote")&&w.isEmpty)return p.remove(w),!0;if(w.is("element","blockQuote")&&!t.checkChild(b.position,w))return p.unwrap(w),!0;if(w.is("element")){const y=p.createRangeIn(w);for(const A of y.getItems())if(A.is("element","blockQuote")&&!t.checkChild(p.createPositionBefore(A),A))return p.unwrap(A),!0}}else if(b.type=="remove"){const w=b.position.parent;if(w.is("element","blockQuote")&&w.isEmpty)return p.remove(w),!0}return!1});const i=this.editor.editing.view.document,l=e.model.document.selection,d=e.commands.get("blockQuote");this.listenTo(i,"enter",(p,g)=>{!l.isCollapsed||!d.value||l.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),g.preventDefault(),p.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(p,g)=>{if(g.direction!="backward"||!l.isCollapsed||!d.value)return;const b=l.getLastPosition().parent;b.isEmpty&&!b.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),g.preventDefault(),p.stop())},{context:"blockquote"})}}var mE=a(3062),Mj={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(mE.Z,Mj),mE.Z.locals;class Pj extends pe{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const l=e.commands.get("blockQuote"),d=new zt(i);return d.set({label:t("Block quote"),icon:Wt.quote,tooltip:!0,isToggleable:!0}),d.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(d,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),d})}}class Nj extends pe{static get pluginName(){return"CKBoxUI"}afterInit(){const e=this.editor,t=e.commands.get("ckbox");if(!t)return;const i=e.t;e.ui.componentFactory.add("ckbox",l=>{const d=new zt(l);return d.set({label:i("Open file manager"),icon:'',tooltip:!0}),d.bind("isOn","isEnabled").to(t,"value","isEnabled"),d.on("execute",()=>{e.execute("ckbox")}),d})}}function kE(c){const e=[];let t=0;for(const l in c){const d=parseInt(l,10);isNaN(d)||(d>t&&(t=d),e.push(`${c[l]} ${l}w`))}const i=[{srcset:e.join(","),sizes:`(max-width: ${t}px) 100vw, ${t}px`,type:"image/webp"}];return{imageFallbackUrl:c.default,imageSources:i}}class Oj extends nt{constructor(e){super(e),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return this._wrapper!==null}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox");return{theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,dialog:{onClose:()=>this.fire("ckbox:close")},assets:{onChoose:t=>this.fire("ckbox:choose",t)}}}_initListeners(){const e=this.editor,t=e.model,i=!e.config.get("ckbox.ignoreDataId");this.on("ckbox",()=>{this.refresh()},{priority:"low"}),this.on("ckbox:open",()=>{this.isEnabled&&!this.value&&(this._wrapper=Oo(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))}),this.on("ckbox:close",()=>{this.value&&(this._wrapper.remove(),this._wrapper=null)}),this.on("ckbox:choose",(l,d)=>{if(!this.isEnabled)return;const p=e.commands.get("insertImage"),g=e.commands.get("link"),b=function({assets:w,isImageAllowed:y,isLinkAllowed:A}){return w.map(E=>function(D){const M=D.data.metadata;return M?M.width&&M.height:!1}(E)?{id:E.data.id,type:"image",attributes:Bj(E)}:{id:E.data.id,type:"link",attributes:Rj(E)}).filter(E=>E.type==="image"?y:A)}({assets:d,isImageAllowed:p.isEnabled,isLinkAllowed:g.isEnabled});b.length!==0&&t.change(w=>{for(const y of b){const A=y===b[b.length-1];this._insertAsset(y,A,w),i&&(setTimeout(()=>this._chosenAssets.delete(y),1e3),this._chosenAssets.add(y))}})}),this.listenTo(e,"destroy",()=>{this.fire("ckbox:close"),this._chosenAssets.clear()})}_insertAsset(e,t,i){const l=this.editor.model.document.selection;i.removeSelectionAttribute("linkHref"),e.type==="image"?this._insertImage(e):this._insertLink(e,i),t||i.setSelection(l.getLastPosition())}_insertImage(e){const t=this.editor,{imageFallbackUrl:i,imageSources:l,imageTextAlternative:d}=e.attributes;t.execute("insertImage",{source:{src:i,sources:l,alt:d}})}_insertLink(e,t){const i=this.editor,l=i.model,d=l.document.selection,{linkName:p,linkHref:g}=e.attributes;if(d.isCollapsed){const b=Ho(d.getAttributes()),w=t.createText(p,b),y=l.insertContent(w);t.setSelection(y)}i.execute("link",g)}}function Bj(c){const{imageFallbackUrl:e,imageSources:t}=kE(c.data.imageUrls);return{imageFallbackUrl:e,imageSources:t,imageTextAlternative:c.data.metadata.description||""}}function Rj(c){return{linkName:c.data.name,linkHref:Lj(c)}}function Lj(c){const e=new URL(c.data.url);return e.searchParams.set("download","true"),e.toString()}var pa=(c,e,t)=>new Promise((i,l)=>{var d=b=>{try{g(t.next(b))}catch(w){l(w)}},p=b=>{try{g(t.throw(b))}catch(w){l(w)}},g=b=>b.done?i(b.value):Promise.resolve(b.value).then(d,p);g((t=t.apply(c,e)).next())});class jj extends pe{static get requires(){return["ImageUploadEditing","ImageUploadProgress",bo,yb]}static get pluginName(){return"CKBoxUploadAdapter"}afterInit(){return pa(this,null,function*(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;const l=e.plugins.get(bo),d=e.plugins.get(yb);l.createUploadAdapter=b=>new zj(b,d.getToken(),e);const p=!e.config.get("ckbox.ignoreDataId"),g=e.plugins.get("ImageUploadEditing");p&&g.on("uploadComplete",(b,{imageElement:w,data:y})=>{e.model.change(A=>{A.setAttribute("ckboxImageId",y.ckboxImageId,w)})})})}}class zj{constructor(e,t,i){this.loader=e,this.token=t,this.editor=i,this.controller=new AbortController,this.serviceOrigin=i.config.get("ckbox.serviceOrigin")}getWorkspaceId(){const e=(0,this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),i=function(l,d){const[,p]=l.value.split("."),g=JSON.parse(atob(p)),b=g.auth&&g.auth.ckbox&&g.auth.ckbox.workspaces||[g.aud];return d?(g.auth&&g.auth.ckbox&&g.auth.ckbox.role)=="superadmin"||b.includes(d)?d:null:b[0]}(this.token,t);if(i==null)throw ae("ckbox-access-default-workspace-error"),e;return i}getAvailableCategories(e=0){return pa(this,null,function*(){const t=new URL("categories",this.serviceOrigin);return t.searchParams.set("limit",50 .toString()),t.searchParams.set("offset",e.toString()),t.searchParams.set("workspaceId",this.getWorkspaceId()),this._sendHttpRequest({url:t}).then(i=>pa(this,null,function*(){if(i.totalCount-(e+50)>0){const l=yield this.getAvailableCategories(e+50);return[...i.items,...l]}return i.items})).catch(()=>{this.controller.signal.throwIfAborted(),ae("ckbox-fetch-category-http-error")})})}getCategoryIdForFile(e){return pa(this,null,function*(){const t=function(p){const g=new RegExp("\\.(?[^.]+)$");return p.match(g).groups.ext.toLowerCase()}(e.name),i=yield this.getAvailableCategories();if(!i)return null;const l=this.editor.config.get("ckbox.defaultUploadCategories");if(l){const p=Object.keys(l).find(g=>l[g].find(b=>b.toLowerCase()==t));if(p){const g=i.find(b=>b.id===p||b.name===p);return g?g.id:null}}const d=i.find(p=>p.extensions.find(g=>g.toLowerCase()==t));return d?d.id:null})}upload(){return pa(this,null,function*(){const e=this.editor.t,t=e("Cannot determine a category for the uploaded file."),i=yield this.loader.file,l=yield this.getCategoryIdForFile(i);if(!l)return Promise.reject(t);const d=new URL("assets",this.serviceOrigin),p=new FormData;d.searchParams.set("workspaceId",this.getWorkspaceId()),p.append("categoryId",l),p.append("file",i);const g={method:"POST",url:d,data:p,onUploadProgress:b=>{b.lengthComputable&&(this.loader.uploadTotal=b.total,this.loader.uploaded=b.loaded)}};return this._sendHttpRequest(g).then(b=>pa(this,null,function*(){const w=kE(b.imageUrls);return{ckboxImageId:b.id,default:w.imageFallbackUrl,sources:w.imageSources}})).catch(()=>{const b=e("Cannot upload file:")+` ${i.name}.`;return Promise.reject(b)})})}abort(){this.controller.abort()}_sendHttpRequest({url:e,method:t="GET",data:i,onUploadProgress:l}){const d=this.controller.signal,p=new XMLHttpRequest;p.open(t,e.toString(),!0),p.setRequestHeader("Authorization",this.token.value),p.setRequestHeader("CKBox-Version","CKEditor 5"),p.responseType="json";const g=()=>{p.abort()};return new Promise((b,w)=>{d.addEventListener("abort",g),p.addEventListener("loadstart",()=>{d.addEventListener("abort",g)}),p.addEventListener("loadend",()=>{d.removeEventListener("abort",g)}),p.addEventListener("error",()=>{w()}),p.addEventListener("abort",()=>{w()}),p.addEventListener("load",()=>pa(this,null,function*(){const y=p.response;return!y||y.statusCode>=400?w(y&&y.message):b(y)})),l&&p.upload.addEventListener("progress",y=>{l(y)}),p.send(i)})}}class yb extends pe{static get pluginName(){return"CKBoxEditing"}static get requires(){return["CloudServices","LinkEditing","PictureEditing",jj]}init(){return e=this,t=null,i=function*(){const l=this.editor,d=!!l.config.get("ckbox"),p=!!window.CKBox;if(!d&&!p)return;this._initConfig();const g=l.plugins.get("CloudServicesCore"),b=l.config.get("ckbox.tokenUrl");if(b===l.config.get("cloudServices.tokenUrl")){const w=l.plugins.get("CloudServices");this._token=w.token}else this._token=yield g.createToken(b).init();l.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()),p&&l.commands.add("ckbox",new Oj(l))},new Promise((l,d)=>{var p=w=>{try{b(i.next(w))}catch(y){d(y)}},g=w=>{try{b(i.throw(w))}catch(y){d(y)}},b=w=>w.done?l(w.value):Promise.resolve(w.value).then(p,g);b((i=i.apply(e,t)).next())});var e,t,i}getToken(){return this._token}_initConfig(){const e=this.editor;if(e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:"default",tokenUrl:e.config.get("cloudServices.tokenUrl")}),!e.config.get("ckbox.tokenUrl"))throw new z("ckbox-plugin-missing-token-url",this);e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||ae("ckbox-plugin-image-feature-missing",e)}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck((t,i)=>{if(!t.last.getAttribute("linkHref")&&i==="ckboxLinkId")return!1})}_initConversion(){const e=this.editor;e.conversion.for("downcast").add(t=>{t.on("attribute:ckboxLinkId:imageBlock",(i,l,d)=>{const{writer:p,mapper:g,consumable:b}=d;if(!b.consume(l.item,i.name))return;const w=[...g.toViewElement(l.item).getChildren()].find(y=>y.name==="a");w&&(l.item.hasAttribute("ckboxLinkId")?p.setAttribute("data-ckbox-resource-id",l.item.getAttribute("ckboxLinkId"),w):p.removeAttribute("data-ckbox-resource-id",w))},{priority:"low"}),t.on("attribute:ckboxLinkId",(i,l,d)=>{const{writer:p,mapper:g,consumable:b}=d;if(b.consume(l.item,i.name)){if(l.attributeOldValue){const w=bE(p,l.attributeOldValue);p.unwrap(g.toViewRange(l.range),w)}if(l.attributeNewValue){const w=bE(p,l.attributeNewValue);if(l.item.is("selection")){const y=p.document.selection;p.wrap(y.getFirstRange(),w)}else p.wrap(g.toViewRange(l.range),w)}}},{priority:"low"})}),e.conversion.for("upcast").add(t=>{t.on("element:a",(i,l,d)=>{const{writer:p,consumable:g}=d;if(!l.viewItem.getAttribute("href")||!g.consume(l.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const b=l.viewItem.getAttribute("data-ckbox-resource-id");if(b)if(l.modelRange)for(let w of l.modelRange.getItems())w.is("$textProxy")&&(w=w.textNode),Uj(w)&&p.setAttribute("ckboxLinkId",b,w);else{const w=l.modelCursor.nodeBefore||l.modelCursor.parent;p.setAttribute("ckboxLinkId",b,w)}},{priority:"low"})}),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:t=>t.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}})}_initFixers(){const e=this.editor,t=e.model,i=t.document.selection;t.document.registerPostFixer(function(l){return d=>{let p=!1;const g=l.model,b=l.commands.get("ckbox");if(!b)return p;for(const w of g.document.differ.getChanges()){if(w.type!=="insert"&&w.type!=="attribute")continue;const y=w.type==="insert"?new oe(w.position,w.position.getShiftedBy(w.length)):w.range,A=w.type==="attribute"&&w.attributeKey==="linkHref"&&w.attributeNewValue===null;for(const E of y.getItems()){if(A&&E.hasAttribute("ckboxLinkId")){d.removeAttribute("ckboxLinkId",E),p=!0;continue}const D=Fj(E,b._chosenAssets);for(const M of D){const R=M.type==="image"?"ckboxImageId":"ckboxLinkId";M.id!==E.getAttribute(R)&&(d.setAttribute(R,M.id,E),p=!0)}}}return p}}(e)),t.document.registerPostFixer(function(l){return d=>!(l.hasAttribute("linkHref")||!l.hasAttribute("ckboxLinkId"))&&(d.removeSelectionAttribute("ckboxLinkId"),!0)}(i))}}function Fj(c,e){const t=c.is("element","imageInline")||c.is("element","imageBlock"),i=c.hasAttribute("linkHref");return[...e].filter(l=>l.type==="image"&&t?l.attributes.imageFallbackUrl===c.getAttribute("src"):l.type==="link"&&i?l.attributes.linkHref===c.getAttribute("linkHref"):void 0)}function bE(c,e){const t=c.createAttributeElement("a",{"data-ckbox-resource-id":e},{priority:5});return c.setCustomProperty("link",!0,t),t}function Uj(c){return!!c.is("$text")||!(!c.is("element","imageInline")&&!c.is("element","imageBlock"))}class Vj extends pe{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,t=e.ui.componentFactory,i=e.t;t.add("ckfinder",l=>{const d=e.commands.get("ckfinder"),p=new zt(l);return p.set({label:i("Insert image or file"),icon:'',tooltip:!0}),p.bind("isEnabled").to(d),p.on("execute",()=>{e.execute("ckfinder"),e.editing.view.focus()}),p})}}class Hj extends nt{constructor(e){super(e),this.affectsData=!1,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if(t!="popup"&&t!="modal")throw new z("ckfinder-unknown-openermethod",e);const i=this.editor.config.get("ckfinder.options")||{};i.chooseFiles=!0;const l=i.onInit;i.language||(i.language=e.locale.uiLanguage),i.onInit=d=>{l&&l(d),d.on("files:choose",p=>{const g=p.data.files.toArray(),b=g.filter(A=>!A.isImage()),w=g.filter(A=>A.isImage());for(const A of b)e.execute("link",A.getUrl());const y=[];for(const A of w){const E=A.getUrl();y.push(E||d.request("file:getProxyUrl",{file:A}))}y.length&&wE(e,y)}),d.on("file:choose:resizedImage",p=>{const g=p.data.resizedUrl;if(g)wE(e,[g]);else{const b=e.plugins.get("Notification"),w=e.locale.t;b.showWarning(w("Could not obtain resized image URL."),{title:w("Selecting resized image failed"),namespace:"ckfinder"})}})},window.CKFinder[t](i)}}function wE(c,e){if(c.commands.get("insertImage").isEnabled)c.execute("insertImage",{source:e});else{const t=c.plugins.get("Notification"),i=c.locale.t;t.showWarning(i("Could not insert image at the current position."),{title:i("Inserting image failed"),namespace:"ckfinder"})}}class Wj extends pe{static get pluginName(){return"CKFinderEditing"}static get requires(){return[lb,"LinkEditing"]}init(){const e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new z("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new Hj(e))}}class $j extends pe{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",bo]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),i=t.token,l=t.uploadUrl;if(!i)return;const d=e.plugins.get("CloudServicesCore");this._uploadGateway=d.createUploadGateway(i,l),e.plugins.get(bo).createUploadAdapter=p=>new Yj(this._uploadGateway,p)}}class Yj{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(t,i)=>{this.loader.uploadTotal=i.total,this.loader.uploaded=i.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}class qj extends nt{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=vn(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&vE(t,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,l=e.selection||i.selection;t.canEditAt(l)&&t.change(d=>{const p=l.getSelectedBlocks();for(const g of p)!g.is("element","paragraph")&&vE(g,t.schema)&&d.rename(g,"paragraph")})}}function vE(c,e){return e.checkChild(c.parent,"paragraph")&&!e.isObject(c)}class Kj extends nt{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let l=e.position;t.canEditAt(l)&&t.change(d=>{if(l=this._findPositionToInsertParagraph(l,d),!l)return;const p=d.createElement("paragraph");i&&t.schema.setAllowedAttributes(p,i,d),t.insertContent(p,l),d.setSelection(p,"in")})}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const l=i.schema.findAllowedParent(e,"paragraph");if(!l)return null;const d=e.parent,p=i.schema.checkChild(d,"$text");return d.isEmpty||p&&e.isAtEnd?i.createPositionAfter(d):!d.isEmpty&&p&&e.isAtStart?i.createPositionBefore(d):t.split(e,l).position}}const yE=class extends pe{static get pluginName(){return"Paragraph"}init(){const c=this.editor,e=c.model;c.commands.add("paragraph",new qj(c)),c.commands.add("insertParagraph",new Kj(c)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),c.conversion.elementToElement({model:"paragraph",view:"p"}),c.conversion.for("upcast").elementToElement({model:(t,{writer:i})=>yE.paragraphLikeElements.has(t.name)?t.isEmpty?null:i.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}};let _b=yE;_b.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class Gj extends nt{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=vn(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>_E(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,l=e.value;t.change(d=>{const p=Array.from(i.selection.getSelectedBlocks()).filter(g=>_E(g,l,t.schema));for(const g of p)g.is("element",l)||d.rename(g,l)})}}function _E(c,e,t){return t.checkChild(c.parent,e)&&!t.isObject(c)}const CE="paragraph";class Qj extends pe{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[_b]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const l of t)l.model!=="paragraph"&&(e.model.schema.register(l.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(l),i.push(l.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new Gj(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(l,d)=>{const p=e.model.document.selection.getFirstPosition().parent;i.some(g=>p.is("element",g.model))&&!p.is("element",CE)&&p.childCount===0&&d.writer.rename(p,CE)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:K.low+1})}}var AE=a(8733),Zj={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(AE.Z,Zj),AE.Z.locals;class Jj extends pe{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=function(p){const g=p.t,b={Paragraph:g("Paragraph"),"Heading 1":g("Heading 1"),"Heading 2":g("Heading 2"),"Heading 3":g("Heading 3"),"Heading 4":g("Heading 4"),"Heading 5":g("Heading 5"),"Heading 6":g("Heading 6")};return p.config.get("heading.options").map(w=>{const y=b[w.title];return y&&y!=w.title&&(w.title=y),w})}(e),l=t("Choose heading"),d=t("Heading");e.ui.componentFactory.add("heading",p=>{const g={},b=new lo,w=e.commands.get("heading"),y=e.commands.get("paragraph"),A=[w];for(const D of i){const M={type:"button",model:new $1({label:D.title,class:D.class,role:"menuitemradio",withText:!0})};D.model==="paragraph"?(M.model.bind("isOn").to(y,"value"),M.model.set("commandName","paragraph"),A.push(y)):(M.model.bind("isOn").to(w,"value",R=>R===D.model),M.model.set({commandName:"heading",commandValue:D.model})),b.add(M),g[D.model]=D.title}const E=cs(p);return p1(E,b,{ariaLabel:d,role:"menu"}),E.buttonView.set({ariaLabel:d,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:d}),E.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),E.bind("isEnabled").toMany(A,"isEnabled",(...D)=>D.some(M=>M)),E.buttonView.bind("label").to(w,"value",y,"value",(D,M)=>{const R=D||M&&"paragraph";return typeof R=="boolean"?l:g[R]?g[R]:l}),this.listenTo(E,"execute",D=>{const{commandName:M,commandValue:R}=D.source;e.execute(M,R?{value:R}:void 0),e.editing.view.focus()}),E})}}function xE(c){return c.createContainerElement("figure",{class:"image"},[c.createEmptyElement("img"),c.createSlot("children")])}function EE(c,e){const t=c.plugins.get("ImageUtils"),i=c.plugins.has("ImageInlineEditing")&&c.plugins.has("ImageBlockEditing");return d=>t.isInlineImageView(d)?i&&(d.getStyle("display")=="block"||d.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:l(d):null;function l(d){const p={name:!0};return d.hasAttribute("src")&&(p.attributes=["src"]),p}}function Cb(c,e){const t=vn(e.getSelectedBlocks());return!t||c.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function Op(c){return c&&c.endsWith("px")?parseInt(c):null}function SE(c){const e=Op(c.getStyle("width")),t=Op(c.getStyle("height"));return!(!e||!t)}var Xj=Object.defineProperty,DE=Object.getOwnPropertySymbols,ez=Object.prototype.hasOwnProperty,tz=Object.prototype.propertyIsEnumerable,TE=(c,e,t)=>e in c?Xj(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,IE=(c,e)=>{for(var t in e||(e={}))ez.call(e,t)&&TE(c,t,e[t]);if(DE)for(var t of DE(e))tz.call(e,t)&&TE(c,t,e[t]);return c};const nz=/^(image|image-inline)$/;class $r extends pe{constructor(){super(...arguments),this._domEmitter=new(Hr())}static get pluginName(){return"ImageUtils"}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,l={}){const d=this.editor,p=d.model,g=p.document.selection;i=ME(d,t||g,i),e=IE(IE({},Object.fromEntries(g.getAttributes())),e);for(const b in e)p.schema.checkAttribute(i,b)||delete e[b];return p.change(b=>{const{setImageSizes:w=!0}=l,y=b.createElement(i,e);return p.insertObject(y,t,null,{setSelection:"on",findOptimalPosition:t||i=="imageInline"?void 0:"auto"}),y.parent?(w&&this.setImageNaturalSizeAttributes(y),y):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(i=>{const l=new Oe.window.Image;this._domEmitter.listenTo(l,"load",()=>{e.getAttribute("width")||e.getAttribute("height")||this.editor.model.enqueueChange(i.batch,d=>{d.setAttribute("width",l.naturalWidth,e),d.setAttribute("height",l.naturalHeight,e)}),this._domEmitter.stopListening(l,"load")}),l.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let l=t.parent;for(;l;){if(l.is("element")&&this.isImageWidget(l))return l;l=l.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:nz})}isImageAllowed(){const e=this.editor.model.document.selection;return function(t,i){if(ME(t,i,null)=="imageBlock"){const d=function(p,g){const b=Bx(p,g),w=b.start.parent;return w.isEmpty&&!w.is("element","$root")?w.parent:w}(i,t.model);if(t.model.schema.checkChild(d,"imageBlock"))return!0}else if(t.model.schema.checkChild(i.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(t){return[...t.focus.getAncestors()].every(i=>!i.is("element","imageBlock"))}(e)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),kb(e,t,{label:()=>{const l=this.findViewImgElement(e).getAttribute("alt");return l?`${l} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&An(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 ME(c,e,t){const i=c.model.schema,l=c.config.get("image.insert.type");return c.plugins.has("ImageBlockEditing")?c.plugins.has("ImageInlineEditing")?t||(l==="inline"?"imageInline":l==="block"?"imageBlock":e.is("selection")?Cb(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class rz extends nt{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),l=t.model,d=i.getClosestSelectedImageElement(l.document.selection);l.change(p=>{p.setAttribute("alt",e.newValue,d)})}}class oz extends pe{static get requires(){return[$r]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new rz(this.editor))}}var PE=a(1905),iz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(PE.Z,iz),PE.Z.locals;var NE=a(6764),sz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(NE.Z,sz),NE.Z.locals;class az extends Ke{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new dr,this.keystrokes=new uo,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Wt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Wt.cancel,"ck-button-cancel","cancel"),this._focusables=new gi,this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),m({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,l){const d=new zt(this.locale);return d.set({label:e,icon:t,tooltip:!0}),d.extendTemplate({attributes:{class:i}}),l&&d.delegate("execute").to(this,l),d}_createLabeledInputView(){const e=this.locale.t,t=new Gh(this.locale,gp);return t.label=e("Text alternative"),t}}function OE(c){const e=c.editing.view,t=fr.defaultPositions,i=c.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]}}class cz extends pe{static get requires(){return[yp]}static get pluginName(){return"ImageTextAlternativeUI"}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 l=e.commands.get("imageTextAlternative"),d=new zt(i);return d.set({label:t("Change image text alternative"),icon:Wt.lowVision,tooltip:!0}),d.bind("isEnabled").to(l,"isEnabled"),d.bind("isOn").to(l,"value",p=>!!p),this.listenTo(d,"execute",()=>{this._showForm()}),d})}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(f(az))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(l,d)=>{this._hideForm(!0),d()}),this.listenTo(e.ui,"update",()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(l){const d=l.plugins.get("ContextualBalloon");if(l.plugins.get("ImageUtils").getClosestSelectedImageWidget(l.editing.view.document.selection)){const p=OE(l);d.updatePosition(p)}}(e):this._hideForm(!0)}),h({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:OE(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)}}class BE extends pe{static get requires(){return[oz,cz]}static get pluginName(){return"ImageTextAlternative"}}function RE(c,e){const t=(i,l,d)=>{if(!d.consumable.consume(l.item,i.name))return;const p=d.writer,g=d.mapper.toViewElement(l.item),b=c.findViewImgElement(g);l.attributeNewValue===null?(p.removeAttribute("srcset",b),p.removeAttribute("sizes",b)):l.attributeNewValue&&(p.setAttribute("srcset",l.attributeNewValue,b),p.setAttribute("sizes","100vw",b))};return i=>{i.on(`attribute:srcset:${e}`,t)}}function Bp(c,e,t){const i=(l,d,p)=>{if(!p.consumable.consume(d.item,l.name))return;const g=p.writer,b=p.mapper.toViewElement(d.item),w=c.findViewImgElement(b);g.setAttribute(d.attributeKey,d.attributeNewValue||"",w)};return l=>{l.on(`attribute:${t}:${e}`,i)}}class lz extends $o{observe(e){this.listenTo(e,"load",(t,i)=>{const l=i.target;this.checkShouldIgnoreEventFromTarget(l)||l.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))}}var uz=Object.defineProperty,LE=Object.getOwnPropertySymbols,dz=Object.prototype.hasOwnProperty,hz=Object.prototype.propertyIsEnumerable,jE=(c,e,t)=>e in c?uz(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,Rp=(c,e)=>{for(var t in e||(e={}))dz.call(e,t)&&jE(c,t,e[t]);if(LE)for(var t of LE(e))hz.call(e,t)&&jE(c,t,e[t]);return c};class pz extends nt{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&te("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&te("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=Sn(e.source),i=this.editor.model.document.selection,l=this.editor.plugins.get("ImageUtils"),d=Object.fromEntries(i.getAttributes());t.forEach((p,g)=>{const b=i.getSelectedElement();if(typeof p=="string"&&(p={src:p}),g&&b&&l.isImage(b)){const w=this.editor.model.createPositionAfter(b);l.insertImage(Rp(Rp({},p),d),w)}else l.insertImage(Rp(Rp({},p),d))})}}class fz extends nt{refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement();this.editor.model.change(i=>{i.setAttribute("src",e.source,t),i.removeAttribute("srcset",t),i.removeAttribute("sizes",t)})}}class Ab extends pe{static get requires(){return[$r]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(lz),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new pz(e),l=new fz(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",l),e.commands.add("imageInsert",i)}}class zE extends pe{static get requires(){return[$r]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),l=e==="imageBlock"?"figure":"img";function d(p,g,b,w){p.on(`attribute:${g}:${e}`,(y,A,E)=>{if(!E.consumable.consume(A.item,y.name))return;const D=E.writer,M=E.mapper.toViewElement(A.item),R=i.findViewImgElement(M);if(A.attributeNewValue!==null?D.setAttribute(b,A.attributeNewValue,R):D.removeAttribute(b,R),A.item.hasAttribute("sources"))return;const U=A.item.hasAttribute("resizedWidth");if(e==="imageInline"&&!U&&!w)return;const W=A.item.getAttribute("width"),J=A.item.getAttribute("height"),ie=R.getStyle("aspect-ratio");W&&J&&!ie&&D.setStyle("aspect-ratio",`${W}/${J}`,R)})}t.conversion.for("upcast").attributeToAttribute({view:{name:l,styles:{width:/.+/}},model:{key:"width",value:p=>SE(p)?Op(p.getStyle("width")):null}}).attributeToAttribute({view:{name:l,key:"width"},model:"width"}).attributeToAttribute({view:{name:l,styles:{height:/.+/}},model:{key:"height",value:p=>SE(p)?Op(p.getStyle("height")):null}}).attributeToAttribute({view:{name:l,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(p=>{d(p,"width","width",!0),d(p,"height","height",!0)}),t.conversion.for("dataDowncast").add(p=>{d(p,"width","width",!1),d(p,"height","height",!1)})}}class FE extends nt{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(e={}){const t=this.editor,i=this.editor.model,l=t.plugins.get("ImageUtils"),d=l.getClosestSelectedImageElement(i.document.selection),p=Object.fromEntries(d.getAttributes());return p.src||p.uploadId?i.change(g=>{const{setImageSizes:b=!0}=e,w=Array.from(i.markers).filter(E=>E.getRange().containsItem(d)),y=l.insertImage(p,i.createSelection(d,"on"),this._modelElementName,{setImageSizes:b});if(!y)return null;const A=g.createRangeOn(y);for(const E of w){const D=E.getRange(),M=D.root.rootName!="$graveyard"?D.getJoined(A,!0):A;g.updateMarker(E,{range:M})}return{oldElement:d,newElement:y}}):null}}class UE extends pe{static get requires(){return[Ab,zE,$r,Ko]}static get pluginName(){return"ImageBlockEditing"}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 FE(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,l=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(d,{writer:p})=>xE(p)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(d,{writer:p})=>l.toImageWidget(xE(p),p,t("image widget"))}),i.for("downcast").add(Bp(l,"imageBlock","src")).add(Bp(l,"imageBlock","alt")).add(RE(l,"imageBlock")),i.for("upcast").elementToElement({view:EE(e,"imageBlock"),model:(d,{writer:p})=>p.createElement("imageBlock",d.hasAttribute("src")?{src:d.getAttribute("src")}:void 0)}).add(function(d){const p=(g,b,w)=>{if(!w.consumable.test(b.viewItem,{name:!0,classes:"image"}))return;const y=d.findViewImgElement(b.viewItem);if(!y||!w.consumable.test(y,{name:!0}))return;w.consumable.consume(b.viewItem,{name:!0,classes:"image"});const A=vn(w.convertItem(y,b.modelCursor).modelRange.getItems());A?(w.convertChildren(b.viewItem,A),w.updateConversionResult(A,b)):w.consumable.revert(b.viewItem,{name:!0,classes:"image"})};return g=>{g.on("element:figure",p)}}(l))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,l=e.plugins.get("ImageUtils"),d=e.plugins.get("ClipboardPipeline");this.listenTo(d,"inputTransformation",(p,g)=>{const b=Array.from(g.content.getChildren());let w;if(!b.every(l.isInlineImageView))return;w=g.targetRanges?e.editing.mapper.toModelRange(g.targetRanges[0]):t.document.selection.getFirstRange();const y=t.createSelection(w);if(Cb(t.schema,y)==="imageBlock"){const A=new da(i.document),E=b.map(D=>A.createElement("figure",{class:"image"},D));g.content=A.createDocumentFragment(E)}}),this.listenTo(d,"contentInsertion",(p,g)=>{g.method==="paste"&&t.change(b=>{const w=b.createRangeIn(g.content);for(const y of w.getItems())y.is("element","imageBlock")&&l.setImageNaturalSizeAttributes(y)})})}}var VE=a(3508),gz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(VE.Z,gz),VE.Z.locals;class mz extends pe{static get requires(){return[UE,Ru,BE]}static get pluginName(){return"ImageBlock"}}class kz extends pe{static get requires(){return[Ab,zE,$r,Ko]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((i,l)=>{if(i.endsWith("caption")&&l.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new FE(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,l=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(d,{writer:p})=>p.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(d,{writer:p})=>l.toImageWidget(function(g){return g.createContainerElement("span",{class:"image-inline"},g.createEmptyElement("img"))}(p),p,t("image widget"))}),i.for("downcast").add(Bp(l,"imageInline","src")).add(Bp(l,"imageInline","alt")).add(RE(l,"imageInline")),i.for("upcast").elementToElement({view:EE(e,"imageInline"),model:(d,{writer:p})=>p.createElement("imageInline",d.hasAttribute("src")?{src:d.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,l=e.plugins.get("ImageUtils"),d=e.plugins.get("ClipboardPipeline");this.listenTo(d,"inputTransformation",(p,g)=>{const b=Array.from(g.content.getChildren());let w;if(!b.every(l.isBlockImageView))return;w=g.targetRanges?e.editing.mapper.toModelRange(g.targetRanges[0]):t.document.selection.getFirstRange();const y=t.createSelection(w);if(Cb(t.schema,y)==="imageInline"){const A=new da(i.document),E=b.map(D=>D.childCount===1?(Array.from(D.getAttributes()).forEach(M=>A.setAttribute(...M,l.findViewImgElement(D))),D.getChild(0)):D);g.content=A.createDocumentFragment(E)}}),this.listenTo(d,"contentInsertion",(p,g)=>{g.method==="paste"&&t.change(b=>{const w=b.createRangeIn(g.content);for(const y of w.getItems())y.is("element","imageInline")&&l.setImageNaturalSizeAttributes(y)})})}}class bz extends pe{static get requires(){return[kz,Ru,BE]}static get pluginName(){return"ImageInline"}}class HE extends pe{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[$r]}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}}class wz extends nt{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(UE))return this.isEnabled=!1,void(this.value=!1);const l=e.model.document.selection,d=l.getSelectedElement();if(!d){const p=t.getCaptionFromModelSelection(l);return this.isEnabled=!!p,void(this.value=!!p)}this.isEnabled=i.isImage(d),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(d):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 i=this.editor.model.document.selection,l=this.editor.plugins.get("ImageCaptionEditing"),d=this.editor.plugins.get("ImageUtils");let p=i.getSelectedElement();const g=l._getSavedCaption(p);d.isInlineImage(p)&&(this.editor.execute("imageTypeBlock"),p=i.getSelectedElement());const b=g||e.createElement("caption");e.append(b,p),t&&e.setSelection(b,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,l=t.plugins.get("ImageCaptionEditing"),d=t.plugins.get("ImageCaptionUtils");let p,g=i.getSelectedElement();g?p=d.getCaptionFromImageModelElement(g):(p=d.getCaptionFromModelSelection(i),g=p.parent),l._saveCaption(g,p),e.setSelection(g,"on"),e.remove(p)}}class vz extends pe{constructor(e){super(e),this._savedCaptionsMap=new WeakMap}static get requires(){return[$r,HE]}static get pluginName(){return"ImageCaptionEditing"}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 wz(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),l=e.plugins.get("ImageCaptionUtils"),d=e.t;e.conversion.for("upcast").elementToElement({view:p=>l.matchImageCaptionViewElement(p),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(p,{writer:g})=>i.isBlockImage(p.parent)?g.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(p,{writer:g})=>{if(!i.isBlockImage(p.parent))return null;const b=g.createEditableElement("figcaption");g.setCustomProperty("imageCaption",!0,b),b.placeholder=d("Enter image caption"),nC({view:t,element:b,keepOnFocus:!0});const w=p.parent.getAttribute("alt");return Ox(b,g,{label:w?d("Caption for image: %0",[w]):d("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),l=e.commands.get("imageTypeInline"),d=e.commands.get("imageTypeBlock"),p=g=>{if(!g.return)return;const{oldElement:b,newElement:w}=g.return;if(!b)return;if(t.isBlockImage(b)){const A=i.getCaptionFromImageModelElement(b);if(A)return void this._saveCaption(w,A)}const y=this._getSavedCaption(b);y&&this._saveCaption(w,y)};l&&this.listenTo(l,"execute",p,{priority:"low"}),d&&this.listenTo(d,"execute",p,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Tt.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"),l=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const d=t.document.differ.getChanges();for(const p of d){if(p.attributeKey!=="alt")continue;const g=p.range.start.nodeAfter;if(i.isBlockImage(g)){const b=l.getCaptionFromImageModelElement(g);if(!b)return;e.editing.reconvertItem(b)}}})}}class yz extends pe{static get requires(){return[HE]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),l=e.t;e.ui.componentFactory.add("toggleImageCaption",d=>{const p=e.commands.get("toggleImageCaption"),g=new zt(d);return g.set({icon:Wt.caption,tooltip:!0,isToggleable:!0}),g.bind("isOn","isEnabled").to(p,"value","isEnabled"),g.bind("label").to(p,"value",b=>l(b?"Toggle caption off":"Toggle caption on")),this.listenTo(g,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const b=i.getCaptionFromModelSelection(e.model.document.selection);if(b){const w=e.editing.mapper.toViewElement(b);t.scrollToTheSelection(),t.change(y=>{y.addClass("image__caption_highlighted",w)})}e.editing.view.focus()}),g})}}var WE=a(2640),_z={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(WE.Z,_z),WE.Z.locals;function $E(c){const e=c.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function Cz(c){return new Promise((e,t)=>{const i=c.getAttribute("src");fetch(i).then(l=>l.blob()).then(l=>{const d=YE(l,i),p=d.replace("image/",""),g=new File([l],`image.${p}`,{type:d});e(g)}).catch(l=>l&&l.name==="TypeError"?function(d){return function(p){return new Promise((g,b)=>{const w=Oe.document.createElement("img");w.addEventListener("load",()=>{const y=Oe.document.createElement("canvas");y.width=w.width,y.height=w.height,y.getContext("2d").drawImage(w,0,0),y.toBlob(A=>A?g(A):b())}),w.addEventListener("error",()=>b()),w.src=p})}(d).then(p=>{const g=YE(p,d),b=g.replace("image/","");return new File([p],`image.${b}`,{type:g})})}(i).then(e).catch(t):t(l))})}function YE(c,e){return c.type?c.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Az extends pe{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=l=>{const d=new vj(l),p=e.commands.get("uploadImage"),g=e.config.get("image.upload.types"),b=$E(g);return d.set({acceptedType:g.map(w=>`image/${w}`).join(","),allowMultipleFiles:!0}),d.buttonView.set({label:t("Insert image"),icon:Wt.image,tooltip:!0}),d.buttonView.bind("isEnabled").to(p),d.on("done",(w,y)=>{const A=Array.from(y).filter(E=>b.test(E.type));A.length&&(e.execute("uploadImage",{file:A}),e.editing.view.focus())}),d};e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i)}}var qE=a(3689),xz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(qE.Z,xz),qE.Z.locals;var KE=a(4036),Ez={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(KE.Z,Ez),KE.Z.locals;var GE=a(3773),Sz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(GE.Z,Sz),GE.Z.locals;class Dz extends pe{constructor(e){super(e),this.uploadStatusChange=(t,i,l)=>{const d=this.editor,p=i.item,g=p.getAttribute("uploadId");if(!l.consumable.consume(i.item,t.name))return;const b=d.plugins.get("ImageUtils"),w=d.plugins.get(bo),y=g?i.attributeNewValue:null,A=this.placeholder,E=d.editing.mapper.toViewElement(p),D=l.writer;if(y=="reading")return QE(E,D),void ZE(b,A,E,D);if(y=="uploading"){const M=w.loaders.get(g);return QE(E,D),void(M?(JE(E,D),function(R,U,W,J){const ie=function(ve){const Be=ve.createUIElement("div",{class:"ck-progress-bar"});return ve.setCustomProperty("progressBar",!0,Be),Be}(U);U.insert(U.createPositionAt(R,"end"),ie),W.on("change:uploadedPercent",(ve,Be,Ct)=>{J.change(at=>{at.setStyle("width",Ct+"%",ie)})})}(E,D,M,d.editing.view),function(R,U,W,J){if(J.data){const ie=R.findViewImgElement(U);W.setAttribute("src",J.data,ie)}}(b,E,D,M)):ZE(b,A,E,D))}y=="complete"&&w.loaders.get(g)&&function(M,R,U){const W=R.createUIElement("div",{class:"ck-image-upload-complete-icon"});R.insert(R.createPositionAt(M,"end"),W),setTimeout(()=>{U.change(J=>J.remove(J.createRangeOn(W)))},3e3)}(E,D,d.editing.view),function(M,R){eS(M,R,"progressBar")}(E,D),JE(E,D),function(M,R){R.removeClass("ck-appear",M)}(E,D)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}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)}}function QE(c,e){c.hasClass("ck-appear")||e.addClass("ck-appear",c)}function ZE(c,e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);const l=c.findViewImgElement(t);l.getAttribute("src")!==e&&i.setAttribute("src",e,l),XE(t,"placeholder")||i.insert(i.createPositionAfter(l),function(d){const p=d.createUIElement("div",{class:"ck-upload-placeholder-loader"});return d.setCustomProperty("placeholder",!0,p),p}(i))}function JE(c,e){c.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",c),eS(c,e,"placeholder")}function XE(c,e){for(const t of c.getChildren())if(t.getCustomProperty(e))return t}function eS(c,e,t){const i=XE(c,t);i&&e.remove(e.createRangeOn(i))}var Tz=Object.defineProperty,Iz=Object.defineProperties,Mz=Object.getOwnPropertyDescriptors,tS=Object.getOwnPropertySymbols,Pz=Object.prototype.hasOwnProperty,Nz=Object.prototype.propertyIsEnumerable,nS=(c,e,t)=>e in c?Tz(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;class Oz extends nt{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=Sn(e.file),i=this.editor.model.document.selection,l=this.editor.plugins.get("ImageUtils"),d=Object.fromEntries(i.getAttributes());t.forEach((p,g)=>{const b=i.getSelectedElement();if(g&&b&&l.isImage(b)){const w=this.editor.model.createPositionAfter(b);this._uploadImage(p,d,w)}else this._uploadImage(p,d)})}_uploadImage(e,t,i){const l=this.editor,d=l.plugins.get(bo).createLoader(e),p=l.plugins.get("ImageUtils");var g,b;d&&p.insertImage((g=((w,y)=>{for(var A in y||(y={}))Pz.call(y,A)&&nS(w,A,y[A]);if(tS)for(var A of tS(y))Nz.call(y,A)&&nS(w,A,y[A]);return w})({},t),b={uploadId:d.id},Iz(g,Mz(b))),i)}}class Bz extends pe{constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[bo,lb,Ko,$r]}static get pluginName(){return"ImageUploadEditing"}init(){const e=this.editor,t=e.model.document,i=e.conversion,l=e.plugins.get(bo),d=e.plugins.get("ImageUtils"),p=e.plugins.get("ClipboardPipeline"),g=$E(e.config.get("image.upload.types")),b=new Oz(e);e.commands.add("uploadImage",b),e.commands.add("imageUpload",b),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(w,y)=>{if(A=y.dataTransfer,Array.from(A.types).includes("text/html")&&A.getData("text/html")!=="")return;var A;const E=Array.from(y.dataTransfer.files).filter(D=>!!D&&g.test(D.type));E.length&&(w.stop(),e.model.change(D=>{y.targetRanges&&D.setSelection(y.targetRanges.map(M=>e.editing.mapper.toModelRange(M))),e.execute("uploadImage",{file:E})}))}),this.listenTo(p,"inputTransformation",(w,y)=>{const A=Array.from(e.editing.view.createRangeIn(y.content)).map(D=>D.item).filter(D=>function(M,R){return!(!M.isInlineImageView(R)||!R.getAttribute("src")||!R.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!R.getAttribute("src").match(/^blob:/g))}(d,D)&&!D.getAttribute("uploadProcessed")).map(D=>({promise:Cz(D),imageElement:D}));if(!A.length)return;const E=new da(e.editing.view.document);for(const D of A){E.setAttribute("uploadProcessed",!0,D.imageElement);const M=l.createLoader(D.promise);M&&(E.setAttribute("src","",D.imageElement),E.setAttribute("uploadId",M.id,D.imageElement))}}),e.editing.view.document.on("dragover",(w,y)=>{y.preventDefault()}),t.on("change",()=>{const w=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),y=new Set;for(const A of w)if(A.type=="insert"&&A.name!="$text"){const E=A.position.nodeAfter,D=A.position.root.rootName=="$graveyard";for(const M of Rz(e,E)){const R=M.getAttribute("uploadId");if(!R)continue;const U=l.loaders.get(R);U&&(D?y.has(R)||U.abort():(y.add(R),this._uploadImageElements.set(R,M),U.status=="idle"&&this._readAndUpload(U)))}}}),this.on("uploadComplete",(w,{imageElement:y,data:A})=>{const E=A.urls?A.urls:A;this.editor.model.change(D=>{D.setAttribute("src",E.default,y),this._parseAndSetSrcsetAttributeOnImage(E,y,D),d.setImageNaturalSizeAttributes(y)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,l=t.locale.t,d=t.plugins.get(bo),p=t.plugins.get(lb),g=t.plugins.get("ImageUtils"),b=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},y=>{y.setAttribute("uploadStatus","reading",b.get(e.id))}),e.read().then(()=>{const y=e.upload(),A=b.get(e.id);if(_.isSafari){const E=t.editing.mapper.toViewElement(A),D=g.findViewImgElement(E);t.editing.view.once("render",()=>{if(!D.parent)return;const M=t.editing.view.domConverter.mapViewToDom(D.parent);if(!M)return;const R=M.style.display;M.style.display="none",M._ckHack=M.offsetHeight,M.style.display=R})}return i.enqueueChange({isUndoable:!1},E=>{E.setAttribute("uploadStatus","uploading",A)}),y}).then(y=>{i.enqueueChange({isUndoable:!1},A=>{const E=b.get(e.id);A.setAttribute("uploadStatus","complete",E),this.fire("uploadComplete",{data:y,imageElement:E})}),w()}).catch(y=>{if(e.status!=="error"&&e.status!=="aborted")throw y;e.status=="error"&&y&&p.showWarning(y,{title:l("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},A=>{A.remove(b.get(e.id))}),w()});function w(){i.enqueueChange({isUndoable:!1},y=>{const A=b.get(e.id);y.removeAttribute("uploadId",A),y.removeAttribute("uploadStatus",A),b.delete(e.id)}),d.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let l=0;const d=Object.keys(e).filter(p=>{const g=parseInt(p,10);if(!isNaN(g))return l=Math.max(l,g),!0}).map(p=>`${e[p]} ${p}w`).join(", ");if(d!=""){const p={srcset:d};t.hasAttribute("width")||t.hasAttribute("height")||(p.width=l),i.setAttributes(p,t)}}}function Rz(c,e){const t=c.plugins.get("ImageUtils");return Array.from(c.model.createRangeOn(e)).filter(i=>t.isImage(i.item)).map(i=>i.item)}var rS=a(1568),Lz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(rS.Z,Lz),rS.Z.locals;var oS=a(3535),jz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(oS.Z,jz),oS.Z.locals;var iS=a(6270),zz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(iS.Z,zz),iS.Z.locals;class Fz extends nt{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(const l of i.modelElements)this._defaultStyles[l]=i.name;return[i.name,i]}))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,l=t.plugins.get("ImageUtils");i.change(d=>{const p=e.value,{setImageSizes:g=!0}=e;let b=l.getClosestSelectedImageElement(i.document.selection);p&&this.shouldConvertImageType(p,b)&&(this.editor.execute(l.isBlockImage(b)?"imageTypeInline":"imageTypeBlock",{setImageSizes:g}),b=l.getClosestSelectedImageElement(i.document.selection)),!p||this._styles.get(p).isDefault?d.removeAttribute("imageStyle",b):d.setAttribute("imageStyle",p,b),g&&l.setImageNaturalSizeAttributes(b)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}var Uz=Object.defineProperty,sS=Object.getOwnPropertySymbols,Vz=Object.prototype.hasOwnProperty,Hz=Object.prototype.propertyIsEnumerable,aS=(c,e,t)=>e in c?Uz(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,cS=(c,e)=>{for(var t in e||(e={}))Vz.call(e,t)&&aS(c,t,e[t]);if(sS)for(var t of sS(e))Hz.call(e,t)&&aS(c,t,e[t]);return c};const{objectFullWidth:Wz,objectInline:lS,objectLeft:uS,objectRight:xb,objectCenter:Eb,objectBlockLeft:dS,objectBlockRight:hS}=Wt,Lp={get inline(){return{name:"inline",title:"In line",icon:lS,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:uS,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:dS,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Eb,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:xb,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:hS,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Eb,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:xb,modelElements:["imageBlock"],className:"image-style-side"}}},pS={full:Wz,left:dS,right:hS,center:Eb,inlineLeft:uS,inlineRight:xb,inline:lS},fS=[{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 gS(c){te("image-style-configuration-definition-invalid",c)}const Sb={normalizeStyles:function(c){return(c.configuredStyles.options||[]).map(e=>function(t){return t=typeof t=="string"?Lp[t]?cS({},Lp[t]):{name:t}:function(i,l){const d=cS({},l);for(const p in i)Object.prototype.hasOwnProperty.call(l,p)||(d[p]=i[p]);return d}(Lp[t.name],t),typeof t.icon=="string"&&(t.icon=pS[t.icon]||t.icon),t}(e)).filter(e=>function(t,{isBlockPluginLoaded:i,isInlinePluginLoaded:l}){const{modelElements:d,name:p}=t;if(!(d&&d.length&&p))return gS({style:t}),!1;{const g=[i?"imageBlock":null,l?"imageInline":null];if(!d.some(b=>g.includes(b)))return te("image-style-missing-dependency",{style:t,missingPlugins:d.map(b=>b==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(e,c))},getDefaultStylesConfiguration:function(c,e){return c&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:c?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(c){return c.has("ImageBlockEditing")&&c.has("ImageInlineEditing")?[...fS]:[]},warnInvalidStyle:gS,DEFAULT_OPTIONS:Lp,DEFAULT_ICONS:pS,DEFAULT_DROPDOWN_DEFINITIONS:fS};function mS(c,e){for(const t of e)if(t.name===c)return t}class kS extends pe{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[$r]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Sb,i=this.editor,l=i.plugins.has("ImageBlockEditing"),d=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(l,d)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:l,isInlinePluginLoaded:d}),this._setupConversion(l,d),this._setupPostFixer(),i.commands.add("imageStyle",new Fz(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,l=i.model.schema,d=(p=this.normalizedStyles,(b,w,y)=>{if(!y.consumable.consume(w.item,b.name))return;const A=mS(w.attributeNewValue,p),E=mS(w.attributeOldValue,p),D=y.mapper.toViewElement(w.item),M=y.writer;E&&M.removeClass(E.className,D),A&&M.addClass(A.className,D)});var p;const g=function(b){const w={imageInline:b.filter(y=>!y.isDefault&&y.modelElements.includes("imageInline")),imageBlock:b.filter(y=>!y.isDefault&&y.modelElements.includes("imageBlock"))};return(y,A,E)=>{if(!A.modelRange)return;const D=A.viewItem,M=vn(A.modelRange.getItems());if(M&&E.schema.checkAttribute(M,"imageStyle"))for(const R of w[M.name])E.consumable.consume(D,{classes:R.className})&&E.writer.setAttribute("imageStyle",R.name,M)}}(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",d),i.data.downcastDispatcher.on("attribute:imageStyle",d),e&&(l.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",g,{priority:"low"})),t&&(l.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",g,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get($r),l=new Map(this.normalizedStyles.map(d=>[d.name,d]));t.registerPostFixer(d=>{let p=!1;for(const g of t.differ.getChanges())if(g.type=="insert"||g.type=="attribute"&&g.attributeKey=="imageStyle"){let b=g.type=="insert"?g.position.nodeAfter:g.range.start.nodeAfter;if(b&&b.is("element","paragraph")&&b.childCount>0&&(b=b.getChild(0)),!i.isImage(b))continue;const w=b.getAttribute("imageStyle");if(!w)continue;const y=l.get(w);y&&y.modelElements.includes(b.name)||(d.removeAttribute("imageStyle",b),p=!0)}return p})}}var bS=a(5083),$z={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(bS.Z,$z),bS.Z.locals;class Yz extends pe{static get requires(){return[kS]}static get pluginName(){return"ImageStyleUI"}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=wS(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const d of i)this._createButton(d);const l=wS([...t.filter(Ne),...Sb.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const d of l)this._createDropdown(d,i)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,l=>{let d;const{defaultItem:p,items:g,title:b}=e,w=g.filter(D=>t.find(({name:M})=>vS(M)===D)).map(D=>{const M=i.create(D);return D===p&&(d=M),M});g.length!==w.length&&Sb.warnInvalidStyle({dropdown:e});const y=cs(l,Zk),A=y.buttonView,E=A.arrowView;return Jk(y,w,{enableActiveItemFocusOnDropdownOpen:!0}),A.set({label:yS(b,d.label),class:null,tooltip:!0}),E.unbind("label"),E.set({label:b}),A.bind("icon").toMany(w,"isOn",(...D)=>{const M=D.findIndex(ra);return M<0?d.icon:w[M].icon}),A.bind("label").toMany(w,"isOn",(...D)=>{const M=D.findIndex(ra);return yS(b,M<0?d.label:w[M].label)}),A.bind("isOn").toMany(w,"isOn",(...D)=>D.some(ra)),A.bind("class").toMany(w,"isOn",(...D)=>D.some(ra)?"ck-splitbutton_flatten":void 0),A.on("execute",()=>{w.some(({isOn:D})=>D)?y.isOpen=!y.isOpen:d.fire("execute")}),y.bind("isEnabled").toMany(w,"isEnabled",(...D)=>D.some(ra)),this.listenTo(y,"execute",()=>{this.editor.editing.view.focus()}),y})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(vS(t),i=>{const l=this.editor.commands.get("imageStyle"),d=new zt(i);return d.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),d.bind("isEnabled").to(l,"isEnabled"),d.bind("isOn").to(l,"value",p=>p===t),d.on("execute",this._executeCommand.bind(this,t)),d})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function wS(c,e){for(const t of c)e[t.title]&&(t.title=e[t.title]);return c}function vS(c){return`imageStyle:${c}`}function yS(c,e){return(c?c+": ":"")+e}class qz extends pe{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Z_(e)),e.commands.add("outdent",new Z_(e))}}const _S='',CS='';class Kz extends pe{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,l=t.uiLanguageDirection=="ltr"?_S:CS,d=t.uiLanguageDirection=="ltr"?CS:_S;this._defineButton("indent",i("Increase indent"),l),this._defineButton("outdent",i("Decrease indent"),d)}_defineButton(e,t,i){const l=this.editor;l.ui.componentFactory.add(e,d=>{const p=l.commands.get(e),g=new zt(d);return g.set({label:t,icon:i,tooltip:!0}),g.bind("isEnabled").to(p,"isEnabled"),this.listenTo(g,"execute",()=>{l.execute(e),l.editing.view.focus()}),g})}}class Gz{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,l)=>{if(!l.consumable.test(i.item,"attribute:linkHref")||!i.item.is("selection")&&!l.schema.isInline(i.item))return;const d=l.writer,p=d.document.selection;for(const g of this._definitions){const b=d.createAttributeElement("a",g.attributes,{priority:5});g.classes&&d.addClass(g.classes,b);for(const w in g.styles)d.setStyle(w,g.styles[w],b);d.setCustomProperty("link",!0,b),g.callback(i.attributeNewValue)?i.item.is("selection")?d.wrap(p.getFirstRange(),b):d.wrap(l.mapper.toViewRange(i.range),b):d.unwrap(l.mapper.toViewRange(i.range),b)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:l,mapper:d})=>{const p=d.toViewElement(i.item),g=Array.from(p.getChildren()).find(b=>b.is("element","a"));for(const b of this._definitions){const w=Ho(b.attributes);if(b.callback(i.attributeNewValue)){for(const[y,A]of w)y==="class"?l.addClass(A,g):l.setAttribute(y,A,g);b.classes&&l.addClass(b.classes,g);for(const y in b.styles)l.setStyle(y,b.styles[y],g)}else{for(const[y,A]of w)y==="class"?l.removeClass(A,g):l.removeAttribute(y,g);b.classes&&l.removeClass(b.classes,g);for(const y in b.styles)l.removeStyle(y,g)}}})}}}const Qz=function(c,e,t){var i=c.length;return t=t===void 0?i:t,!e&&t>=i?c:lC(c,e,t)};var Zz=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const AS=function(c){return Zz.test(c)},Jz=function(c){return c.split("")};var xS="\\ud800-\\udfff",Xz="["+xS+"]",Db="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Tb="\\ud83c[\\udffb-\\udfff]",ES="[^"+xS+"]",SS="(?:\\ud83c[\\udde6-\\uddff]){2}",DS="[\\ud800-\\udbff][\\udc00-\\udfff]",TS="(?:"+Db+"|"+Tb+")?",IS="[\\ufe0e\\ufe0f]?",eF=IS+TS+("(?:\\u200d(?:"+[ES,SS,DS].join("|")+")"+IS+TS+")*"),tF="(?:"+[ES+Db+"?",Db,SS,DS,Xz].join("|")+")",nF=RegExp(Tb+"(?="+Tb+")|"+tF+eF,"g");const rF=function(c){return c.match(nF)||[]},oF=function(c){return AS(c)?rF(c):Jz(c)},iF=function(c){return function(e){e=bk(e);var t=AS(e)?oF(e):void 0,i=t?t[0]:e.charAt(0),l=t?Qz(t,1).join(""):e.slice(1);return i[c]()+l}}("toUpperCase"),sF=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,aF=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,cF=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,lF=/^((\w+:(\/{2,})?)|(\W))/i,Ib="Ctrl+K";function MS(c,{writer:e}){const t=e.createAttributeElement("a",{href:c},{priority:5});return e.setCustomProperty("link",!0,t),t}function PS(c){const e=String(c);return function(t){return!!t.replace(sF,"").match(aF)}(e)?e:"#"}function Mb(c,e){return!!c&&e.checkAttribute(c.name,"linkHref")}function Pb(c,e){const t=(i=c,cF.test(i)?"mailto:":e);var i;const l=!!t&&!NS(c);return c&&l?t+c:c}function NS(c){return lF.test(c)}function OS(c){window.open(c,"_blank","noopener")}class uF extends nt{constructor(){super(...arguments),this.manualDecorators=new lo,this.automaticDecorators=new Gz}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||vn(t.getSelectedBlocks());Mb(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const l of this.manualDecorators)l.value=this._getDecoratorStateFromModel(l.id)}execute(e,t={}){const i=this.editor.model,l=i.document.selection,d=[],p=[];for(const g in t)t[g]?d.push(g):p.push(g);i.change(g=>{if(l.isCollapsed){const b=l.getFirstPosition();if(l.hasAttribute("linkHref")){const w=BS(l);let y=Mc(b,"linkHref",l.getAttribute("linkHref"),i);l.getAttribute("linkHref")===w&&(y=this._updateLinkContent(i,g,y,e)),g.setAttribute("linkHref",e,y),d.forEach(A=>{g.setAttribute(A,!0,y)}),p.forEach(A=>{g.removeAttribute(A,y)}),g.setSelection(g.createPositionAfter(y.end.nodeBefore))}else if(e!==""){const w=Ho(l.getAttributes());w.set("linkHref",e),d.forEach(A=>{w.set(A,!0)});const{end:y}=i.insertContent(g.createText(e,w),b);g.setSelection(y)}["linkHref",...d,...p].forEach(w=>{g.removeSelectionAttribute(w)})}else{const b=i.schema.getValidRanges(l.getRanges(),"linkHref"),w=[];for(const A of l.getSelectedBlocks())i.schema.checkAttribute(A,"linkHref")&&w.push(g.createRangeOn(A));const y=w.slice();for(const A of b)this._isRangeToUpdate(A,w)&&y.push(A);for(const A of y){let E=A;if(y.length===1){const D=BS(l);l.getAttribute("linkHref")===D&&(E=this._updateLinkContent(i,g,A,e),g.setSelection(g.createSelection(E)))}g.setAttribute("linkHref",e,E),d.forEach(D=>{g.setAttribute(D,!0,E)}),p.forEach(D=>{g.removeAttribute(D,E)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,l=i.getSelectedElement();return Mb(l,t.schema)?l.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,l){const d=t.createText(l,{linkHref:l});return e.insertContent(d,i)}}function BS(c){if(c.isCollapsed){const e=c.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(c.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}class dF extends nt{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();Mb(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,l=e.commands.get("link");t.change(d=>{const p=i.isCollapsed?[Mc(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const g of p)if(d.removeAttribute("linkHref",g),l)for(const b of l.manualDecorators)d.removeAttribute(b.id,g)})}}class hF extends Ve(){constructor({id:e,label:t,attributes:i,classes:l,styles:d,defaultValue:p}){super(),this.id=e,this.set("value",void 0),this.defaultValue=p,this.label=t,this.attributes=i,this.classes=l,this.styles=d}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var RS=a(9773),pF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(RS.Z,pF),RS.Z.locals;var fF=Object.defineProperty,LS=Object.getOwnPropertySymbols,gF=Object.prototype.hasOwnProperty,mF=Object.prototype.propertyIsEnumerable,jS=(c,e,t)=>e in c?fF(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,kF=(c,e)=>{for(var t in e||(e={}))gF.call(e,t)&&jS(c,t,e[t]);if(LS)for(var t of LS(e))mF.call(e,t)&&jS(c,t,e[t]);return c};const zS="automatic",bF=/^(https?:)?\/\//;class wF extends pe{static get pluginName(){return"LinkEditing"}static get requires(){return[Ax,kx,Ko]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:MS}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(i,l)=>MS(PS(i),l)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:i=>i.getAttribute("href")}}),e.commands.add("link",new uF(e)),e.commands.add("unlink",new dF(e));const t=function(i,l){const d={"Open in a new tab":i("Open in a new tab"),Downloadable:i("Downloadable")};return l.forEach(p=>("label"in p&&d[p.label]&&(p.label=d[p.label]),p)),l}(e.t,function(i){const l=[];if(i)for(const[d,p]of Object.entries(i)){const g=Object.assign({},p,{id:`link${iF(d)}`});l.push(g)}return l}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(i=>i.mode===zS)),this._enableManualDecorators(t.filter(i=>i.mode==="manual")),e.plugins.get(Ax).registerAttribute("linkHref"),function(i,l,d,p){const g=i.editing.view,b=new Set;g.document.registerPostFixer(w=>{const y=i.model.document.selection;let A=!1;if(y.hasAttribute(l)){const E=Mc(y.getFirstPosition(),l,y.getAttribute(l),i.model),D=i.editing.mapper.toViewRange(E);for(const M of D.getItems())M.is("element",d)&&!M.hasClass(p)&&(w.addClass(p,M),b.add(M),A=!0)}return A}),i.conversion.for("editingDowncast").add(w=>{function y(){g.change(A=>{for(const E of b.values())A.removeClass(p,E),b.delete(E)})}w.on("insert",y,{priority:"highest"}),w.on("remove",y,{priority:"highest"}),w.on("attribute",y,{priority:"highest"}),w.on("selection",y,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:zS,callback:l=>!!l&&bF.test(l),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(l=>{t.model.schema.extend("$text",{allowAttributes:l.id});const d=new hF(l);i.add(d),t.conversion.for("downcast").attributeToElement({model:d.id,view:(p,{writer:g,schema:b},{item:w})=>{if((w.is("selection")||b.isInline(w))&&p){const y=g.createAttributeElement("a",d.attributes,{priority:5});d.classes&&g.addClass(d.classes,y);for(const A in d.styles)g.setStyle(A,d.styles[A],y);return g.setCustomProperty("link",!0,y),y}}}),t.conversion.for("upcast").elementToAttribute({view:kF({name:"a"},d._createPattern()),model:{key:d.id}})})}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,l)=>{if(!(_.isMac?l.domEvent.metaKey:l.domEvent.ctrlKey))return;let d=l.domTarget;if(d.tagName.toLowerCase()!="a"&&(d=d.closest("a")),!d)return;const p=d.getAttribute("href");p&&(i.stop(),l.preventDefault(),OS(p))},{context:"$capture"}),this.listenTo(t,"keydown",(i,l)=>{const d=e.commands.get("link").value;d&&l.keyCode===dt.enter&&l.altKey&&(i.stop(),OS(d))})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",()=>{const i=t.anchor.nodeBefore,l=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&i&&i.hasAttribute("linkHref")&&(l&&l.hasAttribute("linkHref")||e.change(d=>{Nb(d,Ob(e.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(Kk);let i=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{i=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!i)return;i=!1;const l=t.document.selection;if(!l.isCollapsed||!l.hasAttribute("linkHref"))return;const d=l.getFirstPosition(),p=Mc(d,"linkHref",l.getAttribute("linkHref"),t);(d.isTouching(p.start)||d.isTouching(p.end))&&t.change(g=>{Nb(g,Ob(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i=null,l=!1;this.listenTo(t.document,"delete",()=>{l=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const d=e.model.document.selection;d.isCollapsed||(l?l=!1:FS(e)&&function(p){const g=p.document.selection,b=g.getFirstPosition(),w=g.getLastPosition(),y=b.nodeAfter;if(!y||!y.is("$text")||!y.hasAttribute("linkHref"))return!1;const A=w.textNode||w.nodeBefore;return y===A?!0:Mc(b,"linkHref",y.getAttribute("linkHref"),p).containsRange(p.createRange(b,w),!0)}(e.model)&&(i=d.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(d,[p])=>{l=!1,FS(e)&&i&&(e.model.change(g=>{for(const[b,w]of i)g.setAttribute(b,w,p)}),i=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,l=e.editing.view;let d=!1,p=!1;this.listenTo(l.document,"delete",(g,b)=>{p=b.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{d=!1;const g=i.getFirstPosition(),b=i.getAttribute("linkHref");if(!b)return;const w=Mc(g,"linkHref",b,t);d=w.containsPosition(g)||w.end.isEqual(g)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{p&&(p=!1,d||e.model.enqueueChange(g=>{Nb(g,Ob(t.schema))}))},{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(l,d)=>{t.change(p=>{const g=p.createRangeIn(d.content);for(const b of g.getItems())if(b.hasAttribute("linkHref")){const w=Pb(b.getAttribute("linkHref"),i);p.setAttribute("linkHref",w,b)}})})}}function Nb(c,e){c.removeSelectionAttribute("linkHref");for(const t of e)c.removeSelectionAttribute(t)}function FS(c){return c.model.change(e=>e.batch).isTyping}function Ob(c){return c.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}var US=a(7754),vF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(US.Z,vF),US.Z.locals;class yF extends Ke{constructor(e,t){super(e),this.focusTracker=new dr,this.keystrokes=new uo,this._focusables=new gi;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Wt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Wt.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const l=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&l.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:l,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),m({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Gh(this.locale,gp);return t.label=e("Link URL"),t}_createButton(e,t,i,l){const d=new zt(this.locale);return d.set({label:e,icon:t,tooltip:!0}),d.extendTemplate({attributes:{class:i}}),l&&d.delegate("execute").to(this,l),d}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const l=new Kh(this.locale);l.set({name:i.id,label:i.label,withText:!0}),l.bind("isOn").toMany([i,e],"value",(d,p)=>p===void 0&&d===void 0?!!i.defaultValue:!!d),l.on("execute",()=>{i.set("value",!l.isOn)}),t.add(l)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const i=new Ke;i.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(l=>({tag:"li",children:[l],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(i)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var VS=a(2347),_F={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(VS.Z,_F),VS.Z.locals;class CF extends Ke{constructor(e){super(e),this.focusTracker=new dr,this.keystrokes=new uo,this._focusables=new gi;const t=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'',"unlink"),this.editButtonView=this._createButton(t("Edit link"),Wt.pencil,"edit"),this.set("href",void 0),this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const l=new zt(this.locale);return l.set({label:e,icon:t,tooltip:!0}),l.delegate("execute").to(this,i),l}_createPreviewButton(){const e=new zt(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",l=>l&&PS(l)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",l=>l||i("This link has no URL")),e.bind("isEnabled").to(this,"href",l=>!!l),e.template.tag="a",e.template.eventListeners={},e}}const Go="link-ui";class AF extends pe{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[yp]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(JB),this._balloon=e.plugins.get(yp),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Go,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Go,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new CF(e.locale),i=e.commands.get("link"),l=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(l),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(d,p)=>{this._hideUI(),p()}),t.keystrokes.set(Ib,(d,p)=>{this._addFormView(),p()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),l=new(f(yF))(e.locale,t);return l.urlInputView.fieldView.bind("value").to(t,"value"),l.urlInputView.bind("isEnabled").to(t,"isEnabled"),l.saveButtonView.bind("isEnabled").to(t),this.listenTo(l,"submit",()=>{const{value:d}=l.urlInputView.fieldView.element,p=Pb(d,i);e.execute("link",p,l.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(l,"cancel",()=>{this._closeFormView()}),l.keystrokes.set("Esc",(d,p)=>{this._closeFormView(),p()}),l}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.ui.componentFactory.add("link",l=>{const d=new zt(l);return d.isEnabled=!0,d.label=i("Link"),d.icon='',d.keystroke=Ib,d.tooltip=!0,d.isToggleable=!0,d.bind("isEnabled").to(t,"isEnabled"),d.bind("isOn").to(t,"value",p=>!!p),this.listenTo(d,"execute",()=>this._showUI(!0)),d})}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(Ib,(i,l)=>{l(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),h({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),l=p();const d=()=>{const g=this._getSelectedLinkElement(),b=p();i&&!g||!i&&b!==l?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=g,l=b};function p(){return t.selection.focus.getAncestors().reverse().find(g=>g.is("element"))}this.listenTo(e.ui,"update",d),this.listenTo(this._balloon,"change:visibleView",d)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let l;if(t.markers.has(Go)){const d=Array.from(this.editor.editing.mapper.markerNameToElements(Go)),p=e.createRange(e.createPositionBefore(d[0]),e.createPositionAfter(d[d.length-1]));l=e.domConverter.viewRangeToDom(p)}else l=()=>{const d=this._getSelectedLinkElement();return d?e.domConverter.mapViewToDom(d):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:l}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&An(i))return Bb(t.getFirstPosition());{const l=t.getFirstRange().getTrimmed(),d=Bb(l.start),p=Bb(l.end);return d&&d==p&&e.createRangeIn(d).getTrimmed().isEqual(l)?d:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(Go))t.updateMarker(Go,{range:i});else if(i.start.isAtEnd){const l=i.start.getLastMatchingPosition(({item:d})=>!e.schema.isContent(d),{boundaries:i});t.addMarker(Go,{usingOperation:!1,affectsData:!1,range:t.createRange(l,i.end)})}else t.addMarker(Go,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Go)&&e.change(t=>{t.removeMarker(Go)})}}function Bb(c){return c.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})||null}const xF=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class EF extends pe{static get requires(){return[bi]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new Cx(e.model,i=>{if(!function(d){return d.length>4&&d[d.length-1]===" "&&d[d.length-2]!==" "}(i))return;const l=HS(i.substr(0,i.length-1));return l?{url:l}:void 0});t.on("matched:data",(i,l)=>{const{batch:d,range:p,url:g}=l;if(!d.isTyping)return;const b=p.end.getShiftedBy(-1),w=b.getShiftedBy(-g.length),y=e.model.createRange(w,b);this._applyAutoLink(g,y)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const l=t.document.selection.getFirstPosition();if(!l.parent.previousSibling)return;const d=t.createRangeIn(l.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(d)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const l=t.document.selection.getFirstPosition(),d=t.createRange(t.createPositionAt(l.parent,0),l.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(d)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:l}=_x(e,t),d=HS(i);if(d){const p=t.createRange(l.end.getShiftedBy(-d.length),l.end);this._applyAutoLink(d,p)}}_applyAutoLink(e,t){const i=this.editor.model,l=Pb(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(d,p){return p.schema.checkAttributeInSelection(p.createSelection(d),"linkHref")}(t,i)&&NS(l)&&!function(d){const p=d.start.nodeAfter;return!!p&&p.hasAttribute("linkHref")}(t)&&this._persistAutoLink(l,t)}_persistAutoLink(e,t){const i=this.editor.model,l=this.editor.plugins.get("Delete");i.enqueueChange(d=>{d.setAttribute("linkHref",e,t),i.enqueueChange(()=>{l.requestUndoOnBackspace()})})}}function HS(c){const e=xF.exec(c);return e?e[2]:null}var WS=a(111),SF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(WS.Z,SF),WS.Z.locals;var $S=a(5730),DF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()($S.Z,DF),$S.Z.locals;var YS=a(4564),TF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(YS.Z,TF),YS.Z.locals;function IF(c,e){const t=e.mapper,i=e.writer,l=c.getAttribute("listType")=="numbered"?"ol":"ul",d=function(g){const b=g.createContainerElement("li");return b.getFillerOffset=NF,b}(i),p=i.createContainerElement(l,null);return i.insert(i.createPositionAt(p,0),d),t.bindElements(c,d),d}function qS(c,e,t,i){const l=e.parent,d=t.mapper,p=t.writer;let g=d.toViewPosition(i.createPositionBefore(c));const b=GS(c.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:c.getAttribute("listIndent")}),w=c.previousSibling;if(b&&b.getAttribute("listIndent")==c.getAttribute("listIndent")){const y=d.toViewElement(b);g=p.breakContainer(p.createPositionAfter(y))}else if(w&&w.name=="listItem"){g=d.toViewPosition(i.createPositionAt(w,"end"));const y=d.findMappedViewAncestor(g),A=function(E){for(const D of E.getChildren())if(D.name=="ul"||D.name=="ol")return D;return null}(y);g=A?p.createPositionBefore(A):p.createPositionAt(y,"end")}else g=d.toViewPosition(i.createPositionBefore(c));if(g=KS(g),p.insert(g,l),w&&w.name=="listItem"){const y=d.toViewElement(w),A=p.createRange(p.createPositionAt(y,0),g).getWalker({ignoreElementEnd:!0});for(const E of A)if(E.item.is("element","li")){const D=p.breakContainer(p.createPositionBefore(E.item)),M=E.item.parent,R=p.createPositionAt(e,"end");Yr(p,R.nodeBefore,R.nodeAfter),p.move(p.createRangeOn(M),R),A._position=D}}else{const y=l.nextSibling;if(y&&(y.is("element","ul")||y.is("element","ol"))){let A=null;for(const E of y.getChildren()){const D=d.toModelElement(E);if(!(D&&D.getAttribute("listIndent")>c.getAttribute("listIndent")))break;A=E}A&&(p.breakContainer(p.createPositionAfter(A)),p.move(p.createRangeOn(A.parent),p.createPositionAt(e,"end")))}}Yr(p,l,l.nextSibling),Yr(p,l.previousSibling,l)}function Yr(c,e,t){return!e||!t||e.name!="ul"&&e.name!="ol"||e.name!=t.name||e.getAttribute("class")!==t.getAttribute("class")?null:c.mergeContainers(c.createPositionAfter(e))}function KS(c){return c.getLastMatchingPosition(e=>e.item.is("uiElement"))}function GS(c,e){const t=!!e.sameIndent,i=!!e.smallerIndent,l=e.listIndent;let d=c;for(;d&&d.name=="listItem";){const p=d.getAttribute("listIndent");if(t&&l==p||i&&l>p)return d;d=e.direction==="forward"?d.nextSibling:d.previousSibling}return null}function QS(c,e,t,i){c.ui.componentFactory.add(e,l=>{const d=c.commands.get(e),p=new zt(l);return p.set({label:t,icon:i,tooltip:!0,isToggleable:!0}),p.bind("isOn","isEnabled").to(d,"value","isEnabled"),p.on("execute",()=>{c.execute(e),c.editing.view.focus()}),p})}function Rb(c,e){const t=[],i=c.parent,l={ignoreElementEnd:!1,startPosition:c,shallow:!0,direction:e},d=i.getAttribute("listIndent"),p=[...new Yo(l)].filter(g=>g.item.is("element")).map(g=>g.item);for(const g of p){if(!g.is("element","listItem")||g.getAttribute("listIndent")d)){if(g.getAttribute("listType")!==i.getAttribute("listType")||g.getAttribute("listStyle")!==i.getAttribute("listStyle")||g.getAttribute("listReversed")!==i.getAttribute("listReversed")||g.getAttribute("listStart")!==i.getAttribute("listStart"))break;e==="backward"?t.unshift(g):t.push(g)}}return t}const MF=["disc","circle","square"],PF=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function NF(){const c=!this.isEmpty&&(this.getChild(0).name=="ul"||this.getChild(0).name=="ol");return this.isEmpty||c?0:fC.call(this)}class OF extends pe{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;QS(this.editor,"numberedList",e("Numbered List"),''),QS(this.editor,"bulletedList",e("Bulleted List"),'')}}const BF=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:c,typeAttribute:e,listType:t}of BF);var ZS=a(4721),RF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(ZS.Z,RF),ZS.Z.locals;var JS=a(6082),LF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(JS.Z,LF),JS.Z.locals;var XS=a(2417),jF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(XS.Z,jF),XS.Z.locals;class eD extends nt{constructor(e,t){super(e),this._indentBy=t=="forward"?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change(l=>{const d=i[i.length-1];let p=d.nextSibling;for(;p&&p.name=="listItem"&&p.getAttribute("listIndent")>d.getAttribute("listIndent");)i.push(p),p=p.nextSibling;this._indentBy<0&&(i=i.reverse());for(const g of i){const b=g.getAttribute("listIndent")+this._indentBy;b<0?l.rename(g,"paragraph"):l.setAttribute("listIndent",b,g)}this.fire("_executeCleanup",i)})}_checkEnabled(){const e=vn(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let l=e.previousSibling;for(;l&&l.is("element","listItem")&&l.getAttribute("listIndent")>=t;){if(l.getAttribute("listIndent")==t)return l.getAttribute("listType")==i;l=l.previousSibling}return!1}return!0}}class tD extends nt{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,l=Array.from(i.selection.getSelectedBlocks()).filter(p=>rD(p,t.schema)),d=e.forceValue!==void 0?!e.forceValue:this.value;t.change(p=>{if(d){let g=l[l.length-1].nextSibling,b=Number.POSITIVE_INFINITY,w=[];for(;g&&g.name=="listItem"&&g.getAttribute("listIndent")!==0;){const y=g.getAttribute("listIndent");y=t;)d>l.getAttribute("listIndent")&&(d=l.getAttribute("listIndent")),l.getAttribute("listIndent")==d&&c[e?"unshift":"push"](l),l=l[e?"previousSibling":"nextSibling"]}}function rD(c,e){return e.checkChild(c.parent,"listItem")&&!e.isObject(c)}class zF extends pe{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(e){return function(t){return MF.includes(t)?"bulleted":PF.includes(t)?"numbered":null}(e)}getSelectedListItems(e){return function(t){let i=[...t.document.selection.getSelectedBlocks()].filter(l=>l.is("element","listItem")).map(l=>{const d=t.change(p=>p.createPositionAt(l,0));return[...Rb(d,"backward"),...Rb(d,"forward")]}).flat();return i=[...new Set(i)],i}(e)}getSiblingNodes(e,t){return Rb(e,t)}}function oD(c){return(e,t,i)=>{const l=i.consumable;if(!l.test(t.item,"insert")||!l.test(t.item,"attribute:listType")||!l.test(t.item,"attribute:listIndent"))return;l.consume(t.item,"insert"),l.consume(t.item,"attribute:listType"),l.consume(t.item,"attribute:listIndent");const d=t.item;qS(d,IF(d,i),i,c)}}const FF=(c,e,t)=>{if(!t.consumable.test(e.item,c.name))return;const i=t.mapper.toViewElement(e.item),l=t.writer;l.breakContainer(l.createPositionBefore(i)),l.breakContainer(l.createPositionAfter(i));const d=i.parent,p=e.attributeNewValue=="numbered"?"ol":"ul";l.rename(p,d)},UF=(c,e,t)=>{t.consumable.consume(e.item,c.name);const i=t.mapper.toViewElement(e.item).parent,l=t.writer;Yr(l,i,i.nextSibling),Yr(l,i.previousSibling,i)},iD=(c,e,t)=>{if(t.consumable.test(e.item,c.name)&&e.item.name!="listItem"){let i=t.mapper.toViewPosition(e.range.start);const l=t.writer,d=[];for(;(i.parent.name=="ul"||i.parent.name=="ol")&&(i=l.breakContainer(i),i.parent.name=="li");){const p=i,g=l.createPositionAt(i.parent,"end");if(!p.isEqual(g)){const b=l.remove(l.createRange(p,g));d.push(b)}i=l.createPositionAfter(i.parent)}if(d.length>0){for(let p=0;p0){const b=Yr(l,g,g.nextSibling);b&&b.parent==g&&i.offset--}}Yr(l,i.nodeBefore,i.nodeAfter)}}},VF=(c,e,t)=>{const i=t.mapper.toViewPosition(e.position),l=i.nodeBefore,d=i.nodeAfter;Yr(t.writer,l,d)},HF=(c,e,t)=>{if(t.consumable.consume(e.viewItem,{name:!0})){const i=t.writer,l=i.createElement("listItem"),d=function(b){let w=0,y=b.parent;for(;y;){if(y.is("element","li"))w++;else{const A=y.previousSibling;A&&A.is("element","li")&&w++}y=y.parent}return w}(e.viewItem);i.setAttribute("listIndent",d,l);const p=e.viewItem.parent&&e.viewItem.parent.name=="ol"?"numbered":"bulleted";if(i.setAttribute("listType",p,l),!t.safeInsert(l,e.modelCursor))return;const g=function(b,w,y){const{writer:A,schema:E}=y;let D=A.createPositionAfter(b);for(const M of w)if(M.name=="ul"||M.name=="ol")D=y.convertItem(M,D).modelCursor;else{const R=y.convertItem(M,A.createPositionAt(b,"end")),U=R.modelRange.start.nodeAfter;U&&U.is("element")&&!E.checkChild(b,U.name)&&(b=R.modelCursor.parent.is("element","listItem")?R.modelCursor.parent:YF(R.modelCursor),D=A.createPositionAfter(b))}return D}(l,e.viewItem.getChildren(),t);e.modelRange=i.createRange(e.modelCursor,g),t.updateConversionResult(l,e)}},sD=(c,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){const i=Array.from(e.viewItem.getChildren());for(const l of i)!(l.is("element","li")||Bc(l))&&l._remove()}},WF=(c,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){if(e.viewItem.childCount===0)return;const i=[...e.viewItem.getChildren()];let l=!1;for(const d of i)l&&!Bc(d)&&d._remove(),Bc(d)&&(l=!0)}};function aD(c){return(e,t)=>{if(t.isPhantom)return;const i=t.modelPosition.nodeBefore;if(i&&i.is("element","listItem")){const l=t.mapper.toViewElement(i),d=l.getAncestors().find(Bc),p=c.createPositionAt(l,0).getWalker();for(const g of p){if(g.type=="elementStart"&&g.item.is("element","li")){t.viewPosition=g.previousPosition;break}if(g.type=="elementEnd"&&g.item==d){t.viewPosition=g.nextPosition;break}}}}}const $F=function(c,[e,t]){const i=this;let l,d=e.is("documentFragment")?e.getChild(0):e;if(l=t?i.createSelection(t):i.document.selection,d&&d.is("element","listItem")){const p=l.getFirstPosition();let g=null;if(p.parent.is("element","listItem")?g=p.parent:p.nodeBefore&&p.nodeBefore.is("element","listItem")&&(g=p.nodeBefore),g){const b=g.getAttribute("listIndent");if(b>0)for(;d&&d.is("element","listItem");)d._setAttribute("listIndent",d.getAttribute("listIndent")+b),d=d.nextSibling}}};function YF(c){const e=new Yo({startPosition:c});let t;do t=e.next();while(!t.value.item.is("element","listItem"));return t.value.item}function cD(c,e,t,i,l,d){const p=GS(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:c}),g=l.mapper,b=l.writer,w=p?p.getAttribute("listIndent"):null;let y;if(p)if(w==c){const A=g.toViewElement(p).parent;y=b.createPositionAfter(A)}else{const A=d.createPositionAt(p,"end");y=g.toViewPosition(A)}else y=t;y=KS(y);for(const A of[...i.getChildren()])Bc(A)&&(y=b.move(b.createRangeOn(A),y).end,Yr(b,A,A.nextSibling),Yr(b,A.previousSibling,A))}function Bc(c){return c.is("element","ol")||c.is("element","ul")}class qF extends pe{static get pluginName(){return"ListEditing"}static get requires(){return[Sp,bi,zF]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var l;e.model.document.registerPostFixer(p=>function(g,b){const w=g.document.differ.getChanges(),y=new Map;let A=!1;for(const R of w)if(R.type=="insert"&&R.name=="listItem")E(R.position);else if(R.type=="insert"&&R.name!="listItem"){if(R.name!="$text"){const U=R.position.nodeAfter;U.hasAttribute("listIndent")&&(b.removeAttribute("listIndent",U),A=!0),U.hasAttribute("listType")&&(b.removeAttribute("listType",U),A=!0),U.hasAttribute("listStyle")&&(b.removeAttribute("listStyle",U),A=!0),U.hasAttribute("listReversed")&&(b.removeAttribute("listReversed",U),A=!0),U.hasAttribute("listStart")&&(b.removeAttribute("listStart",U),A=!0);for(const W of Array.from(g.createRangeIn(U)).filter(J=>J.item.is("element","listItem")))E(W.previousPosition)}E(R.position.getShiftedBy(R.length))}else R.type=="remove"&&R.name=="listItem"?E(R.position):(R.type=="attribute"&&R.attributeKey=="listIndent"||R.type=="attribute"&&R.attributeKey=="listType")&&E(R.range.start);for(const R of y.values())D(R),M(R);return A;function E(R){const U=R.nodeBefore;if(U&&U.is("element","listItem")){let W=U;if(y.has(W))return;for(let J=W.previousSibling;J&&J.is("element","listItem");J=W.previousSibling)if(W=J,y.has(W))return;y.set(U,W)}else{const W=R.nodeAfter;W&&W.is("element","listItem")&&y.set(W,W)}}function D(R){let U=0,W=null;for(;R&&R.is("element","listItem");){const J=R.getAttribute("listIndent");if(J>U){let ie;W===null?(W=J-U,ie=U):(W>J&&(W=J),ie=J-W),b.setAttribute("listIndent",ie,R),A=!0}else W=null,U=R.getAttribute("listIndent")+1;R=R.nextSibling}}function M(R){let U=[],W=null;for(;R&&R.is("element","listItem");){const J=R.getAttribute("listIndent");if(W&&W.getAttribute("listIndent")>J&&(U=U.slice(0,J+1)),J!=0)if(U[J]){const ie=U[J];R.getAttribute("listType")!=ie&&(b.setAttribute("listType",ie,R),A=!0)}else U[J]=R.getAttribute("listType");W=R,R=R.nextSibling}}}(e.model,p)),i.mapper.registerViewToModelLength("li",Lb),t.mapper.registerViewToModelLength("li",Lb),i.mapper.on("modelToViewPosition",aD(i.view)),i.mapper.on("viewToModelPosition",(l=e.model,(p,g)=>{const b=g.viewPosition,w=b.parent,y=g.mapper;if(w.name=="ul"||w.name=="ol"){if(b.isAtEnd){const A=y.toModelElement(b.nodeBefore),E=y.getModelLength(b.nodeBefore);g.modelPosition=l.createPositionBefore(A).getShiftedBy(E)}else{const A=y.toModelElement(b.nodeAfter);g.modelPosition=l.createPositionBefore(A)}p.stop()}else if(w.name=="li"&&b.nodeBefore&&(b.nodeBefore.name=="ul"||b.nodeBefore.name=="ol")){const A=y.toModelElement(w);let E=1,D=b.nodeBefore;for(;D&&Bc(D);)E+=y.getModelLength(D),D=D.previousSibling;g.modelPosition=l.createPositionBefore(A).getShiftedBy(E),p.stop()}})),t.mapper.on("modelToViewPosition",aD(i.view)),e.conversion.for("editingDowncast").add(p=>{p.on("insert",iD,{priority:"high"}),p.on("insert:listItem",oD(e.model)),p.on("attribute:listType:listItem",FF,{priority:"high"}),p.on("attribute:listType:listItem",UF,{priority:"low"}),p.on("attribute:listIndent:listItem",function(g){return(b,w,y)=>{if(!y.consumable.consume(w.item,"attribute:listIndent"))return;const A=y.mapper.toViewElement(w.item),E=y.writer;E.breakContainer(E.createPositionBefore(A)),E.breakContainer(E.createPositionAfter(A));const D=A.parent,M=D.previousSibling,R=E.createRangeOn(D);E.remove(R),M&&M.nextSibling&&Yr(E,M,M.nextSibling),cD(w.attributeOldValue+1,w.range.start,R.start,A,y,g),qS(w.item,A,y,g);for(const U of w.item.getChildren())y.consumable.consume(U,"insert")}}(e.model)),p.on("remove:listItem",function(g){return(b,w,y)=>{const A=y.mapper.toViewPosition(w.position).getLastMatchingPosition(W=>!W.item.is("element","li")).nodeAfter,E=y.writer;E.breakContainer(E.createPositionBefore(A)),E.breakContainer(E.createPositionAfter(A));const D=A.parent,M=D.previousSibling,R=E.createRangeOn(D),U=E.remove(R);M&&M.nextSibling&&Yr(E,M,M.nextSibling),cD(y.mapper.toModelElement(A).getAttribute("listIndent")+1,w.position,R.start,A,y,g);for(const W of E.createRangeIn(U).getItems())y.mapper.unbindViewElement(W);b.stop()}}(e.model)),p.on("remove",VF,{priority:"low"})}),e.conversion.for("dataDowncast").add(p=>{p.on("insert",iD,{priority:"high"}),p.on("insert:listItem",oD(e.model))}),e.conversion.for("upcast").add(p=>{p.on("element:ul",sD,{priority:"high"}),p.on("element:ol",sD,{priority:"high"}),p.on("element:li",WF,{priority:"high"}),p.on("element:li",HF)}),e.model.on("insertContent",$F,{priority:"high"}),e.commands.add("numberedList",new tD(e,"numbered")),e.commands.add("bulletedList",new tD(e,"bulleted")),e.commands.add("indentList",new eD(e,"forward")),e.commands.add("outdentList",new eD(e,"backward"));const d=i.view.document;this.listenTo(d,"enter",(p,g)=>{const b=this.editor.model.document,w=b.selection.getLastPosition().parent;b.selection.isCollapsed&&w.name=="listItem"&&w.isEmpty&&(this.editor.execute("outdentList"),g.preventDefault(),p.stop())},{context:"li"}),this.listenTo(d,"delete",(p,g)=>{if(g.direction!=="backward")return;const b=this.editor.model.document.selection;if(!b.isCollapsed)return;const w=b.getFirstPosition();if(!w.isAtStart)return;const y=w.parent;y.name==="listItem"&&(y.previousSibling&&y.previousSibling.name==="listItem"||(this.editor.execute("outdentList"),g.preventDefault(),p.stop()))},{context:"li"}),this.listenTo(e.editing.view.document,"tab",(p,g)=>{const b=g.shiftKey?"outdentList":"indentList";this.editor.commands.get(b).isEnabled&&(e.execute(b),g.stopPropagation(),g.preventDefault(),p.stop())},{context:"li"})}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function Lb(c){let e=1;for(const t of c.getChildren())if(t.name=="ul"||t.name=="ol")for(const i of t.getChildren())e+=Lb(i);return e}gu("Ctrl+Enter");var lD=a(1199),KF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(lD.Z,KF),lD.Z.locals,gu("Ctrl+Enter");function uD(c,e){const t=(i,l,d)=>{if(!d.consumable.consume(l.item,i.name))return;const p=l.attributeNewValue,g=d.writer,b=d.mapper.toViewElement(l.item),w=[...b.getChildren()].find(A=>A.getCustomProperty("media-content"));g.remove(w);const y=c.getMediaViewElement(g,p,e);g.insert(g.createPositionAt(b,0),y)};return i=>{i.on("attribute:url:media",t)}}function dD(c,e,t,i){return c.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(c,t,i),c.createSlot()])}function hD(c){const e=c.getSelectedElement();return e&&e.is("element","media")?e:null}function pD(c,e,t,i){c.change(l=>{const d=l.createElement("media",{url:e});c.insertObject(d,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}class GF extends nt{refresh(){const e=this.editor.model,t=e.document.selection,i=hD(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=function(l){const d=l.getSelectedElement();return!!d&&d.name==="media"}(t)||function(l,d){let g=Bx(l,d).start.parent;return g.isEmpty&&!d.schema.isLimit(g)&&(g=g.parent),d.schema.checkChild(g,"media")}(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,l=hD(i);l?t.change(d=>{d.setAttribute("url",e,l)}):pD(t,e,i,!0)}}class QF{constructor(e,t){const i=t.providers,l=t.extraProviders||[],d=new Set(t.removeProviders),p=i.concat(l).filter(g=>{const b=g.name;return b?!d.has(b):(te("media-embed-no-provider-name",{provider:g}),!1)});this.locale=e,this.providerDefinitions=p}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new fD(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,l=Sn(t.url);for(const d of l){const p=this._getUrlMatches(e,d);if(p)return new fD(this.locale,e,p,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let l=e.replace(/^https?:\/\//,"");return i=l.match(t),i||(l=l.replace(/^www\./,""),i=l.match(t),i||null)}}class fD{constructor(e,t,i,l){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=l}getViewElement(e,t){const i={};let l;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const d=this._getPreviewHtml(t);l=e.createRawElement("div",i,(p,g)=>{g.setContentOf(p,d)})}else this.url&&(i.url=this.url),l=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,l),l}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new ea,t=this._locale.t;return e.content='',e.viewBox="0 0 64 42",new ho({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}var gD=a(7442),ZF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(gD.Z,ZF),gD.Z.locals;class jp extends pe{constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>``},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>``},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],l=t[2];return``}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>``},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new QF(e.locale,e.config.get("mediaEmbed"))}static get pluginName(){return"MediaEmbedEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,l=e.conversion,d=e.config.get("mediaEmbed.previewsInData"),p=e.config.get("mediaEmbed.elementName"),g=this.registry;e.commands.add("mediaEmbed",new GF(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),l.for("dataDowncast").elementToStructure({model:"media",view:(b,{writer:w})=>{const y=b.getAttribute("url");return dD(w,g,y,{elementName:p,renderMediaPreview:!!y&&d})}}),l.for("dataDowncast").add(uD(g,{elementName:p,renderMediaPreview:d})),l.for("editingDowncast").elementToStructure({model:"media",view:(b,{writer:w})=>{const y=b.getAttribute("url");return function(A,E,D){return E.setCustomProperty("media",!0,A),kb(A,E,{label:D})}(dD(w,g,y,{elementName:p,renderForEditingView:!0}),w,i("media widget"))}}),l.for("editingDowncast").add(uD(g,{elementName:p,renderForEditingView:!0})),l.for("upcast").elementToElement({view:b=>["oembed",p].includes(b.name)&&b.getAttribute("url")?{name:!0}:null,model:(b,{writer:w})=>{const y=b.getAttribute("url");return g.hasMedia(y)?w.createElement("media",{url:y}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(b,{writer:w})=>{const y=b.getAttribute("data-oembed-url");return g.hasMedia(y)?w.createElement("media",{url:y}):null}}).add(b=>{b.on("element:figure",(w,y,A)=>{if(!A.consumable.consume(y.viewItem,{name:!0,classes:"media"}))return;const{modelRange:E,modelCursor:D}=A.convertChildren(y.viewItem,y.modelCursor);y.modelRange=E,y.modelCursor=D,vn(E.getItems())||A.consumable.revert(y.viewItem,{name:!0,classes:"media"})})})}}const JF=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class XF extends pe{constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}static get requires(){return[eE,bi,aE]}static get pluginName(){return"AutoMediaEmbed"}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const l=t.selection.getFirstRange(),d=Fn.fromPosition(l.start);d.stickiness="toPrevious";const p=Fn.fromPosition(l.end);p.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(d,p),d.detach(),p.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(Oe.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,l=i.plugins.get(jp).registry,d=new Sr(e,t),p=d.getWalker({ignoreElementEnd:!0});let g="";for(const b of p)b.item.is("$textProxy")&&(g+=b.item.data);if(g=g.trim(),!g.match(JF)||!l.hasMedia(g))return void d.detach();i.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Fn.fromPosition(e),this._timeoutId=Oe.window.setTimeout(()=>{i.model.change(b=>{this._timeoutId=null,b.remove(d),d.detach();let w=null;this._positionToInsert.root.rootName!=="$graveyard"&&(w=this._positionToInsert),pD(i.model,g,w,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(bi).requestUndoOnBackspace()},100)):d.detach()}}var mD=a(9292),e6={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(mD.Z,e6),mD.Z.locals;class t6 extends Ke{constructor(e,t){super(t);const i=t.t;this.focusTracker=new dr,this.keystrokes=new uo,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Wt.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",l=>!!l),this.cancelButtonView=this._createButton(i("Cancel"),Wt.cancel,"ck-button-cancel","cancel"),this._focusables=new gi,this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),m({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element);const 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()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new Gh(this.locale,gp),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}_createButton(e,t,i,l){const d=new zt(this.locale);return d.set({label:e,icon:t,tooltip:!0}),d.extendTemplate({attributes:{class:i}}),l&&d.delegate("execute").to(this,l),d}}class n6 extends pe{static get requires(){return[jp]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",i=>{const l=cs(i);return this._setUpDropdown(l,t),l})}_setUpDropdown(e,t){const i=this.editor,l=i.t,d=e.buttonView,p=i.plugins.get(jp).registry;e.once("change:isOpen",()=>{const g=new(f(t6))(function(b,w){return[y=>{if(!y.url.length)return b("The URL must not be empty.")},y=>{if(!w.hasMedia(y.url))return b("This media URL is not supported.")}]}(i.t,p),i.locale);e.panelView.children.add(g),d.on("open",()=>{g.disableCssTransitions(),g.url=t.value||"",g.urlInputView.fieldView.select(),g.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{g.isValid()&&(i.execute("mediaEmbed",g.url),i.editing.view.focus())}),e.on("change:isOpen",()=>g.resetFormStatus()),e.on("cancel",()=>{i.editing.view.focus()}),g.delegate("submit","cancel").to(e),g.urlInputView.fieldView.bind("value").to(t,"value"),g.urlInputView.bind("isEnabled").to(t,"isEnabled")}),e.bind("isEnabled").to(t),d.set({label:l("Insert media"),icon:'',tooltip:!0})}}var kD=a(4652),r6={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(kD.Z,r6),kD.Z.locals;function o6(c,e){if(!c.childCount)return;const t=new da(c.document),i=function(p,g){const b=g.createRangeIn(p),w=new po({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),y=[];for(const A of b)if(A.type==="elementStart"&&w.match(A.item)){const E=s6(A.item);y.push({element:A.item,id:E.id,order:E.order,indent:E.indent})}return y}(c,t);if(!i.length)return;let l=null,d=1;i.forEach((p,g)=>{const b=function(M,R){if(!M)return!0;if(M.id!==R.id)return R.indent-M.indent!=1;const U=R.element.previousSibling;if(!U)return!0;return W=U,!(W.is("element","ol")||W.is("element","ul"));var W}(i[g-1],p),w=b?null:i[g-1],y=(E=p,(A=w)?E.indent-A.indent:E.indent-1);var A,E;if(b&&(l=null,d=1),!l||y!==0){const M=function(R,U){const W=new RegExp(`@list l${R.id}:level${R.indent}\\s*({[^}]*)`,"gi"),J=/mso-level-number-format:([^;]{0,100});/gi,ie=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,ve=W.exec(U);let Be="decimal",Ct="ol",at=null;if(ve&&ve[1]){const rn=J.exec(ve[1]);if(rn&&rn[1]&&(Be=rn[1].trim(),Ct=Be!=="bullet"&&Be!=="image"?"ol":"ul"),Be==="bullet"){const on=function(Lc){const Qo=function(vi){if(vi.getChild(0).is("$text"))return null;for(const yi of vi.getChildren()){if(!yi.is("element","span"))continue;const ka=yi.getChild(0);if(ka)return ka.is("$text")?ka:ka.getChild(0)}return null}(Lc);if(!Qo)return null;const qr=Qo._data;return qr==="o"?"circle":qr==="·"?"disc":qr==="§"?"square":null}(R.element);on&&(Be=on)}else{const on=ie.exec(ve[1]);on&&on[1]&&(at=parseInt(on[1]))}}return{type:Ct,startIndex:at,style:i6(Be)}}(p,e);if(l){if(p.indent>d){const R=l.getChild(l.childCount-1),U=R.getChild(R.childCount-1);l=bD(M,U,t),d+=1}else if(p.indent1&&t.setAttribute("start",c.startIndex,l),l}function s6(c){const e={},t=c.getStyle("mso-list");if(t){const i=t.match(/(^|\s{1,100})l(\d+)/i),l=t.match(/\s{0,100}lfo(\d+)/i),d=t.match(/\s{0,100}level(\d+)/i);i&&l&&d&&(e.id=i[2],e.order=l[1],e.indent=parseInt(d[1]))}return e}function a6(c,e){if(!c.childCount)return;const t=new da(c.document),i=function(d,p){const g=p.createRangeIn(d),b=new po({name:/v:(.+)/}),w=[];for(const y of g){if(y.type!="elementStart")continue;const A=y.item,E=A.previousSibling,D=E&&E.is("element")?E.name:null;b.match(A)&&A.getAttribute("o:gfxdata")&&D!=="v:shapetype"&&w.push(y.item.getAttribute("id"))}return w}(c,t);(function(d,p,g){const b=g.createRangeIn(p),w=new po({name:"img"}),y=[];for(const A of b)if(A.item.is("element")&&w.match(A.item)){const E=A.item,D=E.getAttribute("v:shapes")?E.getAttribute("v:shapes").split(" "):[];D.length&&D.every(M=>d.indexOf(M)>-1)?y.push(E):E.getAttribute("src")||y.push(E)}for(const A of y)g.remove(A)})(i,c,t),function(d,p,g){const b=g.createRangeIn(p),w=[];for(const E of b)if(E.type=="elementStart"&&E.item.is("element","v:shape")){const D=E.item.getAttribute("id");if(d.includes(D))continue;y(E.item.parent.getChildren(),D)||w.push(E.item)}for(const E of w){const D={src:A(E)};E.hasAttribute("alt")&&(D.alt=E.getAttribute("alt"));const M=g.createElement("img",D);g.insertChild(E.index+1,M,E.parent)}function y(E,D){for(const M of E)if(M.is("element")&&(M.name=="img"&&M.getAttribute("v:shapes")==D||y(M.getChildren(),D)))return!0;return!1}function A(E){for(const D of E.getChildren())if(D.is("element")&&D.getAttribute("src"))return D.getAttribute("src")}}(i,c,t),function(d,p){const g=p.createRangeIn(d),b=new po({name:/v:(.+)/}),w=[];for(const y of g)y.type=="elementStart"&&b.match(y.item)&&w.push(y.item);for(const y of w)p.remove(y)}(c,t);const l=function(d,p){const g=p.createRangeIn(d),b=new po({name:"img"}),w=[];for(const y of g)y.item.is("element")&&b.match(y.item)&&y.item.getAttribute("src").startsWith("file://")&&w.push(y.item);return w}(c,t);l.length&&function(d,p,g){if(d.length===p.length)for(let b=0;bString.fromCharCode(parseInt(e,16))).join(""))}const l6=//i,u6=/xmlns:o="urn:schemas-microsoft-com/i;class d6{constructor(e){this.document=e}isActive(e){return l6.test(e)||u6.test(e)}execute(e){const{body:t,stylesString:i}=e._parsedData;o6(t,i),a6(t,e.dataTransfer.getData("text/rtf")),e.content=t}}function wD(c,e,t,{blockElements:i,inlineObjectElements:l}){let d=t.createPositionAt(c,e=="forward"?"after":"before");return d=d.getLastMatchingPosition(({item:p})=>p.is("element")&&!i.includes(p.name)&&!l.includes(p.name),{direction:e}),e=="forward"?d.nodeAfter:d.nodeBefore}function vD(c,e){return!!c&&c.is("element")&&e.includes(c.name)}const h6=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class p6{constructor(e){this.document=e}isActive(e){return h6.test(e)}execute(e){const t=new da(this.document),{body:i}=e._parsedData;(function(l,d){for(const p of l.getChildren())if(p.is("element","b")&&p.getStyle("font-weight")==="normal"){const g=l.getChildIndex(p);d.remove(p),d.insertChild(g,p.getChildren(),l)}})(i,t),function(l,d){for(const p of d.createRangeIn(l)){const g=p.item;if(g.is("element","li")){const b=g.getChild(0);b&&b.is("element","p")&&d.unwrapElement(b)}}}(i,t),function(l,d){const p=new np(d.document.stylesProcessor),g=new ip(p,{renderingMode:"data"}),b=g.blockElements,w=g.inlineObjectElements,y=[];for(const A of d.createRangeIn(l)){const E=A.item;if(E.is("element","br")){const D=wD(E,"forward",d,{blockElements:b,inlineObjectElements:w}),M=wD(E,"backward",d,{blockElements:b,inlineObjectElements:w}),R=vD(D,b);(vD(M,b)||R)&&y.push(E)}}for(const A of y)A.hasClass("Apple-interchange-newline")?d.remove(A):d.replace(A,d.createElement("p"))}(i,t),e.content=i}}const f6=/(\s+)<\/span>/g,(e,t)=>t.length===1?" ":Array(t.length+1).join(" ").substr(0,t.length))}function m6(c,e){const t=new DOMParser,i=function(b){return yD(yD(b)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(b){const w="",y="",A=b.indexOf(w);if(A<0)return b;const E=b.indexOf(y,A+w.length);return b.substring(0,A+w.length)+(E>=0?b.substring(E):"")}(c=c.replace(//g,"")}(g.getData("text/html")):g.getData("text/plain")&&(((w=(w=g.getData("text/plain")).replace(//g,">").replace(/\r?\n\r?\n/g,"").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||w.includes("
"))&&(w=`
${w}
`),A=w),b=this.editor.data.htmlProcessor.toView(A)}var w;const y=new I(this,"inputTransformation");this.fire(y,{content:b,dataTransfer:g,targetRanges:p.targetRanges,method:p.method}),y.stop.called&&d.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(d,p)=>{if(p.content.isEmpty)return;const g=this.editor.data.toModel(p.content,"$clipboardHolder");g.childCount!=0&&(d.stop(),t.change(()=>{this.fire("contentInsertion",{content:g,method:p.method,dataTransfer:p.dataTransfer,targetRanges:p.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(d,p)=>{p.resultRange=t.insertContent(p.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,l=(d,p)=>{const g=p.dataTransfer;p.preventDefault(),this._fireOutputTransformationEvent(g,t.selection,d.name)};this.listenTo(i,"copy",l,{priority:"low"}),this.listenTo(i,"cut",(d,p)=>{e.model.canEditAt(e.model.document.selection)?l(d,p):p.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(d,p)=>{const g=e.data.toView(p.content);i.fire("clipboardOutput",{dataTransfer:p.dataTransfer,content:g,method:p.method})},{priority:"low"}),this.listenTo(i,"clipboardOutput",(d,p)=>{p.content.isEmpty||(p.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(p.content)),p.dataTransfer.setData("text/plain",fx(p.content))),p.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}class gx{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(i,l)=>{l.isLocal&&l.isUndoable&&l!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class _L extends nt{constructor(e,t){super(e),this._buffer=new gx(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,l=e.text||"",d=l.length;let p=i.selection;if(e.selection?p=e.selection:e.range&&(p=t.createSelection(e.range)),!t.canEditAt(p))return;const g=e.resultRange;t.enqueueChange(this._buffer.batch,b=>{this._buffer.lock(),t.deleteContent(p),l&&t.insertContent(b.createText(l,i.selection.getAttributes()),p),g?b.setSelection(g):p.is("documentSelection")||b.setSelection(p),this._buffer.unlock(),this._buffer.input(d)})}}const mx=["insertText","insertReplacementText"];class CL extends $o{constructor(e){super(e),this.focusObserver=e.getObserver(cp),_.isAndroid&&mx.push("insertCompositionText");const t=e.document;t.on("beforeinput",(i,l)=>{if(!this.isEnabled)return;const{data:d,targetRanges:p,inputType:g,domEvent:b}=l;if(!mx.includes(g))return;this.focusObserver.flush();const w=new I(t,"insertText");t.fire(w,new Cc(e,b,{text:d,selection:e.createSelection(p)})),w.stop.called&&i.stop()}),t.on("compositionend",(i,{data:l,domEvent:d})=>{this.isEnabled&&!_.isAndroid&&l&&t.fire("insertText",new Cc(e,d,{text:l,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}class kx extends pe{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,l=t.document.selection;i.addObserver(CL);const d=new _L(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",d),e.commands.add("input",d),this.listenTo(i.document,"insertText",(p,g)=>{i.document.isComposing||g.preventDefault();const{text:b,selection:w,resultRange:y}=g,A=Array.from(w.getRanges()).map(M=>e.editing.mapper.toModelRange(M));let E=b;if(_.isAndroid){const M=Array.from(A[0].getItems()).reduce((R,U)=>R+(U.is("$textProxy")?U.data:""),"");M&&(M.length<=E.length?E.startsWith(M)&&(E=E.substring(M.length),A[0].start=A[0].start.getShiftedBy(M.length)):M.startsWith(E)&&(A[0].start=A[0].start.getShiftedBy(E.length),E=""))}const D={text:E,selection:t.createSelection(A)};y&&(D.resultRange=e.editing.mapper.toModelRange(y)),e.execute("insertText",D),i.scrollToTheSelection()}),_.isAndroid?this.listenTo(i.document,"keydown",(p,g)=>{!l.isCollapsed&&g.keyCode==229&&i.document.isComposing&&bx(t,d)}):this.listenTo(i.document,"compositionstart",()=>{l.isCollapsed||bx(t,d)})}}function bx(c,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),c.enqueueChange(t.batch,()=>{c.deleteContent(c.document.selection)}),t.unlock()}class wx extends nt{constructor(e,t){super(e),this.direction=t,this._buffer=new gx(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const d=l.createSelection(e.selection||i.selection);if(!t.canEditAt(d))return;const p=e.sequence||1,g=d.isCollapsed;if(d.isCollapsed&&t.modifySelection(d,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(p))return void this._replaceEntireContentWithParagraph(l);if(this._shouldReplaceFirstBlockWithParagraph(d,p))return void this.editor.execute("paragraph",{selection:d});if(d.isCollapsed)return;let b=0;d.getFirstRange().getMinimalFlatRanges().forEach(w=>{b+=$(w.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(d,{doNotResetEntireContent:g,direction:this.direction}),this._buffer.input(b),l.setSelection(d),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,l=t.schema.getLimitElement(i);if(!(i.isCollapsed&&i.containsEntireContent(l))||!t.schema.checkChild(l,"paragraph"))return!1;const d=l.getChild(0);return!d||!d.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,l=t.schema.getLimitElement(i),d=e.createElement("paragraph");e.remove(e.createRangeIn(l)),e.insert(d,l),e.setSelection(d,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const l=e.getFirstPosition(),d=i.schema.getLimitElement(l),p=d.getChild(0);return l.parent==p&&!!e.containsEntireContent(p)&&!!i.schema.checkChild(d,"paragraph")&&p.name!="paragraph"}}const vx="word",ls="selection",Tc="backward",Bu="forward",yx={deleteContent:{unit:ls,direction:Tc},deleteContentBackward:{unit:"codePoint",direction:Tc},deleteWordBackward:{unit:vx,direction:Tc},deleteHardLineBackward:{unit:ls,direction:Tc},deleteSoftLineBackward:{unit:ls,direction:Tc},deleteContentForward:{unit:"character",direction:Bu},deleteWordForward:{unit:vx,direction:Bu},deleteHardLineForward:{unit:ls,direction:Bu},deleteSoftLineForward:{unit:ls,direction:Bu}};class AL extends $o{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",()=>{i++}),t.on("keyup",()=>{i=0}),t.on("beforeinput",(l,d)=>{if(!this.isEnabled)return;const{targetRanges:p,domEvent:g,inputType:b}=d,w=yx[b];if(!w)return;const y={direction:w.direction,unit:w.unit,sequence:i};y.unit==ls&&(y.selectionToRemove=e.createSelection(p[0])),b==="deleteContentBackward"&&(_.isAndroid&&(y.sequence=1),function(E){if(E.length!=1||E[0].isCollapsed)return!1;const D=E[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let M=0;for(const{nextPosition:R}of D){if(R.parent.is("$text")){const U=R.parent.data,W=R.offset;if(ck(U,W)||lk(U,W)||C_(U,W))continue;M++}else M++;if(M>1)return!0}return!1}(p)&&(y.unit=ls,y.selectionToRemove=e.createSelection(p)));const A=new yc(t,"delete",p[0]);t.fire(A,new Cc(e,g,y)),A.stop.called&&l.stop()}),_.isBlink&&function(l){const d=l.view,p=d.document;let g=null,b=!1;function w(A){return A==dt.backspace||A==dt.delete}function y(A){return A==dt.backspace?Tc:Bu}p.on("keydown",(A,{keyCode:E})=>{g=E,b=!1}),p.on("keyup",(A,{keyCode:E,domEvent:D})=>{const M=p.selection,R=l.isEnabled&&E==g&&w(E)&&!M.isCollapsed&&!b;if(g=null,R){const U=M.getFirstRange(),W=new yc(p,"delete",U),J={unit:ls,direction:y(E),selectionToRemove:M};p.fire(W,new Cc(d,D,J))}}),p.on("beforeinput",(A,{inputType:E})=>{const D=yx[E];w(g)&&D&&D.direction==y(g)&&(b=!0)},{priority:"high"}),p.on("beforeinput",(A,{inputType:E,data:D})=>{g==dt.delete&&E=="insertText"&&D==""&&A.stop()},{priority:"high"})}(this)}observe(){}stopObserving(){}}class bi extends pe{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,l=e.model.document;t.addObserver(AL),this._undoOnBackspace=!1;const d=new wx(e,"forward");e.commands.add("deleteForward",d),e.commands.add("forwardDelete",d),e.commands.add("delete",new wx(e,"backward")),this.listenTo(i,"delete",(p,g)=>{i.isComposing||g.preventDefault();const{direction:b,sequence:w,selectionToRemove:y,unit:A}=g,E=b==="forward"?"deleteForward":"delete",D={sequence:w};if(A=="selection"){const M=Array.from(y.getRanges()).map(R=>e.editing.mapper.toModelRange(R));D.selection=e.model.createSelection(M)}else D.unit=A;e.execute(E,D),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(p,g)=>{this._undoOnBackspace&&g.direction=="backward"&&g.sequence==1&&g.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),g.preventDefault(),p.stop())},{context:"$capture"}),this.listenTo(l,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class xL extends pe{static get requires(){return[kx,bi]}static get pluginName(){return"Typing"}}function _x(c,e){let t=c.start;return{text:Array.from(c.getWalker({ignoreElementEnd:!1})).reduce((i,{item:l})=>l.is("$text")||l.is("$textProxy")?i+l.data:(t=e.createPositionAfter(l),""),""),range:e.createRange(t,c.end)}}class Cx extends Ve(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))}),this.listenTo(e,"change:data",(t,i)=>{!i.isUndo&&i.isLocal&&this._evaluateTextBeforeSelection("data",{batch:i})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,l=i.document.selection,d=i.createRange(i.createPositionAt(l.focus.parent,0),l.focus),{text:p,range:g}=_x(d,i),b=this.testCallback(p);if(!b&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!b,b){const w=Object.assign(t,{text:p,range:g});typeof b=="object"&&Object.assign(w,b),this.fire(`matched:${e}`,w)}}}class Ax extends pe{constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}init(){const e=this.editor,t=e.model,i=e.editing.view,l=e.locale,d=t.document.selection;this.listenTo(i.document,"arrowKey",(p,g)=>{if(!d.isCollapsed||g.shiftKey||g.altKey||g.ctrlKey)return;const b=g.keyCode==dt.arrowright,w=g.keyCode==dt.arrowleft;if(!b&&!w)return;const y=l.contentLanguageDirection;let A=!1;A=y==="ltr"&&b||y==="rtl"&&w?this._handleForwardMovement(g):this._handleBackwardMovement(g),A===!0&&p.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(d,"change:range",(p,g)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!g.directChange&&Ep(d.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model.document.selection,l=i.getFirstPosition();return!this._isGravityOverridden&&(!l.isAtStart||!pb(i,t))&&!!Ep(l,t)&&(xp(e),this._overrideGravity(),!0)}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,l=i.document.selection,d=l.getFirstPosition();return this._isGravityOverridden?(xp(e),this._restoreGravity(),fb(i,t,d),!0):d.isAtStart?!!pb(l,t)&&(xp(e),fb(i,t,d),!0):!!function(p,g){const b=p.getShiftedBy(-1);return Ep(b,g)}(d,t)&&(d.isAtEnd&&!pb(l,t)&&Ep(d,t)?(xp(e),fb(i,t,d),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function pb(c,e){for(const t of e)if(c.hasAttribute(t))return!0;return!1}function fb(c,e,t){const i=t.nodeBefore;c.change(l=>{if(i){const d=[],p=c.schema.isObject(i)&&c.schema.isInline(i);for(const[g,b]of i.getAttributes())!c.schema.checkAttribute("$text",g)||p&&c.schema.getAttributeProperties(g).copyFromObject===!1||d.push([g,b]);l.setSelectionAttribute(d)}else l.removeSelectionAttribute(e)})}function xp(c){c.preventDefault()}function Ep(c,e){const{nodeBefore:t,nodeAfter:i}=c;for(const l of e){const d=t?t.getAttribute(l):void 0;if((i?i.getAttribute(l):void 0)!==d)return!0}return!1}const xx={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:Ic('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Ic("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Ic("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Ic('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Ic('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Ic("'"),to:[null,"‚",null,"’"]}},Ex={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},EL=["symbols","mathematical","typography","quotes"];function SL(c){return typeof c=="string"?new RegExp(`(${Q1(c)})$`):c}function DL(c){return typeof c=="string"?()=>[c]:c instanceof Array?()=>c:c}function TL(c){return(c.textNode?c.textNode:c.nodeAfter).getAttributes()}function Ic(c){return new RegExp(`(^|\\s)(${c})([^${c}]*)(${c})$`)}function Mc(c,e,t,i){return i.createRange(Sx(c,e,t,!0,i),Sx(c,e,t,!1,i))}function Sx(c,e,t,i,l){let d=c.textNode||(i?c.nodeBefore:c.nodeAfter),p=null;for(;d&&d.getAttribute(e)==t;)p=d,d=i?d.previousSibling:d.nextSibling;return p?l.createPositionAt(p,i?"before":"after"):c}function*Dx(c,e){for(const t of e)t&&c.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}class IL extends nt{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,i=t.document.selection,l=t.schema,d=i.isCollapsed,p=i.getFirstRange(),g=p.start.parent,b=p.end.parent;if(l.isLimit(g)||l.isLimit(b))return d||g!=b||t.deleteContent(i),!1;if(d){const w=Dx(e.model.schema,i.getAttributes());return Tx(e,p.start),e.setSelectionAttribute(w),!0}{const w=!(p.start.isAtStart&&p.end.isAtEnd),y=g==b;if(t.deleteContent(i,{leaveUnmerged:w}),w){if(y)return Tx(e,i.focus),!0;e.setSelection(b,0)}}return!1}}function Tx(c,e){c.split(e),c.setSelection(e.parent.nextSibling,0)}const ML={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Ix extends $o{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",(l,d)=>{i=d.shiftKey}),t.on("beforeinput",(l,d)=>{if(!this.isEnabled)return;let p=d.inputType;_.isSafari&&i&&p=="insertParagraph"&&(p="insertLineBreak");const g=d.domEvent,b=ML[p];if(!b)return;const w=new yc(t,"enter",d.targetRanges[0]);t.fire(w,new Cc(e,g,{isSoft:b.isSoft})),w.stop.called&&l.stop()})}observe(){}stopObserving(){}}class Sp extends pe{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(Ix),e.commands.add("enter",new IL(e)),this.listenTo(i,"enter",(l,d)=>{i.isComposing||d.preventDefault(),d.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class PL extends nt{execute(){const e=this.editor.model,t=e.document;e.change(i=>{(function(l,d,p){const g=p.isCollapsed,b=p.getFirstRange(),w=b.start.parent,y=b.end.parent,A=w==y;if(g){const E=Dx(l.schema,p.getAttributes());Mx(l,d,b.end),d.removeSelectionAttribute(p.getAttributeKeys()),d.setSelectionAttribute(E)}else{const E=!(b.start.isAtStart&&b.end.isAtEnd);l.deleteContent(p,{leaveUnmerged:E}),A?Mx(l,d,p.focus):E&&d.setSelection(y,0)}})(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(i,l){if(l.rangeCount>1)return!1;const d=l.anchor;if(!d||!i.checkChild(d,"softBreak"))return!1;const p=l.getFirstRange(),g=p.start.parent,b=p.end.parent;return!((gb(g,i)||gb(b,i))&&g!==b)}(e.schema,t.selection)}}function Mx(c,e,t){const i=e.createElement("softBreak");c.insertContent(i,t),e.setSelection(i,"after")}function gb(c,e){return!c.is("rootElement")&&(e.isLimit(c)||gb(c.parent,e))}class NL extends pe{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,l=e.editing.view,d=l.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(p,{writer:g})=>g.createEmptyElement("br")}),l.addObserver(Ix),e.commands.add("shiftEnter",new PL(e)),this.listenTo(d,"enter",(p,g)=>{d.isComposing||g.preventDefault(),g.isSoft&&(e.execute("shiftEnter"),l.scrollToTheSelection())},{priority:"low"})}}class OL extends ge(){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,l=i[0];this._insertDescriptor(e);const d=i[0];l===d||mb(l,d)||this.fire("change:top",{oldDescriptor:l,newDescriptor:d,writer:t})}remove(e,t){const i=this._stack,l=i[0];this._removeDescriptor(e);const d=i[0];l===d||mb(l,d)||this.fire("change:top",{oldDescriptor:l,newDescriptor:d,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(d=>d.id===e.id);if(mb(e,t[i]))return;i>-1&&t.splice(i,1);let l=0;for(;t[l]&&BL(t[l],e);)l++;t.splice(l,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(l=>l.id===e);i>-1&&t.splice(i,1)}}function mb(c,e){return c&&e&&c.priority==e.priority&&Dp(c.classes)==Dp(e.classes)}function BL(c,e){return c.priority>e.priority||!(c.priorityDp(e.classes)}function Dp(c){return Array.isArray(c)?c.sort().join(","):c}const RL='',LL="ck-widget",Px="ck-widget_selected";function An(c){return!!c.is("element")&&!!c.getCustomProperty("widget")}function kb(c,e,t={}){if(!c.is("containerElement"))throw new z("widget-to-widget-wrong-element-type",null,{element:c});return e.setAttribute("contenteditable","false",c),e.addClass(LL,c),e.setCustomProperty("widget",!0,c),c.getFillerOffset=FL,e.setCustomProperty("widgetLabel",[],c),t.label&&function(i,l){i.getCustomProperty("widgetLabel").push(l)}(c,t.label),t.hasSelectionHandle&&function(i,l){const d=l.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(p){const g=this.toDomElement(p),b=new ea;return b.set("content",RL),b.render(),g.appendChild(b.element),g});l.insert(l.createPositionAt(i,0),d),l.addClass(["ck-widget_with-selection-handle"],i)}(c,e),Nx(c,e),c}function jL(c,e,t){if(e.classes&&t.addClass(Sn(e.classes),c),e.attributes)for(const i in e.attributes)t.setAttribute(i,e.attributes[i],c)}function zL(c,e,t){if(e.classes&&t.removeClass(Sn(e.classes),c),e.attributes)for(const i in e.attributes)t.removeAttribute(i,c)}function Nx(c,e,t=jL,i=zL){const l=new OL;l.on("change:top",(d,p)=>{p.oldDescriptor&&i(c,p.oldDescriptor,p.writer),p.newDescriptor&&t(c,p.newDescriptor,p.writer)}),e.setCustomProperty("addHighlight",(d,p,g)=>l.add(p,g),c),e.setCustomProperty("removeHighlight",(d,p,g)=>l.remove(p,g),c)}function Ox(c,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],c),e.setAttribute("role","textbox",c),t.label&&e.setAttribute("aria-label",t.label,c),e.setAttribute("contenteditable",c.isReadOnly?"false":"true",c),c.on("change:isReadOnly",(i,l,d)=>{e.setAttribute("contenteditable",d?"false":"true",c)}),c.on("change:isFocused",(i,l,d)=>{d?e.addClass("ck-editor__nested-editable_focused",c):e.removeClass("ck-editor__nested-editable_focused",c)}),Nx(c,e),c}function Bx(c,e){const t=c.getSelectedElement();if(t){const i=us(c);if(i)return e.createRange(e.createPositionAt(t,i))}return n1(c,e)}function FL(){return null}const wi="widget-type-around";function ha(c,e,t){return!!c&&An(c)&&!t.isInline(e)}function us(c){return c.getAttribute(wi)}var Rx=a(4921),UL={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Rx.Z,UL),Rx.Z.locals;const Lx=["before","after"],VL=new DOMParser().parseFromString('',"image/svg+xml").firstChild,jx="ck-widget__type-around_disabled";class HL extends pe{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Sp,bi]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,l,d)=>{t.change(p=>{for(const g of t.document.roots)d?p.removeClass(jx,g):p.addClass(jx,g)}),d||e.model.change(p=>{p.removeSelectionAttribute(wi)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,l=i.editing.view,d=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:d}),l.focus(),l.scrollToTheSelection()}_listenToIfEnabled(e,t,i,l){this.listenTo(e,t,(...d)=>{this.isEnabled&&i(...d)},l)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=us(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,l={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(d,p,g)=>{const b=g.mapper.toViewElement(p.item);b&&ha(b,p.item,t)&&(function(w,y,A){const E=w.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(D){const M=this.toDomElement(D);return function(R,U){for(const W of Lx){const J=new ho({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${W}`],title:U[W],"aria-hidden":"true"},children:[R.ownerDocument.importNode(VL,!0)]});R.appendChild(J.render())}}(M,y),function(R){const U=new ho({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});R.appendChild(U.render())}(M),M});w.insert(w.createPositionAt(A,"end"),E)}(g.writer,l,b),b.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,l=t.schema,d=e.editing.view;function p(g){return`ck-widget_type-around_show-fake-caret_${g}`}this._listenToIfEnabled(d.document,"arrowKey",(g,b)=>{this._handleArrowKeyPress(g,b)},{context:[An,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(g,b)=>{b.directChange&&e.model.change(w=>{w.removeSelectionAttribute(wi)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const g=i.getSelectedElement();g&&ha(e.editing.mapper.toViewElement(g),g,l)||e.model.change(b=>{b.removeSelectionAttribute(wi)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(g,b,w)=>{const y=w.writer;if(this._currentFakeCaretModelElement){const M=w.mapper.toViewElement(this._currentFakeCaretModelElement);M&&(y.removeClass(Lx.map(p),M),this._currentFakeCaretModelElement=null)}const A=b.selection.getSelectedElement();if(!A)return;const E=w.mapper.toViewElement(A);if(!ha(E,A,l))return;const D=us(b.selection);D&&(y.addClass(p(D),E),this._currentFakeCaretModelElement=A)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(g,b,w)=>{w||e.model.change(y=>{y.removeSelectionAttribute(wi)})})}_handleArrowKeyPress(e,t){const i=this.editor,l=i.model,d=l.document.selection,p=l.schema,g=i.editing.view,b=function(A,E){const D=sk(A,E);return D==="down"||D==="right"}(t.keyCode,i.locale.contentLanguageDirection),w=g.document.selection.getSelectedElement();let y;ha(w,i.editing.mapper.toModelElement(w),p)?y=this._handleArrowKeyPressOnSelectedWidget(b):d.isCollapsed?y=this._handleArrowKeyPressWhenSelectionNextToAWidget(b):t.shiftKey||(y=this._handleArrowKeyPressWhenNonCollapsedSelection(b)),y&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=us(t.document.selection);return t.change(l=>i?i!==(e?"after":"before")?(l.removeSelectionAttribute(wi),!0):!1:(l.setSelectionAttribute(wi,e?"after":"before"),!0))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,l=i.schema,d=t.plugins.get("Widget"),p=d._getObjectElementNextToSelection(e);return!!ha(t.editing.mapper.toViewElement(p),p,l)&&(i.change(g=>{d._setSelectionOverElement(p),g.setSelectionAttribute(wi,e?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,l=i.schema,d=t.editing.mapper,p=i.document.selection,g=e?p.getLastPosition().nodeBefore:p.getFirstPosition().nodeAfter;return!!ha(d.toViewElement(g),g,l)&&(i.change(b=>{b.setSelection(g,"on"),b.setSelectionAttribute(wi,e?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,l)=>{const d=l.domTarget.closest(".ck-widget__type-around__button");if(!d)return;const p=function(w){return w.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(d),g=function(w,y){const A=w.closest(".ck-widget");return y.mapDomToView(A)}(d,t.domConverter),b=e.editing.mapper.toModelElement(g);this._insertParagraph(b,p),l.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(l,d)=>{if(l.eventPhase!="atTarget")return;const p=t.getSelectedElement(),g=e.editing.mapper.toViewElement(p),b=e.model.schema;let w;this._insertParagraphAccordingToFakeCaretPosition()?w=!0:ha(g,p,b)&&(this._insertParagraph(p,d.isSoft?"before":"after"),w=!0),w&&(d.preventDefault(),l.stop())},{context:An})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,i)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(i.selection=e.selection)},{priority:"high"}),_.isAndroid?this._listenToIfEnabled(e,"keydown",(t,i)=>{i.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,l=i.schema;this._listenToIfEnabled(t.document,"delete",(d,p)=>{if(d.eventPhase!="atTarget")return;const g=us(i.document.selection);if(!g)return;const b=p.direction,w=i.document.selection.getSelectedElement(),y=b=="forward";if(g==="before"===y)e.execute("delete",{selection:i.createSelection(w,"on")});else{const A=l.getNearestSelectionRange(i.createPositionAt(w,g),b);if(A)if(A.isCollapsed){const E=i.createSelection(A.start);if(i.modifySelection(E,{direction:b}),E.focus.isEqual(A.start)){const D=function(M,R){let U=R;for(const W of R.getAncestors({parentFirst:!0})){if(W.childCount>1||M.isLimit(W))break;U=W}return U}(l,A.start.parent);i.deleteContent(i.createSelection(D,"on"),{doNotAutoparagraph:!0})}else i.change(D=>{D.setSelection(A),e.execute(y?"deleteForward":"delete")})}else i.change(E=>{E.setSelection(A),e.execute(y?"deleteForward":"delete")})}p.preventDefault(),d.stop()},{context:An})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(l,[d,p])=>{if(p&&!p.is("documentSelection"))return;const g=us(i);return g?(l.stop(),t.change(b=>{const w=i.getSelectedElement(),y=t.createPositionAt(w,g),A=b.createSelection(y),E=t.insertContent(d,A);return b.setSelection(A),E})):void 0},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(i,l)=>{const[,d,p={}]=l;if(d&&!d.is("documentSelection"))return;const g=us(t);g&&(p.findOptimalPosition=g,l[3]=p)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(i,[l])=>{l&&!l.is("documentSelection")||us(t)&&i.stop()},{priority:"high"})}}function WL(c){const e=c.model;return(t,i)=>{const l=i.keyCode==dt.arrowup,d=i.keyCode==dt.arrowdown,p=i.shiftKey,g=e.document.selection;if(!l&&!d)return;const b=d;if(p&&function(y,A){return!y.isCollapsed&&y.isBackward==A}(g,b))return;const w=function(y,A,E){const D=y.model;if(E){const M=A.isCollapsed?A.focus:A.getLastPosition(),R=zx(D,M,"forward");if(!R)return null;const U=D.createRange(M,R),W=Fx(D.schema,U,"backward");return W?D.createRange(M,W):null}{const M=A.isCollapsed?A.focus:A.getFirstPosition(),R=zx(D,M,"backward");if(!R)return null;const U=D.createRange(R,M),W=Fx(D.schema,U,"forward");return W?D.createRange(W,M):null}}(c,g,b);if(w){if(w.isCollapsed&&(g.isCollapsed||p))return;(w.isCollapsed||function(y,A,E){const D=y.model,M=y.view.domConverter;if(E){const ie=D.createSelection(A.start);D.modifySelection(ie),ie.focus.isAtEnd||A.start.isEqual(ie.focus)||(A=D.createRange(ie.focus,A.end))}const R=y.mapper.toViewRange(A),U=M.viewRangeToDom(R),W=ft.getDomRangeRects(U);let J;for(const ie of W)if(J!==void 0){if(Math.round(ie.top)>=J)return!1;J=Math.max(J,Math.round(ie.bottom))}else J=Math.round(ie.bottom);return!0}(c,w,b))&&(e.change(y=>{const A=b?w.end:w.start;if(p){const E=e.createSelection(g.anchor);E.setFocus(A),y.setSelection(E)}else y.setSelection(A)}),t.stop(),i.preventDefault(),i.stopPropagation())}}}function zx(c,e,t){const i=c.schema,l=c.createRangeIn(e.root),d=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:p,item:g,type:b}of l.getWalker({startPosition:e,direction:t})){if(i.isLimit(g)&&!i.isInline(g))return p;if(b==d&&i.isBlock(g))return null}return null}function Fx(c,e,t){const i=t=="backward"?e.end:e.start;if(c.checkChild(i,"$text"))return i;for(const{nextPosition:l}of e.getWalker({direction:t}))if(c.checkChild(l,"$text"))return l;return null}var Ux=a(3488),$L={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Ux.Z,$L),Ux.Z.locals;class Ru extends pe{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[HL,bi]}init(){const e=this.editor,t=e.editing.view,i=t.document;this.editor.editing.downcastDispatcher.on("selection",(l,d,p)=>{const g=p.writer,b=d.selection;if(b.isCollapsed)return;const w=b.getSelectedElement();if(!w)return;const y=e.editing.mapper.toViewElement(w);var A;An(y)&&p.consumable.consume(b,"selection")&&g.setSelection(g.createRangeOn(y),{fake:!0,label:(A=y,A.getCustomProperty("widgetLabel").reduce((E,D)=>typeof D=="function"?E?E+". "+D():D():E?E+". "+D:D,""))})}),this.editor.editing.downcastDispatcher.on("selection",(l,d,p)=>{this._clearPreviouslySelectedWidgets(p.writer);const g=p.writer,b=g.document.selection;let w=null;for(const y of b.getRanges())for(const A of y){const E=A.item;An(E)&&!YL(E,w)&&(g.addClass(Px,E),this._previouslySelected.add(E),w=E)}},{priority:"low"}),t.addObserver(Kk),this.listenTo(i,"mousedown",(...l)=>this._onMousedown(...l)),this.listenTo(i,"arrowKey",(...l)=>{this._handleSelectionChangeOnArrowKeyPress(...l)},{context:[An,"$text"]}),this.listenTo(i,"arrowKey",(...l)=>{this._preventDefaultOnArrowKeyPress(...l)},{context:"$root"}),this.listenTo(i,"arrowKey",WL(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(l,d)=>{this._handleDelete(d.direction=="forward")&&(d.preventDefault(),l.stop())},{context:"$root"})}_onMousedown(e,t){const i=this.editor,l=i.editing.view,d=l.document;let p=t.target;if(function(b){let w=b;for(;w;){if(w.is("editableElement")&&!w.is("rootElement"))return!0;if(An(w))return!1;w=w.parent}return!1}(p)){if((_.isSafari||_.isGecko)&&t.domEvent.detail>=3){const b=i.editing.mapper,w=p.is("attributeElement")?p.findAncestor(A=>!A.is("attributeElement")):p,y=b.toModelElement(w);t.preventDefault(),this.editor.model.change(A=>{A.setSelection(y,"in")})}return}if(!An(p)&&(p=p.findAncestor(An),!p))return;_.isAndroid&&t.preventDefault(),d.isFocused||l.focus();const g=i.editing.mapper.toModelElement(p);this._setSelectionOverElement(g)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,l=this.editor.model,d=l.schema,p=l.document.selection,g=p.getSelectedElement(),b=sk(i,this.editor.locale.contentLanguageDirection),w=b=="down"||b=="right",y=b=="up"||b=="down";if(g&&d.isObject(g)){const E=w?p.getLastPosition():p.getFirstPosition(),D=d.getNearestSelectionRange(E,w?"forward":"backward");return void(D&&(l.change(M=>{M.setSelection(D)}),t.preventDefault(),e.stop()))}if(!p.isCollapsed&&!t.shiftKey){const E=p.getFirstPosition(),D=p.getLastPosition(),M=E.nodeAfter,R=D.nodeBefore;return void((M&&d.isObject(M)||R&&d.isObject(R))&&(l.change(U=>{U.setSelection(w?D:E)}),t.preventDefault(),e.stop()))}if(!p.isCollapsed)return;const A=this._getObjectElementNextToSelection(w);if(A&&d.isObject(A)){if(d.isInline(A)&&y)return;this._setSelectionOverElement(A),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,l=i.schema,d=i.document.selection.getSelectedElement();d&&l.isObject(d)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t)||!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change(l=>{let d=t.anchor.parent;for(;d.isEmpty;){const p=d;d=p.parent,l.remove(p)}this._setSelectionOverElement(i)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,l=t.document.selection,d=t.createSelection(l);if(t.modifySelection(d,{direction:e?"forward":"backward"}),d.isEqual(l))return null;const p=e?d.focus.nodeBefore:d.focus.nodeAfter;return p&&i.isObject(p)?p:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Px,t);this._previouslySelected.clear()}}function YL(c,e){return!!e&&Array.from(c.getAncestors()).includes(e)}class Tp extends pe{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[yp]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",i=>{(function(l){const d=l.getSelectedElement();return!(!d||!An(d))})(e.editing.view.document.selection)&&i.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:l,balloonClassName:d="ck-toolbar-container"}){if(!i.length)return void te("widget-toolbar-no-items",{toolbarId:e});const p=this.editor,g=p.t,b=new Qk(p.locale);if(b.ariaLabel=t||g("Widget toolbar"),this._toolbarDefinitions.has(e))throw new z("widget-toolbar-duplicated",this,{toolbarId:e});const w={view:b,getRelatedElement:l,balloonClassName:d,itemsConfig:i,initialized:!1};p.ui.addToolbar(b,{isContextual:!0,beforeFocus:()=>{const y=l(p.editing.view.document.selection);y&&this._showToolbar(w,y)},afterBlur:()=>{this._hideToolbar(w)}}),this._toolbarDefinitions.set(e,w)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const l of this._toolbarDefinitions.values()){const d=l.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&d)if(this.editor.ui.focusTracker.isFocused){const p=d.getAncestors().length;p>e&&(e=p,t=d,i=l)}else this._isToolbarVisible(l)&&this._hideToolbar(l);else this._isToolbarInBalloon(l)&&this._hideToolbar(l)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Vx(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Hx(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const i of this._toolbarDefinitions.values())if(this._isToolbarVisible(i)){const l=i.getRelatedElement(this.editor.editing.view.document.selection);Vx(this.editor,l)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Vx(c,e){const t=c.plugins.get("ContextualBalloon"),i=Hx(c,e);t.updatePosition(i)}function Hx(c,e){const t=c.editing.view,i=fr.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}var Wx=a(8506),qL={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Wx.Z,qL),Wx.Z.locals;const bb=pu("px");class KL extends Ke{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>bb(t)),top:e.to("top",t=>bb(t)),width:e.to("width",t=>bb(t))}}})}}class Ip extends pe{constructor(){super(...arguments),this.removeDropMarkerDelayed=ak(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=wp(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=wp(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new KL,this._domEmitter=new(Hr()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,l,d){this.removeDropMarkerDelayed.cancel();const p=$x(this.editor,e,t,i,l,d);p&&this._updateDropMarkerThrottled(p)}getFinalDropRange(e,t,i,l,d){const p=$x(this.editor,e,t,i,l,d);return this.removeDropMarker(),p}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(l=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||l.updateMarker("drop-target",{range:e}):l.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){const i=this.toDomElement(t);return i.append("",t.createElement("span"),""),i})}_updateDropTargetLine(e){const t=this.editor.editing,i=e.start.nodeBefore,l=e.start.nodeAfter,d=e.start.parent,p=i?t.mapper.toViewElement(i):null,g=p?t.view.domConverter.mapViewToDom(p):null,b=l?t.mapper.toViewElement(l):null,w=b?t.view.domConverter.mapViewToDom(b):null,y=t.mapper.toViewElement(d),A=t.view.domConverter.mapViewToDom(y),E=this._getScrollableRect(y),{scrollX:D,scrollY:M}=Oe.window,R=g?new ft(g):null,U=w?new ft(w):null,W=new ft(A).excludeScrollbarsAndBorders(),J=R?R.bottom:W.top,ie=U?U.top:W.bottom,ve=Oe.window.getComputedStyle(A),Be=J<=ie?(J+ie)/2:ie;if(E.topE.is("element")&&!GL(c,E));let y=0,A=w.length;if(A==0)return p.createRange(p.createPositionAt(b,"end"));for(;ye in c?QL(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;class tj extends pe{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(Hr())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,i,l)=>{l?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),_.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",(i,l)=>this._handleBlockDragStart(l)),this._domEmitter.listenTo(Oe.document,"dragover",(i,l)=>this._handleBlockDragging(l)),this._domEmitter.listenTo(Oe.document,"drop",(i,l)=>this._handleBlockDragging(l)),this._domEmitter.listenTo(Oe.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",(i,l,d)=>{t.setAttribute("draggable",d?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,l=this.editor.editing.view,d=Array.from(i.getSelectedBlocks()),p=t.createRange(t.createPositionBefore(d[0]),t.createPositionAfter(d[d.length-1]));t.change(g=>g.setSelection(p)),this._isBlockDragging=!0,l.focus(),l.getObserver(Ou).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),i=e.clientY,l=document.elementFromPoint(t,i),d=this.editor.editing.view;var p,g;l&&l.closest(".ck-editor__editable")&&d.getObserver(Ou).onDomEvent((p=((b,w)=>{for(var y in w||(w={}))XL.call(w,y)&&Gx(b,y,w[y]);if(Kx)for(var y of Kx(w))ej.call(w,y)&&Gx(b,y,w[y]);return b})({},e),g={type:e.type,dataTransfer:e.dataTransfer,target:l,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()},ZL(p,JL(g))))}_handleBlockDragEnd(){this._isBlockDragging=!1}}var Qx=a(903),nj={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(Qx.Z,nj),Qx.Z.locals;class rj extends pe{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=ak(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(Hr())}static get pluginName(){return"DragDrop"}static get requires(){return[Ko,Ru,Ip,tj]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(Ou),t.addObserver(Kk),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(i,l,d)=>{d?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(i,l,d)=>{d||this._finalizeDragging(!1)}),_.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=e.editing.view,l=i.document,d=e.plugins.get(Ip);this.listenTo(l,"dragstart",(p,g)=>{if(g.target&&g.target.is("editableElement")||(this._prepareDraggedRange(g.target),!this._draggedRange))return void g.preventDefault();this._draggingUid=V(),g.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",g.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const b=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(g.dataTransfer,b,"dragstart");const{dataTransfer:w,domTarget:y,domEvent:A}=g,{clientX:E}=A;this._updatePreview({dataTransfer:w,domTarget:y,clientX:E}),g.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(l,"dragend",(p,g)=>{this._finalizeDragging(!g.dataTransfer.isCanceled&&g.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(Oe.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(l,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(l,"dragleave",()=>{d.removeDropMarkerDelayed()}),this.listenTo(l,"dragging",(p,g)=>{if(!this.isEnabled)return void(g.dataTransfer.dropEffect="none");const{clientX:b,clientY:w}=g.domEvent;d.updateDropMarker(g.target,g.targetRanges,b,w,this._blockMode),this._draggedRange||(g.dataTransfer.dropEffect="copy"),_.isGecko||(g.dataTransfer.effectAllowed=="copy"?g.dataTransfer.dropEffect="copy":["all","copyMove"].includes(g.dataTransfer.effectAllowed)&&(g.dataTransfer.dropEffect="move")),p.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get(Ip);this.listenTo(t,"clipboardInput",(l,d)=>{if(d.method!="drop")return;const{clientX:p,clientY:g}=d.domEvent,b=i.getFinalDropRange(d.target,d.targetRanges,p,g,this._blockMode);if(!b)return this._finalizeDragging(!1),void l.stop();if(this._draggedRange&&this._draggingUid!=d.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),Zx(d.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(b,!0))return this._finalizeDragging(!1),void l.stop();d.targetRanges=[e.editing.mapper.toViewRange(b)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Ko);e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const l=i.targetRanges.map(d=>this.editor.editing.mapper.toModelRange(d));this.editor.model.change(d=>d.setSelection(l))},{priority:"high"}),e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const l=Zx(i.dataTransfer)=="move",d=!i.resultRange||!i.resultRange.isCollapsed;this._finalizeDragging(d&&l)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(l,d)=>{if(_.isAndroid||!d)return;this._clearDraggableAttributesDelayed.cancel();let p=Jx(d.target);if(_.isBlink&&!e.isReadOnly&&!p&&!i.selection.isCollapsed){const g=i.selection.getSelectedElement();g&&An(g)||(p=i.selection.editableElement)}p&&(t.change(g=>{g.setAttribute("draggable","true",p)}),this._draggableElement=e.editing.mapper.toModelElement(p))}),this.listenTo(i,"mouseup",()=>{_.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,i=t.model;t.plugins.get(Ip).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change(l=>{const d=i.createSelection(this._draggedRange);i.deleteContent(d,{doNotAutoparagraph:!0});const p=d.getFirstPosition().parent;p.isEmpty&&!i.schema.checkChild(p,"$text")&&i.schema.checkChild(p,"paragraph")&&l.insertElement("paragraph",p,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,i=t.model,l=i.document.selection,d=e?Jx(e):null;if(d){const w=t.editing.mapper.toModelElement(d);this._draggedRange=Sr.fromRange(i.createRangeOn(w)),this._blockMode=i.schema.isBlock(w),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(l.isCollapsed&&!l.getFirstPosition().parent.isEmpty)return;const p=Array.from(l.getSelectedBlocks()),g=l.getFirstRange();if(p.length==0)return void(this._draggedRange=Sr.fromRange(g));const b=Xx(i,p);if(p.length>1)this._draggedRange=Sr.fromRange(b),this._blockMode=!0;else if(p.length==1){const w=g.start.isTouching(b.start)&&g.end.isTouching(b.end);this._draggedRange=Sr.fromRange(w?b:g),this._blockMode=w}i.change(w=>w.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){const l=this.editor.editing.view,d=l.document.selection.editableElement,p=l.domConverter.mapViewToDom(d),g=Oe.window.getComputedStyle(p);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Oo(Oe.document,"div",{style:"position: fixed; left: -999999px;"}),Oe.document.body.appendChild(this._previewContainer));const b=new ft(p);if(p.contains(t))return;const w=parseFloat(g.paddingLeft),y=Oo(Oe.document,"div");y.className="ck ck-content",y.style.width=g.width,y.style.paddingLeft=`${b.left-i+w}px`,_.isiOS&&(y.style.backgroundColor="white"),y.innerHTML=e.getData("text/html"),e.setDragImage(y,0,0),this._previewContainer.appendChild(y)}}function Zx(c){return _.isGecko?c.dropEffect:["all","copyMove"].includes(c.effectAllowed)?"move":"copy"}function Jx(c){if(c.is("editableElement"))return null;if(c.hasClass("ck-widget__selection-handle"))return c.findAncestor(An);if(An(c))return c;const e=c.findAncestor(t=>An(t)||t.is("editableElement"));return An(e)?e:null}function Xx(c,e){const t=e[0],i=e[e.length-1],l=t.getCommonAncestor(i),d=c.createPositionBefore(t),p=c.createPositionAfter(i);if(l&&l.is("element")&&!c.schema.isLimit(l)){const g=c.createRangeOn(l),b=d.isTouching(g.start),w=p.isTouching(g.end);if(b&&w)return Xx(c,[l])}return c.createRange(d,p)}class oj extends pe{static get pluginName(){return"PastePlainText"}static get requires(){return[Ko]}init(){const e=this.editor,t=e.model,i=e.editing.view,l=i.document,d=t.document.selection;let p=!1;i.addObserver(Ou),this.listenTo(l,"keydown",(g,b)=>{p=b.shiftKey}),e.plugins.get(Ko).on("contentInsertion",(g,b)=>{(p||function(w,y){if(w.childCount>1)return!1;const A=w.getChild(0);return y.isObject(A)?!1:Array.from(A.getAttributeKeys()).length==0}(b.content,t.schema))&&t.change(w=>{const y=Array.from(d.getAttributes()).filter(([E])=>t.schema.getAttributeProperties(E).isFormatting);d.isCollapsed||t.deleteContent(d,{doNotAutoparagraph:!0}),y.push(...d.getAttributes());const A=w.createRangeIn(b.content);for(const E of A.getItems())E.is("$textProxy")&&w.setAttributes(y,E)})})}}class eE extends pe{static get pluginName(){return"Clipboard"}static get requires(){return[Ko,rj,oj]}}class ij extends nt{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!tE(e.schema,i))do if(i=i.parent,!i)return;while(!tE(e.schema,i));e.change(l=>{l.setSelection(i,"in")})}}function tE(c,e){return c.isLimit(e)&&(c.checkChild(e,"$text")||c.checkChild(e,"paragraph"))}const sj=gu("Ctrl+A");class aj extends pe{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new ij(e)),this.listenTo(t,"keydown",(i,l)=>{wc(l)===sj&&(e.execute("selectAll"),l.preventDefault())})}}class cj extends pe{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const i=e.commands.get("selectAll"),l=new zt(t),d=t.t;return l.set({label:d("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),l.bind("isEnabled").to(i,"isEnabled"),this.listenTo(l,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),l})}}class lj extends pe{static get requires(){return[aj,cj]}static get pluginName(){return"SelectAll"}}var uj=Object.defineProperty,nE=Object.getOwnPropertySymbols,dj=Object.prototype.hasOwnProperty,hj=Object.prototype.propertyIsEnumerable,rE=(c,e,t)=>e in c?uj(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;class oE extends nt{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,i)=>{i[1]=((d,p)=>{for(var g in p||(p={}))dj.call(p,g)&&rE(d,g,p[g]);if(nE)for(var g of nE(p))hj.call(p,g)&&rE(d,g,p[g]);return d})({},i[1]);const l=i[1];l.batchType||(l.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,i)=>{i[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const l=this.editor.model,d=l.document,p=[],g=e.map(w=>w.getTransformedByOperations(i)),b=g.flat();for(const w of g){const y=w.filter(A=>A.root!=d.graveyard).filter(A=>!fj(A,b));y.length&&(pj(y),p.push(y[0]))}p.length&&l.change(w=>{w.setSelection(p,{backward:t})})}_undo(e,t){const i=this.editor.model,l=i.document;this._createdBatches.add(t);const d=e.operations.slice().filter(p=>p.isDocumentOperation);d.reverse();for(const p of d){const g=p.baseVersion+1,b=Array.from(l.history.getOperations(g)),w=gB([p.getReversed()],b,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let y of w){const A=y.affectedSelectable;A&&!i.canEditAt(A)&&(y=new yn(y.baseVersion)),t.addOperation(y),i.applyOperation(y),l.history.setOperationAsUndone(p,y)}}}}function pj(c){c.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;et!==c&&t.containsRange(c,!0))}class gj extends oE{execute(e=null){const t=e?this._stack.findIndex(d=>d.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],l=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(l,()=>{this._undo(i.batch,l);const d=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,d)}),this.fire("revert",i.batch,l),this.refresh()}}class mj extends oE{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,l=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,l),this._undo(e.batch,t)}),this.refresh()}}class kj extends pe{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor;this._undoCommand=new gj(e),this._redoCommand=new mj(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(t,i)=>{const l=i[0];if(!l.isDocumentOperation)return;const d=l.batch,p=this._redoCommand.createdBatches.has(d),g=this._undoCommand.createdBatches.has(d);this._batchRegistry.has(d)||(this._batchRegistry.add(d),d.isUndoable&&(p?this._undoCommand.addBatch(d):g||(this._undoCommand.addBatch(d),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,i,l)=>{this._redoCommand.addBatch(l)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}const iE='',sE='';class bj extends pe{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,l=t.uiLanguageDirection=="ltr"?iE:sE,d=t.uiLanguageDirection=="ltr"?sE:iE;this._addButton("undo",i("Undo"),"CTRL+Z",l),this._addButton("redo",i("Redo"),"CTRL+Y",d)}_addButton(e,t,i,l){const d=this.editor;d.ui.componentFactory.add(e,p=>{const g=d.commands.get(e),b=new zt(p);return b.set({label:t,icon:l,keystroke:i,tooltip:!0}),b.bind("isEnabled").to(g,"isEnabled"),this.listenTo(b,"execute",()=>{d.execute(e),d.editing.view.focus()}),b})}}class aE extends pe{static get requires(){return[kj,bj]}static get pluginName(){return"Undo"}}class wj extends Ve(){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,l)=>{t.onload=()=>{const d=t.result;this._data=d,i(d)},t.onerror=()=>{l("error")},t.onabort=()=>{l("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}class bo extends pe{constructor(){super(...arguments),this.loaders=new lo,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[r1]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return te("filerepository-no-upload-adapter"),null;const t=new cE(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(i=>{this._loadersMap.set(i,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let i=0;for(const l of this.loaders)i+=l.uploaded;this.uploaded=i}),t.on("change:uploadTotal",()=>{let i=0;for(const l of this.loaders)l.uploadTotal&&(i+=l.uploadTotal);this.uploadTotal=i}),t}destroyLoader(e){const t=e instanceof cE?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((i,l)=>{i===t&&this._loadersMap.delete(l)})}_updatePendingAction(){const e=this.editor.plugins.get(r1);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=l=>`${t("Upload in progress")} ${parseInt(l)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}class cE extends Ve(){constructor(e,t){super(),this.id=V(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new wj,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(i,l)=>l?i/l*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new z("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new z("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,l)=>{t.rejecter=l,t.isFulfilled=!1,e.then(d=>{t.isFulfilled=!0,i(d)}).catch(d=>{t.isFulfilled=!0,l(d)})}),t}}class vj extends Ke{constructor(e){super(e),this.buttonView=new zt(e),this._fileInputView=new yj(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class yj extends Ke{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}const lE="ckCsrfToken",uE="abcdefghijklmnopqrstuvwxyz0123456789";function _j(){let c=function(i){i=i.toLowerCase();const l=document.cookie.split(";");for(const d of l){const p=d.split("=");if(decodeURIComponent(p[0].trim().toLowerCase())===i)return decodeURIComponent(p[1])}return null}(lE);var e,t;return c&&c.length==40||(c=function(i){let l="";const d=new Uint8Array(i);window.crypto.getRandomValues(d);for(let p=0;p.5?g.toUpperCase():g}return l}(40),e=lE,t=c,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/"),c}class Cj{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const l=this.xhr,d=this.loader,p=(0,this.t)("Cannot upload file:")+` ${i.name}.`;l.addEventListener("error",()=>t(p)),l.addEventListener("abort",()=>t()),l.addEventListener("load",()=>{const g=l.response;if(!g||!g.uploaded)return t(g&&g.error&&g.error.message?g.error.message:p);e({default:g.url})}),l.upload&&l.upload.addEventListener("progress",g=>{g.lengthComputable&&(d.uploadTotal=g.total,d.uploaded=g.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",_j()),this.xhr.send(t)}}function ds(c,e,t,i){let l,d=null;typeof i=="function"?l=i:(d=c.commands.get(i),l=()=>{c.execute(i)}),c.model.document.on("change:data",(p,g)=>{if(d&&!d.isEnabled||!e.isEnabled)return;const b=vn(c.model.document.selection.getRanges());if(!b.isCollapsed||g.isUndo||!g.isLocal)return;const w=Array.from(c.model.document.differ.getChanges()),y=w[0];if(w.length!=1||y.type!=="insert"||y.name!="$text"||y.length!=1)return;const A=y.position.parent;if(A.is("element","codeBlock")||A.is("element","listItem")&&typeof i!="function"&&!["numberedList","bulletedList","todoList"].includes(i)||d&&d.value===!0)return;const E=A.getChild(0),D=c.model.createRangeOn(E);if(!D.containsRange(b)&&!b.end.isEqual(D.end))return;const M=t.exec(E.data.substr(0,b.end.offset));M&&c.model.enqueueChange(R=>{const U=R.createPositionAt(A,0),W=R.createPositionAt(A,M[0].length),J=new Sr(U,W);if(l({match:M})!==!1){R.remove(J);const ie=c.model.document.selection.getFirstRange(),ve=R.createRangeIn(A);!A.isEmpty||ve.isEqual(ie)||ve.containsRange(ie,!0)||R.remove(A)}J.detach(),c.model.enqueueChange(()=>{c.plugins.get("Delete").requestUndoOnBackspace()})})})}function Pc(c,e,t,i){let l,d;t instanceof RegExp?l=t:d=t,d=d||(p=>{let g;const b=[],w=[];for(;(g=l.exec(p))!==null&&!(g&&g.length<4);){let{index:y,1:A,2:E,3:D}=g;const M=A+E+D;y+=g[0].length-M.length;const R=[y,y+A.length],U=[y+A.length+E.length,y+A.length+E.length+D.length];b.push(R),b.push(U),w.push([y+A.length,y+A.length+E.length])}return{remove:b,format:w}}),c.model.document.on("change:data",(p,g)=>{if(g.isUndo||!g.isLocal||!e.isEnabled)return;const b=c.model,w=b.document.selection;if(!w.isCollapsed)return;const y=Array.from(b.document.differ.getChanges()),A=y[0];if(y.length!=1||A.type!=="insert"||A.name!="$text"||A.length!=1)return;const E=w.focus,D=E.parent,{text:M,range:R}=function(ie,ve){let Be=ie.start;return{text:Array.from(ie.getItems()).reduce((at,rn)=>!rn.is("$text")&&!rn.is("$textProxy")||rn.getAttribute("code")?(Be=ve.createPositionAfter(rn),""):at+rn.data,""),range:ve.createRange(Be,ie.end)}}(b.createRange(b.createPositionAt(D,0),E),b),U=d(M),W=dE(R.start,U.format,b),J=dE(R.start,U.remove,b);W.length&&J.length&&b.enqueueChange(ie=>{if(i(ie,W)!==!1){for(const ve of J.reverse())ie.remove(ve);b.enqueueChange(()=>{c.plugins.get("Delete").requestUndoOnBackspace()})}})})}function dE(c,e,t){return e.filter(i=>i[0]!==void 0&&i[1]!==void 0).map(i=>t.createRange(c.getShiftedBy(i[0]),c.getShiftedBy(i[1])))}function Pp(c,e){return(t,i)=>{if(!c.commands.get(e).isEnabled)return!1;const l=c.model.schema.getValidRanges(i,e);for(const d of l)t.setAttribute(e,!0,d);t.removeSelectionAttribute(e)}}class hE extends nt{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,l=e.forceValue===void 0?!this.value:e.forceValue;t.change(d=>{if(i.isCollapsed)l?d.setSelectionAttribute(this.attributeKey,!0):d.removeSelectionAttribute(this.attributeKey);else{const p=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const g of p)l?d.setAttribute(this.attributeKey,l,g):d.removeAttribute(this.attributeKey,g)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const l of i.getRanges())for(const d of l.getItems())if(t.checkAttribute(d,this.attributeKey))return d.hasAttribute(this.attributeKey);return!1}}const Nc="bold";class Aj extends pe{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Nc}),e.model.schema.setAttributeProperties(Nc,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Nc,view:"strong",upcastAlso:["b",t=>{const i=t.getStyle("font-weight");return i&&(i=="bold"||Number(i)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Nc,new hE(e,Nc)),e.keystrokes.set("CTRL+B",Nc)}}const wb="bold";class xj extends pe{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(wb,i=>{const l=e.commands.get(wb),d=new zt(i);return d.set({label:t("Bold"),icon:Wt.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),d.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(d,"execute",()=>{e.execute(wb),e.editing.view.focus()}),d})}}var pE=a(8603),Ej={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(pE.Z,Ej),pE.Z.locals;const Oc="italic";class Sj extends pe{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Oc}),e.model.schema.setAttributeProperties(Oc,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Oc,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Oc,new hE(e,Oc)),e.keystrokes.set("CTRL+I",Oc)}}const vb="italic";class Dj extends pe{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(vb,i=>{const l=e.commands.get(vb),d=new zt(i);return d.set({label:t("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),d.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(d,"execute",()=>{e.execute(vb),e.editing.view.focus()}),d})}}class Tj extends nt{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,l=t.document.selection,d=Array.from(l.getSelectedBlocks()),p=e.forceValue===void 0?!this.value:e.forceValue;t.change(g=>{if(p){const b=d.filter(w=>Np(w)||gE(i,w));this._applyQuote(g,b)}else this._removeQuote(g,d.filter(Np))})}_getValue(){const e=vn(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Np(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=vn(e.getSelectedBlocks());return!!i&&gE(t,i)}_removeQuote(e,t){fE(e,t).reverse().forEach(i=>{if(i.start.isAtStart&&i.end.isAtEnd)return void e.unwrap(i.start.parent);if(i.start.isAtStart){const d=e.createPositionBefore(i.start.parent);return void e.move(i,d)}i.end.isAtEnd||e.split(i.end);const l=e.createPositionAfter(i.end.parent);e.move(i,l)})}_applyQuote(e,t){const i=[];fE(e,t).reverse().forEach(l=>{let d=Np(l.start);d||(d=e.createElement("blockQuote"),e.wrap(l,d)),i.push(d)}),i.reverse().reduce((l,d)=>l.nextSibling==d?(e.merge(e.createPositionAfter(l)),l):d)}}function Np(c){return c.parent.name=="blockQuote"?c.parent:null}function fE(c,e){let t,i=0;const l=[];for(;i{const g=e.model.document.differ.getChanges();for(const b of g)if(b.type=="insert"){const w=b.position.nodeAfter;if(!w)continue;if(w.is("element","blockQuote")&&w.isEmpty)return p.remove(w),!0;if(w.is("element","blockQuote")&&!t.checkChild(b.position,w))return p.unwrap(w),!0;if(w.is("element")){const y=p.createRangeIn(w);for(const A of y.getItems())if(A.is("element","blockQuote")&&!t.checkChild(p.createPositionBefore(A),A))return p.unwrap(A),!0}}else if(b.type=="remove"){const w=b.position.parent;if(w.is("element","blockQuote")&&w.isEmpty)return p.remove(w),!0}return!1});const i=this.editor.editing.view.document,l=e.model.document.selection,d=e.commands.get("blockQuote");this.listenTo(i,"enter",(p,g)=>{!l.isCollapsed||!d.value||l.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),g.preventDefault(),p.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(p,g)=>{if(g.direction!="backward"||!l.isCollapsed||!d.value)return;const b=l.getLastPosition().parent;b.isEmpty&&!b.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),g.preventDefault(),p.stop())},{context:"blockquote"})}}var mE=a(3062),Mj={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(mE.Z,Mj),mE.Z.locals;class Pj extends pe{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const l=e.commands.get("blockQuote"),d=new zt(i);return d.set({label:t("Block quote"),icon:Wt.quote,tooltip:!0,isToggleable:!0}),d.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(d,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),d})}}class Nj extends pe{static get pluginName(){return"CKBoxUI"}afterInit(){const e=this.editor,t=e.commands.get("ckbox");if(!t)return;const i=e.t;e.ui.componentFactory.add("ckbox",l=>{const d=new zt(l);return d.set({label:i("Open file manager"),icon:'',tooltip:!0}),d.bind("isOn","isEnabled").to(t,"value","isEnabled"),d.on("execute",()=>{e.execute("ckbox")}),d})}}function kE(c){const e=[];let t=0;for(const l in c){const d=parseInt(l,10);isNaN(d)||(d>t&&(t=d),e.push(`${c[l]} ${l}w`))}const i=[{srcset:e.join(","),sizes:`(max-width: ${t}px) 100vw, ${t}px`,type:"image/webp"}];return{imageFallbackUrl:c.default,imageSources:i}}class Oj extends nt{constructor(e){super(e),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return this._wrapper!==null}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox");return{theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,dialog:{onClose:()=>this.fire("ckbox:close")},assets:{onChoose:t=>this.fire("ckbox:choose",t)}}}_initListeners(){const e=this.editor,t=e.model,i=!e.config.get("ckbox.ignoreDataId");this.on("ckbox",()=>{this.refresh()},{priority:"low"}),this.on("ckbox:open",()=>{this.isEnabled&&!this.value&&(this._wrapper=Oo(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))}),this.on("ckbox:close",()=>{this.value&&(this._wrapper.remove(),this._wrapper=null)}),this.on("ckbox:choose",(l,d)=>{if(!this.isEnabled)return;const p=e.commands.get("insertImage"),g=e.commands.get("link"),b=function({assets:w,isImageAllowed:y,isLinkAllowed:A}){return w.map(E=>function(D){const M=D.data.metadata;return M?M.width&&M.height:!1}(E)?{id:E.data.id,type:"image",attributes:Bj(E)}:{id:E.data.id,type:"link",attributes:Rj(E)}).filter(E=>E.type==="image"?y:A)}({assets:d,isImageAllowed:p.isEnabled,isLinkAllowed:g.isEnabled});b.length!==0&&t.change(w=>{for(const y of b){const A=y===b[b.length-1];this._insertAsset(y,A,w),i&&(setTimeout(()=>this._chosenAssets.delete(y),1e3),this._chosenAssets.add(y))}})}),this.listenTo(e,"destroy",()=>{this.fire("ckbox:close"),this._chosenAssets.clear()})}_insertAsset(e,t,i){const l=this.editor.model.document.selection;i.removeSelectionAttribute("linkHref"),e.type==="image"?this._insertImage(e):this._insertLink(e,i),t||i.setSelection(l.getLastPosition())}_insertImage(e){const t=this.editor,{imageFallbackUrl:i,imageSources:l,imageTextAlternative:d}=e.attributes;t.execute("insertImage",{source:{src:i,sources:l,alt:d}})}_insertLink(e,t){const i=this.editor,l=i.model,d=l.document.selection,{linkName:p,linkHref:g}=e.attributes;if(d.isCollapsed){const b=Ho(d.getAttributes()),w=t.createText(p,b),y=l.insertContent(w);t.setSelection(y)}i.execute("link",g)}}function Bj(c){const{imageFallbackUrl:e,imageSources:t}=kE(c.data.imageUrls);return{imageFallbackUrl:e,imageSources:t,imageTextAlternative:c.data.metadata.description||""}}function Rj(c){return{linkName:c.data.name,linkHref:Lj(c)}}function Lj(c){const e=new URL(c.data.url);return e.searchParams.set("download","true"),e.toString()}var pa=(c,e,t)=>new Promise((i,l)=>{var d=b=>{try{g(t.next(b))}catch(w){l(w)}},p=b=>{try{g(t.throw(b))}catch(w){l(w)}},g=b=>b.done?i(b.value):Promise.resolve(b.value).then(d,p);g((t=t.apply(c,e)).next())});class jj extends pe{static get requires(){return["ImageUploadEditing","ImageUploadProgress",bo,yb]}static get pluginName(){return"CKBoxUploadAdapter"}afterInit(){return pa(this,null,function*(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;const l=e.plugins.get(bo),d=e.plugins.get(yb);l.createUploadAdapter=b=>new zj(b,d.getToken(),e);const p=!e.config.get("ckbox.ignoreDataId"),g=e.plugins.get("ImageUploadEditing");p&&g.on("uploadComplete",(b,{imageElement:w,data:y})=>{e.model.change(A=>{A.setAttribute("ckboxImageId",y.ckboxImageId,w)})})})}}class zj{constructor(e,t,i){this.loader=e,this.token=t,this.editor=i,this.controller=new AbortController,this.serviceOrigin=i.config.get("ckbox.serviceOrigin")}getWorkspaceId(){const e=(0,this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),i=function(l,d){const[,p]=l.value.split("."),g=JSON.parse(atob(p)),b=g.auth&&g.auth.ckbox&&g.auth.ckbox.workspaces||[g.aud];return d?(g.auth&&g.auth.ckbox&&g.auth.ckbox.role)=="superadmin"||b.includes(d)?d:null:b[0]}(this.token,t);if(i==null)throw ae("ckbox-access-default-workspace-error"),e;return i}getAvailableCategories(e=0){return pa(this,null,function*(){const t=new URL("categories",this.serviceOrigin);return t.searchParams.set("limit",50 .toString()),t.searchParams.set("offset",e.toString()),t.searchParams.set("workspaceId",this.getWorkspaceId()),this._sendHttpRequest({url:t}).then(i=>pa(this,null,function*(){if(i.totalCount-(e+50)>0){const l=yield this.getAvailableCategories(e+50);return[...i.items,...l]}return i.items})).catch(()=>{this.controller.signal.throwIfAborted(),ae("ckbox-fetch-category-http-error")})})}getCategoryIdForFile(e){return pa(this,null,function*(){const t=function(p){const g=new RegExp("\\.(?[^.]+)$");return p.match(g).groups.ext.toLowerCase()}(e.name),i=yield this.getAvailableCategories();if(!i)return null;const l=this.editor.config.get("ckbox.defaultUploadCategories");if(l){const p=Object.keys(l).find(g=>l[g].find(b=>b.toLowerCase()==t));if(p){const g=i.find(b=>b.id===p||b.name===p);return g?g.id:null}}const d=i.find(p=>p.extensions.find(g=>g.toLowerCase()==t));return d?d.id:null})}upload(){return pa(this,null,function*(){const e=this.editor.t,t=e("Cannot determine a category for the uploaded file."),i=yield this.loader.file,l=yield this.getCategoryIdForFile(i);if(!l)return Promise.reject(t);const d=new URL("assets",this.serviceOrigin),p=new FormData;d.searchParams.set("workspaceId",this.getWorkspaceId()),p.append("categoryId",l),p.append("file",i);const g={method:"POST",url:d,data:p,onUploadProgress:b=>{b.lengthComputable&&(this.loader.uploadTotal=b.total,this.loader.uploaded=b.loaded)}};return this._sendHttpRequest(g).then(b=>pa(this,null,function*(){const w=kE(b.imageUrls);return{ckboxImageId:b.id,default:w.imageFallbackUrl,sources:w.imageSources}})).catch(()=>{const b=e("Cannot upload file:")+` ${i.name}.`;return Promise.reject(b)})})}abort(){this.controller.abort()}_sendHttpRequest({url:e,method:t="GET",data:i,onUploadProgress:l}){const d=this.controller.signal,p=new XMLHttpRequest;p.open(t,e.toString(),!0),p.setRequestHeader("Authorization",this.token.value),p.setRequestHeader("CKBox-Version","CKEditor 5"),p.responseType="json";const g=()=>{p.abort()};return new Promise((b,w)=>{d.addEventListener("abort",g),p.addEventListener("loadstart",()=>{d.addEventListener("abort",g)}),p.addEventListener("loadend",()=>{d.removeEventListener("abort",g)}),p.addEventListener("error",()=>{w()}),p.addEventListener("abort",()=>{w()}),p.addEventListener("load",()=>pa(this,null,function*(){const y=p.response;return!y||y.statusCode>=400?w(y&&y.message):b(y)})),l&&p.upload.addEventListener("progress",y=>{l(y)}),p.send(i)})}}class yb extends pe{static get pluginName(){return"CKBoxEditing"}static get requires(){return["CloudServices","LinkEditing","PictureEditing",jj]}init(){return e=this,t=null,i=function*(){const l=this.editor,d=!!l.config.get("ckbox"),p=!!window.CKBox;if(!d&&!p)return;this._initConfig();const g=l.plugins.get("CloudServicesCore"),b=l.config.get("ckbox.tokenUrl");if(b===l.config.get("cloudServices.tokenUrl")){const w=l.plugins.get("CloudServices");this._token=w.token}else this._token=yield g.createToken(b).init();l.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()),p&&l.commands.add("ckbox",new Oj(l))},new Promise((l,d)=>{var p=w=>{try{b(i.next(w))}catch(y){d(y)}},g=w=>{try{b(i.throw(w))}catch(y){d(y)}},b=w=>w.done?l(w.value):Promise.resolve(w.value).then(p,g);b((i=i.apply(e,t)).next())});var e,t,i}getToken(){return this._token}_initConfig(){const e=this.editor;if(e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:"default",tokenUrl:e.config.get("cloudServices.tokenUrl")}),!e.config.get("ckbox.tokenUrl"))throw new z("ckbox-plugin-missing-token-url",this);e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||ae("ckbox-plugin-image-feature-missing",e)}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck((t,i)=>{if(!t.last.getAttribute("linkHref")&&i==="ckboxLinkId")return!1})}_initConversion(){const e=this.editor;e.conversion.for("downcast").add(t=>{t.on("attribute:ckboxLinkId:imageBlock",(i,l,d)=>{const{writer:p,mapper:g,consumable:b}=d;if(!b.consume(l.item,i.name))return;const w=[...g.toViewElement(l.item).getChildren()].find(y=>y.name==="a");w&&(l.item.hasAttribute("ckboxLinkId")?p.setAttribute("data-ckbox-resource-id",l.item.getAttribute("ckboxLinkId"),w):p.removeAttribute("data-ckbox-resource-id",w))},{priority:"low"}),t.on("attribute:ckboxLinkId",(i,l,d)=>{const{writer:p,mapper:g,consumable:b}=d;if(b.consume(l.item,i.name)){if(l.attributeOldValue){const w=bE(p,l.attributeOldValue);p.unwrap(g.toViewRange(l.range),w)}if(l.attributeNewValue){const w=bE(p,l.attributeNewValue);if(l.item.is("selection")){const y=p.document.selection;p.wrap(y.getFirstRange(),w)}else p.wrap(g.toViewRange(l.range),w)}}},{priority:"low"})}),e.conversion.for("upcast").add(t=>{t.on("element:a",(i,l,d)=>{const{writer:p,consumable:g}=d;if(!l.viewItem.getAttribute("href")||!g.consume(l.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const b=l.viewItem.getAttribute("data-ckbox-resource-id");if(b)if(l.modelRange)for(let w of l.modelRange.getItems())w.is("$textProxy")&&(w=w.textNode),Uj(w)&&p.setAttribute("ckboxLinkId",b,w);else{const w=l.modelCursor.nodeBefore||l.modelCursor.parent;p.setAttribute("ckboxLinkId",b,w)}},{priority:"low"})}),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:t=>t.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}})}_initFixers(){const e=this.editor,t=e.model,i=t.document.selection;t.document.registerPostFixer(function(l){return d=>{let p=!1;const g=l.model,b=l.commands.get("ckbox");if(!b)return p;for(const w of g.document.differ.getChanges()){if(w.type!=="insert"&&w.type!=="attribute")continue;const y=w.type==="insert"?new oe(w.position,w.position.getShiftedBy(w.length)):w.range,A=w.type==="attribute"&&w.attributeKey==="linkHref"&&w.attributeNewValue===null;for(const E of y.getItems()){if(A&&E.hasAttribute("ckboxLinkId")){d.removeAttribute("ckboxLinkId",E),p=!0;continue}const D=Fj(E,b._chosenAssets);for(const M of D){const R=M.type==="image"?"ckboxImageId":"ckboxLinkId";M.id!==E.getAttribute(R)&&(d.setAttribute(R,M.id,E),p=!0)}}}return p}}(e)),t.document.registerPostFixer(function(l){return d=>!(l.hasAttribute("linkHref")||!l.hasAttribute("ckboxLinkId"))&&(d.removeSelectionAttribute("ckboxLinkId"),!0)}(i))}}function Fj(c,e){const t=c.is("element","imageInline")||c.is("element","imageBlock"),i=c.hasAttribute("linkHref");return[...e].filter(l=>l.type==="image"&&t?l.attributes.imageFallbackUrl===c.getAttribute("src"):l.type==="link"&&i?l.attributes.linkHref===c.getAttribute("linkHref"):void 0)}function bE(c,e){const t=c.createAttributeElement("a",{"data-ckbox-resource-id":e},{priority:5});return c.setCustomProperty("link",!0,t),t}function Uj(c){return!!c.is("$text")||!(!c.is("element","imageInline")&&!c.is("element","imageBlock"))}class Vj extends pe{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,t=e.ui.componentFactory,i=e.t;t.add("ckfinder",l=>{const d=e.commands.get("ckfinder"),p=new zt(l);return p.set({label:i("Insert image or file"),icon:'',tooltip:!0}),p.bind("isEnabled").to(d),p.on("execute",()=>{e.execute("ckfinder"),e.editing.view.focus()}),p})}}class Hj extends nt{constructor(e){super(e),this.affectsData=!1,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if(t!="popup"&&t!="modal")throw new z("ckfinder-unknown-openermethod",e);const i=this.editor.config.get("ckfinder.options")||{};i.chooseFiles=!0;const l=i.onInit;i.language||(i.language=e.locale.uiLanguage),i.onInit=d=>{l&&l(d),d.on("files:choose",p=>{const g=p.data.files.toArray(),b=g.filter(A=>!A.isImage()),w=g.filter(A=>A.isImage());for(const A of b)e.execute("link",A.getUrl());const y=[];for(const A of w){const E=A.getUrl();y.push(E||d.request("file:getProxyUrl",{file:A}))}y.length&&wE(e,y)}),d.on("file:choose:resizedImage",p=>{const g=p.data.resizedUrl;if(g)wE(e,[g]);else{const b=e.plugins.get("Notification"),w=e.locale.t;b.showWarning(w("Could not obtain resized image URL."),{title:w("Selecting resized image failed"),namespace:"ckfinder"})}})},window.CKFinder[t](i)}}function wE(c,e){if(c.commands.get("insertImage").isEnabled)c.execute("insertImage",{source:e});else{const t=c.plugins.get("Notification"),i=c.locale.t;t.showWarning(i("Could not insert image at the current position."),{title:i("Inserting image failed"),namespace:"ckfinder"})}}class Wj extends pe{static get pluginName(){return"CKFinderEditing"}static get requires(){return[lb,"LinkEditing"]}init(){const e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new z("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new Hj(e))}}class $j extends pe{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",bo]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),i=t.token,l=t.uploadUrl;if(!i)return;const d=e.plugins.get("CloudServicesCore");this._uploadGateway=d.createUploadGateway(i,l),e.plugins.get(bo).createUploadAdapter=p=>new Yj(this._uploadGateway,p)}}class Yj{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(t,i)=>{this.loader.uploadTotal=i.total,this.loader.uploaded=i.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}class qj extends nt{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=vn(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&vE(t,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,l=e.selection||i.selection;t.canEditAt(l)&&t.change(d=>{const p=l.getSelectedBlocks();for(const g of p)!g.is("element","paragraph")&&vE(g,t.schema)&&d.rename(g,"paragraph")})}}function vE(c,e){return e.checkChild(c.parent,"paragraph")&&!e.isObject(c)}class Kj extends nt{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let l=e.position;t.canEditAt(l)&&t.change(d=>{if(l=this._findPositionToInsertParagraph(l,d),!l)return;const p=d.createElement("paragraph");i&&t.schema.setAllowedAttributes(p,i,d),t.insertContent(p,l),d.setSelection(p,"in")})}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const l=i.schema.findAllowedParent(e,"paragraph");if(!l)return null;const d=e.parent,p=i.schema.checkChild(d,"$text");return d.isEmpty||p&&e.isAtEnd?i.createPositionAfter(d):!d.isEmpty&&p&&e.isAtStart?i.createPositionBefore(d):t.split(e,l).position}}const yE=class extends pe{static get pluginName(){return"Paragraph"}init(){const c=this.editor,e=c.model;c.commands.add("paragraph",new qj(c)),c.commands.add("insertParagraph",new Kj(c)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),c.conversion.elementToElement({model:"paragraph",view:"p"}),c.conversion.for("upcast").elementToElement({model:(t,{writer:i})=>yE.paragraphLikeElements.has(t.name)?t.isEmpty?null:i.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}};let _b=yE;_b.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class Gj extends nt{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=vn(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>_E(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,l=e.value;t.change(d=>{const p=Array.from(i.selection.getSelectedBlocks()).filter(g=>_E(g,l,t.schema));for(const g of p)g.is("element",l)||d.rename(g,l)})}}function _E(c,e,t){return t.checkChild(c.parent,e)&&!t.isObject(c)}const CE="paragraph";class Qj extends pe{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[_b]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const l of t)l.model!=="paragraph"&&(e.model.schema.register(l.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(l),i.push(l.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new Gj(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(l,d)=>{const p=e.model.document.selection.getFirstPosition().parent;i.some(g=>p.is("element",g.model))&&!p.is("element",CE)&&p.childCount===0&&d.writer.rename(p,CE)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:K.low+1})}}var AE=a(8733),Zj={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(AE.Z,Zj),AE.Z.locals;class Jj extends pe{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=function(p){const g=p.t,b={Paragraph:g("Paragraph"),"Heading 1":g("Heading 1"),"Heading 2":g("Heading 2"),"Heading 3":g("Heading 3"),"Heading 4":g("Heading 4"),"Heading 5":g("Heading 5"),"Heading 6":g("Heading 6")};return p.config.get("heading.options").map(w=>{const y=b[w.title];return y&&y!=w.title&&(w.title=y),w})}(e),l=t("Choose heading"),d=t("Heading");e.ui.componentFactory.add("heading",p=>{const g={},b=new lo,w=e.commands.get("heading"),y=e.commands.get("paragraph"),A=[w];for(const D of i){const M={type:"button",model:new $1({label:D.title,class:D.class,role:"menuitemradio",withText:!0})};D.model==="paragraph"?(M.model.bind("isOn").to(y,"value"),M.model.set("commandName","paragraph"),A.push(y)):(M.model.bind("isOn").to(w,"value",R=>R===D.model),M.model.set({commandName:"heading",commandValue:D.model})),b.add(M),g[D.model]=D.title}const E=cs(p);return p1(E,b,{ariaLabel:d,role:"menu"}),E.buttonView.set({ariaLabel:d,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:d}),E.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),E.bind("isEnabled").toMany(A,"isEnabled",(...D)=>D.some(M=>M)),E.buttonView.bind("label").to(w,"value",y,"value",(D,M)=>{const R=D||M&&"paragraph";return typeof R=="boolean"?l:g[R]?g[R]:l}),this.listenTo(E,"execute",D=>{const{commandName:M,commandValue:R}=D.source;e.execute(M,R?{value:R}:void 0),e.editing.view.focus()}),E})}}function xE(c){return c.createContainerElement("figure",{class:"image"},[c.createEmptyElement("img"),c.createSlot("children")])}function EE(c,e){const t=c.plugins.get("ImageUtils"),i=c.plugins.has("ImageInlineEditing")&&c.plugins.has("ImageBlockEditing");return d=>t.isInlineImageView(d)?i&&(d.getStyle("display")=="block"||d.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:l(d):null;function l(d){const p={name:!0};return d.hasAttribute("src")&&(p.attributes=["src"]),p}}function Cb(c,e){const t=vn(e.getSelectedBlocks());return!t||c.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function Op(c){return c&&c.endsWith("px")?parseInt(c):null}function SE(c){const e=Op(c.getStyle("width")),t=Op(c.getStyle("height"));return!(!e||!t)}var Xj=Object.defineProperty,DE=Object.getOwnPropertySymbols,ez=Object.prototype.hasOwnProperty,tz=Object.prototype.propertyIsEnumerable,TE=(c,e,t)=>e in c?Xj(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,IE=(c,e)=>{for(var t in e||(e={}))ez.call(e,t)&&TE(c,t,e[t]);if(DE)for(var t of DE(e))tz.call(e,t)&&TE(c,t,e[t]);return c};const nz=/^(image|image-inline)$/;class $r extends pe{constructor(){super(...arguments),this._domEmitter=new(Hr())}static get pluginName(){return"ImageUtils"}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,l={}){const d=this.editor,p=d.model,g=p.document.selection;i=ME(d,t||g,i),e=IE(IE({},Object.fromEntries(g.getAttributes())),e);for(const b in e)p.schema.checkAttribute(i,b)||delete e[b];return p.change(b=>{const{setImageSizes:w=!0}=l,y=b.createElement(i,e);return p.insertObject(y,t,null,{setSelection:"on",findOptimalPosition:t||i=="imageInline"?void 0:"auto"}),y.parent?(w&&this.setImageNaturalSizeAttributes(y),y):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(i=>{const l=new Oe.window.Image;this._domEmitter.listenTo(l,"load",()=>{e.getAttribute("width")||e.getAttribute("height")||this.editor.model.enqueueChange(i.batch,d=>{d.setAttribute("width",l.naturalWidth,e),d.setAttribute("height",l.naturalHeight,e)}),this._domEmitter.stopListening(l,"load")}),l.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let l=t.parent;for(;l;){if(l.is("element")&&this.isImageWidget(l))return l;l=l.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:nz})}isImageAllowed(){const e=this.editor.model.document.selection;return function(t,i){if(ME(t,i,null)=="imageBlock"){const d=function(p,g){const b=Bx(p,g),w=b.start.parent;return w.isEmpty&&!w.is("element","$root")?w.parent:w}(i,t.model);if(t.model.schema.checkChild(d,"imageBlock"))return!0}else if(t.model.schema.checkChild(i.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(t){return[...t.focus.getAncestors()].every(i=>!i.is("element","imageBlock"))}(e)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),kb(e,t,{label:()=>{const l=this.findViewImgElement(e).getAttribute("alt");return l?`${l} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&An(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 ME(c,e,t){const i=c.model.schema,l=c.config.get("image.insert.type");return c.plugins.has("ImageBlockEditing")?c.plugins.has("ImageInlineEditing")?t||(l==="inline"?"imageInline":l==="block"?"imageBlock":e.is("selection")?Cb(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class rz extends nt{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),l=t.model,d=i.getClosestSelectedImageElement(l.document.selection);l.change(p=>{p.setAttribute("alt",e.newValue,d)})}}class oz extends pe{static get requires(){return[$r]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new rz(this.editor))}}var PE=a(1905),iz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(PE.Z,iz),PE.Z.locals;var NE=a(6764),sz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(NE.Z,sz),NE.Z.locals;class az extends Ke{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new dr,this.keystrokes=new uo,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Wt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Wt.cancel,"ck-button-cancel","cancel"),this._focusables=new gi,this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),m({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,l){const d=new zt(this.locale);return d.set({label:e,icon:t,tooltip:!0}),d.extendTemplate({attributes:{class:i}}),l&&d.delegate("execute").to(this,l),d}_createLabeledInputView(){const e=this.locale.t,t=new Gh(this.locale,gp);return t.label=e("Text alternative"),t}}function OE(c){const e=c.editing.view,t=fr.defaultPositions,i=c.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]}}class cz extends pe{static get requires(){return[yp]}static get pluginName(){return"ImageTextAlternativeUI"}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 l=e.commands.get("imageTextAlternative"),d=new zt(i);return d.set({label:t("Change image text alternative"),icon:Wt.lowVision,tooltip:!0}),d.bind("isEnabled").to(l,"isEnabled"),d.bind("isOn").to(l,"value",p=>!!p),this.listenTo(d,"execute",()=>{this._showForm()}),d})}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(f(az))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(l,d)=>{this._hideForm(!0),d()}),this.listenTo(e.ui,"update",()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(l){const d=l.plugins.get("ContextualBalloon");if(l.plugins.get("ImageUtils").getClosestSelectedImageWidget(l.editing.view.document.selection)){const p=OE(l);d.updatePosition(p)}}(e):this._hideForm(!0)}),h({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:OE(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)}}class BE extends pe{static get requires(){return[oz,cz]}static get pluginName(){return"ImageTextAlternative"}}function RE(c,e){const t=(i,l,d)=>{if(!d.consumable.consume(l.item,i.name))return;const p=d.writer,g=d.mapper.toViewElement(l.item),b=c.findViewImgElement(g);l.attributeNewValue===null?(p.removeAttribute("srcset",b),p.removeAttribute("sizes",b)):l.attributeNewValue&&(p.setAttribute("srcset",l.attributeNewValue,b),p.setAttribute("sizes","100vw",b))};return i=>{i.on(`attribute:srcset:${e}`,t)}}function Bp(c,e,t){const i=(l,d,p)=>{if(!p.consumable.consume(d.item,l.name))return;const g=p.writer,b=p.mapper.toViewElement(d.item),w=c.findViewImgElement(b);g.setAttribute(d.attributeKey,d.attributeNewValue||"",w)};return l=>{l.on(`attribute:${t}:${e}`,i)}}class lz extends $o{observe(e){this.listenTo(e,"load",(t,i)=>{const l=i.target;this.checkShouldIgnoreEventFromTarget(l)||l.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))}}var uz=Object.defineProperty,LE=Object.getOwnPropertySymbols,dz=Object.prototype.hasOwnProperty,hz=Object.prototype.propertyIsEnumerable,jE=(c,e,t)=>e in c?uz(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,Rp=(c,e)=>{for(var t in e||(e={}))dz.call(e,t)&&jE(c,t,e[t]);if(LE)for(var t of LE(e))hz.call(e,t)&&jE(c,t,e[t]);return c};class pz extends nt{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&te("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&te("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=Sn(e.source),i=this.editor.model.document.selection,l=this.editor.plugins.get("ImageUtils"),d=Object.fromEntries(i.getAttributes());t.forEach((p,g)=>{const b=i.getSelectedElement();if(typeof p=="string"&&(p={src:p}),g&&b&&l.isImage(b)){const w=this.editor.model.createPositionAfter(b);l.insertImage(Rp(Rp({},p),d),w)}else l.insertImage(Rp(Rp({},p),d))})}}class fz extends nt{refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement();this.editor.model.change(i=>{i.setAttribute("src",e.source,t),i.removeAttribute("srcset",t),i.removeAttribute("sizes",t)})}}class Ab extends pe{static get requires(){return[$r]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(lz),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new pz(e),l=new fz(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",l),e.commands.add("imageInsert",i)}}class zE extends pe{static get requires(){return[$r]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),l=e==="imageBlock"?"figure":"img";function d(p,g,b,w){p.on(`attribute:${g}:${e}`,(y,A,E)=>{if(!E.consumable.consume(A.item,y.name))return;const D=E.writer,M=E.mapper.toViewElement(A.item),R=i.findViewImgElement(M);if(A.attributeNewValue!==null?D.setAttribute(b,A.attributeNewValue,R):D.removeAttribute(b,R),A.item.hasAttribute("sources"))return;const U=A.item.hasAttribute("resizedWidth");if(e==="imageInline"&&!U&&!w)return;const W=A.item.getAttribute("width"),J=A.item.getAttribute("height"),ie=R.getStyle("aspect-ratio");W&&J&&!ie&&D.setStyle("aspect-ratio",`${W}/${J}`,R)})}t.conversion.for("upcast").attributeToAttribute({view:{name:l,styles:{width:/.+/}},model:{key:"width",value:p=>SE(p)?Op(p.getStyle("width")):null}}).attributeToAttribute({view:{name:l,key:"width"},model:"width"}).attributeToAttribute({view:{name:l,styles:{height:/.+/}},model:{key:"height",value:p=>SE(p)?Op(p.getStyle("height")):null}}).attributeToAttribute({view:{name:l,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(p=>{d(p,"width","width",!0),d(p,"height","height",!0)}),t.conversion.for("dataDowncast").add(p=>{d(p,"width","width",!1),d(p,"height","height",!1)})}}class FE extends nt{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(e={}){const t=this.editor,i=this.editor.model,l=t.plugins.get("ImageUtils"),d=l.getClosestSelectedImageElement(i.document.selection),p=Object.fromEntries(d.getAttributes());return p.src||p.uploadId?i.change(g=>{const{setImageSizes:b=!0}=e,w=Array.from(i.markers).filter(E=>E.getRange().containsItem(d)),y=l.insertImage(p,i.createSelection(d,"on"),this._modelElementName,{setImageSizes:b});if(!y)return null;const A=g.createRangeOn(y);for(const E of w){const D=E.getRange(),M=D.root.rootName!="$graveyard"?D.getJoined(A,!0):A;g.updateMarker(E,{range:M})}return{oldElement:d,newElement:y}}):null}}class UE extends pe{static get requires(){return[Ab,zE,$r,Ko]}static get pluginName(){return"ImageBlockEditing"}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 FE(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,l=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(d,{writer:p})=>xE(p)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(d,{writer:p})=>l.toImageWidget(xE(p),p,t("image widget"))}),i.for("downcast").add(Bp(l,"imageBlock","src")).add(Bp(l,"imageBlock","alt")).add(RE(l,"imageBlock")),i.for("upcast").elementToElement({view:EE(e,"imageBlock"),model:(d,{writer:p})=>p.createElement("imageBlock",d.hasAttribute("src")?{src:d.getAttribute("src")}:void 0)}).add(function(d){const p=(g,b,w)=>{if(!w.consumable.test(b.viewItem,{name:!0,classes:"image"}))return;const y=d.findViewImgElement(b.viewItem);if(!y||!w.consumable.test(y,{name:!0}))return;w.consumable.consume(b.viewItem,{name:!0,classes:"image"});const A=vn(w.convertItem(y,b.modelCursor).modelRange.getItems());A?(w.convertChildren(b.viewItem,A),w.updateConversionResult(A,b)):w.consumable.revert(b.viewItem,{name:!0,classes:"image"})};return g=>{g.on("element:figure",p)}}(l))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,l=e.plugins.get("ImageUtils"),d=e.plugins.get("ClipboardPipeline");this.listenTo(d,"inputTransformation",(p,g)=>{const b=Array.from(g.content.getChildren());let w;if(!b.every(l.isInlineImageView))return;w=g.targetRanges?e.editing.mapper.toModelRange(g.targetRanges[0]):t.document.selection.getFirstRange();const y=t.createSelection(w);if(Cb(t.schema,y)==="imageBlock"){const A=new da(i.document),E=b.map(D=>A.createElement("figure",{class:"image"},D));g.content=A.createDocumentFragment(E)}}),this.listenTo(d,"contentInsertion",(p,g)=>{g.method==="paste"&&t.change(b=>{const w=b.createRangeIn(g.content);for(const y of w.getItems())y.is("element","imageBlock")&&l.setImageNaturalSizeAttributes(y)})})}}var VE=a(3508),gz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(VE.Z,gz),VE.Z.locals;class mz extends pe{static get requires(){return[UE,Ru,BE]}static get pluginName(){return"ImageBlock"}}class kz extends pe{static get requires(){return[Ab,zE,$r,Ko]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((i,l)=>{if(i.endsWith("caption")&&l.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new FE(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,l=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(d,{writer:p})=>p.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(d,{writer:p})=>l.toImageWidget(function(g){return g.createContainerElement("span",{class:"image-inline"},g.createEmptyElement("img"))}(p),p,t("image widget"))}),i.for("downcast").add(Bp(l,"imageInline","src")).add(Bp(l,"imageInline","alt")).add(RE(l,"imageInline")),i.for("upcast").elementToElement({view:EE(e,"imageInline"),model:(d,{writer:p})=>p.createElement("imageInline",d.hasAttribute("src")?{src:d.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,l=e.plugins.get("ImageUtils"),d=e.plugins.get("ClipboardPipeline");this.listenTo(d,"inputTransformation",(p,g)=>{const b=Array.from(g.content.getChildren());let w;if(!b.every(l.isBlockImageView))return;w=g.targetRanges?e.editing.mapper.toModelRange(g.targetRanges[0]):t.document.selection.getFirstRange();const y=t.createSelection(w);if(Cb(t.schema,y)==="imageInline"){const A=new da(i.document),E=b.map(D=>D.childCount===1?(Array.from(D.getAttributes()).forEach(M=>A.setAttribute(...M,l.findViewImgElement(D))),D.getChild(0)):D);g.content=A.createDocumentFragment(E)}}),this.listenTo(d,"contentInsertion",(p,g)=>{g.method==="paste"&&t.change(b=>{const w=b.createRangeIn(g.content);for(const y of w.getItems())y.is("element","imageInline")&&l.setImageNaturalSizeAttributes(y)})})}}class bz extends pe{static get requires(){return[kz,Ru,BE]}static get pluginName(){return"ImageInline"}}class HE extends pe{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[$r]}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}}class wz extends nt{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(UE))return this.isEnabled=!1,void(this.value=!1);const l=e.model.document.selection,d=l.getSelectedElement();if(!d){const p=t.getCaptionFromModelSelection(l);return this.isEnabled=!!p,void(this.value=!!p)}this.isEnabled=i.isImage(d),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(d):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 i=this.editor.model.document.selection,l=this.editor.plugins.get("ImageCaptionEditing"),d=this.editor.plugins.get("ImageUtils");let p=i.getSelectedElement();const g=l._getSavedCaption(p);d.isInlineImage(p)&&(this.editor.execute("imageTypeBlock"),p=i.getSelectedElement());const b=g||e.createElement("caption");e.append(b,p),t&&e.setSelection(b,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,l=t.plugins.get("ImageCaptionEditing"),d=t.plugins.get("ImageCaptionUtils");let p,g=i.getSelectedElement();g?p=d.getCaptionFromImageModelElement(g):(p=d.getCaptionFromModelSelection(i),g=p.parent),l._saveCaption(g,p),e.setSelection(g,"on"),e.remove(p)}}class vz extends pe{constructor(e){super(e),this._savedCaptionsMap=new WeakMap}static get requires(){return[$r,HE]}static get pluginName(){return"ImageCaptionEditing"}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 wz(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),l=e.plugins.get("ImageCaptionUtils"),d=e.t;e.conversion.for("upcast").elementToElement({view:p=>l.matchImageCaptionViewElement(p),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(p,{writer:g})=>i.isBlockImage(p.parent)?g.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(p,{writer:g})=>{if(!i.isBlockImage(p.parent))return null;const b=g.createEditableElement("figcaption");g.setCustomProperty("imageCaption",!0,b),b.placeholder=d("Enter image caption"),nC({view:t,element:b,keepOnFocus:!0});const w=p.parent.getAttribute("alt");return Ox(b,g,{label:w?d("Caption for image: %0",[w]):d("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),l=e.commands.get("imageTypeInline"),d=e.commands.get("imageTypeBlock"),p=g=>{if(!g.return)return;const{oldElement:b,newElement:w}=g.return;if(!b)return;if(t.isBlockImage(b)){const A=i.getCaptionFromImageModelElement(b);if(A)return void this._saveCaption(w,A)}const y=this._getSavedCaption(b);y&&this._saveCaption(w,y)};l&&this.listenTo(l,"execute",p,{priority:"low"}),d&&this.listenTo(d,"execute",p,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Tt.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"),l=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const d=t.document.differ.getChanges();for(const p of d){if(p.attributeKey!=="alt")continue;const g=p.range.start.nodeAfter;if(i.isBlockImage(g)){const b=l.getCaptionFromImageModelElement(g);if(!b)return;e.editing.reconvertItem(b)}}})}}class yz extends pe{static get requires(){return[HE]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),l=e.t;e.ui.componentFactory.add("toggleImageCaption",d=>{const p=e.commands.get("toggleImageCaption"),g=new zt(d);return g.set({icon:Wt.caption,tooltip:!0,isToggleable:!0}),g.bind("isOn","isEnabled").to(p,"value","isEnabled"),g.bind("label").to(p,"value",b=>l(b?"Toggle caption off":"Toggle caption on")),this.listenTo(g,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const b=i.getCaptionFromModelSelection(e.model.document.selection);if(b){const w=e.editing.mapper.toViewElement(b);t.scrollToTheSelection(),t.change(y=>{y.addClass("image__caption_highlighted",w)})}e.editing.view.focus()}),g})}}var WE=a(2640),_z={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(WE.Z,_z),WE.Z.locals;function $E(c){const e=c.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function Cz(c){return new Promise((e,t)=>{const i=c.getAttribute("src");fetch(i).then(l=>l.blob()).then(l=>{const d=YE(l,i),p=d.replace("image/",""),g=new File([l],`image.${p}`,{type:d});e(g)}).catch(l=>l&&l.name==="TypeError"?function(d){return function(p){return new Promise((g,b)=>{const w=Oe.document.createElement("img");w.addEventListener("load",()=>{const y=Oe.document.createElement("canvas");y.width=w.width,y.height=w.height,y.getContext("2d").drawImage(w,0,0),y.toBlob(A=>A?g(A):b())}),w.addEventListener("error",()=>b()),w.src=p})}(d).then(p=>{const g=YE(p,d),b=g.replace("image/","");return new File([p],`image.${b}`,{type:g})})}(i).then(e).catch(t):t(l))})}function YE(c,e){return c.type?c.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Az extends pe{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=l=>{const d=new vj(l),p=e.commands.get("uploadImage"),g=e.config.get("image.upload.types"),b=$E(g);return d.set({acceptedType:g.map(w=>`image/${w}`).join(","),allowMultipleFiles:!0}),d.buttonView.set({label:t("Insert image"),icon:Wt.image,tooltip:!0}),d.buttonView.bind("isEnabled").to(p),d.on("done",(w,y)=>{const A=Array.from(y).filter(E=>b.test(E.type));A.length&&(e.execute("uploadImage",{file:A}),e.editing.view.focus())}),d};e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i)}}var qE=a(3689),xz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(qE.Z,xz),qE.Z.locals;var KE=a(4036),Ez={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(KE.Z,Ez),KE.Z.locals;var GE=a(3773),Sz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(GE.Z,Sz),GE.Z.locals;class Dz extends pe{constructor(e){super(e),this.uploadStatusChange=(t,i,l)=>{const d=this.editor,p=i.item,g=p.getAttribute("uploadId");if(!l.consumable.consume(i.item,t.name))return;const b=d.plugins.get("ImageUtils"),w=d.plugins.get(bo),y=g?i.attributeNewValue:null,A=this.placeholder,E=d.editing.mapper.toViewElement(p),D=l.writer;if(y=="reading")return QE(E,D),void ZE(b,A,E,D);if(y=="uploading"){const M=w.loaders.get(g);return QE(E,D),void(M?(JE(E,D),function(R,U,W,J){const ie=function(ve){const Be=ve.createUIElement("div",{class:"ck-progress-bar"});return ve.setCustomProperty("progressBar",!0,Be),Be}(U);U.insert(U.createPositionAt(R,"end"),ie),W.on("change:uploadedPercent",(ve,Be,Ct)=>{J.change(at=>{at.setStyle("width",Ct+"%",ie)})})}(E,D,M,d.editing.view),function(R,U,W,J){if(J.data){const ie=R.findViewImgElement(U);W.setAttribute("src",J.data,ie)}}(b,E,D,M)):ZE(b,A,E,D))}y=="complete"&&w.loaders.get(g)&&function(M,R,U){const W=R.createUIElement("div",{class:"ck-image-upload-complete-icon"});R.insert(R.createPositionAt(M,"end"),W),setTimeout(()=>{U.change(J=>J.remove(J.createRangeOn(W)))},3e3)}(E,D,d.editing.view),function(M,R){eS(M,R,"progressBar")}(E,D),JE(E,D),function(M,R){R.removeClass("ck-appear",M)}(E,D)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}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)}}function QE(c,e){c.hasClass("ck-appear")||e.addClass("ck-appear",c)}function ZE(c,e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);const l=c.findViewImgElement(t);l.getAttribute("src")!==e&&i.setAttribute("src",e,l),XE(t,"placeholder")||i.insert(i.createPositionAfter(l),function(d){const p=d.createUIElement("div",{class:"ck-upload-placeholder-loader"});return d.setCustomProperty("placeholder",!0,p),p}(i))}function JE(c,e){c.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",c),eS(c,e,"placeholder")}function XE(c,e){for(const t of c.getChildren())if(t.getCustomProperty(e))return t}function eS(c,e,t){const i=XE(c,t);i&&e.remove(e.createRangeOn(i))}var Tz=Object.defineProperty,Iz=Object.defineProperties,Mz=Object.getOwnPropertyDescriptors,tS=Object.getOwnPropertySymbols,Pz=Object.prototype.hasOwnProperty,Nz=Object.prototype.propertyIsEnumerable,nS=(c,e,t)=>e in c?Tz(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;class Oz extends nt{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=Sn(e.file),i=this.editor.model.document.selection,l=this.editor.plugins.get("ImageUtils"),d=Object.fromEntries(i.getAttributes());t.forEach((p,g)=>{const b=i.getSelectedElement();if(g&&b&&l.isImage(b)){const w=this.editor.model.createPositionAfter(b);this._uploadImage(p,d,w)}else this._uploadImage(p,d)})}_uploadImage(e,t,i){const l=this.editor,d=l.plugins.get(bo).createLoader(e),p=l.plugins.get("ImageUtils");var g,b;d&&p.insertImage((g=((w,y)=>{for(var A in y||(y={}))Pz.call(y,A)&&nS(w,A,y[A]);if(tS)for(var A of tS(y))Nz.call(y,A)&&nS(w,A,y[A]);return w})({},t),b={uploadId:d.id},Iz(g,Mz(b))),i)}}class Bz extends pe{constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[bo,lb,Ko,$r]}static get pluginName(){return"ImageUploadEditing"}init(){const e=this.editor,t=e.model.document,i=e.conversion,l=e.plugins.get(bo),d=e.plugins.get("ImageUtils"),p=e.plugins.get("ClipboardPipeline"),g=$E(e.config.get("image.upload.types")),b=new Oz(e);e.commands.add("uploadImage",b),e.commands.add("imageUpload",b),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(w,y)=>{if(A=y.dataTransfer,Array.from(A.types).includes("text/html")&&A.getData("text/html")!=="")return;var A;const E=Array.from(y.dataTransfer.files).filter(D=>!!D&&g.test(D.type));E.length&&(w.stop(),e.model.change(D=>{y.targetRanges&&D.setSelection(y.targetRanges.map(M=>e.editing.mapper.toModelRange(M))),e.execute("uploadImage",{file:E})}))}),this.listenTo(p,"inputTransformation",(w,y)=>{const A=Array.from(e.editing.view.createRangeIn(y.content)).map(D=>D.item).filter(D=>function(M,R){return!(!M.isInlineImageView(R)||!R.getAttribute("src")||!R.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!R.getAttribute("src").match(/^blob:/g))}(d,D)&&!D.getAttribute("uploadProcessed")).map(D=>({promise:Cz(D),imageElement:D}));if(!A.length)return;const E=new da(e.editing.view.document);for(const D of A){E.setAttribute("uploadProcessed",!0,D.imageElement);const M=l.createLoader(D.promise);M&&(E.setAttribute("src","",D.imageElement),E.setAttribute("uploadId",M.id,D.imageElement))}}),e.editing.view.document.on("dragover",(w,y)=>{y.preventDefault()}),t.on("change",()=>{const w=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),y=new Set;for(const A of w)if(A.type=="insert"&&A.name!="$text"){const E=A.position.nodeAfter,D=A.position.root.rootName=="$graveyard";for(const M of Rz(e,E)){const R=M.getAttribute("uploadId");if(!R)continue;const U=l.loaders.get(R);U&&(D?y.has(R)||U.abort():(y.add(R),this._uploadImageElements.set(R,M),U.status=="idle"&&this._readAndUpload(U)))}}}),this.on("uploadComplete",(w,{imageElement:y,data:A})=>{const E=A.urls?A.urls:A;this.editor.model.change(D=>{D.setAttribute("src",E.default,y),this._parseAndSetSrcsetAttributeOnImage(E,y,D),d.setImageNaturalSizeAttributes(y)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,l=t.locale.t,d=t.plugins.get(bo),p=t.plugins.get(lb),g=t.plugins.get("ImageUtils"),b=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},y=>{y.setAttribute("uploadStatus","reading",b.get(e.id))}),e.read().then(()=>{const y=e.upload(),A=b.get(e.id);if(_.isSafari){const E=t.editing.mapper.toViewElement(A),D=g.findViewImgElement(E);t.editing.view.once("render",()=>{if(!D.parent)return;const M=t.editing.view.domConverter.mapViewToDom(D.parent);if(!M)return;const R=M.style.display;M.style.display="none",M._ckHack=M.offsetHeight,M.style.display=R})}return i.enqueueChange({isUndoable:!1},E=>{E.setAttribute("uploadStatus","uploading",A)}),y}).then(y=>{i.enqueueChange({isUndoable:!1},A=>{const E=b.get(e.id);A.setAttribute("uploadStatus","complete",E),this.fire("uploadComplete",{data:y,imageElement:E})}),w()}).catch(y=>{if(e.status!=="error"&&e.status!=="aborted")throw y;e.status=="error"&&y&&p.showWarning(y,{title:l("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},A=>{A.remove(b.get(e.id))}),w()});function w(){i.enqueueChange({isUndoable:!1},y=>{const A=b.get(e.id);y.removeAttribute("uploadId",A),y.removeAttribute("uploadStatus",A),b.delete(e.id)}),d.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let l=0;const d=Object.keys(e).filter(p=>{const g=parseInt(p,10);if(!isNaN(g))return l=Math.max(l,g),!0}).map(p=>`${e[p]} ${p}w`).join(", ");if(d!=""){const p={srcset:d};t.hasAttribute("width")||t.hasAttribute("height")||(p.width=l),i.setAttributes(p,t)}}}function Rz(c,e){const t=c.plugins.get("ImageUtils");return Array.from(c.model.createRangeOn(e)).filter(i=>t.isImage(i.item)).map(i=>i.item)}var rS=a(1568),Lz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(rS.Z,Lz),rS.Z.locals;var oS=a(3535),jz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(oS.Z,jz),oS.Z.locals;var iS=a(6270),zz={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(iS.Z,zz),iS.Z.locals;class Fz extends nt{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(const l of i.modelElements)this._defaultStyles[l]=i.name;return[i.name,i]}))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,l=t.plugins.get("ImageUtils");i.change(d=>{const p=e.value,{setImageSizes:g=!0}=e;let b=l.getClosestSelectedImageElement(i.document.selection);p&&this.shouldConvertImageType(p,b)&&(this.editor.execute(l.isBlockImage(b)?"imageTypeInline":"imageTypeBlock",{setImageSizes:g}),b=l.getClosestSelectedImageElement(i.document.selection)),!p||this._styles.get(p).isDefault?d.removeAttribute("imageStyle",b):d.setAttribute("imageStyle",p,b),g&&l.setImageNaturalSizeAttributes(b)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}var Uz=Object.defineProperty,sS=Object.getOwnPropertySymbols,Vz=Object.prototype.hasOwnProperty,Hz=Object.prototype.propertyIsEnumerable,aS=(c,e,t)=>e in c?Uz(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,cS=(c,e)=>{for(var t in e||(e={}))Vz.call(e,t)&&aS(c,t,e[t]);if(sS)for(var t of sS(e))Hz.call(e,t)&&aS(c,t,e[t]);return c};const{objectFullWidth:Wz,objectInline:lS,objectLeft:uS,objectRight:xb,objectCenter:Eb,objectBlockLeft:dS,objectBlockRight:hS}=Wt,Lp={get inline(){return{name:"inline",title:"In line",icon:lS,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:uS,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:dS,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Eb,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:xb,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:hS,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Eb,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:xb,modelElements:["imageBlock"],className:"image-style-side"}}},pS={full:Wz,left:dS,right:hS,center:Eb,inlineLeft:uS,inlineRight:xb,inline:lS},fS=[{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 gS(c){te("image-style-configuration-definition-invalid",c)}const Sb={normalizeStyles:function(c){return(c.configuredStyles.options||[]).map(e=>function(t){return t=typeof t=="string"?Lp[t]?cS({},Lp[t]):{name:t}:function(i,l){const d=cS({},l);for(const p in i)Object.prototype.hasOwnProperty.call(l,p)||(d[p]=i[p]);return d}(Lp[t.name],t),typeof t.icon=="string"&&(t.icon=pS[t.icon]||t.icon),t}(e)).filter(e=>function(t,{isBlockPluginLoaded:i,isInlinePluginLoaded:l}){const{modelElements:d,name:p}=t;if(!(d&&d.length&&p))return gS({style:t}),!1;{const g=[i?"imageBlock":null,l?"imageInline":null];if(!d.some(b=>g.includes(b)))return te("image-style-missing-dependency",{style:t,missingPlugins:d.map(b=>b==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(e,c))},getDefaultStylesConfiguration:function(c,e){return c&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:c?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(c){return c.has("ImageBlockEditing")&&c.has("ImageInlineEditing")?[...fS]:[]},warnInvalidStyle:gS,DEFAULT_OPTIONS:Lp,DEFAULT_ICONS:pS,DEFAULT_DROPDOWN_DEFINITIONS:fS};function mS(c,e){for(const t of e)if(t.name===c)return t}class kS extends pe{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[$r]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Sb,i=this.editor,l=i.plugins.has("ImageBlockEditing"),d=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(l,d)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:l,isInlinePluginLoaded:d}),this._setupConversion(l,d),this._setupPostFixer(),i.commands.add("imageStyle",new Fz(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,l=i.model.schema,d=(p=this.normalizedStyles,(b,w,y)=>{if(!y.consumable.consume(w.item,b.name))return;const A=mS(w.attributeNewValue,p),E=mS(w.attributeOldValue,p),D=y.mapper.toViewElement(w.item),M=y.writer;E&&M.removeClass(E.className,D),A&&M.addClass(A.className,D)});var p;const g=function(b){const w={imageInline:b.filter(y=>!y.isDefault&&y.modelElements.includes("imageInline")),imageBlock:b.filter(y=>!y.isDefault&&y.modelElements.includes("imageBlock"))};return(y,A,E)=>{if(!A.modelRange)return;const D=A.viewItem,M=vn(A.modelRange.getItems());if(M&&E.schema.checkAttribute(M,"imageStyle"))for(const R of w[M.name])E.consumable.consume(D,{classes:R.className})&&E.writer.setAttribute("imageStyle",R.name,M)}}(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",d),i.data.downcastDispatcher.on("attribute:imageStyle",d),e&&(l.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",g,{priority:"low"})),t&&(l.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",g,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get($r),l=new Map(this.normalizedStyles.map(d=>[d.name,d]));t.registerPostFixer(d=>{let p=!1;for(const g of t.differ.getChanges())if(g.type=="insert"||g.type=="attribute"&&g.attributeKey=="imageStyle"){let b=g.type=="insert"?g.position.nodeAfter:g.range.start.nodeAfter;if(b&&b.is("element","paragraph")&&b.childCount>0&&(b=b.getChild(0)),!i.isImage(b))continue;const w=b.getAttribute("imageStyle");if(!w)continue;const y=l.get(w);y&&y.modelElements.includes(b.name)||(d.removeAttribute("imageStyle",b),p=!0)}return p})}}var bS=a(5083),$z={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(bS.Z,$z),bS.Z.locals;class Yz extends pe{static get requires(){return[kS]}static get pluginName(){return"ImageStyleUI"}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=wS(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const d of i)this._createButton(d);const l=wS([...t.filter(Ne),...Sb.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const d of l)this._createDropdown(d,i)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,l=>{let d;const{defaultItem:p,items:g,title:b}=e,w=g.filter(D=>t.find(({name:M})=>vS(M)===D)).map(D=>{const M=i.create(D);return D===p&&(d=M),M});g.length!==w.length&&Sb.warnInvalidStyle({dropdown:e});const y=cs(l,Zk),A=y.buttonView,E=A.arrowView;return Jk(y,w,{enableActiveItemFocusOnDropdownOpen:!0}),A.set({label:yS(b,d.label),class:null,tooltip:!0}),E.unbind("label"),E.set({label:b}),A.bind("icon").toMany(w,"isOn",(...D)=>{const M=D.findIndex(ra);return M<0?d.icon:w[M].icon}),A.bind("label").toMany(w,"isOn",(...D)=>{const M=D.findIndex(ra);return yS(b,M<0?d.label:w[M].label)}),A.bind("isOn").toMany(w,"isOn",(...D)=>D.some(ra)),A.bind("class").toMany(w,"isOn",(...D)=>D.some(ra)?"ck-splitbutton_flatten":void 0),A.on("execute",()=>{w.some(({isOn:D})=>D)?y.isOpen=!y.isOpen:d.fire("execute")}),y.bind("isEnabled").toMany(w,"isEnabled",(...D)=>D.some(ra)),this.listenTo(y,"execute",()=>{this.editor.editing.view.focus()}),y})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(vS(t),i=>{const l=this.editor.commands.get("imageStyle"),d=new zt(i);return d.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),d.bind("isEnabled").to(l,"isEnabled"),d.bind("isOn").to(l,"value",p=>p===t),d.on("execute",this._executeCommand.bind(this,t)),d})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function wS(c,e){for(const t of c)e[t.title]&&(t.title=e[t.title]);return c}function vS(c){return`imageStyle:${c}`}function yS(c,e){return(c?c+": ":"")+e}class qz extends pe{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Z_(e)),e.commands.add("outdent",new Z_(e))}}const _S='',CS='';class Kz extends pe{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,l=t.uiLanguageDirection=="ltr"?_S:CS,d=t.uiLanguageDirection=="ltr"?CS:_S;this._defineButton("indent",i("Increase indent"),l),this._defineButton("outdent",i("Decrease indent"),d)}_defineButton(e,t,i){const l=this.editor;l.ui.componentFactory.add(e,d=>{const p=l.commands.get(e),g=new zt(d);return g.set({label:t,icon:i,tooltip:!0}),g.bind("isEnabled").to(p,"isEnabled"),this.listenTo(g,"execute",()=>{l.execute(e),l.editing.view.focus()}),g})}}class Gz{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,l)=>{if(!l.consumable.test(i.item,"attribute:linkHref")||!i.item.is("selection")&&!l.schema.isInline(i.item))return;const d=l.writer,p=d.document.selection;for(const g of this._definitions){const b=d.createAttributeElement("a",g.attributes,{priority:5});g.classes&&d.addClass(g.classes,b);for(const w in g.styles)d.setStyle(w,g.styles[w],b);d.setCustomProperty("link",!0,b),g.callback(i.attributeNewValue)?i.item.is("selection")?d.wrap(p.getFirstRange(),b):d.wrap(l.mapper.toViewRange(i.range),b):d.unwrap(l.mapper.toViewRange(i.range),b)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:l,mapper:d})=>{const p=d.toViewElement(i.item),g=Array.from(p.getChildren()).find(b=>b.is("element","a"));for(const b of this._definitions){const w=Ho(b.attributes);if(b.callback(i.attributeNewValue)){for(const[y,A]of w)y==="class"?l.addClass(A,g):l.setAttribute(y,A,g);b.classes&&l.addClass(b.classes,g);for(const y in b.styles)l.setStyle(y,b.styles[y],g)}else{for(const[y,A]of w)y==="class"?l.removeClass(A,g):l.removeAttribute(y,g);b.classes&&l.removeClass(b.classes,g);for(const y in b.styles)l.removeStyle(y,g)}}})}}}const Qz=function(c,e,t){var i=c.length;return t=t===void 0?i:t,!e&&t>=i?c:lC(c,e,t)};var Zz=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const AS=function(c){return Zz.test(c)},Jz=function(c){return c.split("")};var xS="\\ud800-\\udfff",Xz="["+xS+"]",Db="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Tb="\\ud83c[\\udffb-\\udfff]",ES="[^"+xS+"]",SS="(?:\\ud83c[\\udde6-\\uddff]){2}",DS="[\\ud800-\\udbff][\\udc00-\\udfff]",TS="(?:"+Db+"|"+Tb+")?",IS="[\\ufe0e\\ufe0f]?",eF=IS+TS+("(?:\\u200d(?:"+[ES,SS,DS].join("|")+")"+IS+TS+")*"),tF="(?:"+[ES+Db+"?",Db,SS,DS,Xz].join("|")+")",nF=RegExp(Tb+"(?="+Tb+")|"+tF+eF,"g");const rF=function(c){return c.match(nF)||[]},oF=function(c){return AS(c)?rF(c):Jz(c)},iF=function(c){return function(e){e=bk(e);var t=AS(e)?oF(e):void 0,i=t?t[0]:e.charAt(0),l=t?Qz(t,1).join(""):e.slice(1);return i[c]()+l}}("toUpperCase"),sF=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,aF=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,cF=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,lF=/^((\w+:(\/{2,})?)|(\W))/i,Ib="Ctrl+K";function MS(c,{writer:e}){const t=e.createAttributeElement("a",{href:c},{priority:5});return e.setCustomProperty("link",!0,t),t}function PS(c){const e=String(c);return function(t){return!!t.replace(sF,"").match(aF)}(e)?e:"#"}function Mb(c,e){return!!c&&e.checkAttribute(c.name,"linkHref")}function Pb(c,e){const t=(i=c,cF.test(i)?"mailto:":e);var i;const l=!!t&&!NS(c);return c&&l?t+c:c}function NS(c){return lF.test(c)}function OS(c){window.open(c,"_blank","noopener")}class uF extends nt{constructor(){super(...arguments),this.manualDecorators=new lo,this.automaticDecorators=new Gz}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||vn(t.getSelectedBlocks());Mb(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const l of this.manualDecorators)l.value=this._getDecoratorStateFromModel(l.id)}execute(e,t={}){const i=this.editor.model,l=i.document.selection,d=[],p=[];for(const g in t)t[g]?d.push(g):p.push(g);i.change(g=>{if(l.isCollapsed){const b=l.getFirstPosition();if(l.hasAttribute("linkHref")){const w=BS(l);let y=Mc(b,"linkHref",l.getAttribute("linkHref"),i);l.getAttribute("linkHref")===w&&(y=this._updateLinkContent(i,g,y,e)),g.setAttribute("linkHref",e,y),d.forEach(A=>{g.setAttribute(A,!0,y)}),p.forEach(A=>{g.removeAttribute(A,y)}),g.setSelection(g.createPositionAfter(y.end.nodeBefore))}else if(e!==""){const w=Ho(l.getAttributes());w.set("linkHref",e),d.forEach(A=>{w.set(A,!0)});const{end:y}=i.insertContent(g.createText(e,w),b);g.setSelection(y)}["linkHref",...d,...p].forEach(w=>{g.removeSelectionAttribute(w)})}else{const b=i.schema.getValidRanges(l.getRanges(),"linkHref"),w=[];for(const A of l.getSelectedBlocks())i.schema.checkAttribute(A,"linkHref")&&w.push(g.createRangeOn(A));const y=w.slice();for(const A of b)this._isRangeToUpdate(A,w)&&y.push(A);for(const A of y){let E=A;if(y.length===1){const D=BS(l);l.getAttribute("linkHref")===D&&(E=this._updateLinkContent(i,g,A,e),g.setSelection(g.createSelection(E)))}g.setAttribute("linkHref",e,E),d.forEach(D=>{g.setAttribute(D,!0,E)}),p.forEach(D=>{g.removeAttribute(D,E)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,l=i.getSelectedElement();return Mb(l,t.schema)?l.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,l){const d=t.createText(l,{linkHref:l});return e.insertContent(d,i)}}function BS(c){if(c.isCollapsed){const e=c.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(c.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}class dF extends nt{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();Mb(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,l=e.commands.get("link");t.change(d=>{const p=i.isCollapsed?[Mc(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const g of p)if(d.removeAttribute("linkHref",g),l)for(const b of l.manualDecorators)d.removeAttribute(b.id,g)})}}class hF extends Ve(){constructor({id:e,label:t,attributes:i,classes:l,styles:d,defaultValue:p}){super(),this.id=e,this.set("value",void 0),this.defaultValue=p,this.label=t,this.attributes=i,this.classes=l,this.styles=d}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var RS=a(9773),pF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(RS.Z,pF),RS.Z.locals;var fF=Object.defineProperty,LS=Object.getOwnPropertySymbols,gF=Object.prototype.hasOwnProperty,mF=Object.prototype.propertyIsEnumerable,jS=(c,e,t)=>e in c?fF(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,kF=(c,e)=>{for(var t in e||(e={}))gF.call(e,t)&&jS(c,t,e[t]);if(LS)for(var t of LS(e))mF.call(e,t)&&jS(c,t,e[t]);return c};const zS="automatic",bF=/^(https?:)?\/\//;class wF extends pe{static get pluginName(){return"LinkEditing"}static get requires(){return[Ax,kx,Ko]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:MS}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(i,l)=>MS(PS(i),l)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:i=>i.getAttribute("href")}}),e.commands.add("link",new uF(e)),e.commands.add("unlink",new dF(e));const t=function(i,l){const d={"Open in a new tab":i("Open in a new tab"),Downloadable:i("Downloadable")};return l.forEach(p=>("label"in p&&d[p.label]&&(p.label=d[p.label]),p)),l}(e.t,function(i){const l=[];if(i)for(const[d,p]of Object.entries(i)){const g=Object.assign({},p,{id:`link${iF(d)}`});l.push(g)}return l}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(i=>i.mode===zS)),this._enableManualDecorators(t.filter(i=>i.mode==="manual")),e.plugins.get(Ax).registerAttribute("linkHref"),function(i,l,d,p){const g=i.editing.view,b=new Set;g.document.registerPostFixer(w=>{const y=i.model.document.selection;let A=!1;if(y.hasAttribute(l)){const E=Mc(y.getFirstPosition(),l,y.getAttribute(l),i.model),D=i.editing.mapper.toViewRange(E);for(const M of D.getItems())M.is("element",d)&&!M.hasClass(p)&&(w.addClass(p,M),b.add(M),A=!0)}return A}),i.conversion.for("editingDowncast").add(w=>{function y(){g.change(A=>{for(const E of b.values())A.removeClass(p,E),b.delete(E)})}w.on("insert",y,{priority:"highest"}),w.on("remove",y,{priority:"highest"}),w.on("attribute",y,{priority:"highest"}),w.on("selection",y,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:zS,callback:l=>!!l&&bF.test(l),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(l=>{t.model.schema.extend("$text",{allowAttributes:l.id});const d=new hF(l);i.add(d),t.conversion.for("downcast").attributeToElement({model:d.id,view:(p,{writer:g,schema:b},{item:w})=>{if((w.is("selection")||b.isInline(w))&&p){const y=g.createAttributeElement("a",d.attributes,{priority:5});d.classes&&g.addClass(d.classes,y);for(const A in d.styles)g.setStyle(A,d.styles[A],y);return g.setCustomProperty("link",!0,y),y}}}),t.conversion.for("upcast").elementToAttribute({view:kF({name:"a"},d._createPattern()),model:{key:d.id}})})}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,l)=>{if(!(_.isMac?l.domEvent.metaKey:l.domEvent.ctrlKey))return;let d=l.domTarget;if(d.tagName.toLowerCase()!="a"&&(d=d.closest("a")),!d)return;const p=d.getAttribute("href");p&&(i.stop(),l.preventDefault(),OS(p))},{context:"$capture"}),this.listenTo(t,"keydown",(i,l)=>{const d=e.commands.get("link").value;d&&l.keyCode===dt.enter&&l.altKey&&(i.stop(),OS(d))})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",()=>{const i=t.anchor.nodeBefore,l=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&i&&i.hasAttribute("linkHref")&&(l&&l.hasAttribute("linkHref")||e.change(d=>{Nb(d,Ob(e.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(Kk);let i=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{i=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!i)return;i=!1;const l=t.document.selection;if(!l.isCollapsed||!l.hasAttribute("linkHref"))return;const d=l.getFirstPosition(),p=Mc(d,"linkHref",l.getAttribute("linkHref"),t);(d.isTouching(p.start)||d.isTouching(p.end))&&t.change(g=>{Nb(g,Ob(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i=null,l=!1;this.listenTo(t.document,"delete",()=>{l=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const d=e.model.document.selection;d.isCollapsed||(l?l=!1:FS(e)&&function(p){const g=p.document.selection,b=g.getFirstPosition(),w=g.getLastPosition(),y=b.nodeAfter;if(!y||!y.is("$text")||!y.hasAttribute("linkHref"))return!1;const A=w.textNode||w.nodeBefore;return y===A?!0:Mc(b,"linkHref",y.getAttribute("linkHref"),p).containsRange(p.createRange(b,w),!0)}(e.model)&&(i=d.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(d,[p])=>{l=!1,FS(e)&&i&&(e.model.change(g=>{for(const[b,w]of i)g.setAttribute(b,w,p)}),i=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,l=e.editing.view;let d=!1,p=!1;this.listenTo(l.document,"delete",(g,b)=>{p=b.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{d=!1;const g=i.getFirstPosition(),b=i.getAttribute("linkHref");if(!b)return;const w=Mc(g,"linkHref",b,t);d=w.containsPosition(g)||w.end.isEqual(g)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{p&&(p=!1,d||e.model.enqueueChange(g=>{Nb(g,Ob(t.schema))}))},{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(l,d)=>{t.change(p=>{const g=p.createRangeIn(d.content);for(const b of g.getItems())if(b.hasAttribute("linkHref")){const w=Pb(b.getAttribute("linkHref"),i);p.setAttribute("linkHref",w,b)}})})}}function Nb(c,e){c.removeSelectionAttribute("linkHref");for(const t of e)c.removeSelectionAttribute(t)}function FS(c){return c.model.change(e=>e.batch).isTyping}function Ob(c){return c.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}var US=a(7754),vF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(US.Z,vF),US.Z.locals;class yF extends Ke{constructor(e,t){super(e),this.focusTracker=new dr,this.keystrokes=new uo,this._focusables=new gi;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Wt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Wt.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const l=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&l.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:l,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),m({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Gh(this.locale,gp);return t.label=e("Link URL"),t}_createButton(e,t,i,l){const d=new zt(this.locale);return d.set({label:e,icon:t,tooltip:!0}),d.extendTemplate({attributes:{class:i}}),l&&d.delegate("execute").to(this,l),d}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const l=new Kh(this.locale);l.set({name:i.id,label:i.label,withText:!0}),l.bind("isOn").toMany([i,e],"value",(d,p)=>p===void 0&&d===void 0?!!i.defaultValue:!!d),l.on("execute",()=>{i.set("value",!l.isOn)}),t.add(l)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const i=new Ke;i.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(l=>({tag:"li",children:[l],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(i)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var VS=a(2347),_F={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(VS.Z,_F),VS.Z.locals;class CF extends Ke{constructor(e){super(e),this.focusTracker=new dr,this.keystrokes=new uo,this._focusables=new gi;const t=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'',"unlink"),this.editButtonView=this._createButton(t("Edit link"),Wt.pencil,"edit"),this.set("href",void 0),this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const l=new zt(this.locale);return l.set({label:e,icon:t,tooltip:!0}),l.delegate("execute").to(this,i),l}_createPreviewButton(){const e=new zt(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",l=>l&&PS(l)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",l=>l||i("This link has no URL")),e.bind("isEnabled").to(this,"href",l=>!!l),e.template.tag="a",e.template.eventListeners={},e}}const Go="link-ui";class AF extends pe{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[yp]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(JB),this._balloon=e.plugins.get(yp),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Go,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Go,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new CF(e.locale),i=e.commands.get("link"),l=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(l),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(d,p)=>{this._hideUI(),p()}),t.keystrokes.set(Ib,(d,p)=>{this._addFormView(),p()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),l=new(f(yF))(e.locale,t);return l.urlInputView.fieldView.bind("value").to(t,"value"),l.urlInputView.bind("isEnabled").to(t,"isEnabled"),l.saveButtonView.bind("isEnabled").to(t),this.listenTo(l,"submit",()=>{const{value:d}=l.urlInputView.fieldView.element,p=Pb(d,i);e.execute("link",p,l.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(l,"cancel",()=>{this._closeFormView()}),l.keystrokes.set("Esc",(d,p)=>{this._closeFormView(),p()}),l}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.ui.componentFactory.add("link",l=>{const d=new zt(l);return d.isEnabled=!0,d.label=i("Link"),d.icon='',d.keystroke=Ib,d.tooltip=!0,d.isToggleable=!0,d.bind("isEnabled").to(t,"isEnabled"),d.bind("isOn").to(t,"value",p=>!!p),this.listenTo(d,"execute",()=>this._showUI(!0)),d})}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(Ib,(i,l)=>{l(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),h({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),l=p();const d=()=>{const g=this._getSelectedLinkElement(),b=p();i&&!g||!i&&b!==l?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=g,l=b};function p(){return t.selection.focus.getAncestors().reverse().find(g=>g.is("element"))}this.listenTo(e.ui,"update",d),this.listenTo(this._balloon,"change:visibleView",d)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let l;if(t.markers.has(Go)){const d=Array.from(this.editor.editing.mapper.markerNameToElements(Go)),p=e.createRange(e.createPositionBefore(d[0]),e.createPositionAfter(d[d.length-1]));l=e.domConverter.viewRangeToDom(p)}else l=()=>{const d=this._getSelectedLinkElement();return d?e.domConverter.mapViewToDom(d):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:l}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&An(i))return Bb(t.getFirstPosition());{const l=t.getFirstRange().getTrimmed(),d=Bb(l.start),p=Bb(l.end);return d&&d==p&&e.createRangeIn(d).getTrimmed().isEqual(l)?d:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(Go))t.updateMarker(Go,{range:i});else if(i.start.isAtEnd){const l=i.start.getLastMatchingPosition(({item:d})=>!e.schema.isContent(d),{boundaries:i});t.addMarker(Go,{usingOperation:!1,affectsData:!1,range:t.createRange(l,i.end)})}else t.addMarker(Go,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Go)&&e.change(t=>{t.removeMarker(Go)})}}function Bb(c){return c.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})||null}const xF=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class EF extends pe{static get requires(){return[bi]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new Cx(e.model,i=>{if(!function(d){return d.length>4&&d[d.length-1]===" "&&d[d.length-2]!==" "}(i))return;const l=HS(i.substr(0,i.length-1));return l?{url:l}:void 0});t.on("matched:data",(i,l)=>{const{batch:d,range:p,url:g}=l;if(!d.isTyping)return;const b=p.end.getShiftedBy(-1),w=b.getShiftedBy(-g.length),y=e.model.createRange(w,b);this._applyAutoLink(g,y)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const l=t.document.selection.getFirstPosition();if(!l.parent.previousSibling)return;const d=t.createRangeIn(l.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(d)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const l=t.document.selection.getFirstPosition(),d=t.createRange(t.createPositionAt(l.parent,0),l.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(d)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:l}=_x(e,t),d=HS(i);if(d){const p=t.createRange(l.end.getShiftedBy(-d.length),l.end);this._applyAutoLink(d,p)}}_applyAutoLink(e,t){const i=this.editor.model,l=Pb(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(d,p){return p.schema.checkAttributeInSelection(p.createSelection(d),"linkHref")}(t,i)&&NS(l)&&!function(d){const p=d.start.nodeAfter;return!!p&&p.hasAttribute("linkHref")}(t)&&this._persistAutoLink(l,t)}_persistAutoLink(e,t){const i=this.editor.model,l=this.editor.plugins.get("Delete");i.enqueueChange(d=>{d.setAttribute("linkHref",e,t),i.enqueueChange(()=>{l.requestUndoOnBackspace()})})}}function HS(c){const e=xF.exec(c);return e?e[2]:null}var WS=a(111),SF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(WS.Z,SF),WS.Z.locals;var $S=a(5730),DF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()($S.Z,DF),$S.Z.locals;var YS=a(4564),TF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(YS.Z,TF),YS.Z.locals;function IF(c,e){const t=e.mapper,i=e.writer,l=c.getAttribute("listType")=="numbered"?"ol":"ul",d=function(g){const b=g.createContainerElement("li");return b.getFillerOffset=NF,b}(i),p=i.createContainerElement(l,null);return i.insert(i.createPositionAt(p,0),d),t.bindElements(c,d),d}function qS(c,e,t,i){const l=e.parent,d=t.mapper,p=t.writer;let g=d.toViewPosition(i.createPositionBefore(c));const b=GS(c.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:c.getAttribute("listIndent")}),w=c.previousSibling;if(b&&b.getAttribute("listIndent")==c.getAttribute("listIndent")){const y=d.toViewElement(b);g=p.breakContainer(p.createPositionAfter(y))}else if(w&&w.name=="listItem"){g=d.toViewPosition(i.createPositionAt(w,"end"));const y=d.findMappedViewAncestor(g),A=function(E){for(const D of E.getChildren())if(D.name=="ul"||D.name=="ol")return D;return null}(y);g=A?p.createPositionBefore(A):p.createPositionAt(y,"end")}else g=d.toViewPosition(i.createPositionBefore(c));if(g=KS(g),p.insert(g,l),w&&w.name=="listItem"){const y=d.toViewElement(w),A=p.createRange(p.createPositionAt(y,0),g).getWalker({ignoreElementEnd:!0});for(const E of A)if(E.item.is("element","li")){const D=p.breakContainer(p.createPositionBefore(E.item)),M=E.item.parent,R=p.createPositionAt(e,"end");Yr(p,R.nodeBefore,R.nodeAfter),p.move(p.createRangeOn(M),R),A._position=D}}else{const y=l.nextSibling;if(y&&(y.is("element","ul")||y.is("element","ol"))){let A=null;for(const E of y.getChildren()){const D=d.toModelElement(E);if(!(D&&D.getAttribute("listIndent")>c.getAttribute("listIndent")))break;A=E}A&&(p.breakContainer(p.createPositionAfter(A)),p.move(p.createRangeOn(A.parent),p.createPositionAt(e,"end")))}}Yr(p,l,l.nextSibling),Yr(p,l.previousSibling,l)}function Yr(c,e,t){return!e||!t||e.name!="ul"&&e.name!="ol"||e.name!=t.name||e.getAttribute("class")!==t.getAttribute("class")?null:c.mergeContainers(c.createPositionAfter(e))}function KS(c){return c.getLastMatchingPosition(e=>e.item.is("uiElement"))}function GS(c,e){const t=!!e.sameIndent,i=!!e.smallerIndent,l=e.listIndent;let d=c;for(;d&&d.name=="listItem";){const p=d.getAttribute("listIndent");if(t&&l==p||i&&l>p)return d;d=e.direction==="forward"?d.nextSibling:d.previousSibling}return null}function QS(c,e,t,i){c.ui.componentFactory.add(e,l=>{const d=c.commands.get(e),p=new zt(l);return p.set({label:t,icon:i,tooltip:!0,isToggleable:!0}),p.bind("isOn","isEnabled").to(d,"value","isEnabled"),p.on("execute",()=>{c.execute(e),c.editing.view.focus()}),p})}function Rb(c,e){const t=[],i=c.parent,l={ignoreElementEnd:!1,startPosition:c,shallow:!0,direction:e},d=i.getAttribute("listIndent"),p=[...new Yo(l)].filter(g=>g.item.is("element")).map(g=>g.item);for(const g of p){if(!g.is("element","listItem")||g.getAttribute("listIndent")d)){if(g.getAttribute("listType")!==i.getAttribute("listType")||g.getAttribute("listStyle")!==i.getAttribute("listStyle")||g.getAttribute("listReversed")!==i.getAttribute("listReversed")||g.getAttribute("listStart")!==i.getAttribute("listStart"))break;e==="backward"?t.unshift(g):t.push(g)}}return t}const MF=["disc","circle","square"],PF=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function NF(){const c=!this.isEmpty&&(this.getChild(0).name=="ul"||this.getChild(0).name=="ol");return this.isEmpty||c?0:fC.call(this)}class OF extends pe{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;QS(this.editor,"numberedList",e("Numbered List"),''),QS(this.editor,"bulletedList",e("Bulleted List"),'')}}const BF=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:c,typeAttribute:e,listType:t}of BF);var ZS=a(4721),RF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(ZS.Z,RF),ZS.Z.locals;var JS=a(6082),LF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(JS.Z,LF),JS.Z.locals;var XS=a(2417),jF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(XS.Z,jF),XS.Z.locals;class eD extends nt{constructor(e,t){super(e),this._indentBy=t=="forward"?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change(l=>{const d=i[i.length-1];let p=d.nextSibling;for(;p&&p.name=="listItem"&&p.getAttribute("listIndent")>d.getAttribute("listIndent");)i.push(p),p=p.nextSibling;this._indentBy<0&&(i=i.reverse());for(const g of i){const b=g.getAttribute("listIndent")+this._indentBy;b<0?l.rename(g,"paragraph"):l.setAttribute("listIndent",b,g)}this.fire("_executeCleanup",i)})}_checkEnabled(){const e=vn(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let l=e.previousSibling;for(;l&&l.is("element","listItem")&&l.getAttribute("listIndent")>=t;){if(l.getAttribute("listIndent")==t)return l.getAttribute("listType")==i;l=l.previousSibling}return!1}return!0}}class tD extends nt{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,l=Array.from(i.selection.getSelectedBlocks()).filter(p=>rD(p,t.schema)),d=e.forceValue!==void 0?!e.forceValue:this.value;t.change(p=>{if(d){let g=l[l.length-1].nextSibling,b=Number.POSITIVE_INFINITY,w=[];for(;g&&g.name=="listItem"&&g.getAttribute("listIndent")!==0;){const y=g.getAttribute("listIndent");y=t;)d>l.getAttribute("listIndent")&&(d=l.getAttribute("listIndent")),l.getAttribute("listIndent")==d&&c[e?"unshift":"push"](l),l=l[e?"previousSibling":"nextSibling"]}}function rD(c,e){return e.checkChild(c.parent,"listItem")&&!e.isObject(c)}class zF extends pe{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(e){return function(t){return MF.includes(t)?"bulleted":PF.includes(t)?"numbered":null}(e)}getSelectedListItems(e){return function(t){let i=[...t.document.selection.getSelectedBlocks()].filter(l=>l.is("element","listItem")).map(l=>{const d=t.change(p=>p.createPositionAt(l,0));return[...Rb(d,"backward"),...Rb(d,"forward")]}).flat();return i=[...new Set(i)],i}(e)}getSiblingNodes(e,t){return Rb(e,t)}}function oD(c){return(e,t,i)=>{const l=i.consumable;if(!l.test(t.item,"insert")||!l.test(t.item,"attribute:listType")||!l.test(t.item,"attribute:listIndent"))return;l.consume(t.item,"insert"),l.consume(t.item,"attribute:listType"),l.consume(t.item,"attribute:listIndent");const d=t.item;qS(d,IF(d,i),i,c)}}const FF=(c,e,t)=>{if(!t.consumable.test(e.item,c.name))return;const i=t.mapper.toViewElement(e.item),l=t.writer;l.breakContainer(l.createPositionBefore(i)),l.breakContainer(l.createPositionAfter(i));const d=i.parent,p=e.attributeNewValue=="numbered"?"ol":"ul";l.rename(p,d)},UF=(c,e,t)=>{t.consumable.consume(e.item,c.name);const i=t.mapper.toViewElement(e.item).parent,l=t.writer;Yr(l,i,i.nextSibling),Yr(l,i.previousSibling,i)},iD=(c,e,t)=>{if(t.consumable.test(e.item,c.name)&&e.item.name!="listItem"){let i=t.mapper.toViewPosition(e.range.start);const l=t.writer,d=[];for(;(i.parent.name=="ul"||i.parent.name=="ol")&&(i=l.breakContainer(i),i.parent.name=="li");){const p=i,g=l.createPositionAt(i.parent,"end");if(!p.isEqual(g)){const b=l.remove(l.createRange(p,g));d.push(b)}i=l.createPositionAfter(i.parent)}if(d.length>0){for(let p=0;p0){const b=Yr(l,g,g.nextSibling);b&&b.parent==g&&i.offset--}}Yr(l,i.nodeBefore,i.nodeAfter)}}},VF=(c,e,t)=>{const i=t.mapper.toViewPosition(e.position),l=i.nodeBefore,d=i.nodeAfter;Yr(t.writer,l,d)},HF=(c,e,t)=>{if(t.consumable.consume(e.viewItem,{name:!0})){const i=t.writer,l=i.createElement("listItem"),d=function(b){let w=0,y=b.parent;for(;y;){if(y.is("element","li"))w++;else{const A=y.previousSibling;A&&A.is("element","li")&&w++}y=y.parent}return w}(e.viewItem);i.setAttribute("listIndent",d,l);const p=e.viewItem.parent&&e.viewItem.parent.name=="ol"?"numbered":"bulleted";if(i.setAttribute("listType",p,l),!t.safeInsert(l,e.modelCursor))return;const g=function(b,w,y){const{writer:A,schema:E}=y;let D=A.createPositionAfter(b);for(const M of w)if(M.name=="ul"||M.name=="ol")D=y.convertItem(M,D).modelCursor;else{const R=y.convertItem(M,A.createPositionAt(b,"end")),U=R.modelRange.start.nodeAfter;U&&U.is("element")&&!E.checkChild(b,U.name)&&(b=R.modelCursor.parent.is("element","listItem")?R.modelCursor.parent:YF(R.modelCursor),D=A.createPositionAfter(b))}return D}(l,e.viewItem.getChildren(),t);e.modelRange=i.createRange(e.modelCursor,g),t.updateConversionResult(l,e)}},sD=(c,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){const i=Array.from(e.viewItem.getChildren());for(const l of i)!(l.is("element","li")||Bc(l))&&l._remove()}},WF=(c,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){if(e.viewItem.childCount===0)return;const i=[...e.viewItem.getChildren()];let l=!1;for(const d of i)l&&!Bc(d)&&d._remove(),Bc(d)&&(l=!0)}};function aD(c){return(e,t)=>{if(t.isPhantom)return;const i=t.modelPosition.nodeBefore;if(i&&i.is("element","listItem")){const l=t.mapper.toViewElement(i),d=l.getAncestors().find(Bc),p=c.createPositionAt(l,0).getWalker();for(const g of p){if(g.type=="elementStart"&&g.item.is("element","li")){t.viewPosition=g.previousPosition;break}if(g.type=="elementEnd"&&g.item==d){t.viewPosition=g.nextPosition;break}}}}}const $F=function(c,[e,t]){const i=this;let l,d=e.is("documentFragment")?e.getChild(0):e;if(l=t?i.createSelection(t):i.document.selection,d&&d.is("element","listItem")){const p=l.getFirstPosition();let g=null;if(p.parent.is("element","listItem")?g=p.parent:p.nodeBefore&&p.nodeBefore.is("element","listItem")&&(g=p.nodeBefore),g){const b=g.getAttribute("listIndent");if(b>0)for(;d&&d.is("element","listItem");)d._setAttribute("listIndent",d.getAttribute("listIndent")+b),d=d.nextSibling}}};function YF(c){const e=new Yo({startPosition:c});let t;do t=e.next();while(!t.value.item.is("element","listItem"));return t.value.item}function cD(c,e,t,i,l,d){const p=GS(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:c}),g=l.mapper,b=l.writer,w=p?p.getAttribute("listIndent"):null;let y;if(p)if(w==c){const A=g.toViewElement(p).parent;y=b.createPositionAfter(A)}else{const A=d.createPositionAt(p,"end");y=g.toViewPosition(A)}else y=t;y=KS(y);for(const A of[...i.getChildren()])Bc(A)&&(y=b.move(b.createRangeOn(A),y).end,Yr(b,A,A.nextSibling),Yr(b,A.previousSibling,A))}function Bc(c){return c.is("element","ol")||c.is("element","ul")}class qF extends pe{static get pluginName(){return"ListEditing"}static get requires(){return[Sp,bi,zF]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var l;e.model.document.registerPostFixer(p=>function(g,b){const w=g.document.differ.getChanges(),y=new Map;let A=!1;for(const R of w)if(R.type=="insert"&&R.name=="listItem")E(R.position);else if(R.type=="insert"&&R.name!="listItem"){if(R.name!="$text"){const U=R.position.nodeAfter;U.hasAttribute("listIndent")&&(b.removeAttribute("listIndent",U),A=!0),U.hasAttribute("listType")&&(b.removeAttribute("listType",U),A=!0),U.hasAttribute("listStyle")&&(b.removeAttribute("listStyle",U),A=!0),U.hasAttribute("listReversed")&&(b.removeAttribute("listReversed",U),A=!0),U.hasAttribute("listStart")&&(b.removeAttribute("listStart",U),A=!0);for(const W of Array.from(g.createRangeIn(U)).filter(J=>J.item.is("element","listItem")))E(W.previousPosition)}E(R.position.getShiftedBy(R.length))}else R.type=="remove"&&R.name=="listItem"?E(R.position):(R.type=="attribute"&&R.attributeKey=="listIndent"||R.type=="attribute"&&R.attributeKey=="listType")&&E(R.range.start);for(const R of y.values())D(R),M(R);return A;function E(R){const U=R.nodeBefore;if(U&&U.is("element","listItem")){let W=U;if(y.has(W))return;for(let J=W.previousSibling;J&&J.is("element","listItem");J=W.previousSibling)if(W=J,y.has(W))return;y.set(U,W)}else{const W=R.nodeAfter;W&&W.is("element","listItem")&&y.set(W,W)}}function D(R){let U=0,W=null;for(;R&&R.is("element","listItem");){const J=R.getAttribute("listIndent");if(J>U){let ie;W===null?(W=J-U,ie=U):(W>J&&(W=J),ie=J-W),b.setAttribute("listIndent",ie,R),A=!0}else W=null,U=R.getAttribute("listIndent")+1;R=R.nextSibling}}function M(R){let U=[],W=null;for(;R&&R.is("element","listItem");){const J=R.getAttribute("listIndent");if(W&&W.getAttribute("listIndent")>J&&(U=U.slice(0,J+1)),J!=0)if(U[J]){const ie=U[J];R.getAttribute("listType")!=ie&&(b.setAttribute("listType",ie,R),A=!0)}else U[J]=R.getAttribute("listType");W=R,R=R.nextSibling}}}(e.model,p)),i.mapper.registerViewToModelLength("li",Lb),t.mapper.registerViewToModelLength("li",Lb),i.mapper.on("modelToViewPosition",aD(i.view)),i.mapper.on("viewToModelPosition",(l=e.model,(p,g)=>{const b=g.viewPosition,w=b.parent,y=g.mapper;if(w.name=="ul"||w.name=="ol"){if(b.isAtEnd){const A=y.toModelElement(b.nodeBefore),E=y.getModelLength(b.nodeBefore);g.modelPosition=l.createPositionBefore(A).getShiftedBy(E)}else{const A=y.toModelElement(b.nodeAfter);g.modelPosition=l.createPositionBefore(A)}p.stop()}else if(w.name=="li"&&b.nodeBefore&&(b.nodeBefore.name=="ul"||b.nodeBefore.name=="ol")){const A=y.toModelElement(w);let E=1,D=b.nodeBefore;for(;D&&Bc(D);)E+=y.getModelLength(D),D=D.previousSibling;g.modelPosition=l.createPositionBefore(A).getShiftedBy(E),p.stop()}})),t.mapper.on("modelToViewPosition",aD(i.view)),e.conversion.for("editingDowncast").add(p=>{p.on("insert",iD,{priority:"high"}),p.on("insert:listItem",oD(e.model)),p.on("attribute:listType:listItem",FF,{priority:"high"}),p.on("attribute:listType:listItem",UF,{priority:"low"}),p.on("attribute:listIndent:listItem",function(g){return(b,w,y)=>{if(!y.consumable.consume(w.item,"attribute:listIndent"))return;const A=y.mapper.toViewElement(w.item),E=y.writer;E.breakContainer(E.createPositionBefore(A)),E.breakContainer(E.createPositionAfter(A));const D=A.parent,M=D.previousSibling,R=E.createRangeOn(D);E.remove(R),M&&M.nextSibling&&Yr(E,M,M.nextSibling),cD(w.attributeOldValue+1,w.range.start,R.start,A,y,g),qS(w.item,A,y,g);for(const U of w.item.getChildren())y.consumable.consume(U,"insert")}}(e.model)),p.on("remove:listItem",function(g){return(b,w,y)=>{const A=y.mapper.toViewPosition(w.position).getLastMatchingPosition(W=>!W.item.is("element","li")).nodeAfter,E=y.writer;E.breakContainer(E.createPositionBefore(A)),E.breakContainer(E.createPositionAfter(A));const D=A.parent,M=D.previousSibling,R=E.createRangeOn(D),U=E.remove(R);M&&M.nextSibling&&Yr(E,M,M.nextSibling),cD(y.mapper.toModelElement(A).getAttribute("listIndent")+1,w.position,R.start,A,y,g);for(const W of E.createRangeIn(U).getItems())y.mapper.unbindViewElement(W);b.stop()}}(e.model)),p.on("remove",VF,{priority:"low"})}),e.conversion.for("dataDowncast").add(p=>{p.on("insert",iD,{priority:"high"}),p.on("insert:listItem",oD(e.model))}),e.conversion.for("upcast").add(p=>{p.on("element:ul",sD,{priority:"high"}),p.on("element:ol",sD,{priority:"high"}),p.on("element:li",WF,{priority:"high"}),p.on("element:li",HF)}),e.model.on("insertContent",$F,{priority:"high"}),e.commands.add("numberedList",new tD(e,"numbered")),e.commands.add("bulletedList",new tD(e,"bulleted")),e.commands.add("indentList",new eD(e,"forward")),e.commands.add("outdentList",new eD(e,"backward"));const d=i.view.document;this.listenTo(d,"enter",(p,g)=>{const b=this.editor.model.document,w=b.selection.getLastPosition().parent;b.selection.isCollapsed&&w.name=="listItem"&&w.isEmpty&&(this.editor.execute("outdentList"),g.preventDefault(),p.stop())},{context:"li"}),this.listenTo(d,"delete",(p,g)=>{if(g.direction!=="backward")return;const b=this.editor.model.document.selection;if(!b.isCollapsed)return;const w=b.getFirstPosition();if(!w.isAtStart)return;const y=w.parent;y.name==="listItem"&&(y.previousSibling&&y.previousSibling.name==="listItem"||(this.editor.execute("outdentList"),g.preventDefault(),p.stop()))},{context:"li"}),this.listenTo(e.editing.view.document,"tab",(p,g)=>{const b=g.shiftKey?"outdentList":"indentList";this.editor.commands.get(b).isEnabled&&(e.execute(b),g.stopPropagation(),g.preventDefault(),p.stop())},{context:"li"})}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function Lb(c){let e=1;for(const t of c.getChildren())if(t.name=="ul"||t.name=="ol")for(const i of t.getChildren())e+=Lb(i);return e}gu("Ctrl+Enter");var lD=a(1199),KF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(lD.Z,KF),lD.Z.locals,gu("Ctrl+Enter");function uD(c,e){const t=(i,l,d)=>{if(!d.consumable.consume(l.item,i.name))return;const p=l.attributeNewValue,g=d.writer,b=d.mapper.toViewElement(l.item),w=[...b.getChildren()].find(A=>A.getCustomProperty("media-content"));g.remove(w);const y=c.getMediaViewElement(g,p,e);g.insert(g.createPositionAt(b,0),y)};return i=>{i.on("attribute:url:media",t)}}function dD(c,e,t,i){return c.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(c,t,i),c.createSlot()])}function hD(c){const e=c.getSelectedElement();return e&&e.is("element","media")?e:null}function pD(c,e,t,i){c.change(l=>{const d=l.createElement("media",{url:e});c.insertObject(d,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}class GF extends nt{refresh(){const e=this.editor.model,t=e.document.selection,i=hD(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=function(l){const d=l.getSelectedElement();return!!d&&d.name==="media"}(t)||function(l,d){let g=Bx(l,d).start.parent;return g.isEmpty&&!d.schema.isLimit(g)&&(g=g.parent),d.schema.checkChild(g,"media")}(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,l=hD(i);l?t.change(d=>{d.setAttribute("url",e,l)}):pD(t,e,i,!0)}}class QF{constructor(e,t){const i=t.providers,l=t.extraProviders||[],d=new Set(t.removeProviders),p=i.concat(l).filter(g=>{const b=g.name;return b?!d.has(b):(te("media-embed-no-provider-name",{provider:g}),!1)});this.locale=e,this.providerDefinitions=p}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new fD(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,l=Sn(t.url);for(const d of l){const p=this._getUrlMatches(e,d);if(p)return new fD(this.locale,e,p,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let l=e.replace(/^https?:\/\//,"");return i=l.match(t),i||(l=l.replace(/^www\./,""),i=l.match(t),i||null)}}class fD{constructor(e,t,i,l){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=l}getViewElement(e,t){const i={};let l;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const d=this._getPreviewHtml(t);l=e.createRawElement("div",i,(p,g)=>{g.setContentOf(p,d)})}else this.url&&(i.url=this.url),l=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,l),l}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new ea,t=this._locale.t;return e.content='',e.viewBox="0 0 64 42",new ho({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}var gD=a(7442),ZF={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(gD.Z,ZF),gD.Z.locals;class jp extends pe{constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>``},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>``},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],l=t[2];return``}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>``},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new QF(e.locale,e.config.get("mediaEmbed"))}static get pluginName(){return"MediaEmbedEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,l=e.conversion,d=e.config.get("mediaEmbed.previewsInData"),p=e.config.get("mediaEmbed.elementName"),g=this.registry;e.commands.add("mediaEmbed",new GF(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),l.for("dataDowncast").elementToStructure({model:"media",view:(b,{writer:w})=>{const y=b.getAttribute("url");return dD(w,g,y,{elementName:p,renderMediaPreview:!!y&&d})}}),l.for("dataDowncast").add(uD(g,{elementName:p,renderMediaPreview:d})),l.for("editingDowncast").elementToStructure({model:"media",view:(b,{writer:w})=>{const y=b.getAttribute("url");return function(A,E,D){return E.setCustomProperty("media",!0,A),kb(A,E,{label:D})}(dD(w,g,y,{elementName:p,renderForEditingView:!0}),w,i("media widget"))}}),l.for("editingDowncast").add(uD(g,{elementName:p,renderForEditingView:!0})),l.for("upcast").elementToElement({view:b=>["oembed",p].includes(b.name)&&b.getAttribute("url")?{name:!0}:null,model:(b,{writer:w})=>{const y=b.getAttribute("url");return g.hasMedia(y)?w.createElement("media",{url:y}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(b,{writer:w})=>{const y=b.getAttribute("data-oembed-url");return g.hasMedia(y)?w.createElement("media",{url:y}):null}}).add(b=>{b.on("element:figure",(w,y,A)=>{if(!A.consumable.consume(y.viewItem,{name:!0,classes:"media"}))return;const{modelRange:E,modelCursor:D}=A.convertChildren(y.viewItem,y.modelCursor);y.modelRange=E,y.modelCursor=D,vn(E.getItems())||A.consumable.revert(y.viewItem,{name:!0,classes:"media"})})})}}const JF=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class XF extends pe{constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}static get requires(){return[eE,bi,aE]}static get pluginName(){return"AutoMediaEmbed"}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const l=t.selection.getFirstRange(),d=Fn.fromPosition(l.start);d.stickiness="toPrevious";const p=Fn.fromPosition(l.end);p.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(d,p),d.detach(),p.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(Oe.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,l=i.plugins.get(jp).registry,d=new Sr(e,t),p=d.getWalker({ignoreElementEnd:!0});let g="";for(const b of p)b.item.is("$textProxy")&&(g+=b.item.data);if(g=g.trim(),!g.match(JF)||!l.hasMedia(g))return void d.detach();i.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Fn.fromPosition(e),this._timeoutId=Oe.window.setTimeout(()=>{i.model.change(b=>{this._timeoutId=null,b.remove(d),d.detach();let w=null;this._positionToInsert.root.rootName!=="$graveyard"&&(w=this._positionToInsert),pD(i.model,g,w,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(bi).requestUndoOnBackspace()},100)):d.detach()}}var mD=a(9292),e6={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(mD.Z,e6),mD.Z.locals;class t6 extends Ke{constructor(e,t){super(t);const i=t.t;this.focusTracker=new dr,this.keystrokes=new uo,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Wt.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",l=>!!l),this.cancelButtonView=this._createButton(i("Cancel"),Wt.cancel,"ck-button-cancel","cancel"),this._focusables=new gi,this._focusCycler=new os({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),m({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element);const 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()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new Gh(this.locale,gp),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}_createButton(e,t,i,l){const d=new zt(this.locale);return d.set({label:e,icon:t,tooltip:!0}),d.extendTemplate({attributes:{class:i}}),l&&d.delegate("execute").to(this,l),d}}class n6 extends pe{static get requires(){return[jp]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",i=>{const l=cs(i);return this._setUpDropdown(l,t),l})}_setUpDropdown(e,t){const i=this.editor,l=i.t,d=e.buttonView,p=i.plugins.get(jp).registry;e.once("change:isOpen",()=>{const g=new(f(t6))(function(b,w){return[y=>{if(!y.url.length)return b("The URL must not be empty.")},y=>{if(!w.hasMedia(y.url))return b("This media URL is not supported.")}]}(i.t,p),i.locale);e.panelView.children.add(g),d.on("open",()=>{g.disableCssTransitions(),g.url=t.value||"",g.urlInputView.fieldView.select(),g.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{g.isValid()&&(i.execute("mediaEmbed",g.url),i.editing.view.focus())}),e.on("change:isOpen",()=>g.resetFormStatus()),e.on("cancel",()=>{i.editing.view.focus()}),g.delegate("submit","cancel").to(e),g.urlInputView.fieldView.bind("value").to(t,"value"),g.urlInputView.bind("isEnabled").to(t,"isEnabled")}),e.bind("isEnabled").to(t),d.set({label:l("Insert media"),icon:'',tooltip:!0})}}var kD=a(4652),r6={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};ye()(kD.Z,r6),kD.Z.locals;function o6(c,e){if(!c.childCount)return;const t=new da(c.document),i=function(p,g){const b=g.createRangeIn(p),w=new po({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),y=[];for(const A of b)if(A.type==="elementStart"&&w.match(A.item)){const E=s6(A.item);y.push({element:A.item,id:E.id,order:E.order,indent:E.indent})}return y}(c,t);if(!i.length)return;let l=null,d=1;i.forEach((p,g)=>{const b=function(M,R){if(!M)return!0;if(M.id!==R.id)return R.indent-M.indent!=1;const U=R.element.previousSibling;if(!U)return!0;return W=U,!(W.is("element","ol")||W.is("element","ul"));var W}(i[g-1],p),w=b?null:i[g-1],y=(E=p,(A=w)?E.indent-A.indent:E.indent-1);var A,E;if(b&&(l=null,d=1),!l||y!==0){const M=function(R,U){const W=new RegExp(`@list l${R.id}:level${R.indent}\\s*({[^}]*)`,"gi"),J=/mso-level-number-format:([^;]{0,100});/gi,ie=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,ve=W.exec(U);let Be="decimal",Ct="ol",at=null;if(ve&&ve[1]){const rn=J.exec(ve[1]);if(rn&&rn[1]&&(Be=rn[1].trim(),Ct=Be!=="bullet"&&Be!=="image"?"ol":"ul"),Be==="bullet"){const on=function(Lc){const Qo=function(vi){if(vi.getChild(0).is("$text"))return null;for(const yi of vi.getChildren()){if(!yi.is("element","span"))continue;const ka=yi.getChild(0);if(ka)return ka.is("$text")?ka:ka.getChild(0)}return null}(Lc);if(!Qo)return null;const qr=Qo._data;return qr==="o"?"circle":qr==="·"?"disc":qr==="§"?"square":null}(R.element);on&&(Be=on)}else{const on=ie.exec(ve[1]);on&&on[1]&&(at=parseInt(on[1]))}}return{type:Ct,startIndex:at,style:i6(Be)}}(p,e);if(l){if(p.indent>d){const R=l.getChild(l.childCount-1),U=R.getChild(R.childCount-1);l=bD(M,U,t),d+=1}else if(p.indent1&&t.setAttribute("start",c.startIndex,l),l}function s6(c){const e={},t=c.getStyle("mso-list");if(t){const i=t.match(/(^|\s{1,100})l(\d+)/i),l=t.match(/\s{0,100}lfo(\d+)/i),d=t.match(/\s{0,100}level(\d+)/i);i&&l&&d&&(e.id=i[2],e.order=l[1],e.indent=parseInt(d[1]))}return e}function a6(c,e){if(!c.childCount)return;const t=new da(c.document),i=function(d,p){const g=p.createRangeIn(d),b=new po({name:/v:(.+)/}),w=[];for(const y of g){if(y.type!="elementStart")continue;const A=y.item,E=A.previousSibling,D=E&&E.is("element")?E.name:null;b.match(A)&&A.getAttribute("o:gfxdata")&&D!=="v:shapetype"&&w.push(y.item.getAttribute("id"))}return w}(c,t);(function(d,p,g){const b=g.createRangeIn(p),w=new po({name:"img"}),y=[];for(const A of b)if(A.item.is("element")&&w.match(A.item)){const E=A.item,D=E.getAttribute("v:shapes")?E.getAttribute("v:shapes").split(" "):[];D.length&&D.every(M=>d.indexOf(M)>-1)?y.push(E):E.getAttribute("src")||y.push(E)}for(const A of y)g.remove(A)})(i,c,t),function(d,p,g){const b=g.createRangeIn(p),w=[];for(const E of b)if(E.type=="elementStart"&&E.item.is("element","v:shape")){const D=E.item.getAttribute("id");if(d.includes(D))continue;y(E.item.parent.getChildren(),D)||w.push(E.item)}for(const E of w){const D={src:A(E)};E.hasAttribute("alt")&&(D.alt=E.getAttribute("alt"));const M=g.createElement("img",D);g.insertChild(E.index+1,M,E.parent)}function y(E,D){for(const M of E)if(M.is("element")&&(M.name=="img"&&M.getAttribute("v:shapes")==D||y(M.getChildren(),D)))return!0;return!1}function A(E){for(const D of E.getChildren())if(D.is("element")&&D.getAttribute("src"))return D.getAttribute("src")}}(i,c,t),function(d,p){const g=p.createRangeIn(d),b=new po({name:/v:(.+)/}),w=[];for(const y of g)y.type=="elementStart"&&b.match(y.item)&&w.push(y.item);for(const y of w)p.remove(y)}(c,t);const l=function(d,p){const g=p.createRangeIn(d),b=new po({name:"img"}),w=[];for(const y of g)y.item.is("element")&&b.match(y.item)&&y.item.getAttribute("src").startsWith("file://")&&w.push(y.item);return w}(c,t);l.length&&function(d,p,g){if(d.length===p.length)for(let b=0;bString.fromCharCode(parseInt(e,16))).join(""))}const l6=//i,u6=/xmlns:o="urn:schemas-microsoft-com/i;class d6{constructor(e){this.document=e}isActive(e){return l6.test(e)||u6.test(e)}execute(e){const{body:t,stylesString:i}=e._parsedData;o6(t,i),a6(t,e.dataTransfer.getData("text/rtf")),e.content=t}}function wD(c,e,t,{blockElements:i,inlineObjectElements:l}){let d=t.createPositionAt(c,e=="forward"?"after":"before");return d=d.getLastMatchingPosition(({item:p})=>p.is("element")&&!i.includes(p.name)&&!l.includes(p.name),{direction:e}),e=="forward"?d.nodeAfter:d.nodeBefore}function vD(c,e){return!!c&&c.is("element")&&e.includes(c.name)}const h6=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class p6{constructor(e){this.document=e}isActive(e){return h6.test(e)}execute(e){const t=new da(this.document),{body:i}=e._parsedData;(function(l,d){for(const p of l.getChildren())if(p.is("element","b")&&p.getStyle("font-weight")==="normal"){const g=l.getChildIndex(p);d.remove(p),d.insertChild(g,p.getChildren(),l)}})(i,t),function(l,d){for(const p of d.createRangeIn(l)){const g=p.item;if(g.is("element","li")){const b=g.getChild(0);b&&b.is("element","p")&&d.unwrapElement(b)}}}(i,t),function(l,d){const p=new np(d.document.stylesProcessor),g=new ip(p,{renderingMode:"data"}),b=g.blockElements,w=g.inlineObjectElements,y=[];for(const A of d.createRangeIn(l)){const E=A.item;if(E.is("element","br")){const D=wD(E,"forward",d,{blockElements:b,inlineObjectElements:w}),M=wD(E,"backward",d,{blockElements:b,inlineObjectElements:w}),R=vD(D,b);(vD(M,b)||R)&&y.push(E)}}for(const A of y)A.hasClass("Apple-interchange-newline")?d.remove(A):d.replace(A,d.createElement("p"))}(i,t),e.content=i}}const f6=/(\s+)<\/span>/g,(e,t)=>t.length===1?" ":Array(t.length+1).join(" ").substr(0,t.length))}function m6(c,e){const t=new DOMParser,i=function(b){return yD(yD(b)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(b){const w="",y="",A=b.indexOf(w);if(A<0)return b;const E=b.indexOf(y,A+w.length);return b.substring(0,A+w.length)+(E>=0?b.substring(E):"")}(c=c.replace(/