PageSourceSearch

https://conversiontab.com/build/assets/ckeditor-page-Hsn1UMHm.js

js conversiontab.com collected 2026-09-24 10:07:17 UTC 1,088,410 bytes, 1,818 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B6EzSpTQ.js","assets/_commonjsHelpers-BosuxZz1.js"])))=>i.map(i=>d[i]);
2import{_ as zp}from"./app-gOHIPY12.js";import{saveResultFile as Wp}from"./ctResultAccessAd-Dk9whJZs.js";import{s as vh}from"./ctToast-C2BAo121.js";import{g as kh}from"./_commonjsHelpers-BosuxZz1.js";import{H as qp}from"./hex-PEGE98j7.js";import"./FileSaver.min-BR20wtAe.js";import"./ctFullscreenAd-CL-AA_Ul.js";function jp(i,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in i)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}/**
3 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
4 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
5 */let A;try{A={window,document}}catch{/* istanbul ignore next -- @preserve */A={window:{},document:{}}}/**
6 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8 */function Gp(){try{return navigator.userAgent.toLowerCase()}catch{return""}}const Qt=Gp(),B={isMac:Ch(Qt),isWindows:Kp(Qt),isGecko:Jp(Qt),isSafari:Zp(Qt),isiOS:Qp(Qt),isAndroid:Yp(Qt),isBlink:Xp(Qt),get isMediaForcedColors(){return tb()},features:{isRegExpUnicodePropertySupported:eb()}};function Ch(i){return i.indexOf("macintosh")>-1}function Kp(i){return i.indexOf("windows")>-1}function Jp(i){return!!i.match(/gecko\/\d+/)}function Zp(i){return i.indexOf(" applewebkit/")>-1&&i.indexOf("chrome")===-1}function Qp(i){return!!i.match(/iphone|ipad/i)||Ch(i)&&navigator.maxTouchPoints>0}function Yp(i){return i.indexOf("android")>-1}function Xp(i){return i.indexOf("chrome/")>-1&&i.indexOf("edge/")<0}function eb(){let i=!1;try{i="ć".search(new RegExp("[\\p{L}]","u"))===0}catch{}return i}function tb(){return A.window.matchMedia?A.window.matchMedia("(forced-colors: active)").matches:!1}/**
9 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
10 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
11 */function Th(i,e,t,n){t=t||function(l,c){return l===c};const s=Array.isArray(i)?i:Array.prototype.slice.call(i),o=Array.isArray(e)?e:Array.prototype.slice.call(e),r=nb(s,o,t);return n?sb(r,o.length):ib(o,r)}function nb(i,e,t){const n=Il(i,e,t);if(n===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=Pl(i,n),o=Pl(e,n),r=Il(s,o,t),a=i.length-r,l=e.length-r;return{firstIndex:n,lastIndexOld:a,lastIndexNew:l}}function Il(i,e,t){for(let n=0;n<Math.max(i.length,e.length);n++)if(i[n]===void 0||e[n]===void 0||!t(i[n],e[n]))return n;return-1}function Pl(i,e){return i.slice(e).reverse()}function ib(i,e){const t=[],{firstIndex:n,lastIndexOld:s,lastIndexNew:o}=e;return o-n>0&&t.push({index:n,type:"insert",values:i.slice(n,o)}),s-n>0&&t.push({index:n+(o-n),type:"delete",howMany:s-n}),t}function sb(i,e){const{firstIndex:t,lastIndexOld:n,lastIndexNew:s}=i;if(t===-1)return Array(e).fill("equal");let o=[];return t>0&&(o=o.concat(Array(t).fill("equal"))),s-t>0&&(o=o.concat(Array(s-t).fill("insert"))),n-t>0&&(o=o.concat(Array(n-t).fill("delete"))),s<e&&(o=o.concat(Array(e-s).fill("equal"))),o}/**
12 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
13 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
14 */function Ii(i,e,t){t=t||function(p,_){return p===_};const n=i.length,s=e.length;if(n>200||s>200||n+s>300)return Ii.fastDiff(i,e,t,!0);let o,r;if(s<n){const p=i;i=e,e=p,o="delete",r="insert"}else o="insert",r="delete";const a=i.length,l=e.length,c=l-a,u={},d={};function h(p){const _=(d[p-1]!==void 0?d[p-1]:-1)+1,v=d[p+1]!==void 0?d[p+1]:-1,T=_>v?-1:1;u[p+T]&&(u[p]=u[p+T].slice(0)),u[p]||(u[p]=[]),u[p].push(_>v?o:r);let L=Math.max(_,v),U=L-p;for(;U<a&&L<l&&t(i[U],e[L]);)U++,L++,u[p].push("equal");return L}let f=0,m;do{for(m=-f;m<c;m++)d[m]=h(m);for(m=c+f;m>c;
14m--)d[m]=h(m);d[c]=h(c),f++}while(d[c]!==l);return u[c].slice(1)}Ii.fastDiff=Th;/**
15 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
16 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
17 */function Rl(){return function i(){i.called=!0}}/**
18 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
19 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
20 */class xt{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=Rl(),this.off=Rl()}}/**
21 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
22 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
23 */const Ce=new Array(256).fill("").map((i,e)=>("0"+e.toString(16)).slice(-2));function $e(){const i=Math.random()*4294967296>>>0,e=Math.random()*4294967296>>>0,t=Math.random()*4294967296>>>0,n=Math.random()*4294967296>>>0;return"e"+Ce[i>>0&255]+Ce[i>>8&255]+Ce[i>>16&255]+Ce[i>>24&255]+Ce[e>>0&255]+Ce[e>>8&255]+Ce[e>>16&255]+Ce[e>>24&255]+Ce[t>>0&255]+Ce[t>>8&255]+Ce[t>>16&255]+Ce[t>>24&255]+Ce[n>>0&255]+Ce[n>>8&255]+Ce[n>>16&255]+Ce[n>>24&255]}/**
24 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
25 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
26 */const Ut={get(i="normal"){return typeof i!="number"?this[i]||this.normal:i},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};/**
27 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
28 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
29 */function Eh(i,e){const t=Ut.get(e.priority);for(let n=0;n<i.length;n++)if(Ut.get(i[n].priority)<t){i.splice(n,0,e);return}i.push(e)}/**
30 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
31 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
32 */const ob="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class g extends Error{constructor(e,t,n){super(rb(e,n)),this.name="CKEditorError",this.context=t,this.data=n}is(e){return e==="CKEditorError"}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const n=new g(e.message,t);throw n.stack=e.stack,n}}function N(i,e){console.warn(...ab(i,e))}function Ah(i){return`
33Read more: ${ob}#error-${i}`}function rb(i,e){const t=new WeakSet,s=e?` ${JSON.stringify(e,(r,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return`[object ${a.constructor.name}]`;t.add(a)}return a})}`:"",o=Ah(i);return i+s+o}function ab(i,e){const t=Ah(i);return e?[i,e,t]:[i,t]}/**
34 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
35 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
36 */const lb="41.4.2",cb=new Date(2024,4,17);/* istanbul ignore next -- @preserve */if(globalThis.CKEDITOR_VERSION)throw new g("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=lb;/**
37 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
38 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
39 */const Dn=Symbol("listeningTo"),Dr=Symbol("emitterId"),wt=Symbol("delegations"),xh=G(Object);function G(i){if(!i)return xh;class e extends i{on(n,s,o){this.listenTo(this,n,s,o)}once(n,s,o){let r=!1;const a=(l,...c)=>{r||(r=!0,l.off(),s.call(this,l,...c))};this.listenTo(this,n,a,o)}off(n,s){this.stopListening(this,n,s)}listenTo(n,s,o,r={}){let a,l;this[Dn]||(this[Dn]={});const c=this[Dn];lr(n)||Sh(n);const u=lr(n);(a=c[u])||(a=c[u]={emitter:n,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(o),fb(this,n,s,o,r)}stopListening(n,s,o){const r=this[Dn];let a=n&&lr(n);const l=r&&a?r[a]:void 0,c=l&&s?l.callbacks[s]:void 0;if(!(!r||n&&!l||s&&!c))if(o)cr(this,n,s,o),c.indexOf(o)!==-1&&(c.length===1?delete l.callbacks[s]:cr(this,n,s,o));else if(c){for(;o=c.pop();)cr(this,n,s,o);delete l.callbacks[s]}else if(l){for(s in l.callbacks)this.stopListening(n,s);delete r[a]}else{for(a in r)this.stopListening(r[a].emitter);delete this[Dn]}}fire(n,...s){try{const o=n instanceof xt?n:new xt(this,n),r=o.name;let a=Ph(this,r);if(o.path.push(this),a){const c=[o,...s];a=Array.from(a);for(let u=0;
39u<a.length&&(a[u].callback.apply(this,c),o.off.called&&(delete o.off.called,this._removeEventListener(r,a[u].callback)),!o.stop.called);u++);}const l=this[wt];if(l){const c=l.get(r),u=l.get("*");c&&Vl(c,o,s),u&&Vl(u,o,s)}return o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}delegate(...n){return{to:(s,o)=>{this[wt]||(this[wt]=new Map),n.forEach(r=>{const a=this[wt].get(r);a?a.set(s,o):this[wt].set(r,new Map([[s,o]]))})}}}stopDelegating(n,s){if(this[wt])if(!n)this[wt].clear();else if(!s)this[wt].delete(n);else{const o=this[wt].get(n);o&&o.delete(s)}}_addEventListener(n,s,o){hb(this,n);const r=$r(this,n),a=Ut.get(o.priority),l={callback:s,priority:a};for(const c of r)Eh(c,l)}_removeEventListener(n,s){const o=$r(this,n);for(const r of o)for(let a=0;a<r.length;a++)r[a].callback==s&&(r.splice(a,1),a--)}}return e}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(i=>{G[i]=xh.prototype[i]});function ub(i,e){const t=i[Dn];return t&&t[e]?t[e].emitter:null}function Sh(i,e){i[Dr]||(i[Dr]=e||$e())}function lr(i){return i[Dr]}function Ih(i){return i._events||Object.defineProperty(i,"_events",{value:{}}),i._events}function db(){return{callbacks:[],childEvents:[]}}function hb(i,e){const t=Ih(i);if(t[e])return;let n=e,s=null;const o=[];for(;n!==""&&!t[n];)t[n]=db(),o.push(t[n]),s&&t[n].childEvents.push(s),s=n,n=n.substr(0,n.lastIndexOf(":"));if(n!==""){for(const r of o)r.callbacks=t[n].callbacks.slice();t[n].childEvents.push(s)}}function $r(i,e){const t=Ih(i)[e];if(!t)return[];let n=[t.callbacks];for(let s=0;s<t.childEvents.length;s++){const o=$r(i,t.childEvents[s]);n=n.concat(o)}return n}function Ph(i,e){let t;return!i._events||!(t=i._events[e])||!t.callbacks.length?e.indexOf(":")>-1?Ph(i,e.substr(0,e.lastIndexOf(":"))):null:t.callbacks}function Vl(i,e,t){for(let[n,s]of i){s?typeof s=="function"&&(s=s(e.name)):s=e.name;const o=new xt(e.source,s);o.path=[...e.path],n.fire(o,...t)}}function fb(i,e,t,n,s){e._addEventListener?e._addEventListener(t,n,s):i._addEventListener.call(e,t,n,s)}function cr(i,e,t,n){e._removeEventListener?e._removeEventListener(t,n):i._removeEventListener.call(e,t,n)}var Rh=typeof global=="object"&&global&&global.Object===Object&&global,mb=typeof self=="object"&&self&&self.Object===Object&&self,rt=Rh||mb||Function("return this")(),mt=rt.Symbol,Vh=Object.prototype,gb=Vh.hasOwnProperty,pb=Vh.toString,hi=mt?mt.toStringTag:void 0;function bb(i){var e=gb.call(i,hi),t=i[hi];try{i[hi]=void 0;var n=!0}catch{}var s=pb.call(i);return n&&(e?i[hi]=t:delete i[hi]),s}var wb=Object.prototype,_b=wb.toString;function yb(i){return _b.call(i)}var vb="[object Null]",kb="[object Undefined]",Bl=mt?mt.toStringTag:void 0;function Kt(i){return i==null?i===void 0?kb:vb:Bl&&Bl in Object(i)?bb(i):yb(i)}function Ge(i){return i!=null&&typeof i=="object"}var Cb="[object Symbol]";function Mo(i){return typeof i=="symbol"||Ge(i)&&Kt(i)==Cb}function Tb(i,e){for(var t=-1,n=i==null?0:i.length,s=Array(n);++t<n;)s[t]=e(i[t],t,i);return s}var Ue=Array.isArray,Ml=mt?mt.prototype:void 0,Ol=Ml?Ml.toString:void 0;function Bh(i){if(typeof i=="string")return i;if(Ue(i))return Tb(i,Bh)+"";if(Mo(i))return Ol?Ol.call(i):"";var e=i+"";return e=="0"&&1/i==-1/0?"-0":e}var Eb=/\s/;function Ab(i){for(var e=i.length;e--&&Eb.test(i.charAt(e)););return e}var xb=/^\s+/;function Sb(i){return i&&i.slice(0,Ab(i)+1).replace(xb,"")}function Z(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Ll=NaN,Ib=/^[-+]0x[0-9a-f]+$/i,Pb=/^0b[01]+$/i,Rb=/^0o[0-7]+$/i,Vb=parseInt;function Fl(i){if(typeof i=="number")return i;if(Mo(i))return Ll;if(Z(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Z(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Sb(i);var t=Pb.test(i);return t||Rb.test(i)?Vb(i.slice(2),t?2:8):Ib.test(i)?Ll:+i}function Dt(i){return i}var Bb="[object AsyncFunction]",Mb="[object Function]",Ob="[object GeneratorFunction]",Lb="[object Proxy]";function hn(i){if(!Z(i))return!1;var e=Kt(i);return e==Mb||e==Ob||e==Bb||e==Lb}
39var ur=rt["__core-js_shared__"],Nl=function(){var i=/[^.]+$/.exec(ur&&ur.keys&&ur.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function Fb(i){return!!Nl&&Nl in i}var Nb=Function.prototype,Db=Nb.toString;function pn(i){if(i!=null){try{return Db.call(i)}catch{}try{return i+""}catch{}}return""}var $b=/[\\^$.*+?()[\]{}|]/g,Ub=/^\[object .+?Constructor\]$/,Hb=Function.prototype,zb=Object.prototype,Wb=Hb.toString,qb=zb.hasOwnProperty,jb=RegExp("^"+Wb.call(qb).replace($b,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Gb(i){if(!Z(i)||Fb(i))return!1;var e=hn(i)?jb:Ub;return e.test(pn(i))}function Kb(i,e){return i==null?void 0:i[e]}function bn(i,e){var t=Kb(i,e);return Gb(t)?t:void 0}var Ur=bn(rt,"WeakMap"),Dl=Object.create,Jb=function(){function i(){}return function(e){if(!Z(e))return{};if(Dl)return Dl(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}();function Zb(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}function Mh(i,e){var t=-1,n=i.length;for(e||(e=Array(n));++t<n;)e[t]=i[t];return e}var Qb=800,Yb=16,Xb=Date.now;function ew(i){var e=0,t=0;return function(){var n=Xb(),s=Yb-(n-t);if(t=n,s>0){if(++e>=Qb)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}function tw(i){return function(){return i}}var lo=function(){try{var i=bn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),nw=lo?function(i,e){return lo(i,"toString",{configurable:!0,enumerable:!1,value:tw(e),writable:!0})}:Dt,iw=ew(nw);function sw(i,e){for(var t=-1,n=i==null?0:i.length;++t<n&&e(i[t],t,i)!==!1;);return i}var ow=9007199254740991,rw=/^(?:0|[1-9]\d*)$/;function Oo(i,e){var t=typeof i;return e=e??ow,!!e&&(t=="number"||t!="symbol"&&rw.test(i))&&i>-1&&i%1==0&&i<e}function Lo(i,e,t){e=="__proto__"&&lo?lo(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}function as(i,e){return i===e||i!==i&&e!==e}var aw=Object.prototype,lw=aw.hasOwnProperty;function Va(i,e,t){var n=i[e];(!(lw.call(i,e)&&as(n,t))||t===void 0&&!(e in i))&&Lo(i,e,t)}function ii(i,e,t,n){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var a=e[o],l=void 0;l===void 0&&(l=i[a]),s?Lo(t,a,l):Va(t,a,l)}return t}var $l=Math.max;function cw(i,e,t){return e=$l(e===void 0?i.length-1:e,0),function(){for(var n=arguments,s=-1,o=$l(n.length-e,0),r=Array(o);++s<o;)r[s]=n[e+s];s=-1;for(var a=Array(e+1);++s<e;)a[s]=n[s];return a[e]=t(r),Zb(i,this,a)}}function uw(i,e){return iw(cw(i,e,Dt),i+"")}var dw=9007199254740991;function Ba(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=dw}function Fo(i){return i!=null&&Ba(i.length)&&!hn(i)}function hw(i,e,t){if(!Z(t))return!1;var n=typeof e;return(n=="number"?Fo(t)&&Oo(e,t.length):n=="string"&&e in t)?as(t[e],i):!1}function Oh(i){return uw(function(e,t){var n=-1,s=t.length,o=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(o=i.length>3&&typeof o=="function"?(s--,o):void 0,r&&hw(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++n<s;){var a=t[n];a&&i(e,a,n,o)}return e})}var fw=Object.prototype;function Ma(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||fw;return i===t}function mw(i,e){for(var t=-1,n=Array(i);++t<i;)n[t]=e(t);return n}var gw="[object Arguments]";function Ul(i){return Ge(i)&&Kt(i)==gw}var Lh=Object.prototype,pw=Lh.hasOwnProperty,bw=Lh.propertyIsEnumerable,co=Ul(function(){return arguments}())?Ul:function(i){return Ge(i)&&pw.call(i,"callee")&&!bw.call(i,"callee")};function ww(){return!1}var Fh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hl=Fh&&typeof module=="object"&&module&&!module.nodeType&&module,_w=Hl&&Hl.exports===Fh,zl=_w?rt.Buffer:void 0,yw=zl?zl.isBuffer:void 0,Ui=yw||ww,vw="[object Arguments]",kw="[object Array]",Cw="[object Boolean]",Tw="[object Date]",Ew="[object Error]",Aw="[object Function]",xw="[object Map]",Sw="[object Number]",Iw="[object Object]",Pw="[object RegExp]",Rw="[object Set]",Vw="[object String]",Bw="[object WeakMap]",Mw="[object ArrayBuffer]",Ow="[object DataView]",Lw="[object Float32Array]",Fw="[object Float64Array
39]",Nw="[object Int8Array]",Dw="[object Int16Array]",$w="[object Int32Array]",Uw="[object Uint8Array]",Hw="[object Uint8ClampedArray]",zw="[object Uint16Array]",Ww="[object Uint32Array]",te={};te[Lw]=te[Fw]=te[Nw]=te[Dw]=te[$w]=te[Uw]=te[Hw]=te[zw]=te[Ww]=!0;te[vw]=te[kw]=te[Mw]=te[Cw]=te[Ow]=te[Tw]=te[Ew]=te[Aw]=te[xw]=te[Sw]=te[Iw]=te[Pw]=te[Rw]=te[Vw]=te[Bw]=!1;function qw(i){return Ge(i)&&Ba(i.length)&&!!te[Kt(i)]}function Oa(i){return function(e){return i(e)}}var Nh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=Nh&&typeof module=="object"&&module&&!module.nodeType&&module,jw=Pi&&Pi.exports===Nh,dr=jw&&Rh.process,Jn=function(){try{var i=Pi&&Pi.require&&Pi.require("util").types;return i||dr&&dr.binding&&dr.binding("util")}catch{}}(),Wl=Jn&&Jn.isTypedArray,La=Wl?Oa(Wl):qw,Gw=Object.prototype,Kw=Gw.hasOwnProperty;function Dh(i,e){var t=Ue(i),n=!t&&co(i),s=!t&&!n&&Ui(i),o=!t&&!n&&!s&&La(i),r=t||n||s||o,a=r?mw(i.length,String):[],l=a.length;for(var c in i)(e||Kw.call(i,c))&&!(r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Oo(c,l)))&&a.push(c);return a}function $h(i,e){return function(t){return i(e(t))}}var Jw=$h(Object.keys,Object),Zw=Object.prototype,Qw=Zw.hasOwnProperty;function Yw(i){if(!Ma(i))return Jw(i);var e=[];for(var t in Object(i))Qw.call(i,t)&&t!="constructor"&&e.push(t);return e}function ls(i){return Fo(i)?Dh(i):Yw(i)}function Xw(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var e_=Object.prototype,t_=e_.hasOwnProperty;function n_(i){if(!Z(i))return Xw(i);var e=Ma(i),t=[];for(var n in i)n=="constructor"&&(e||!t_.call(i,n))||t.push(n);return t}function si(i){return Fo(i)?Dh(i,!0):n_(i)}var Uh=Oh(function(i,e){ii(e,si(e),i)}),i_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s_=/^\w*$/;function Fa(i,e){if(Ue(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Mo(i)?!0:s_.test(i)||!i_.test(i)||e!=null&&i in Object(e)}var Hi=bn(Object,"create");function o_(){this.__data__=Hi?Hi(null):{},this.size=0}function r_(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var a_="__lodash_hash_undefined__",l_=Object.prototype,c_=l_.hasOwnProperty;function u_(i){var e=this.__data__;if(Hi){var t=e[i];return t===a_?void 0:t}return c_.call(e,i)?e[i]:void 0}var d_=Object.prototype,h_=d_.hasOwnProperty;function f_(i){var e=this.__data__;return Hi?e[i]!==void 0:h_.call(e,i)}var m_="__lodash_hash_undefined__";function g_(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=Hi&&e===void 0?m_:e,this}function fn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var n=i[e];this.set(n[0],n[1])}}fn.prototype.clear=o_;fn.prototype.delete=r_;fn.prototype.get=u_;fn.prototype.has=f_;fn.prototype.set=g_;function p_(){this.__data__=[],this.size=0}function No(i,e){for(var t=i.length;t--;)if(as(i[t][0],e))return t;return-1}var b_=Array.prototype,w_=b_.splice;function __(i){var e=this.__data__,t=No(e,i);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():w_.call(e,t,1),--this.size,!0}function y_(i){var e=this.__data__,t=No(e,i);return t<0?void 0:e[t][1]}function v_(i){return No(this.__data__,i)>-1}function k_(i,e){var t=this.__data__,n=No(t,i);return n<0?(++this.size,t.push([i,e])):t[n][1]=e,this}function Vt(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var n=i[e];this.set(n[0],n[1])}}Vt.prototype.clear=p_;Vt.prototype.delete=__;Vt.prototype.get=y_;Vt.prototype.has=v_;Vt.prototype.set=k_;var zi=bn(rt,"Map");function C_(){this.size=0,this.__data__={hash:new fn,map:new(zi||Vt),string:new fn}}function T_(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}function Do(i,e){var t=i.__data__;return T_(e)?t[typeof e=="string"?"string":"hash"]:t.map}function E_(i){var e=Do(this,i).delete(i);return this.size-=e?1:0,e}function A_(i){return Do(this,i).get(i)}function x_(i){return Do(this,i).has(i)}function S_(i,e){var t=Do(this,i),n=t.size;return t.set(i,e),this.size+=t.size==n?0:1,this}function Bt(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var n=i[e];this.set(n[0],n[1])}}Bt.prototype.clear=C_;Bt.prototype.delete=E_;Bt.prototype.get=A_;Bt.prototype.has=x_;Bt.prototype.set=S_;var I_="Expected a function";function Na(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(I_);var t=function(){var n=arguments,s=e?e.apply(this,n):n[0],o=t.cache;if(o.has(s))return o.get(s);var r=i.apply(this,n);return t.cache=o.set(s,r)||o,r};return t.cache=new(Na.Cache||Bt),t}Na.Cache=Bt;var P_=500;function R_(i){var e=Na(i,function(n){return t.size===P_&&t.clear(),n}),t=e.cache;return e}var V_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,B_=/\\(\\)?/g,M_=R_(function(i){var e=[];
39return i.charCodeAt(0)===46&&e.push(""),i.replace(V_,function(t,n,s,o){e.push(s?o.replace(B_,"$1"):n||t)}),e});function Da(i){return i==null?"":Bh(i)}function $o(i,e){return Ue(i)?i:Fa(i,e)?[i]:M_(Da(i))}function oi(i){if(typeof i=="string"||Mo(i))return i;var e=i+"";return e=="0"&&1/i==-1/0?"-0":e}function $a(i,e){e=$o(e,i);for(var t=0,n=e.length;i!=null&&t<n;)i=i[oi(e[t++])];return t&&t==n?i:void 0}function Wi(i,e,t){var n=i==null?void 0:$a(i,e);return n===void 0?t:n}function Hh(i,e){for(var t=-1,n=e.length,s=i.length;++t<n;)i[s+t]=e[t];return i}var Ua=$h(Object.getPrototypeOf,Object),O_="[object Object]",L_=Function.prototype,F_=Object.prototype,zh=L_.toString,N_=F_.hasOwnProperty,D_=zh.call(Object);function Oe(i){if(!Ge(i)||Kt(i)!=O_)return!1;var e=Ua(i);if(e===null)return!0;var t=N_.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&zh.call(t)==D_}function Wh(i,e,t){var n=-1,s=i.length;e<0&&(e=-e>s?0:s+e),t=t>s?s:t,t<0&&(t+=s),s=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(s);++n<s;)o[n]=i[n+e];return o}function $_(i,e,t){var n=i.length;return t=t===void 0?n:t,!e&&t>=n?i:Wh(i,e,t)}var U_="\\ud800-\\udfff",H_="\\u0300-\\u036f",z_="\\ufe20-\\ufe2f",W_="\\u20d0-\\u20ff",q_=H_+z_+W_,j_="\\ufe0e\\ufe0f",G_="\\u200d",K_=RegExp("["+G_+U_+q_+j_+"]");function qh(i){return K_.test(i)}function J_(i){return i.split("")}var jh="\\ud800-\\udfff",Z_="\\u0300-\\u036f",Q_="\\ufe20-\\ufe2f",Y_="\\u20d0-\\u20ff",X_=Z_+Q_+Y_,e0="\\ufe0e\\ufe0f",t0="["+jh+"]",Hr="["+X_+"]",zr="\\ud83c[\\udffb-\\udfff]",n0="(?:"+Hr+"|"+zr+")",Gh="[^"+jh+"]",Kh="(?:\\ud83c[\\udde6-\\uddff]){2}",Jh="[\\ud800-\\udbff][\\udc00-\\udfff]",i0="\\u200d",Zh=n0+"?",Qh="["+e0+"]?",s0="(?:"+i0+"(?:"+[Gh,Kh,Jh].join("|")+")"+Qh+Zh+")*",o0=Qh+Zh+s0,r0="(?:"+[Gh+Hr+"?",Hr,Kh,Jh,t0].join("|")+")",a0=RegExp(zr+"(?="+zr+")|"+r0+o0,"g");function l0(i){return i.match(a0)||[]}function c0(i){return qh(i)?l0(i):J_(i)}function u0(i){return function(e){e=Da(e);var t=qh(e)?c0(e):void 0,n=t?t[0]:e.charAt(0),s=t?$_(t,1).join(""):e.slice(1);return n[i]()+s}}var d0=u0("toUpperCase");function h0(){this.__data__=new Vt,this.size=0}function f0(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}function m0(i){return this.__data__.get(i)}function g0(i){return this.__data__.has(i)}var p0=200;function b0(i,e){var t=this.__data__;if(t instanceof Vt){var n=t.__data__;if(!zi||n.length<p0-1)return n.push([i,e]),this.size=++t.size,this;t=this.__data__=new Bt(n)}return t.set(i,e),this.size=t.size,this}function it(i){var e=this.__data__=new Vt(i);this.size=e.size}it.prototype.clear=h0;it.prototype.delete=f0;it.prototype.get=m0;it.prototype.has=g0;it.prototype.set=b0;function w0(i,e){return i&&ii(e,ls(e),i)}function _0(i,e){return i&&ii(e,si(e),i)}var Yh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ql=Yh&&typeof module=="object"&&module&&!module.nodeType&&module,y0=ql&&ql.exports===Yh,jl=y0?rt.Buffer:void 0,Gl=jl?jl.allocUnsafe:void 0;function Xh(i,e){if(e)return i.slice();var t=i.length,n=Gl?Gl(t):new i.constructor(t);return i.copy(n),n}function v0(i,e){for(var t=-1,n=i==null?0:i.length,s=0,o=[];++t<n;){var r=i[t];e(r,t,i)&&(o[s++]=r)}return o}function ef(){return[]}var k0=Object.prototype,C0=k0.propertyIsEnumerable,Kl=Object.getOwnPropertySymbols,Ha=Kl?function(i){return i==null?[]:(i=Object(i),v0(Kl(i),function(e){return C0.call(i,e)}))}:ef;function T0(i,e){return ii(i,Ha(i),e)}var E0=Object.getOwnPropertySymbols,tf=E0?function(i){for(var e=[];i;)Hh(e,Ha(i)),i=Ua(i);return e}:ef;function A0(i,e){return ii(i,tf(i),e)}function nf(i,e,t){var n=e(i);return Ue(i)?n:Hh(n,t(i))}function Wr(i){return nf(i,ls,Ha)}function x0(i){return nf(i,si,tf)}var qr=bn(rt,"DataView"),jr=bn(rt,"Promise"),Gr=bn(rt,"Set"),Jl="[object Map]",S0="[object Object]",Zl="[object Promise]",Ql="[object Set]",Yl="[object WeakMap]",Xl="[object DataView]",I0=pn(qr),P0=pn(zi),R0=pn(jr),V0=pn(Gr),B0=pn(Ur),Xe=Kt;(qr&&Xe(new qr(new ArrayBuffer(1)))!=Xl||zi&&Xe(new zi)!=Jl||jr&&Xe(jr.resolve())!=Zl||Gr&&Xe(new Gr)!=Ql||Ur&&Xe(new Ur)!=Yl)&&(Xe=function(i){var e=Kt(i),t=e==S0?i.constructor:void 0,n=t?pn(t):"";if(n)switch(n){case I0:return Xl;case P0:return Jl;case R0:return Zl;case V0:return Ql;case B0:return Yl}return e});var M0=Object.prototype,O0=M0.hasOwnProperty;function L0(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&O0.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var uo=rt.Uint8Array;function za(i){var e=new i.constructor(i.byteLength);return new uo(e).set(new uo(i)),e}function F0(i,e){var t=e?za(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var N0=/\w*$/;function D0(i){var e=new i.constructor(i.source,N0.exec(i));return e.lastIndex=i.lastIndex,e}
39var ec=mt?mt.prototype:void 0,tc=ec?ec.valueOf:void 0;function $0(i){return tc?Object(tc.call(i)):{}}function sf(i,e){var t=e?za(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var U0="[object Boolean]",H0="[object Date]",z0="[object Map]",W0="[object Number]",q0="[object RegExp]",j0="[object Set]",G0="[object String]",K0="[object Symbol]",J0="[object ArrayBuffer]",Z0="[object DataView]",Q0="[object Float32Array]",Y0="[object Float64Array]",X0="[object Int8Array]",e1="[object Int16Array]",t1="[object Int32Array]",n1="[object Uint8Array]",i1="[object Uint8ClampedArray]",s1="[object Uint16Array]",o1="[object Uint32Array]";function r1(i,e,t){var n=i.constructor;switch(e){case J0:return za(i);case U0:case H0:return new n(+i);case Z0:return F0(i,t);case Q0:case Y0:case X0:case e1:case t1:case n1:case i1:case s1:case o1:return sf(i,t);case z0:return new n;case W0:case G0:return new n(i);case q0:return D0(i);case j0:return new n;case K0:return $0(i)}}function of(i){return typeof i.constructor=="function"&&!Ma(i)?Jb(Ua(i)):{}}var a1="[object Map]";function l1(i){return Ge(i)&&Xe(i)==a1}var nc=Jn&&Jn.isMap,c1=nc?Oa(nc):l1,u1="[object Set]";function d1(i){return Ge(i)&&Xe(i)==u1}var ic=Jn&&Jn.isSet,h1=ic?Oa(ic):d1,f1=1,m1=2,g1=4,rf="[object Arguments]",p1="[object Array]",b1="[object Boolean]",w1="[object Date]",_1="[object Error]",af="[object Function]",y1="[object GeneratorFunction]",v1="[object Map]",k1="[object Number]",lf="[object Object]",C1="[object RegExp]",T1="[object Set]",E1="[object String]",A1="[object Symbol]",x1="[object WeakMap]",S1="[object ArrayBuffer]",I1="[object DataView]",P1="[object Float32Array]",R1="[object Float64Array]",V1="[object Int8Array]",B1="[object Int16Array]",M1="[object Int32Array]",O1="[object Uint8Array]",L1="[object Uint8ClampedArray]",F1="[object Uint16Array]",N1="[object Uint32Array]",Y={};Y[rf]=Y[p1]=Y[S1]=Y[I1]=Y[b1]=Y[w1]=Y[P1]=Y[R1]=Y[V1]=Y[B1]=Y[M1]=Y[v1]=Y[k1]=Y[lf]=Y[C1]=Y[T1]=Y[E1]=Y[A1]=Y[O1]=Y[L1]=Y[F1]=Y[N1]=!0;Y[_1]=Y[af]=Y[x1]=!1;function Kn(i,e,t,n,s,o){var r,a=e&f1,l=e&m1,c=e&g1;if(t&&(r=s?t(i,n,s,o):t(i)),r!==void 0)return r;if(!Z(i))return i;var u=Ue(i);if(u){if(r=L0(i),!a)return Mh(i,r)}else{var d=Xe(i),h=d==af||d==y1;if(Ui(i))return Xh(i,a);if(d==lf||d==rf||h&&!s){if(r=l||h?{}:of(i),!a)return l?A0(i,_0(r,i)):T0(i,w0(r,i))}else{if(!Y[d])return s?i:{};r=r1(i,d,a)}}o||(o=new it);var f=o.get(i);if(f)return f;o.set(i,r),h1(i)?i.forEach(function(_){r.add(Kn(_,e,t,_,i,o))}):c1(i)&&i.forEach(function(_,v){r.set(v,Kn(_,e,t,v,i,o))});var m=c?l?x0:Wr:l?si:ls,p=u?void 0:m(i);return sw(p||i,function(_,v){p&&(v=_,_=i[v]),Va(r,v,Kn(_,e,t,v,i,o))}),r}var D1=4;function cf(i){return Kn(i,D1)}var $1=1,U1=4;function at(i){return Kn(i,$1|U1)}var H1=1,z1=4;function Wa(i,e){return e=typeof e=="function"?e:void 0,Kn(i,H1|z1,e)}var W1="__lodash_hash_undefined__";function q1(i){return this.__data__.set(i,W1),this}function j1(i){return this.__data__.has(i)}function ho(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new Bt;++e<t;)this.add(i[e])}ho.prototype.add=ho.prototype.push=q1;ho.prototype.has=j1;function G1(i,e){for(var t=-1,n=i==null?0:i.length;++t<n;)if(e(i[t],t,i))return!0;return!1}function K1(i,e){return i.has(e)}var J1=1,Z1=2;function uf(i,e,t,n,s,o){var r=t&J1,a=i.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(i),u=o.get(e);if(c&&u)return c==e&&u==i;var d=-1,h=!0,f=t&Z1?new ho:void 0;for(o.set(i,e),o.set(e,i);++d<a;){var m=i[d],p=e[d];if(n)var _=r?n(p,m,d,e,i,o):n(m,p,d,i,e,o);if(_!==void 0){if(_)continue;h=!1;break}if(f){if(!G1(e,function(v,T){if(!K1(f,T)&&(m===v||s(m,v,t,n,o)))return f.push(T)})){h=!1;break}}else if(!(m===p||s(m,p,t,n,o))){h=!1;break}}return o.delete(i),o.delete(e),h}function Q1(i){var e=-1,t=Array(i.size);return i.forEach(function(n,s){t[++e]=[s,n]}),t}function Y1(i){var e=-1,t=Array(i.size);return i.forEach(function(n){t[++e]=n}),t}var X1=1,ey=2,ty="[object Boolean]",ny="[object Date]",iy="[object Error]",sy="[object Map]",oy="[object Number]",ry="[object RegExp]",ay="[object Set]",ly="[object String]",cy="[object Symbol]",uy="[object ArrayBuffer]",dy="[object DataView]",sc=mt?mt.prototype:void 0,hr=sc?sc.valueOf
vendor: 1,659 bytes, line 39
39:void 0;function hy(i,e,t,n,s,o,r){switch(t){case dy:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case uy:return!(i.byteLength!=e.byteLength||!o(new uo(i),new uo(e)));case ty:case ny:case oy:return as(+i,+e);case iy:return i.name==e.name&&i.message==e.message;case ry:case ly:return i==e+"";case sy:var a=Q1;case ay:var l=n&X1;if(a||(a=Y1),i.size!=e.size&&!l)return!1;var c=r.get(i);if(c)return c==e;n|=ey,r.set(i,e);var u=uf(a(i),a(e),n,s,o,r);return r.delete(i),u;case cy:if(hr)return hr.call(i)==hr.call(e)}return!1}var fy=1,my=Object.prototype,gy=my.hasOwnProperty;function py(i,e,t,n,s,o){var r=t&fy,a=Wr(i),l=a.length,c=Wr(e),u=c.length;if(l!=u&&!r)return!1;for(var d=l;d--;){var h=a[d];if(!(r?h in e:gy.call(e,h)))return!1}var f=o.get(i),m=o.get(e);if(f&&m)return f==e&&m==i;var p=!0;o.set(i,e),o.set(e,i);for(var _=r;++d<l;){h=a[d];var v=i[h],T=e[h];if(n)var L=r?n(T,v,h,e,i,o):n(v,T,h,i,e,o);if(!(L===void 0?v===T||s(v,T,t,n,o):L)){p=!1;break}_||(_=h=="constructor")}if(p&&!_){var U=i.constructor,K=e.constructor;U!=K&&"constructor"in i&&"constructor"in e&&!(typeof U=="function"&&U instanceof U&&typeof K=="function"&&K instanceof K)&&(p=!1)}return o.delete(i),o.delete(e),p}var by=1,oc="[object Arguments]",rc="[object Array]",_s="[object Object]",wy=Object.prototype,ac=wy.hasOwnProperty;function _y(i,e,t,n,s,o){var r=Ue(i),a=Ue(e),l=r?rc:Xe(i),c=a?rc:Xe(e);l=l==oc?_s:l,c=c==oc?_s:c;var u=l==_s,d=c==_s,h=l==c;if(h&&Ui(i)){if(!Ui(e))return!1;r=!0,u=!1}if(h&&!u)return o||(o=new it),r||La(i)?uf(i,e,t,n,s,o):hy(i,e,l,t,n,s,o);if(!(t&by)){var f=u&&ac.call(i,"__wrapped__"),m=d&&ac.call(e,"__wrapped__");
39if(f||m){var p=f?i.value():i,_=m?e.value():e;return o||(o=new it),s(p,_,t,n,o)}}return h?(o||(o=new it),py(i,e,t,n,s,o)):!1}function cs(i,e,t,n,s){return i===e?!0:i==null||e==null||!Ge(i)&&!Ge(e)?i!==i&&e!==e:_y(i,e,t,n,cs,s)}var yy=1,vy=2;function ky(i,e,t,n){var s=t.length,o=s;if(i==null)return!o;for(i=Object(i);s--;){var r=t[s];if(r[2]?r[1]!==i[r[0]]:!(r[0]in i))return!1}for(;++s<o;){r=t[s];var a=r[0],l=i[a],c=r[1];if(r[2]){if(l===void 0&&!(a in i))return!1}else{var u=new it,d;if(!(d===void 0?cs(c,l,yy|vy,n,u):d))return!1}}return!0}function df(i){return i===i&&!Z(i)}function Cy(i){for(var e=ls(i),t=e.length;t--;){var n=e[t],s=i[n];e[t]=[n,s,df(s)]}return e}function hf(i,e){return function(t){return t==null?!1:t[i]===e&&(e!==void 0||i in Object(t))}}function Ty(i){var e=Cy(i);return e.length==1&&e[0][2]?hf(e[0][0],e[0][1]):function(t){return t===i||ky(t,i,e)}}function Ey(i,e){return i!=null&&e in Object(i)}function Ay(i,e,t){e=$o(e,i);for(var n=-1,s=e.length,o=!1;++n<s;){var r=oi(e[n]);if(!(o=i!=null&&t(i,r)))break;i=i[r]}return o||++n!=s?o:(s=i==null?0:i.length,!!s&&Ba(s)&&Oo(r,s)&&(Ue(i)||co(i)))}function xy(i,e){return i!=null&&Ay(i,e,Ey)}var Sy=1,Iy=2;function Py(i,e){return Fa(i)&&df(e)?hf(oi(i),e):function(t){var n=Wi(t,i);return n===void 0&&n===e?xy(t,i):cs(e,n,Sy|Iy)}}function Ry(i){return function(e){return e==null?void 0:e[i]}}function Vy(i){return function(e){return $a(e,i)}}function By(i){return Fa(i)?Ry(oi(i)):Vy(i)}function My(i){return typeof i=="function"?i:i==null?Dt:typeof i=="object"?Ue(i)?Py(i[0],i[1]):Ty(i):By(i)}function Oy(i){return function(e,t,n){for(var s=-1,o=Object(e),r=n(e),a=r.length;a--;){var l=r[++s];if(t(o[l],l,o)===!1)break}return e}}var ff=Oy();function Ly(i,e){return i&&ff(i,e,ls)}var fr=function(){return rt.Date.now()},Fy="Expected a function",Ny=Math.max,Dy=Math.min;function gt(i,e,t){var n,s,o,r,a,l,c=0,u=!1,d=!1,h=!0;if(typeof i!="function")throw new TypeError(Fy);e=Fl(e)||0,Z(t)&&(u=!!t.leading,d="maxWait"in t,o=d?Ny(Fl(t.maxWait)||0,e):o,h="trailing"in t?!!t.trailing:h);function f(x){var V=n,I=s;return n=s=void 0,c=x,r=i.apply(I,V),r}function m(x){return c=x,a=setTimeout(v,e),u?f(x):r}function p(x){var V=x-l,I=x-c,ee=e-V;return d?Dy(ee,o-I):ee}function _(x){var V=x-l,I=x-c;return l===void 0||V>=e||V<0||d&&I>=o}function v(){var x=fr();if(_(x))return T(x);a=setTimeout(v,p(x))}function T(x){return a=void 0,h&&n?f(x):(n=s=void 0,r)}function L(){a!==void 0&&clearTimeout(a),c=0,n=l=s=a=void 0}function U(){return a===void 0?r:T(fr())}function K(){var x=fr(),V=_(x);if(n=arguments,s=this,l=x,V){if(a===void 0)return m(l);if(d)return clearTimeout(a),a=setTimeout(v,e),f(l)}return a===void 0&&(a=setTimeout(v,e)),r}return K.cancel=L,K.flush=U,K}function Kr(i,e,t){(t!==void 0&&!as(i[e],t)||t===void 0&&!(e in i))&&Lo(i,e,t)}function $y(i){return Ge(i)&&Fo(i)}function Jr(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}function Uy(i){return ii(i,si(i))}function Hy(i,e,t,n,s,o,r){var a=Jr(i,t),l=Jr(e,t),c=r.get(l);if(c){Kr(i,t,c);return}var u=o?o(a,l,t+"",i,e,r):void 0,d=u===void 0;if(d){var h=Ue(l),f=!h&&Ui(l),m=!h&&!f&&La(l);u=l,h||f||m?Ue(a)?u=a:$y(a)?u=Mh(a):f?(d=!1,u=Xh(l,!0)):m?(d=!1,u=sf(l,!0)):u=[]:Oe(l)||co(l)?(u=a,co(a)?u=Uy(a):(!Z(a)||hn(a))&&(u=of(l))):d=!1}d&&(r.set(l,u),s(u,l,n,o,r),r.delete(l)),Kr(i,t,u)}function mf(i,e,t,n,s){i!==e&&ff(e,function(o,r){if(s||(s=new it),Z(o))Hy(i,e,r,t,mf,n,s);else{var a=n?n(Jr(i,r),o,r+"",i,e,s):void 0;a===void 0&&(a=o),Kr(i,r,a)}},si)}function zy(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var gf=/[\\^$.*+?()[\]{}|]/g,Wy=RegExp(gf.source);function qa(i){return i=Da(i),i&&Wy.test(i)?i.replace(gf,"\\$&"):i}var qy="[object String]";function lc(i){return typeof i=="string"||!Ue(i)&&Ge(i)&&Kt(i)==qy}function jy(i,e){return e.length<2?i:$a(i,Wh(e,0,-1))}function Ht(i){return Ge(i)&&i.nodeType===1&&!Oe(i)}function cc(i,e){return cs(i,e)}function Gy(i,e,t){t=typeof t=="function"?t:void 0;var n=t?t(i,e):void 0;return n===void 0?cs(i,e,void 0,t):!!n}function Ky(i,e){var t={};return e=My(e),Ly(i,function(n,s,o){Lo(t,s,e(n,s,o))}),t}var ja=Oh(function(i,e,t){mf(i,e,t)});function Jy(i,e){return e=$o(e,i),i=jy(i,e),i==null||delete i[oi(zy(e))]}
39function Zy(i,e,t,n){if(!Z(i))return i;e=$o(e,i);for(var s=-1,o=e.length,r=o-1,a=i;a!=null&&++s<o;){var l=oi(e[s]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return i;if(s!=r){var u=a[l];c=void 0,c===void 0&&(c=Z(u)?u:Oo(e[s+1])?[]:{})}Va(a,l,c),a=a[l]}return i}function Qy(i,e,t){return i==null?i:Zy(i,e,t)}var Yy="Expected a function";function qi(i,e,t){var n=!0,s=!0;if(typeof i!="function")throw new TypeError(Yy);return Z(t)&&(n="leading"in t?!!t.leading:n,s="trailing"in t?!!t.trailing:s),gt(i,e,{leading:n,maxWait:e,trailing:s})}function Xy(i,e){return i==null?!0:Jy(i,e)}/**
40 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
41 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
42 */const fo=Symbol("observableProperties"),Uo=Symbol("boundObservables"),mo=Symbol("boundProperties"),Rn=Symbol("decoratedMethods"),uc=Symbol("decoratedOriginal"),pf=W(G());function W(i){if(!i)return pf;class e extends i{set(n,s){if(Z(n)){Object.keys(n).forEach(r=>{this.set(r,n[r])},this);return}mr(this);const o=this[fo];if(n in this&&!o.has(n))throw new g("observable-set-cannot-override",this);Object.defineProperty(this,n,{enumerable:!0,configurable:!0,get(){return o.get(n)},set(r){const a=o.get(n);let l=this.fire(`set:${n}`,n,r,a);l===void 0&&(l=r),(a!==l||!o.has(n))&&(o.set(n,l),this.fire(`change:${n}`,n,l,a))}}),this[n]=s}bind(...n){if(!n.length||!dc(n))throw new g("observable-bind-wrong-properties",this);if(new Set(n).size!==n.length)throw new g("observable-bind-duplicate-properties",this);mr(this);const s=this[mo];n.forEach(r=>{if(s.has(r))throw new g("observable-bind-rebind",this)});const o=new Map;return n.forEach(r=>{const a={property:r,to:[]};s.set(r,a),o.set(r,a)}),{to:ev,toMany:tv,_observable:this,_bindProperties:n,_to:[],_bindings:o}}unbind(...n){if(!this[fo])return;const s=this[mo],o=this[Uo];if(n.length){if(!dc(n))throw new g("observable-unbind-wrong-properties",this);n.forEach(r=>{const a=s.get(r);a&&(a.to.forEach(([l,c])=>{const u=o.get(l),d=u[c];d.delete(a),d.size||delete u[c],Object.keys(u).length||(o.delete(l),this.stopListening(l,"change"))}),s.delete(r))})}else o.forEach((r,a)=>{this.stopListening(a,"change")}),o.clear(),s.clear()}decorate(n){mr(this);const s=this[n];if(!s)throw new g("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:n});this.on(n,(o,r)=>{o.return=s.apply(this,r)}),this[n]=function(...o){return this.fire(n,o)},this[n][uc]=s,this[Rn]||(this[Rn]=[]),this[Rn].push(n)}stopListening(n,s,o){if(!n&&this[Rn]){for(const r of this[Rn])this[r]=this[r][uc];delete this[Rn]}super.stopListening(n,s,o)}}return e}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(i=>{W[i]=pf.prototype[i]});function mr(i){i[fo]||(Object.defineProperty(i,fo,{value:new Map}),Object.defineProperty(i,Uo,{value:new Map}),Object.defineProperty(i,mo,{value:new Map}))}function ev(...i){const e=iv(...i),t=Array.from(this._bindings.keys()),n=t.length;if(!e.callback&&e.to.length>1)throw new g("observable-bind-to-no-callback",this);if(n>1&&e.callback)throw new g("observable-bind-to-extra-callback",this);e.to.forEach(s=>{if(s.properties.length&&s.properties.length!==n)throw new g("observable-bind-to-properties-length",this);s.properties.length||(s.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(t[0]).callback=e.callback),rv(this._observable,this._to),ov(this),this._bindProperties.forEach(s=>{bf(this._observable,s)})}function tv(i,e,t){if(this._bindings.size>1)throw new g("observable-bind-to-many-not-one-binding",this);this.to(...nv(i,e),t)}function nv(i,e){const t=i.map(n=>[n,e]);return Array.prototype.concat.apply([],t)}function dc(i){return i.every(e=>typeof e=="string")}function iv(...i){if(!i.length)throw new g("observable-bind-to-parse-error",null);const e={to:[]};let t;return typeof i[i.length-1]=="function"&&(e.callback=i.pop()),i.forEac
42h(n=>{if(typeof n=="string")t.properties.push(n);else if(typeof n=="object")t={observable:n,properties:[]},e.to.push(t);else throw new g("observable-bind-to-parse-error",null)}),e}function sv(i,e,t,n){const s=i[Uo],o=s.get(t),r=o||{};r[n]||(r[n]=new Set),r[n].add(e),o||s.set(t,r)}function ov(i){let e;i._bindings.forEach((t,n)=>{i._to.forEach(s=>{e=s.properties[t.callback?0:i._bindProperties.indexOf(n)],t.to.push([s.observable,e]),sv(i._observable,t,s.observable,e)})})}function bf(i,e){const n=i[mo].get(e);let s;n.callback?s=n.callback.apply(i,n.to.map(o=>o[0][o[1]])):(s=n.to[0],s=s[0][s[1]]),Object.prototype.hasOwnProperty.call(i,e)?i[e]=s:i.set(e,s)}function rv(i,e){e.forEach(t=>{const n=i[Uo];let s;n.get(t.observable)||i.listenTo(t.observable,"change",(o,r)=>{s=n.get(t.observable)[r],s&&s.forEach(a=>{bf(i,a.property)})})})}/**
43 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
44 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
45 */class wf{constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach(({element:e,newElement:t})=>{e.style.display="",t&&t.remove()}),this._replacedElements=[]}}/**
46 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
47 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
48 */function Zr(i){let e=0;for(const t of i)e++;return e}/**
49 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
50 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
51 */function Te(i,e){const t=Math.min(i.length,e.length);for(let n=0;n<t;n++)if(i[n]!=e[n])return n;return i.length==e.length?"same":i.length<e.length?"prefix":"extension"}/**
52 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
53 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
54 */function He(i){return!!(i&&i[Symbol.iterator])}/**
55 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
56 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
57 */function Ve(i,e,t={},n=[]){const s=t&&t.xmlns,o=s?i.createElementNS(s,e):i.createElement(e);for(const r in t)o.setAttribute(r,t[r]);(lc(n)||!He(n))&&(n=[n]);for(let r of n)lc(r)&&(r=i.createTextNode(r)),o.appendChild(r);return o}/**
58 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
59 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
60 */class _f{constructor(e,t){this._config={},t&&this.define(hc(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,n,s=!1){if(Oe(t)){this._setObjectToTarget(e,t,s);return}const o=t.split(".");t=o.pop();for(const r of o)Oe(e[r])||(e[r]={}),e=e[r];if(Oe(n)){Oe(e[t])||(e[t]={}),e=e[t],this._setObjectToTarget(e,n,s);return}s&&typeof e[t]<"u"||(e[t]=n)}_getFromSource(e,t){const n=t.split(".");t=n.pop();for(const s of n){if(!Oe(e[s])){e=null;break}e=e[s]}return e?hc(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach(s=>{this._setToTarget(e,s,t[s],n)})}}function hc(i){return Wa(i,av)}function av(i){return Ht(i)||typeof i=="function"?i:void 0}/**
61 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
62 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
63 */function zt(i){if(i){if(i.defaultView)return i instanceof i.defaultView.Document;if(i.ownerDocument&&i.ownerDocument.defaultView)return i instanceof i.ownerDocument.defaultView.Node}return!1}/**
64 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
65 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
66 */function go(i){const e=Object.prototype.toString.apply(i);return e=="[object Window]"||e=="[object global]"}/**
67 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
68 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
69 */const yf=Qe(G());function Qe(i){if(!i)return yf;class e extends i{listenTo(n,s,o,r={}){if(zt(n)||go(n)){const a={capture:!!r.useCapture,passive:!!r.usePassive},l=this._getProxyEmitter(n,a)||new lv(n,a);this.listenTo(l,s,o,r)}else super.listenTo(n,s,o,r)}stopListening(n,s,o){if(zt(n)||go(n)){const r=this._getAllProxyEmitters(n);for(const a of r)this.stopListening(a,s,o)}else super.stopListening(n,s,o)}_getProxyEmitter(n,s){return ub(this,vf(n,s))}_getAllProxyEmitters(n){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(s=>this._getProxyEmitter(n,s)).filter(s=>!!s)}}return e}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(i=>
69{Qe[i]=yf.prototype[i]});class lv extends G(){constructor(e,t){super(),Sh(this,vf(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;this._domListeners[e]&&(!(t=this._events[e])||!t.callbacks.length)&&this._domListeners[e].removeListener()}_addEventListener(e,t,n){this.attach(e),G().prototype._addEventListener.call(this,e,t,n)}_removeEventListener(e,t){G().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=n=>{this.fire(e,n)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function cv(i){return i["data-ck-expando"]||(i["data-ck-expando"]=$e())}function vf(i,e){let t=cv(i);for(const n of Object.keys(e).sort())e[n]&&(t+="-"+n);return t}/**
70 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
71 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
72 */function uv(i){const e=[];let t=i;for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}/**
73 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
74 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
75 */function dv(i){return i instanceof HTMLTextAreaElement?i.value:i.innerHTML}/**
76 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
77 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
78 */function kf(i){const e=i.ownerDocument.defaultView.getComputedStyle(i);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}/**
79 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
80 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
81 */function le(i){return Object.prototype.toString.call(i)=="[object Text]"}/**
82 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
83 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
84 */function Ho(i){return Object.prototype.toString.apply(i)=="[object Range]"}/**
85 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
86 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
87 */function Cf(i){return!i||!i.parentNode||i.offsetParent===A.document.body?null:i.offsetParent}/**
88 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
89 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
90 */const Tf=["top","right","bottom","left","width","height"];class O{constructor(e){const t=Ho(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),Qr(e)||t)if(t){const n=O.getDomRangeRects(e);ys(this,O.getBoundingRect(n))}else ys(this,e.getBoundingClientRect());else if(go(e)){const{innerWidth:n,innerHeight:s}=e;ys(this,{top:0,right:n,bottom:s,left:0,width:n,height:s})}else ys(this,e)}clone(){return new O(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const n=new O(t);return n._source=this._source,n}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(fc(e))return t;let n=e,s=e.parentNode||e.commonAncestorContainer,o;for(;s&&!fc(s);){const r=hv(s)==="visible";n instanceof HTMLElement&&mc(n)==="absolute"&&(o=n);const a=mc(s);if(r||o&&(a==="relative"&&r||a!=="relative")){n=s,s=s.parentNode;continue}const l=new O(s),c=t.getIntersection(l);if(c)c.getArea()<t.getArea()&&(t=c);else return null;n=s,s=s.parentNode}return t}isEqual(e){for(const t of Tf)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!!(t&&t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=A.window,n=this.clone().moveBy(e,t);if(Qr(n._source)){const s=Cf(n._source);s&&fv(n,s)}return n}excludeScrollbarsAndBorders(){const e=this._source;let t,n,s;if(go(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHe
90ight-e.document.documentElement.clientHeight,s=e.getComputedStyle(e.document.documentElement).direction;else{const o=kf(e);t=e.offsetWidth-e.clientWidth-o.left-o.right,n=e.offsetHeight-e.clientHeight-o.top-o.bottom,s=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=o.left,this.top+=o.top,this.right-=o.right,this.bottom-=o.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,s==="ltr"?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(e){const t=[],n=Array.from(e.getClientRects());if(n.length)for(const s of n)t.push(new O(s));else{let s=e.startContainer;le(s)&&(s=s.parentNode);const o=new O(s.getBoundingClientRect());o.right=o.left,o.width=0,t.push(o)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let n=0;for(const s of e)n++,t.left=Math.min(t.left,s.left),t.top=Math.min(t.top,s.top),t.right=Math.max(t.right,s.right),t.bottom=Math.max(t.bottom,s.bottom);return n==0?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new O(t))}}function ys(i,e){for(const t of Tf)i[t]=e[t]}function fc(i){return Qr(i)?i===i.ownerDocument.body:!1}function Qr(i){return i!==null&&typeof i=="object"&&i.nodeType===1&&typeof i.getBoundingClientRect=="function"}function mc(i){return i instanceof HTMLElement?i.ownerDocument.defaultView.getComputedStyle(i).position:"static"}function hv(i){return i instanceof HTMLElement?i.ownerDocument.defaultView.getComputedStyle(i).overflow:"visible"}function fv(i,e){const t=new O(e),n=kf(e);let s=0,o=0;s-=t.left,o-=t.top,s+=e.scrollLeft,o+=e.scrollTop,s-=n.left,o-=n.top,i.moveBy(s,o)}/**
91 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
92 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
93 */class X{constructor(e,t){X._observerInstance||X._createObserver(),this._element=e,this._callback=t,X._addElementCallback(e,t),X._observerInstance.observe(e)}get element(){return this._element}destroy(){X._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){X._elementCallbacks||(X._elementCallbacks=new Map);let n=X._elementCallbacks.get(e);n||(n=new Set,X._elementCallbacks.set(e,n)),n.add(t)}static _deleteElementCallback(e,t){const n=X._getElementCallbacks(e);n&&(n.delete(t),n.size||(X._elementCallbacks.delete(e),X._observerInstance.unobserve(e))),X._elementCallbacks&&!X._elementCallbacks.size&&(X._observerInstance=null,X._elementCallbacks=null)}static _getElementCallbacks(e){return X._elementCallbacks?X._elementCallbacks.get(e):null}static _createObserver(){X._observerInstance=new A.window.ResizeObserver(e=>{for(const t of e){const n=X._getElementCallbacks(t.target);if(n)for(const s of n)s(t)}})}}X._observerInstance=null;X._elementCallbacks=null;/**
94 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
95 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
96 */function gc(i,e){i instanceof HTMLTextAreaElement&&(i.value=e),i.innerHTML=e}/**
97 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
98 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
99 */function ri(i){return e=>e+i}/**
100 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
101 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
102 */function Ei(i){let e=0;for(;i.previousSibling;)i=i.previousSibling,e++;return e}/**
103 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
104 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
105 */function Ef(i,e,t){i.insertBefore(t,i.childNodes[e]||null)}/**
106 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
107 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
108 */function Ri(i){return i&&i.nodeType===Node.COMMENT_NODE}/**
109 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
110 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
111 */function mv(i){try{A.document.createAttribute(i)}catch{return!1}return!0}/**
112 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
113 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
114 */function Wt(i){return!!(i&&i.getClientRects&&i.getClientRects().length)}/**
115 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
116 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
117 */function zo({element:i,target:e,positions:t,limiter:n,fitInViewport:s,viewportOffsetConfig:o}){hn(e)&&(e=e()),hn(n)&&(n=n());const r=Cf(i),a=gv(o),l=new O(i),c=pc(e,a);let u;if(!c||!a.getIntersection(c))return null;const d={targetRect:c,elementRect:l,positionedElementAncestor:r,viewportRect:a};if(!n&&!s)u=new Af(t[0],d);else{if(n){const h=pc(n,a);h&&(d.limiterRect=h)}u=pv(t,d)}return u}function pc(i,e){const t=new O(i).getVisible();return t?t.getIntersection(e):null}
117function gv(i){i=Object.assign({top:0,bottom:0,left:0,right:0},i);const e=new O(A.window);return e.top+=i.top,e.height-=i.top,e.bottom-=i.bottom,e.height-=i.bottom,e}function pv(i,e){const{elementRect:t}=e,n=t.getArea(),s=i.map(a=>new Af(a,e)).filter(a=>!!a.name);let o=0,r=null;for(const a of s){const{limiterIntersectionArea:l,viewportIntersectionArea:c}=a;if(l===n)return a;const u=c**2+l**2;u>o&&(o=u,r=a)}return r}class Af{constructor(e,t){const n=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!n)return;const{left:s,top:o,name:r,config:a}=n;this.name=r,this.config=a,this._positioningFunctionCoordinates={left:s,top:o},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect?this._cachedRect:(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top),this._cachedRect)}get _absoluteRect(){return this._cachedAbsoluteRect?this._cachedAbsoluteRect:(this._cachedAbsoluteRect=this._rect.toAbsoluteRect(),this._cachedAbsoluteRect)}}/**
118 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
119 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
120 */function bc(i){const e=i.parentNode;e&&e.removeChild(i)}/**
121 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
122 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
123 */function xf({target:i,viewportOffset:e=0,ancestorOffset:t=0,alignToTop:n,forceScroll:s}){const o=Ga(i);let r=o,a=null;for(e=_v(e);r;){let l;r==o?l=wc(i):l=wc(a),wv({parent:l,getRect:()=>_c(i,r),alignToTop:n,ancestorOffset:t,forceScroll:s});const c=_c(i,r);if(bv({window:r,rect:c,viewportOffset:e,alignToTop:n,forceScroll:s}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null}}function bv({window:i,rect:e,alignToTop:t,forceScroll:n,viewportOffset:s}){const o=e.clone().moveBy(0,s.bottom),r=e.clone().moveBy(0,-s.top),a=new O(i).excludeScrollbarsAndBorders(),l=[r,o],c=t&&n,u=l.every(p=>a.contains(p));let{scrollX:d,scrollY:h}=i;const f=d,m=h;c?h-=a.top-e.top+s.top:u||(If(r,a)?h-=a.top-e.top+s.top:Sf(o,a)&&(t?h+=e.top-a.top-s.top:h+=e.bottom-a.bottom+s.bottom)),u||(Pf(e,a)?d-=a.left-e.left+s.left:Rf(e,a)&&(d+=e.right-a.right+s.right)),(d!=f||h!==m)&&i.scrollTo(d,h)}function wv({parent:i,getRect:e,alignToTop:t,forceScroll:n,ancestorOffset:s=0,limiterElement:o}){const r=Ga(i),a=t&&n;let l,c,u;const d=o||r.document.body;for(;i!=d;)c=e(),l=new O(i).excludeScrollbarsAndBorders(),u=l.contains(c),a?i.scrollTop-=l.top-c.top+s:u||(If(c,l)?i.scrollTop-=l.top-c.top+s:Sf(c,l)&&(t?i.scrollTop+=c.top-l.top-s:i.scrollTop+=c.bottom-l.bottom+s)),u||(Pf(c,l)?i.scrollLeft-=l.left-c.left+s:Rf(c,l)&&(i.scrollLeft+=c.right-l.right+s)),i=i.parentNode}function Sf(i,e){return i.bottom>e.bottom}function If(i,e){return i.top<e.top}function Pf(i,e){return i.left<e.left}function Rf(i,e){return i.right>e.right}function Ga(i){return Ho(i)?i.startContainer.ownerDocument.defaultView:i.ownerDocument.defaultView}function wc(i){if(Ho(i)){let e=i.commonAncestorContainer;return le(e)&&(e=e.parentNode),e}else return i.parentNode}function _c(i,e){const t=Ga(i),n=new O(i);if(t===e)return n;{let s=t;for(;s!=e;){const o=s.frameElement,r=new O(o).excludeScrollbarsAndBorders();n.moveBy(r.left,r.top),s=s.parent}}return n}function _v(i){return typeof i=="number"?{top:i,bottom:i,left:i,right:i}:i}/**
124 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
125 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
126 */const yv={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},vv={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},yc={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},F=Av(),kv=Object.fromEntries(Object.entries(F).map(([i,e])=>{let t;return e in yc?t=yc[e]:t=i.charAt(0).toUpperCase()+i.slice(1),[e,t]}));function mn(i){let e;if(typeof i=="string"){if(e=F[i.toLowerCase()],!e)throw new g("keyboard-unknown-key",null,{key:i})}
126else e=i.keyCode+(i.altKey?F.alt:0)+(i.ctrlKey?F.ctrl:0)+(i.shiftKey?F.shift:0)+(i.metaKey?F.cmd:0);return e}function us(i){return typeof i=="string"&&(i=xv(i)),i.map(e=>typeof e=="string"?Tv(e):e).reduce((e,t)=>t+e,0)}function po(i){let e=us(i);return Object.entries(B.isMac||B.isiOS?yv:vv).reduce((s,[o,r])=>(e&F[o]&&(e&=~F[o],s+=r),s),"")+(e?kv[e]:"")}function Cv(i){return i==F.arrowright||i==F.arrowleft||i==F.arrowup||i==F.arrowdown}function Wo(i,e){const t=e==="ltr";switch(i){case F.arrowleft:return t?"left":"right";case F.arrowright:return t?"right":"left";case F.arrowup:return"up";case F.arrowdown:return"down"}}function Tv(i){if(i.endsWith("!"))return mn(i.slice(0,-1));const e=mn(i);return(B.isMac||B.isiOS)&&e==F.ctrl?F.cmd:e}function Ev(i,e){const t=Wo(i,e);return t==="down"||t==="right"}function Av(){const i={pageup:33,pagedown:34,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++){const t=String.fromCharCode(e);i[t.toLowerCase()]=e}for(let e=48;e<=57;e++)i[e-48]=e;for(let e=112;e<=123;e++)i["f"+(e-111)]=e;return Object.assign(i,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),i}function xv(i){return i.split("+").map(e=>e.trim())}/**
127 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
128 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
129 */const Sv=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig"];function vc(i){return Sv.includes(i)?"rtl":"ltr"}/**
130 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
131 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
132 */function J(i){return Array.isArray(i)?i:[i]}/**
133 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
134 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
135 *//* istanbul ignore else -- @preserve */A.window.CKEDITOR_TRANSLATIONS||(A.window.CKEDITOR_TRANSLATIONS={});function Iv(i,e,t=1,n){if(typeof t!="number")throw new g("translation-service-quantity-not-a-number",null,{quantity:t});const s=n||A.window.CKEDITOR_TRANSLATIONS,o=Vv(s);o===1&&(i=Object.keys(s)[0]);const r=e.id||e.string;if(o===0||!Rv(i,r,s))return t!==1?e.plural:e.string;const a=s[i].dictionary,l=s[i].getPluralForm||(d=>d===1?0:1),c=a[r];if(typeof c=="string")return c;const u=Number(l(t));return c[u]}function Pv(i){return Array.isArray(i)?i.reduce((e,t)=>ja(e,t)):i}function Rv(i,e,t){return!!t[i]&&!!t[i].dictionary[e]}function Vv(i){return Object.keys(i).length}/**
136 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
137 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
138 */class Bv{constructor({uiLanguage:e="en",contentLanguage:t,translations:n}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=vc(this.uiLanguage),this.contentLanguageDirection=vc(this.contentLanguage),this.translations=Pv(n),this.t=(s,o)=>this._t(s,o)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=J(t),typeof e=="string"&&(e={string:e});const s=!!e.plural?t[0]:1,o=Iv(this.uiLanguage,e,s,this.translations);return Mv(o,t)}}function Mv(i,e){return i.replace(/%(\d+)/g,(t,n)=>n<e.length?e[n]:t)}/**
139 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
140 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
141 */class me extends G(){constructor(e={},t={}){super();const n=He(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(const s of e)this._items.push(s),this._itemMap.set(this._getItemIdBeforeAdding(s),s)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new g("collection-add-item-invalid-index",this);let n=0;for(const s of e){const o=this._getItemIdBeforeAdding(s),r=t+n;this._items.splice(r,0,s),this._itemMap.set(o,s),this.fire("add",s,r),n++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if(typeof e=="string")t=this._itemMap.get(e);else if(typeof e=="number")t=this._items[e];else throw new g("collection-get-invalid-arg",this);return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=this._idProperty,n=e[t];return n&&this._itemMap.has(n)}}getIndex(e){let t;return typeof e=="string"?t=this._itemMap.get(e):t=e,t?this._items.indexOf(t):-1}remove(e){const[t,n]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:n}),t}map(e,t){return this._items.map(e,t)}
141forEach(e,t){this._items.forEach(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new g("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(n=>new t(n))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(n=>n[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,n=(s,o,r)=>{const a=t._bindToCollection==this,l=t._bindToInternalToExternalMap.get(o);if(a&&l)this._bindToExternalToInternalMap.set(o,l),this._bindToInternalToExternalMap.set(l,o);else{const c=e(o);if(!c){this._skippedIndexesFromExternal.push(r);return}let u=r;for(const d of this._skippedIndexesFromExternal)r>d&&u--;for(const d of t._skippedIndexesFromExternal)u>=d&&u++;this._bindToExternalToInternalMap.set(o,c),this._bindToInternalToExternalMap.set(c,o),this.add(c,u);for(let d=0;d<t._skippedIndexesFromExternal.length;d++)u<=t._skippedIndexesFromExternal[d]&&t._skippedIndexesFromExternal[d]++}};for(const s of t)n(null,s,t.getIndex(s));this.listenTo(t,"add",n),this.listenTo(t,"remove",(s,o,r)=>{const a=this._bindToExternalToInternalMap.get(o);a&&this.remove(a),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((l,c)=>(r<c&&l.push(c-1),r>c&&l.push(c),l),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let n;if(t in e){if(n=e[t],typeof n!="string")throw new g("collection-add-invalid-id",this);if(this.get(n))throw new g("collection-add-item-already-exists",this)}else e[t]=n=$e();return n}_remove(e){let t,n,s,o=!1;const r=this._idProperty;if(typeof e=="string"?(n=e,s=this._itemMap.get(n),o=!s,s&&(t=this._items.indexOf(s))):typeof e=="number"?(t=e,s=this._items[t],o=!s,s&&(n=s[r])):(s=e,n=s[r],t=this._items.indexOf(s),o=t==-1||!this._itemMap.get(n)),o)throw new g("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(n);const a=this._bindToInternalToExternalMap.get(s);return this._bindToInternalToExternalMap.delete(s),this._bindToExternalToInternalMap.delete(a),this.fire("remove",s,t),[s,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}/**
142 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
143 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
144 */function ie(i){const e=i.next();return e.done?null:e.value}/**
145 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
146 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
147 */class se extends Qe(W()){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new g("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}/**
148 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
149 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
150 */class de{constructor(){this._listener=new(Qe())}listenTo(e){this._listener.listenTo(e,"keydown",(t,n)=>{this._listener.fire("_keydown:"+mn(n),n)})}set(e,t,n={}){const s=us(e),o=n.priority;this._listener.listenTo(this._listener,"_keydown:"+s,(r,a)=>{t(a,()=>{a.preventDefault(),a.stopPropagation(),r.stop()}),r.return=!0},{priority:o})}press(e){return!!this._listener.fire("_keydown:"+mn(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}/**
151 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
152 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
153 */function Ov(i){const e=new Map;for(const t in i)e.set(t,i[t]);return e}/**
154 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
155 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
156 */function St(i){return He(i)?new Map(i):Ov(i)}/**
157 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
158 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
159 */const Lv=1e4;function Fv(i,e,t,n){if(Math.max(e.length,i.length)>Lv)return i.slice(0,t).concat(e).concat(i.slice(t+n,i.length));{const s=Array.from(i);return s.splice(t,n,...e),s}}/**
160 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
161 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
162 */function Ka(i,e){let t;function n(...s){n.cancel(),t=setTimeout(()=>i(...s),e)}return n.cancel=()=>{clearTimeout(t)},n}/**
163 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
164 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
165 */function Nv(i){function e(d){return d.length>=40&&d.length<=255?"VALID":"INVALID"}if(!i)return"INVALID";let t="";try{t=atob(i)}catch{return"INVALID"}const n=t.split("-"),s=n[0],o=n[1];if(!o)return e(i);try{atob(o)}catch{try{if(atob(s),!atob(s).length)return e(i)}catch{return e(i)}}if(s.length<40||s.length>255)return"INVALID";let r="";try{atob(s),r=atob(o)}catch{return"INVALID"}if(r.length!==8)return"INVALID";const a=Number(r.substring(0,4)),l=Number(r.substring(4,6))-1,c=Number(r.substring(6,8)),u=new Date(a,l,c);return u<cb||isNaN(Number(u))?"INVALID":"VALID"}/**
166 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
167 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
168 */function Dv(i){return!!i&&i.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(i)}function $v(i){return!!i&&i.length==1&&/[\ud800-\udbff]/.test(i)}function Uv(i){return!!i&&i.length==1&&/[\udc00-\udfff]/.test(i)}function Ja(i,e){return $v(i.charAt(e-1))&&Uv(i.charAt(e))}function Za(i,e){return Dv(i.charAt(e))}const Hv=zv();function Vf(i,e){const t=String(i).matchAll(Hv);return Array.from(t).some(n=>n.index<e&&e<n.index+n[0].length)}function zv(){const i=[new RegExp("\\p{Emoji}[\\u{E0020}-\\u{E007E}]+\\u{E007F}","u"),new RegExp("\\p{Emoji}\\u{FE0F}?\\u{20E3}","u"),new RegExp("\\p{Emoji}\\u{FE0F}","u"),new RegExp("(?=\\p{General_Category=Other_Symbol})\\p{Emoji}\\p{Emoji_Modifier}*","u")],e=new RegExp("\\p{Regional_Indicator}{2}","u").source,t="(?:"+i.map(s=>s.source).join("|")+")",n=`${e}|${t}(?:‍${t})*`;return new RegExp(n,"ug")}/**
169 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
170 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
171 */class ve extends me{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(t,n,s)=>{this._renderViewIntoCollectionParent(n,s)}),this.on("remove",(t,n)=>{n.element&&this._parentElement&&n.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!Wv(e))throw new g("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const n of this)for(const s of e)n.delegate(s).to(t);this.on("add",(n,s)=>{for(const o of e)s.delegate(o).to(t)}),this.on("remove",(n,s)=>{for(const o of e)s.stopDelegating(o,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}function Wv(i){return i.every(e=>typeof e=="string")}/**
172 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
173 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
174 */const qv="http://www.w3.org/1999/xhtml";class xe extends G(){constructor(e){super(),Object.assign(this,Cc(kc(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=Ac(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new g("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(const n of t.children)bo(n)?yield n:Qa(n)&&(yield*e(n))}yield*e(this)}static bind(e,t){return{to(n,s){return new jv({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:s})},if(n,s,o){return new Bf({observable:e,emitter:t,attribute:n,valueIfTrue:s,callback:o})}}}static extend(e,t){if(e._isRendered)throw new g("template-extend-render",[this,e]);Ff(e,Cc(kc(t)))}_renderNode(e){let t;if(e.node?t=this.tag&&this.text:t=this.tag?this.text:!this.text,t)throw new g("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||qv,this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),Xs(this.text)?this._bindToObservable({schema:this.text,updater:Kv(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,n=e.revertData;for(const s in this.attributes){const o=t.getAttribute(s),r=this.attributes[s];n&&(n.attributes[s]=o);const a=Ec(r)?r[0].ns:null;if(Xs(r)){const l=Ec(r)?r[0].value:r;n&&xc(s)&&l.unshift(o),this._bindToObservable({schema:l,updater:Jv(t,s,a),data:e})}
174else if(s=="style"&&typeof r[0]!="string")this._renderStyleAttribute(r[0],e);else{n&&o&&xc(s)&&r.unshift(o);const l=r.map(c=>c&&(c.value||c)).reduce((c,u)=>c.concat(u),[]).reduce(Lf,"");Zn(l)||t.setAttributeNS(a,s,l)}}}_renderStyleAttribute(e,t){const n=t.node;for(const s in e){const o=e[s];Xs(o)?this._bindToObservable({schema:[o],updater:Zv(n,s),data:t}):n.style[s]=o}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,s=e.isApplying;let o=0;for(const r of this.children)if(Ya(r)){if(!s){r.setParent(t);for(const a of r)n.appendChild(a.element)}}else if(bo(r))s||(r.isRendered||r.render(),n.appendChild(r.element));else if(zt(r))n.appendChild(r);else if(s){const a=e.revertData,l=Ac();a.children.push(l),r._renderNode({intoFragment:!1,node:n.childNodes[o++],isApplying:!0,revertData:l})}else n.appendChild(r.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map(s=>{const[o,r]=t.split("@");return s.activateDomEventListener(o,r,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const s=n.revertData;Mf(e,t,n);const o=e.filter(r=>!Zn(r)).filter(r=>r.observable).map(r=>r.activateAttributeListener(e,t,n));s&&s.bindings.push(o)}_revertTemplateFromNode(e,t){for(const s of t.bindings)for(const o of s)o();if(t.text){e.textContent=t.text;return}const n=e;for(const s in t.attributes){const o=t.attributes[s];o===null?n.removeAttribute(s):n.setAttribute(s,o)}for(let s=0;s<t.children.length;++s)this._revertTemplateFromNode(n.childNodes[s],t.children[s])}}class ds{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){const s=()=>Mf(e,t,n);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class jv extends ds{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,n){const s=(o,r)=>{(!t||r.target.matches(t))&&(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(r):this.observable.fire(this.eventNameOrFunction,r))};return this.emitter.listenTo(n.node,e,s),()=>{this.emitter.stopListening(n.node,e,s)}}}class Bf extends ds{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return Zn(t)?!1:this.valueIfTrue||!0}}function Xs(i){return i?(i.value&&(i=i.value),Array.isArray(i)?i.some(Xs):i instanceof ds):!1}function Gv(i,e){return i.map(t=>t instanceof ds?t.getValue(e):t)}function Mf(i,e,{node:t}){const n=Gv(i,t);let s;i.length==1&&i[0]instanceof Bf?s=n[0]:s=n.reduce(Lf,""),Zn(s)?e.remove():e.set(s)}function Kv(i){return{set(e){i.textContent=e},remove(){i.textContent=""}}}function Jv(i,e,t){return{set(n){i.setAttributeNS(t,e,n)},remove(){i.removeAttributeNS(t,e)}}}function Zv(i,e){return{set(t){i.style[e]=t},remove(){i.style[e]=null}}}function kc(i){return Wa(i,t=>{if(t&&(t instanceof ds||Qa(t)||bo(t)||Ya(t)))return t})}function Cc(i){if(typeof i=="string"?i=Xv(i):i.text&&ek(i),i.on&&(i.eventListeners=Yv(i.on),delete i.on),!i.text){i.attributes&&Qv(i.attributes);const e=[];if(i.children)if(Ya(i.children))e.push(i.children);else for(const t of i.children)Qa(t)||bo(t)||zt(t)?e.push(t):e.push(new xe(t));i.children=e}return i}function Qv(i){for(const e in i)i[e].value&&(i[e].value=J(i[e].value)),Of(i,e)}function Yv(i){for(const e in i)Of(i,e);return i}function Xv(i){return{text:[i]}}function ek(i){i.text=J(i.text)}function Of(i,e){i[e]=J(i[e])}function Lf(i,e){return Zn(e)?i:Zn(i)?e:`${i} ${e}`}function Tc(i,e){for(const t in e)i[t]?i[t].push(...e[t]):i[t]=e[t]}function Ff(i,e){if(e.attributes&&(i.attributes||(i.attributes={}),Tc(i.attributes,e.attributes)),e.eventListeners&&(i.eventListeners||(i.eventListeners={}),Tc(i.eventListeners,e.eventListeners)),e.text&&i.text.push(...e.text),e.children&&e.children.length){if(i.children.length!=e.children.length)throw new g("ui-template-extend-children-mismatch",i);let t=0;for(const n of e.children)Ff(i.children[t++],n)}}function Zn(i){return!i&&i!==0}function bo(i){return i instanceof C}function Qa(i){return i instanceof xe}function Ya(i){return i instanceof ve}function Ec(i){return Z(i[0])&&i[0].ns}function Ac(){return{children:[],bindings:[],attributes:{}}}function xc(i){return i=="class"||i=="style"}/**
175 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
176 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
177 */let C=class extends Qe(W()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new me,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,n)=>{n.locale=e,n.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=xe.bind(this,this)}createCollection(e){const t=new ve(e);return this._viewCollections.add(t),t}registerChild(e){He(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){He(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new xe(e)}extendTemplate(e){xe.extend(this.template,e)}
177render(){if(this.isRendered)throw new g("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}};/**
178 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
179 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
180 */function ai({emitter:i,activator:e,callback:t,contextElements:n}){i.listenTo(document,"mousedown",(s,o)=>{if(!e())return;const r=typeof o.composedPath=="function"?o.composedPath():[],a=typeof n=="function"?n():n;for(const l of a)if(l.contains(o.target)||r.includes(l))return;t()})}/**
181 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
182 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
183 */function qo(i){class e extends i{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...n){super(...n),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}return e}/**
184 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
185 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
186 */function wn({view:i}){i.listenTo(i.element,"submit",(e,t)=>{t.preventDefault(),i.fire("submit")},{useCapture:!0})}/**
187 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
188 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
189 */function Nf({keystrokeHandler:i,focusTracker:e,gridItems:t,numberOfColumns:n,uiLanguageDirection:s}){const o=typeof n=="number"?()=>n:n;i.set("arrowright",r((c,u)=>s==="rtl"?l(c,u.length):a(c,u.length))),i.set("arrowleft",r((c,u)=>s==="rtl"?a(c,u.length):l(c,u.length))),i.set("arrowup",r((c,u)=>{let d=c-o();return d<0&&(d=c+o()*Math.floor(u.length/o()),d>u.length-1&&(d-=o())),d})),i.set("arrowdown",r((c,u)=>{let d=c+o();return d>u.length-1&&(d=c%o()),d}));function r(c){return u=>{const d=t.find(m=>m.element===e.focusedElement),h=t.getIndex(d),f=c(h,t);t.get(f).focus(),u.stopPropagation(),u.preventDefault()}}function a(c,u){return c===u-1?0:c+1}function l(c,u){return c===0?u-1:c-1}}/**
190 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
191 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
192 */class b extends W(){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Sc,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Sc),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Sc(i){i.return=!1,i.stop()}/**
193 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
194 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
195 */class R extends W(){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{if(!this.affectsData)return;const n=e.model.document.selection,o=!(n.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(n);(e.isReadOnly||this._isEnabledBasedOnSelection&&!o)&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Ic,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Ic),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Ic(i){i.return=!1,i.stop()}/**
196 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
197 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
198 */class Pc extends R{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Eh(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}/**
199 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
200 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
201 */class Df extends G(){constructor(e,t=[],n=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(const[s,o]of n)this._contextPlugins.set(s,o),this._contextPlugins.set(o,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let n=e;throw typeof e=="function"&&(n=e.pluginName||e.name),new g("plugincollection-
201plugin-not-loaded",this._context,{plugin:n})}return t}has(e){return this._plugins.has(e)}init(e,t=[],n=[]){const s=this,o=this._context;f(e),p(e);const r=e.filter(x=>!d(x,t)),a=[...m(r)];K(a,n);const l=L(a);return U(l,"init").then(()=>U(l,"afterInit")).then(()=>l);function c(x){return typeof x=="function"}function u(x){return c(x)&&!!x.isContextPlugin}function d(x,V){return V.some(I=>I===x||h(x)===I||h(I)===x)}function h(x){return c(x)?x.pluginName||x.name:x}function f(x,V=new Set){x.forEach(I=>{c(I)&&(V.has(I)||(V.add(I),I.pluginName&&!s._availablePlugins.has(I.pluginName)&&s._availablePlugins.set(I.pluginName,I),I.requires&&f(I.requires,V)))})}function m(x,V=new Set){return x.map(I=>c(I)?I:s._availablePlugins.get(I)).reduce((I,ee)=>V.has(ee)?I:(V.add(ee),ee.requires&&(p(ee.requires,ee),m(ee.requires,V).forEach(Zt=>I.add(Zt))),I.add(ee)),new Set)}function p(x,V=null){x.map(I=>c(I)?I:s._availablePlugins.get(I)||I).forEach(I=>{_(I,V),v(I,V),T(I,V)})}function _(x,V){if(!c(x))throw V?new g("plugincollection-soft-required",o,{missingPlugin:x,requiredBy:h(V)}):new g("plugincollection-plugin-not-found",o,{plugin:x})}function v(x,V){if(u(V)&&!u(x))throw new g("plugincollection-context-required",o,{plugin:h(x),requiredBy:h(V)})}function T(x,V){if(V&&d(x,t))throw new g("plugincollection-required",o,{plugin:h(x),requiredBy:h(V)})}function L(x){return x.map(V=>{let I=s._contextPlugins.get(V);return I=I||new V(o),s._add(V,I),I})}function U(x,V){return x.reduce((I,ee)=>!ee[V]||s._contextPlugins.has(ee)?I:I.then(ee[V].bind(ee)),Promise.resolve())}function K(x,V){for(const I of V){if(typeof I!="function")throw new g("plugincollection-replace-plugin-invalid-type",null,{pluginItem:I});const ee=I.pluginName;if(!ee)throw new g("plugincollection-replace-plugin-missing-name",null,{pluginItem:I});if(I.requires&&I.requires.length)throw new g("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:ee});const Zt=s._availablePlugins.get(ee);if(!Zt)throw new g("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:ee});const Sl=x.indexOf(Zt);if(Sl===-1){if(s._contextPlugins.has(Zt))return;throw new g("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:ee})}if(Zt.requires&&Zt.requires.length)throw new g("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:ee});x.splice(Sl,1,I),s._availablePlugins.set(ee,I)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const n=e.pluginName;if(n){if(this._plugins.has(n))throw new g("plugincollection-plugin-name-conflict",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}/**
202 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
203 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
204 */class $f{constructor(e){this._contextOwner=null;const{translations:t,...n}=e||{};this.config=new _f(n,this.constructor.defaultConfig);const s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new Df(this,s);const o=this.config.get("language")||{};this.locale=new Bv({uiLanguage:typeof o=="string"?o:o.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new me}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const n of e.concat(t)){if(typeof n!="function")throw new g("context-initplugins-constructor-only",null,{Plugin:n});if(n.isContextPlugin!==!0)throw new g("context-initplugins-invalid-plugin",null,{Plugin:n})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new g("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const n=new this(e);t(n.initPlugins().then(()=>n))})}}/**
205 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
206 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
207 */class Uf extends W(){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}/**
208 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
209 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
210 */const eo=new WeakMap;let Rc=!1;function Hf({view:i,element:e,text:t,isDirectHost:n=!0,keepOnFocus:s=!1}){const o=i.document;
210eo.has(o)||(eo.set(o,new Map),o.registerPostFixer(a=>gr(o,a)),o.on("change:isComposing",()=>{i.change(a=>gr(o,a))},{priority:"high"})),e.is("editableElement")&&e.on("change:placeholder",(a,l,c)=>{r(c)}),e.placeholder?r(e.placeholder):t&&r(t),t&&ok();function r(a){eo.get(o).set(e,{text:a,isDirectHost:n,keepOnFocus:s,hostElement:n?e:null}),i.change(l=>gr(o,l))}}function tk(i,e){return e.hasClass("ck-placeholder")?!1:(i.addClass("ck-placeholder",e),!0)}function nk(i,e){return e.hasClass("ck-placeholder")?(i.removeClass("ck-placeholder",e),!0):!1}function ik(i,e){if(!i.isAttached()||Array.from(i.getChildren()).some(r=>!r.is("uiElement")))return!1;const n=i.document,o=n.selection.anchor;return n.isComposing&&o&&o.parent===i?!1:e||!n.isFocused?!0:!!o&&o.parent!==i}function gr(i,e){const t=eo.get(i),n=[];let s=!1;for(const[o,r]of t)r.isDirectHost&&(n.push(o),Vc(e,o,r)&&(s=!0));for(const[o,r]of t){if(r.isDirectHost)continue;const a=sk(o);a&&(n.includes(a)||(r.hostElement=a,Vc(e,o,r)&&(s=!0)))}return s}function Vc(i,e,t){const{text:n,isDirectHost:s,hostElement:o}=t;let r=!1;return o.getAttribute("data-placeholder")!==n&&(i.setAttribute("data-placeholder",n,o),r=!0),(s||e.childCount==1)&&ik(o,t.keepOnFocus)?tk(i,o)&&(r=!0):nk(i,o)&&(r=!0),r}function sk(i){if(i.childCount){const e=i.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}function ok(){Rc||N("enableplaceholder-deprecated-text-option"),Rc=!0}/**
211 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
212 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
213 */let _n=class{is(){throw new Error("is() method is abstract")}};/**
214 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
215 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
216 */let yn=class extends G(_n){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new g("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),s=e.getAncestors(t);let o=0;for(;n[o]==s[o]&&n[o];)o++;return o===0?null:n[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),s=Te(t,n);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<n[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=cf(this);return delete e.parent,e}};yn.prototype.is=function(i){return i==="node"||i==="view:node"};/**
217 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
218 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
219 */let ne=class Yr extends yn{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof Yr?this===e||this.data===e.data:!1}_clone(){return new Yr(this.document,this.data)}};ne.prototype.is=function(i){return i==="$text"||i==="view:$text"||i==="text"||i==="view:text"||i==="node"||i==="view:node"};/**
220 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
221 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
222 */let ut=class extends _n{constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.data.length)throw new g("view-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.data.length)throw new g("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let n=e.includeSelf?this.textNode:this.parent;for(;n!==null;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}};ut.prototype.is=function(i){return i==="$textProxy"||i==="view:$textProxy"||i==="textProxy"||i==="view:textProxy"};/**
223 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
224 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
225 */class Ke{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)(typeof t=="string"||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const n of this._patterns){const s=Bc(t,n);if(s)return{element:t,pattern:n,match:s}}return null}matchAll(...e){const t=[];for(const n of e)for(const s of this._patterns){const o=Bc(n,s);o&&t.push({element:n,pattern:s,match:o})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;const e=this._patterns[0],t=e.name;return typeof e!="function"&&t&&!(t instanceof RegExp)?t:null}}function Bc(i,e){if(typeof e=="function")return e(i);const t={};return e.name&&(t.name=rk(e.name,i.name),!t.name)||e.attributes&&(t.attributes=uk(e.attributes,i),!t.attributes)||e.classes&&(t.classes=dk(e.classes,i),!t.classes)||e.styles&&(t.styles=hk(e.styles,i),!t.styles)?null:t}function rk(i,e){return i instanceof RegExp?!!e.match(i):i===e}function Xa(i,e,t){const n=ak(i),s=Array.from(e),o=[];if(n.forEach(([r,a])=>
225{s.forEach(l=>{lk(r,l)&&ck(a,l,t)&&o.push(l)})}),!(!n.length||o.length<n.length))return o}function ak(i){return Array.isArray(i)?i.map(e=>Oe(e)?((e.key===void 0||e.value===void 0)&&N("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]):Oe(i)?Object.entries(i):[[i,!0]]}function lk(i,e){return i===!0||i===e||i instanceof RegExp&&e.match(i)}function ck(i,e,t){if(i===!0)return!0;const n=t(e);return i===n||i instanceof RegExp&&!!String(n).match(i)}function uk(i,e){const t=new Set(e.getAttributeKeys());return Oe(i)?(i.style!==void 0&&N("matcher-pattern-deprecated-attributes-style-key",i),i.class!==void 0&&N("matcher-pattern-deprecated-attributes-class-key",i)):(t.delete("style"),t.delete("class")),Xa(i,t,n=>e.getAttribute(n))}function dk(i,e){return Xa(i,e.getClassNames(),()=>{})}function hk(i,e){return Xa(i,e.getStyleNames(!0),t=>e.getStyle(t))}/**
226 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
227 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
228 */class Xr{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=mk(e);for(const[n,s]of t)this._styleProcessor.toNormalizedForm(n,s,this._styles)}has(e){if(this.isEmpty)return!1;const n=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);return Array.isArray(n)}set(e,t){if(Z(e))for(const[n,s]of Object.entries(e))this._styleProcessor.toNormalizedForm(n,s,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=ea(e);Xy(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!Z(this._styles[e]))return this._styles[e];const n=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);if(Array.isArray(n))return n[1]}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this.getStylesEntries().map(([n])=>n)}clear(){this._styles={}}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const s=t.splice(0,t.length-1).join("."),o=Wi(this._styles,s);if(!o)return;!Object.keys(o).length&&this.remove(s)}}class fk{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(Z(t)){pr(n,ea(e),t);return}if(this._normalizers.has(e)){const s=this._normalizers.get(e),{path:o,value:r}=s(t);pr(n,o,r)}else pr(n,e,t)}getNormalized(e,t){if(!e)return ja({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if(typeof n=="string")return Wi(t,n);const s=n(e,t);if(s)return s}return Wi(t,ea(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);return n===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(n):[[e,n]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(s=>{const o=this.getNormalized(s,e);return o&&typeof o=="object"?Object.keys(o).length:o}),n=new Set([...t,...Object.keys(e)]);return Array.from(n)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function mk(i){let e=null,t=0,n=0,s=null;const o=new Map;if(i==="")return o;i.charAt(i.length-1)!=";"&&(i=i+";");for(let r=0;r<i.length;r++){const a=i.charAt(r);if(e===null)switch(a){case":":s||(s=i.substr(t,r-t),n=r+1);break;case'"':case"'":e=a;break;case";":{const l=i.substr(n,r-n);s&&o.set(s.trim(),l.trim()),s=null,t=r+1;break}}else a===e&&(e=null)}return o}function ea(i){return i.replace("-",".")}function pr(i,e,t){let n=t;Z(t)&&(n=ja({},Wi(i,e),t)),Qy(i,e,n)}/**
229 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
230 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
231 */let st=class zf extends yn{constructor(e,t,n,s){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=gk(n),this._children=[],s&&this._insertChild(0,s),this._classes=new Set,this._attrs.has("class")){const o=this._attrs.get("class");Mc(this._classes,o),this._attrs.delete("class")}this._styles=new Xr(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>
2310&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if(e=="class")return this._classes.size>0?[...this._classes].join(" "):void 0;if(e=="style"){const t=this._styles.toString();return t==""?void 0:t}return this._attrs.get(e)}hasAttribute(e){return e=="class"?this._classes.size>0:e=="style"?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof zf))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,n]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==n)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Ke(...e);let n=this.parent;for(;n&&!n.is("documentFragment");){if(t.match(n))return n;n=n.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),n=Array.from(this._attrs).map(s=>`${s[0]}="${s[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(n==""?"":` ${n}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const s of this.getChildren())t.push(s._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n._unsafeAttributesToRender=this._unsafeAttributesToRender,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let n=0;const s=pk(this.document,t);for(const o of s)o.parent!==null&&o._remove(),o.parent=this,o.document=this.document,this._children.splice(e,0,o),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const n=String(t);this._fireChange("attributes",this),e=="class"?Mc(this._classes,n):e=="style"?this._styles.setTo(n):this._attrs.set(e,n)}_removeAttribute(e){return this._fireChange("attributes",this),e=="class"?this._classes.size>0?(this._classes.clear(),!0):!1:e=="style"?this._styles.isEmpty?!1:(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of J(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of J(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),typeof e!="string"?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of J(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};st.prototype.is=function(i,e){return e?e===this.name&&(i==="element"||i==="view:element"):i==="element"||i==="view:element"||i==="node"||i==="view:node"};function gk(i){const e=St(i);for(const[t,n]of e)n===null?e.delete(t):typeof n!="string"&&e.set(t,String(n));return e}function Mc(i,e){const t=e.split(/\s+/);i.clear(),t.forEach(n=>i.add(n))}function pk(i,e){return typeof e=="string"?[new ne(i,e)]:(He(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new ne(i,t):t instanceof ut?new ne(i,t.data):t))}/**
232 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
233 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
234 */class ji extends st{constructor(e,t,n,s){super(e,t,n,s),this.getFillerOffset=bk}}ji.prototype.is=function(i,e){return e?e===this.name&&(i==="containerElement"||i==="view:containerElement"||i==="element"||i==="view:element"):i==="containerElement"||i==="view:containerElement"||i==="element"||i==="view:element"||i==="node"||i==="view:node"};function bk(){const i=[...this.getChildren()],e=i[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const t of i)if(!t.is("uiElement"))return null;return this.childCount}/**
235 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
236 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
237 */class jo extends W(ji){constructor(e,t,n,s){super(e,t,n,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",o=>o&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}jo.prototype.is=function(i,e){return e?e===this.name&&(i==="editableElement"||i==="view:editableElement"||i==="containerElement"||i==="view:containerElement"||i==="element"||i==="view:element"):i==="editableElement"||i==="view:editableElement"||i==="containerElement"||i==="view:containerElement"||i==="element"||i==="view:element"||i==="node"||i==="view:node"};
237/**
238 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
239 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
240 */const Oc=Symbol("rootName");class Wf extends jo{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Oc)}set rootName(e){this._setCustomProperty(Oc,e)}set _name(e){this.name=e}}Wf.prototype.is=function(i,e){return e?e===this.name&&(i==="rootElement"||i==="view:rootElement"||i==="editableElement"||i==="view:editableElement"||i==="containerElement"||i==="view:containerElement"||i==="element"||i==="view:element"):i==="rootElement"||i==="view:rootElement"||i==="editableElement"||i==="view:editableElement"||i==="containerElement"||i==="view:containerElement"||i==="element"||i==="view:element"||i==="node"||i==="view:node"};/**
241 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
242 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
243 */let rn=class{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new g("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new g("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=k._createAt(e.startPosition):this._position=k._createAt(e.boundaries[e.direction=="backward"?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n;do n=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=n)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(n.parent===null&&e.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;if(n instanceof ne){if(e.isAtEnd)return this._position=k._createAfter(n),this._next();s=n.data[e.offset]}else s=n.getChild(e.offset);if(s instanceof st){if(!this.shallow)e=new k(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}return this._position=e,this._formatReturnValue("elementStart",s,t,e,1)}if(s instanceof ne){if(this.singleCharacters)return e=new k(s,0),this._position=e,this._next();let o=s.data.length,r;return s==this._boundaryEndParent?(o=this.boundaries.end.offset,r=new ut(s,0,o),e=k._createAfter(r)):(r=new ut(s,0,s.data.length),e.offset++),this._position=e,this._formatReturnValue("text",r,t,e,o)}if(typeof s=="string"){let o;this.singleCharacters?o=1:o=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset;const r=new ut(n,e.offset,o);return e.offset+=o,this._position=e,this._formatReturnValue("text",r,t,e,o)}return e=k._createAfter(n),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(n.parent===null&&e.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(n instanceof ne){if(e.isAtStart)return this._position=k._createBefore(n),this._previous();s=n.data[e.offset-1]}else s=n.getChild(e.offset-1);if(s instanceof st)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",s,t,e,1)):(e=new k(s,s.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,t,e));if(s instanceof ne){if(this.singleCharacters)return e=new k(s,s.data.length),this._position=e,this._previous();let o=s.data.length,r;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;r=new ut(s,a,s.data.length-a),o=r.data.length,e=k._createBefore(r)}else r=new ut(s,0,s.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",r,t,e,o)}if(typeof s=="string"){let o;if(this.singleCharacters)o=1;else{const a=n===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-a}e.offset-=o;const r=new ut(n,e.offset,o);return this._position=e,this._formatReturnValue("text",r,t,e,o)}return e=k._createBefore(n),this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,s,o){return t instanceof ut&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=k._createAfter(t.textNode),this._position=s):n=k._createAfter(t.textNode)),t.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=k._createBefore(t.textNode),this._position=s):n=k._createBefore(t.textNode))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:s,length:o}}}};/**
244 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
245 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
246 */let k=class yt extends _n{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof jo);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const t=yt._createAt(this),n=t.offset+e;return t.offset=n<0?0:n,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new rn(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let s=0;for(;t[s]==n[s]&&t[s];)s++;return s===0?null:t[s-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const s=Te(t,n);switch(s){case"prefix":return"before";case"extension":return"after";default:return t[s]<n[s]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new rn(e)}clone(){return new yt(this.parent,this.offset)}static _createAt(e,t){if(e instanceof yt)return new this(e.parent,e.offset);{const n=e;if(t=="end")t=n.is("$text")?n.data.length:n.childCount;else{if(t=="before")return this._createBefore(n);if(t=="after")return this._createAfter(n);if(t!==0&&!t)throw new g("view-createpositionat-offset-required",n)}return new yt(n,t)}}static _createAfter(e){if(e.is("$textProxy"))return new yt(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new g("view-position-after-root",e,{root:e});return new yt(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new yt(e.textNode,e.offsetInText);if(!e.parent)throw new g("view-position-before-root",e,{root:e});return new yt(e.parent,e.index)}};k.prototype.is=function(i){return i==="position"||i==="view:position"};/**
247 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
248 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
249 */let M=class Ft extends _n{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new rn({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(vs,{direction:"backward"}),t=this.end.getLastMatchingPosition(vs);return e.parent.is("$text")&&e.isAtStart&&(e=k._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=k._createAfter(t.parent)),new Ft(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(vs);if(e.isAfter(this.end)||e.isEqual(this.end))return new Ft(e,e);let t=this.end.getLastMatchingPosition(vs,{direction:"backward"});const n=e.nodeAfter,s=t.nodeBefore;return n&&n.is("$text")&&(e=new k(n,0)),s&&s.is("$text")&&(t=new k(s,s.data.length)),new Ft(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&s}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new Ft(this.start,e.start)),this.containsPosition(e.end)&&t.pu
249sh(new Ft(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new Ft(t,n)}return null}getWalker(e={}){return e.boundaries=this,new rn(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new Ft(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new rn(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new rn(e);yield t.position;for(const n of t)yield n.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,n,s){return new this(new k(e,t),new k(n,s))}static _createFromPositionAndShift(e,t){const n=e,s=e.getShiftedBy(t);return t>0?new this(n,s):new this(s,n)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(k._createBefore(e),t)}};M.prototype.is=function(i){return i==="range"||i==="view:range"};function vs(i){return!!(i.item.is("attributeElement")||i.item.is("uiElement"))}/**
250 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
251 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
252 */let Et=class qf extends G(_n){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const s of e._ranges)if(t.isEqual(s)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=Zr(this.getRanges()),n=Zr(e.getRanges());if(t!=n)return!1;if(t==0)return!0;for(let s of this.getRanges()){s=s.getTrimmed();let o=!1;for(let r of e.getRanges())if(r=r.getTrimmed(),s.start.isEqual(r.start)&&s.end.isEqual(r.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,n,s]=e;if(typeof n=="object"&&(s=n,n=void 0),t===null)this._setRanges([]),this._setFakeOptions(s);else if(t instanceof qf||t instanceof el)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof M)this._setRanges([t],s&&s.backward),this._setFakeOptions(s);
252else if(t instanceof k)this._setRanges([new M(t)]),this._setFakeOptions(s);else if(t instanceof yn){const o=!!s&&!!s.backward;let r;if(n===void 0)throw new g("view-selection-setto-required-second-parameter",this);n=="in"?r=M._createIn(t):n=="on"?r=M._createOn(t):r=new M(k._createAt(t,n)),this._setRanges([r],o),this._setFakeOptions(s)}else if(He(t))this._setRanges(t,s&&s.backward),this._setFakeOptions(s);else throw new g("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new g("view-selection-setfocus-no-ranges",this);const n=k._createAt(e,t);if(n.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.pop(),n.compareWith(s)=="before"?this._addRange(new M(n,s),!0):this._addRange(new M(s,n)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const n of e)this._addRange(n);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof M))throw new g("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new g("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new M(e.start,e.end))}};Et.prototype.is=function(i){return i==="selection"||i==="view:selection"};/**
253 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
254 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
255 */let el=class extends G(_n){constructor(...e){super(),this._selection=new Et,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};el.prototype.is=function(i){return i==="selection"||i=="documentSelection"||i=="view:selection"||i=="view:documentSelection"};/**
256 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
257 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
258 */class li extends xt{constructor(e,t,n){super(e,t),this.startRange=n,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}/**
259 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
260 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
261 */const br=Symbol("bubbling contexts");function ta(i){class e extends i{fire(n,...s){try{const o=n instanceof xt?n:new xt(this,n),r=wr(this);if(!r.size)return;if(fi(o,"capturing",this),Vn(r,"$capture",o,...s))return o.return;const a=o.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,c=l?!!jf(r,l):!1;let u=l||wk(a);if(fi(o,"atTarget",u),!c){if(Vn(r,"$text",o,...s))return o.return;fi(o,"bubbling",u)}for(;u;){if(u.is("rootElement")){if(Vn(r,"$root",o,...s))return o.return}else if(u.is("element")&&Vn(r,u.name,o,...s))return o.return;if(Vn(r,u,o,...s))return o.return;u=u.parent,fi(o,"bubbling",u)}return fi(o,"bubbling",this),Vn(r,"$document",o,...s),o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}_addEventListener(n,s,o){const r=J(o.context||"$document"),a=wr(this);for(const l of r){let c=a.get(l);c||(c=new(G()),a.set(l,c)),this.listenTo(c,n,s,o)}}_removeEventListener(n,s){const o=wr(this);for(const r of o.values())this.stopListening(r,n,s)}}return e}{const i=ta(Object);
261["fire","_addEventListener","_removeEventListener"].forEach(e=>{ta[e]=i.prototype[e]})}function fi(i,e,t){i instanceof li&&(i._eventPhase=e,i._currentTarget=t)}function Vn(i,e,t,...n){const s=typeof e=="string"?i.get(e):jf(i,e);return s?(s.fire(t,...n),t.stop.called):!1}function jf(i,e){for(const[t,n]of i)if(typeof t=="function"&&t(e))return n;return null}function wr(i){return i[br]||(i[br]=new Map),i[br]}function wk(i){if(!i)return null;const e=i.start.parent,t=i.end.parent,n=e.getPath(),s=t.getPath();return n.length>s.length?e:t}/**
262 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
263 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
264 */let Go=class extends ta(W()){constructor(e){super(),this._postFixers=new Set,this.selection=new el,this.roots=new me({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const n of this._postFixers)if(t=n(e),t)break;while(t)}};/**
265 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
266 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
267 */const Gf=10;class an extends st{constructor(e,t,n,s){super(e,t,n,s),this._priority=Gf,this._id=null,this._clonesGroup=null,this.getFillerOffset=_k}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new g("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}an.DEFAULT_PRIORITY=Gf;an.prototype.is=function(i,e){return e?e===this.name&&(i==="attributeElement"||i==="view:attributeElement"||i==="element"||i==="view:element"):i==="attributeElement"||i==="view:attributeElement"||i==="element"||i==="view:element"||i==="node"||i==="view:node"};function _k(){if(_r(this))return null;let i=this.parent;for(;i&&i.is("attributeElement");){if(_r(i)>1)return null;i=i.parent}return!i||_r(i)>1?null:this.childCount}function _r(i){return Array.from(i.getChildren()).filter(e=>!e.is("uiElement")).length}/**
268 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
269 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
270 */class tl extends st{constructor(e,t,n,s){super(e,t,n,s),this.getFillerOffset=yk}_insertChild(e,t){if(t&&(t instanceof yn||Array.from(t).length>0))throw new g("view-emptyelement-cannot-add",[this,t]);return 0}}tl.prototype.is=function(i,e){return e?e===this.name&&(i==="emptyElement"||i==="view:emptyElement"||i==="element"||i==="view:element"):i==="emptyElement"||i==="view:emptyElement"||i==="element"||i==="view:element"||i==="node"||i==="view:node"};function yk(){return null}/**
271 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
272 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
273 */class Ko extends st{constructor(e,t,n,s){super(e,t,n,s),this.getFillerOffset=kk}_insertChild(e,t){if(t&&(t instanceof yn||Array.from(t).length>0))throw new g("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const n of this.getAttributeKeys())t.setAttribute(n,this.getAttribute(n));return t}}Ko.prototype.is=function(i,e){return e?e===this.name&&(i==="uiElement"||i==="view:uiElement"||i==="element"||i==="view:element"):i==="uiElement"||i==="view:uiElement"||i==="element"||i==="view:element"||i==="node"||i==="view:node"};function vk(i){i.document.on("arrowKey",(e,t)=>Ck(e,t,i.domConverter),{priority:"low"})}function kk(){return null}function Ck(i,e,t){if(e.keyCode==F.arrowright){const n=e.domTarget.ownerDocument.defaultView.getSelection(),s=n.rangeCount==1&&n.getRangeAt(0).collapsed;if(s||e.shiftKey){const o=n.focusNode,r=n.focusOffset,a=t.domPositionToView(o,r);if(a===null)return;let l=!1;const c=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){const u=t.viewPositionToDom(c);s?n.collapse(u.parent,u.offset):n.extend(u.parent,u.offset)}}}}/**
274 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
275 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
276 */class nl extends st{constructor(e,t,n,s){super(e,t,n,s),this.getFillerOffset=Tk}_insertChild(e,t){if(t&&(t instanceof yn||Array.from(t).length>0))throw new g("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}nl.prototype.is=function(i,e){return e?e===this.name&&(i==="rawElement"||i==="view:rawElement"||i==="element"||i==="view:element"):i==="rawElement"||i==="view:rawElement"||i===this.name||i==="view:"+this.name||i==="element"||i==="view:element"||i==="node"||i==="view:node"};function Tk(){return null}/**
277 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
278 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
279 */let ln=class extends G(_n){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let n=0;const s=Ek(this.document,t);for(const o of s)o.parent!==null&&o._remove(),o.parent=this,this._children.splice(e,0,o),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};ln.prototype.is=function(i){return i==="documentFragment"||i==="view:documentFragment"};function Ek(i,e){return typeof e=="string"?[new ne(i,e)]:(He(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new ne(i,t):t instanceof ut?new ne(i,t.data):t))}/**
280 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
281 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
282 */class Kf{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new ln(this.document,e)}createText(e){return new ne(this.document,e)}createAttributeElement(e,t,n={}){const s=new an(this.document,e,t);return typeof n.priority=="number"&&(s._priority=n.priority),n.id&&(s._id=n.id),n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createContainerElement(e,t,n={},s={}){let o=null;Oe(n)?s=n:o=n;const r=new ji(this.document,e,t,o);return s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}createEditableElement(e,t,n={}){const s=new jo(this.document,e,t);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createEmptyElement(e,t,n={}){const s=new tl(this.document,e,t);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createUIElement(e,t,n){const s=new Ko(this.document,e,t);return n&&(s.render=n),s}createRawElement(e,t,n,s={}){const o=new nl(this.document,e,t);return n&&(o.render=n),s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Oe(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof k?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new g("view-writer-break-non-container-element",this.document);if(!t.parent)throw new g("view-writer-break-root",this.document);if(e.isAtStart)return k._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(k._createAfter(t),n);const s=new M(e,k._createAt(t,"end")),o=new k(n,0);this.move(s,o)}return k._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("$text"))return e;if(n.is("attributeElement")&&n.childCount===0){const r=n.parent,a=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new k(r,a))}const s=n.getChild(t-1),o=n.getChild(t);if(!s||!o)return e;if(s.is("$text")&&o.is("$text"))return Fc(s,o);if(s.is("attributeElement")&&o.is("attributeElement")&&s.isSimilar(o)){const r=s.childCount;return s._appendChild(o.getChildren()),o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new k(s,r))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!t||!n||!t.is("containerElement")||!n.is("containerElement"))throw new g("view-writer-merge-containers-invalid-position",this.document);const s=t.getChild(t.childCount-1),o=s instanceof ne?k._createAt(s,"end"):k._createAt(t,"end");return this.move(M._createIn(n),k._createAt(t,"end")),this.remove(M._createOn(n)),o}insert(e,t){t=He(t)?[...t]:[t],Jf(t,this.document);const n=t.reduce((r,a)=>{const l=r[r.length-1],c=!a.is("uiElement");return!l||l.breakAttributes!=c?r.push({breakAttributes:c,nodes:[a]}):l.nodes.push(a),r},[]);let s=null,o=e;for(const{nodes:r,breakAttributes:a}of n){const l=this._insertNodes(o,r,a);s||(s=l.start),o=l.end}return s?new M(s,o):new M(e)}remove(e){const t=e instanceof M?e:M._createOn(e);if(mi(t,this.document),t.isCollapsed)return new ln(this.document);const{start:n,end:s}=this._breakAttributesRange(t,!0),o=n.parent,r=s.offset-n.offset,a=o._removeChildren(n.offset,r);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(n);return t.start=l,t.end=l.clone(),new ln(this.document,a)}clear(e,t){mi(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of n){const o=s.item;let r;if(o.is("element")&&t.isSimilar(o))r=M._createOn(o);else if(!s.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const a=o.getAncestors().find(l=>l.is("element")&&t.isSimilar(l));a&&(r=M._createIn(a))}r&&(r.end.isAfter(e.end)&&(r.end=e.end),r.start.isBefore(e.start)&&(r.start=e.start),this.remove(r))}}move(e,t){let n;if(t.isAfter(e.end)){t=this._breakAttributes(t,!0);const s=t.parent,o=s.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=s.childCount-o}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof an))throw new g("view-writer-wrap-invalid-attribute",this.document);if(mi(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&!Ak(n.parent)&&(n=n.getLastMatchingPosition(o=>o.item.is("uiElement"))),n=this._wrapPosition(n,t);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new M(n)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof an))throw new g("view-writer-unwrap-invalid-attribute",this.document);if(mi(e,this.document),e.isCollapsed)return e;const{start:n,end:s}=this._breakAttributesRange(e,!0),o=n.parent,r=this._unwrapChildren(o,n.offset,s.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;
282const l=this.mergeAttributes(r.end);return new M(a,l)}rename(e,t){const n=new ji(this.document,e,t.getAttributes());return this.insert(k._createAfter(t),n),this.move(M._createIn(t),k._createAt(n,0)),this.remove(M._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return k._createAt(e,t)}createPositionAfter(e){return k._createAfter(e)}createPositionBefore(e){return k._createBefore(e)}createRange(e,t){return new M(e,t)}createRangeOn(e){return M._createOn(e)}createRangeIn(e){return M._createIn(e)}createSelection(...e){return new Et(...e)}createSlot(e="children"){if(!this._slotFactory)throw new g("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,n){let s;if(n?s=na(e):s=e.parent.is("$text")?e.parent.parent:e.parent,!s)throw new g("view-writer-invalid-position-container",this.document);let o;n?o=this._breakAttributes(e,!0):o=e.parent.is("$text")?yr(e):e;const r=s._insertChild(o.offset,t);for(const u of t)this._addToClonedElementsGroup(u);const a=o.getShiftedBy(r),l=this.mergeAttributes(o);l.isEqual(o)||a.offset--;const c=this.mergeAttributes(a);return new M(l,c)}_wrapChildren(e,t,n,s){let o=t;const r=[];for(;o<n;){const l=e.getChild(o),c=l.is("$text"),u=l.is("attributeElement");if(u&&this._wrapAttributeElement(s,l))r.push(new k(e,o));else if(c||!u||xk(s,l)){const d=s._clone();l._remove(),d._appendChild(l),e._insertChild(o,d),this._addToClonedElementsGroup(d),r.push(new k(e,o))}else this._wrapChildren(l,0,l.childCount,s);o++}let a=0;for(const l of r){if(l.offset-=a,l.offset==t)continue;this.mergeAttributes(l).isEqual(l)||(a++,n--)}return M._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,s){let o=t;const r=[];for(;o<n;){const l=e.getChild(o);if(!l.is("attributeElement")){o++;continue}if(l.isSimilar(s)){const c=l.getChildren(),u=l.childCount;l._remove(),e._insertChild(o,c),this._removeFromClonedElementsGroup(l),r.push(new k(e,o),new k(e,o+u)),o+=u,n+=u-1;continue}if(this._unwrapAttributeElement(s,l)){r.push(new k(e,o),new k(e,o+1)),o++;continue}this._unwrapChildren(l,0,l.childCount,s),o++}let a=0;for(const l of r){if(l.offset-=a,l.offset==t||l.offset==n)continue;this.mergeAttributes(l).isEqual(l)||(a++,n--)}return M._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){const{start:n,end:s}=this._breakAttributesRange(e,!0),o=n.parent,r=this._wrapChildren(o,n.offset,s.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new M(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Lc(e.clone());e.parent.is("$text")&&(e=yr(e));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);const s=new M(e,e.getShiftedBy(1));this.wrap(s,t);const o=new k(n.parent,n.index);n._remove();const r=o.nodeBefore,a=o.nodeAfter;return r instanceof ne&&a instanceof ne?Fc(r,a):Lc(o)}_wrapAttributeElement(e,t){if(!Nc(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if(!(n==="class"||n==="style")&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())n==="class"||n==="style"||t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t);for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!Nc(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if(!(n==="class"||n==="style")&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())n==="class"||n==="style"||this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,s=e.end;if(mi(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new M(l,l)}const o=this._breakAttributes(s,t),r=o.parent.childCount,a=this._breakAttributes(n,t);return o.offset+=o.parent.childCount-r,new M(a,o)}_breakAttributes(e,t=!1){const n=e.offset,s=e.parent;if(e.parent.is("emptyElement"))throw new g("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new g("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new g("view-writer-cannot-break-raw-element",this.document);if(!t&&s.is("$text")&&ia(s.parent)||ia(s))return e.clone();if(s.is("$text"))return this._breakAttributes(yr(e),t);const o=s.childCount;if(n==o){const r=new k(s.parent,s.index+1);return this._breakAttributes(r,t)}else if(n===0){const r=new k(s.parent,s.index);return this._breakAttributes(r,t)}else{const r=s.index+1,a=s._clone();s.parent._insertChild(r,a),this._addToClonedElementsGroup(a);const l=s.childCount-n,c=s._removeChildren(n,l);a._appendChild(c);const u=new k(s.parent,r);return this._breakAttributes(u,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const s of e.getChildren())this._addToClonedElementsGroup(s);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const s of e.getChildren())this._removeFromClonedElementsGroup(s);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function Ak(i){return Array.from(i.getChildren()).some(e=>!e.is("uiElement"))}function na(i){let e=i.parent;for(;!ia(e);){if(!e)return;e=e.parent}return e}function xk(i,e){return i.priority<e.priority?!0:i.priority>e.priority?!1:i.getIdentity()<e.getIdentity()}function Lc(i){const e=i.nodeBefore;if(e&&e.is("$text"))return new k(e,e.data.length);const t=i.nodeAfter;return t&&t.is("$text")?new k(t,0):i}function yr(i){if(i.offset==i.parent.data.length)return new k(i.parent.parent,i.parent.index+1);if(i.offset===0)return new k(i.parent.parent,i.parent.index);const e=i.parent.data.slice(i.offset);return i.parent._data=i.parent.data.slice(0,i.offset),i.parent.parent._insertChild(i.parent.index+1,new ne(i.root.document,e)),new k(i.parent.parent,i.parent.index+1)}function Fc(i,e){const t=i.data.length;return i._data+=e.data,e._remove(),new k(i,t)}const Sk=[ne,an,ji,tl,nl,Ko];function Jf(i,e){for(const t of i){if(!Sk.some(n=>t instanceof n))throw new g("view-writer-insert-invalid-node-type",e);t.is("$text")||Jf(t.getChildren(),e)}}function ia(i){return i&&(i.is("containerElement")||i.is("documentFragment"))}function mi(i,e){const t=na(i.start),n=na(i.end);if(!t||!n||t!==n)throw new g("view-writer-invalid-range-container",e)}function Nc(i,e){return i.id===null&&e.id===null}/**
283 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
284 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
285 */const Zf=i=>i.createTextNode(" "),Qf=i=>{const e=i.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},Yf=i=>{const e=i.createElement("br");return e.dataset.ckeFiller="true",e},tt=7,Gi="⁠".repeat(tt);function Me(i){return typeof i=="string"?i.substr(0,tt)===Gi:le(i)&&i.data.substr(0,tt)===Gi}function jn(i){return i.data.length==tt&&Me(i)}function Dc(i){const e=typeof i=="string"?i:i.data;return Me(i)?e.slice(tt):e}function Ik(i){i.document.on("arrowKey",Pk,{priority:"low"})}function Pk(i,e){if(e.keyCode==F.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(t.rangeCount==1&&t.getRangeAt(0).collapsed){const n=t.getRangeAt(0).startContainer,s=t.getRangeAt(0).startOffset;Me(n)&&s<=tt&&t.collapse(n,0)}}}/**
286 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
287 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
288 */class Rk extends W(){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),B.isBlink&&!B.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()}),this.set("isComposing",!1),this.on("change:isComposing",()=>{this.isComposing||this.render()})}markToSync(e,t){if(e==="text")this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e==="attributes")this.markedAttributes.add(t);else if(e==="children")this.markedChildren.add(t);else throw new g("view-renderer-unknown-type",this)}}
288render(){if(this.isComposing&&!B.isAndroid)return;let e=null;const t=B.isBlink&&!B.isAndroid?!this.isSelecting:!0;for(const n of this.markedChildren)this._updateChildrenMappings(n);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=k._createBefore(e.parent)));for(const n of this.markedAttributes)this._updateAttrs(n);for(const n of this.markedChildren)this._updateChildren(n,{inlineFillerPosition:e});for(const n of this.markedTexts)!this.markedChildren.has(n.parent)&&this.domConverter.mapViewToDom(n.parent)&&this._updateText(n,{inlineFillerPosition:e});if(t)if(e){const n=this.domConverter.viewPositionToDom(e),s=n.parent.ownerDocument;Me(n.parent)?this._inlineFiller=n.parent:this._inlineFiller=$c(s,n.parent,n.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.childNodes),s=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),o=this._diffNodeLists(n,s),r=this._findUpdateActions(o,n,s,Bk);if(r.indexOf("update")!==-1){const a={equal:0,insert:0,delete:0};for(const l of r)if(l==="update"){const c=a.equal+a.insert,u=a.equal+a.delete,d=e.getChild(c);d&&!d.is("uiElement")&&!d.is("rawElement")&&this._updateElementMappings(d,n[u]),bc(s[c]),a.equal++}else a[l]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?k._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&le(t.parent)&&Me(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Me(e))throw new g("view-renderer-filler-was-lost",this);jn(e)?e.remove():e.data=e.data.substr(tt),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!Vk(t))return!1;const s=e.nodeBefore,o=e.nodeAfter;return!(s instanceof ne||o instanceof ne||n===t.getFillerOffset()&&(!s||!s.is("element","br"))||B.isAndroid&&(s||o))}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e);let o=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(o=Gi+o),Uc(n,o)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.attributes).map(o=>o.name),s=e.getAttributeKeys();for(const o of s)this.domConverter.setDomElementAttribute(t,o,e.getAttribute(o),e);for(const o of n)e.hasAttribute(o)||this.domConverter.removeDomElementAttribute(t,o)}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;if(B.isAndroid){let d=null;for(const h of Array.from(n.childNodes)){if(d&&le(d)&&le(h)){n.normalize();break}d=h}}const s=t.inlineFillerPosition,o=n.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));s&&s.parent===e&&$c(n.ownerDocument,r,s.offset);const a=this._diffNodeLists(o,r),l=this._findUpdateActions(a,o,r,Mk);let c=0;const u=new Set;for(const d of l)d==="delete"?(u.add(o[c]),bc(o[c])):(d==="equal"||d==="update")&&c++;c=0;for(const d of l)d==="insert"?(Ef(n,c,r[c]),c++):d==="update"?(Uc(o[c],r[c].data),c++):d==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(r[c])),c++);for(const d of u)d.parentNode||this.domConverter.unbindDomElement(d)}_diffNodeLists(e,t){return e=Fk(e,this._fakeSelectionContainer),Ii(e,t,Ok.bind(null,this.domConverter))}
288_findUpdateActions(e,t,n,s){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let o=[],r=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)c==="insert"?a.push(n[l.equal+l.insert]):c==="delete"?r.push(t[l.equal+l.delete]):(o=o.concat(Ii(r,a,s).map(u=>u==="equal"?"update":u)),o.push("equal"),r=[],a=[]),l[c]++;return o.concat(Ii(r,a,s).map(c=>c==="equal"?"update":c))}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(B.isBlink&&!B.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}const e=this.domConverter.mapViewToDom(this.selection.editableElement);!this.isFocused||!e||(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&B.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=Nk(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!n.parentElement||n.parentElement!=e)&&e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const s=t.getSelection(),o=t.createRange();s.removeAllRanges(),o.selectNodeContents(n),s.addRange(o)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),s=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(n.parent,n.offset,s.parent,s.offset),B.isGecko&&Lk(s,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||n.anchorNode!==t&&!t.contains(n.anchorNode)?!0:t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const n=e.activeElement,s=this.domConverter.mapDomToView(n);n&&s&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Vk(i){if(i.getAttribute("contenteditable")=="false")return!1;const e=i.findAncestor(t=>t.hasAttribute("contenteditable"));return!e||e.getAttribute("contenteditable")=="true"}function $c(i,e,t){const n=e instanceof Array?e:e.childNodes,s=n[t];if(le(s))return s.data=Gi+s.data,s;{const o=i.createTextNode(Gi);return Array.isArray(e)?n.splice(t,0,o):Ef(e,t,o),o}}function Bk(i,e){return zt(i)&&zt(e)&&!le(i)&&!le(e)&&!Ri(i)&&!Ri(e)&&i.tagName.toLowerCase()===e.tagName.toLowerCase()}function Mk(i,e){return zt(i)&&zt(e)&&le(i)&&le(e)}function Ok(i,e,t){return e===t?!0:le(e)&&le(t)?e.data===t.data:!!(i.isBlockFiller(e)&&i.isBlockFiller(t))}function Lk(i,e){let t=i.parent,n=i.offset;if(le(t)&&jn(t)&&(n=Ei(t)+1,t=t.parentNode),t.nodeType!=Node.ELEMENT_NODE||n!=t.childNodes.length-1)return;const s=t.childNodes[n];s&&s.tagName=="BR"&&e.addRange(e.getRangeAt(0))}function Fk(i,e){const t=Array.from(i);return t.length==0||!e||t[t.length-1]==e&&t.pop(),t}function Nk(i){const e=i.createElement("div");return e.className="ck-fake-selection-container",Object.assign(e.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),e.textContent=" ",e}function Uc(i,e){const t=i.data;if(t==e)return;const n=Th(t,e);for(const s of n)s.type==="insert"?i.insertData(s.index,s.values.join("")):i.deleteData(s.index,s.howMany)}/**
289 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
290 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
291 */const Dk=Yf(A.document),$k=Zf(A.document),Uk=Qf(A.document),ks="data-ck-unsafe-attribute-",Hc="data-ck-unsafe-element";class Jo{constructor(e,{blockFillerMode:t,renderingMode:n="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Ke,this._inlineObjectElementMatcher=new Ke,this._elementsWithTemporaryCustomProperties=new Set,this.document=e,this.renderingMode=n,this.blockFillerMode=t||(n==="editing"?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?A.document:A.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new Et(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const n of Array.from(e.children))this.unbindDomElement(n)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,n){return this.renderingMode==="data"?!0:(e=e.toLowerCase(),e.startsWith("on")||e==="srcdoc"&&t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:n==="img"&&(e==="src"||e==="srcset")||n==="source"&&e==="srcset"?!0:!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data"){e.innerHTML=t;return}const n=new DOMParser().parseFromString(t,"text/html"),s=n.createDocumentFragment(),o=n.body.childNodes;for(;o.length>0;)s.appendChild(o[0]);const r=n.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=r.nextNode();)a.push(l);for(const c of a){for(const d of c.getAttributeNames())this.setDomElementAttribute(c,d,c.getAttribute(d));const u=c.tagName.toLowerCase();this._shouldRenameElement(u)&&(Wc(u),c.replaceWith(this._createReplacementDomElement(u,c)))}for(;e.firstChild;)e.firstChild.remove();e.append(s)}viewToDom(e,t={}){if(e.is("$text")){const n=this._processDataFromViewText(e);return this._domDocument.createTextNode(n)}else{const n=e;if(this.mapViewToDom(n))if(n.getCustomProperty("editingPipeline:doNotReuseOnce"))this._elementsWithTemporaryCustomProperties.add(n);else return this.mapViewToDom(n);let s;if(n.is("documentFragment"))s=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(s,n);else{if(n.is("uiElement"))return n.name==="$comment"?s=this._domDocument.createComment(n.getCustomProperty("$rawContent")):s=n.render(this._domDocument,this),t.bind&&this.bindElements(s,n),s;this._shouldRenameElement(n.name)?(Wc(n.name),s=this._createReplacementDomElement(n.name)):n.hasAttribute("xmlns")?s=this._domDocument.createElementNS(n.getAttribute("xmlns"),n.name):s=this._domDocument.createElement(n.name),n.is("rawElement")&&n.render(s,this),t.bind&&this.bindElements(s,n);for(const o of n.getAttributeKeys())this.setDomElementAttribute(s,o,n.getAttribute(o),n)}if(t.withChildren!==!1)for(const o of this.viewChildrenToDom(n,t))s instanceof HTMLTemplateElement?s.content.appendChild(o):s.appendChild(o);return s}}setDomElementAttribute(e,t,n,s){const o=this.shouldRenderAttribute(t,n,e.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(t);if(o||N("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:n}),!mv(t)){N("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:n});return}e.hasAttribute(t)&&!o?e.removeAttribute(t):e.hasAttribute(ks+t)&&o&&e.removeAttribute(ks+t),e.setAttribute(o?t:ks+t,n)}removeDomElementAttribute(e,t){t!=Hc&&(e.removeAttribute(t),e.removeAttribute(ks+t))}*viewChildrenToDom(e,t={}){const n=e.getFillerOffset&&e.getFillerOffset();let s=0;for(const o of e.getChildren()){n===s&&(yield this._getBlockFiller());const r=o.is("element")&&!!o.getCustomProperty("dataPipeline:transparentRendering")&&!ie(o.getAttributes());r&&this.renderingMode=="data"?yield*this.viewChildrenToDom(o,t):(r&&N("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:o}),yield this.viewToDom(o,t)),s++}n===s&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),s=this._domDocument.createRange();return s.setStart(t.parent,t.offset),s.setEnd(n.parent,n.offset),s}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let s=e.offset;return Me(n)&&(s+=tt),{parent:n,offset:s}}else{let n,s,o;if(e.offset===0){if(n=this.mapViewToDom(t),!n)return null;o=n.childNodes[0]}else{const a=e.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;n=s.parentNode,o=s.nextSibling}
291if(le(o)&&Me(o))return{parent:o,offset:tt};const r=s?Ei(s)+1:0;return{parent:n,offset:r}}}domToView(e,t={}){const n=[],s=this._domToView(e,t,n),o=s.next().value;return!o||(s.next(),this._processDomInlineNodes(null,n,t),o.is("$text")&&o.data.length==0)?null:o}*domChildrenToView(e,t={},n=[]){let s=[];e instanceof HTMLTemplateElement?s=[...e.content.childNodes]:s=[...e.childNodes];for(let o=0;o<s.length;o++){const r=s[o],a=this._domToView(r,t,n),l=a.next().value;l!==null&&(this._isBlockViewElement(l)&&this._processDomInlineNodes(e,n,t),yield l,a.next())}this._processDomInlineNodes(e,n,t)}domSelectionToView(e){if(Wk(e))return new Et([]);if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;le(s)&&(s=s.parentNode);const o=this.fakeSelectionToView(s);if(o)return o}const t=this.isDomSelectionBackward(e),n=[];for(let s=0;s<e.rangeCount;s++){const o=e.getRangeAt(s),r=this.domRangeToView(o);r&&n.push(r)}return new Et(n,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new M(t,n):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,Ei(e));const n=this.mapDomToView(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return k._createBefore(n);if(le(e)){if(jn(e))return this.domPositionToView(e.parentNode,Ei(e));const s=this.findCorrespondingViewText(e);let o=t;return s?(Me(e)&&(o-=tt,o=o<0?0:o),new k(s,o)):null}else{if(t===0){const s=this.mapDomToView(e);if(s)return new k(s,0)}else{const s=e.childNodes[t-1];if(le(s)&&jn(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,Ei(s));const o=le(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(o&&o.parent)return new k(o.parent,o.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(jn(e))return null;const t=this.getHostViewElement(e);if(t)return t;const n=e.previousSibling;if(n){if(!this.isElement(n))return null;const s=this.mapDomToView(n);if(s){const o=s.nextSibling;return o instanceof ne?o:null}}else{const s=this.mapDomToView(e.parentNode);if(s){const o=s.getChild(0);return o instanceof ne?o:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:n,scrollY:s}=A.window,o=[];zc(t,r=>{const{scrollLeft:a,scrollTop:l}=r;o.push([a,l])}),t.focus(),zc(t,r=>{const[a,l]=o.shift();r.scrollLeft=a,r.scrollTop=l}),A.window.scrollTo(n,s)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),n=this.domSelectionToView(t);n&&n.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return this.blockFillerMode=="br"?e.isEqualNode(Dk):e.tagName==="BR"&&Xf(e,this.blockElements)&&e.parentNode.childNodes.length===1?!0:e.isEqualNode(Uk)||zk(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}const n=t.collapsed;return t.detach(),n}getHostViewElement(e){const t=uv(e);for(t.pop();t.length;){const n=t.pop(),s=this._domToViewMapping.get(n);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Zf(this._domDocument);case"markedNbsp":return Qf(this._domDocument);case"br":return Yf(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(le(e)&&Me(e)&&t<tt||this.isElement(e)&&Me(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!(n&&(n.is("uiElement")||n.is("rawElement")))}*_domToView(e,t,n){if(this.isBlockFiller(e))return null;const s=this.getHostViewElement(e);
291if(s)return s;if(Ri(e)&&t.skipComments)return null;if(le(e)){if(jn(e))return null;{const o=e.data;if(o==="")return null;const r=new ne(this.document,o);return n.push(r),r}}else{let o=this.mapDomToView(e);if(o)return this._isInlineObjectElement(o)&&n.push(o),o;if(this.isDocumentFragment(e))o=new ln(this.document),t.bind&&this.bindDocumentFragments(e,o);else{o=this._createViewElement(e,t),t.bind&&this.bindElements(e,o);const a=e.attributes;if(a)for(let l=a.length,c=0;c<l;c++)o._setAttribute(a[c].name,a[c].value);if(this._isViewElementWithRawContent(o,t))return o._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(o)||n.push(o),o;if(Ri(e))return o._setCustomProperty("$rawContent",e.data),o}yield o;const r=[];if(t.withChildren!==!1)for(const a of this.domChildrenToView(e,t,r))o._appendChild(a);if(this._isInlineObjectElement(o))n.push(o);else for(const a of r)n.push(a)}}_processDomInlineNodes(e,t,n){if(!t.length||e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let s=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!r.is("$text")){s=!1;continue}let a,l=!1;if(Hk(r,this.preElements))a=Dc(r.data);else{a=r.data.replace(/[ \n\t\r]{1,}/g," "),l=/[^\S\u00A0]/.test(a.charAt(a.length-1));const c=o>0?t[o-1]:null,u=o+1<t.length?t[o+1]:null,d=!c||c.is("element")&&c.name=="br"||s,h=u?!1:!Me(r.data);n.withChildren!==!1&&(d&&(a=a.replace(/^ /,"")),h&&(a=a.replace(/ $/,""))),a=Dc(a),a=a.replace(/ \u00A0/g,"  ");const f=u&&u.is("element")&&u.name!="br",m=u&&u.is("$text")&&u.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(a)||!u||f||m)&&(a=a.replace(/\u00A0$/," ")),(d||c&&c.is("element")&&c.name!="br")&&(a=a.replace(/^\u00A0/," "))}a.length==0&&r.parent?(r._remove(),t.splice(o,1),o--):(r._data=a,s=l)}t.length=0}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(n=>this.preElements.includes(n.name)))return t;if(t.charAt(0)==" "){const n=this._getTouchingInlineViewNode(e,!1);(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n)||!n)&&(t=" "+t.substr(1))}if(t.charAt(t.length-1)==" "){const n=this._getTouchingInlineViewNode(e,!0),s=n&&n.is("$textProxy")&&n.data.charAt(0)==" ";(t.charAt(t.length-2)==" "||!n||s)&&(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(n=>this.preElements.includes(n.name)))return!1;const t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_getTouchingInlineViewNode(e,t){const n=new rn({startPosition:t?k._createAfter(e):k._createBefore(e),direction:t?"forward":"backward"});for(const s of n){if(s.item.is("element","br"))return null;if(this._isInlineObjectElement(s.item))return s.item;if(s.item.is("containerElement"))return null;if(s.item.is("$textProxy"))return s.item}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return e.is("element")?e.name=="br"||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e):!1}_createViewElement(e,t){if(Ri(e))return new Ko(this.document,"$comment");const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new st(this.document,n)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const n=this._domDocument.createElement("span");if(n.setAttribute(Hc,e),t){for(;t.firstChild;)n.appendChild(t.firstChild);for(const s of t.getAttributeNames())n.setAttribute(s,t.getAttribute(s))}return n}}function Hk(i,e){return i.getAncestors().some(t=>t.is("element")&&e.includes(t.name))}function zc(i,e){let t=i;for(;t;)e(t),t=t.parentElement}function zk(i,e){return i.isEqualNode($k)&&Xf(i,e)&&i.parentNode.childNodes.length===1}function Xf(i,e){const t=i.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Wc(i){i==="script"&&N("domconverter-unsafe-script-element-detected"),i==="style"&&N("domconverter-unsafe-style-element-detected")}function Wk(i){if(!B.isGecko||!i.rangeCount)return!1;const e=i.getRangeAt(0).startContainer;try{Object.prototype.toString.call(e)}catch{return!0}return!1}/**
292 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
293 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
294 */class pt extends Qe(){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}/**
295 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
296 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
297 */class Qn{constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Uh(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}/**
298 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
299 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
300 */class Mt extends pt{constructor(){super(...arguments),this.useCapture=!1}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(n=>{this.listenTo(e,n,(s,o)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(o.target)&&this.onDomEvent(o)},{useCapture:this.useCapture})})}stopObserving(e){this.stopListening(e)}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Qn(this.view,t,n))}}/**
301 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
302 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
303 */class qk extends Mt{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return mn(this)}};this.fire(e.type,e,t)}}/**
304 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
305 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
306 */class jk extends pt{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=gt(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&n.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new Et(t.getRanges(),{backward:t.isBackward,fake:!1});(e==F.arrowleft||e==F.arrowup)&&n.setTo(n.getFirstPosition()),(e==F.arrowright||e==F.arrowdown)&&n.setTo(n.getLastPosition());const s={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",s),this._fireSelectionChangeDoneDebounced(s)}}/**
307 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
308 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
309 */let em=class extends pt{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const t=this.domConverter,n=new Set,s=new Set;for(const r of e){const a=t.mapDomToView(r.target);a&&(a.is("uiElement")||a.is("rawElement")||r.type==="childList"&&!this._isBogusBrMutation(r)&&s.add(a))}for(const r of e){const a=t.mapDomToView(r.target);if(!(a&&(a.is("uiElement")||a.is("rawElement")))&&r.type==="characterData"){const l=t.findCorrespondingViewText(r.target);l&&!s.has(l.parent)?n.add(l):!l&&Me(r.target)&&s.add(t.mapDomToView(r.target.parentNode))}}let o=!1;for(const r of n)o=!0,this.renderer.markToSync("text",r);for(const r of s){const a=t.mapViewToDom(r),l=Array.from(r.getChildren()),c=Array.from(t.domChildrenToView(a,{withChildren:!1}));Gy(l,c,Gk)||(o=!0,this.renderer.markToSync("children",r))}o&&this.view.forceRender()}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}};function Gk(i,e){if(!Array.isArray(i))return i===e?!0:i.is("$text")&&e.is("$text")?i.data===e.data:!1}/**
310 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
311 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
312 */class wo extends Mt{constructor(e){super(e),this._isFocusChanging=!1,this.domEventType=["focu
312s","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this.flush(),e.change(()=>{})},50)}),t.on("blur",(n,s)=>{const o=t.selection.editableElement;(o===null||o===s.target)&&(t.isFocused=!1,this._isFocusChanging=!1,e.change(()=>{}))})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}/**
313 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
314 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
315 */class Kk extends pt{constructor(e){super(e),this.mutationObserver=e.getObserver(em),this.focusObserver=e.getObserver(wo),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=gt(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=gt(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,n=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},s=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",n,{priority:"highest"}),this.listenTo(e,"keydown",s,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",s,{priority:"highest",useCapture:!0}),!this._documents.has(t)&&(this.listenTo(t,"mouseup",s,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(o,r)=>{this.document.isComposing&&!B.isAndroid||(this._handleSelectionChange(r,t),this._documentIsSelectingInactivityTimeoutDebounced())}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const n=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(n.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(n);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(n))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(this.selection.isSimilar(s))this.view.forceRender();else{const o={oldSelection:this.selection,newSelection:s,domSelection:n};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}/**
316 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
317 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
318 */class Jk extends Mt{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
319 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
320 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
321 */class tm{constructor(e,t={}){this._files=t.cacheFiles?qc(e):null,this._native=e}get files(){return this._files||(this._files=qc(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,n){this._native.setDragImage(e,t,n)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function qc(i){const e=Array.from(i.files||[]),t=Array.from(i.items||[]);return e.length?e:t.filter(n=>n.kind==="file").map(n=>n.getAsFile())}/**
322 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
323 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
324 */class Zk extends Mt{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),n=this.view,s=n.document;let o=null,r=null,a=[];if(e.dataTransfer&&(o=new tm(e.dataTransfer)),e.data!==null?r=e.data:o&&(r=o.getData("text/plain")),s.selection.isFake)a=Array.from(s.selection.getRanges());else if(t.length)a=t.map(l=>{const c=n.domConverter.domPositionToView(l.startContainer,l.startOffset),u=n.domConverter.domPositionToView(l.endContainer,l.endOffset);if(c)return n.createRange(c,u);if(u)return n.createRange(u)}).filter(l=>!!l);else if(B.isAndroid){const l=e.target.ownerDocument.defaultView.getSelection();a=Array.from(n.domConverter.domSelectionToView(l).getRanges())}if(B.isAndroid&&e.inputType=="insertCompositionText"&&r&&r.endsWith(`
325`)){this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[n.createRange(a[0].end)]});return}if(e.inputType=="insertText"&&r&&r.includes(`
326`)){const l=r.split(/\n{1,2}/g);let c=a;for(let u=0;u<l.length;u++){const d=l[u];d!=""&&(this.fire(e.type,e,{data:d,dataTransfer:o,targetRanges:c,inputType:e.inputType,isComposing:e.isComposing}),c=[s.selection.getFirstRange()]),u+1<l.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:c}),c=[s.selection.getFirstRange()])}return}this.fire(e.type,e,{data:r,dataTransfer:o,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}/**
327 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
328 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
329 */class Qk extends pt{constructor(e){super(e),this.document.on("key
329down",(t,n)=>{if(this.isEnabled&&Cv(n.keyCode)){const s=new li(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(s,n),s.stop.called&&t.stop()}})}observe(){}stopObserving(){}}/**
330 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
331 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
332 */class Yk extends pt{constructor(e){super(e);const t=this.document;t.on("keydown",(n,s)=>{if(!this.isEnabled||s.keyCode!=F.tab||s.ctrlKey)return;const o=new li(t,"tab",t.selection.getFirstRange());t.fire(o,s),o.stop.called&&n.stop()})}observe(){}stopObserving(){}}/**
333 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
334 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
335 */class Xk extends W(){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new Go(e),this.domConverter=new Jo(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new Rk(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Kf(this.document),this.addObserver(em),this.addObserver(wo),this.addObserver(Kk),this.addObserver(qk),this.addObserver(jk),this.addObserver(Jk),this.addObserver(Qk),this.addObserver(Zk),this.addObserver(Yk),Ik(this),vk(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0}),this.listenTo(this.document,"change:isFocused",()=>{this._hasChangedSinceTheLastRendering=!0}),B.isiOS&&this.listenTo(this.document,"blur",(t,n)=>{this.domConverter.mapDomToView(n.domEvent.relatedTarget)||this.domConverter._clearDomSelection()})}attachDomRoot(e,t="main"){const n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const s={};for(const{name:r,value:a}of Array.from(e.attributes))s[r]=a,r==="class"?this._writer.addClass(a.split(" "),n):this._writer.setAttribute(r,a,n);this._initialDomRootAttributes.set(e,s);const o=()=>{this._writer.setAttribute("contenteditable",(!n.isReadOnly).toString(),n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};o(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",(r,a)=>this._renderer.markToSync("children",a)),n.on("change:attributes",(r,a)=>this._renderer.markToSync("attributes",a)),n.on("change:text",(r,a)=>this._renderer.markToSync("text",a)),n.on("change:isReadOnly",()=>this.change(o)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const r of this._observers.values())r.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:s})=>t.removeAttribute(s));const n=this._initialDomRootAttributes.get(t);for(const s in n)t.setAttribute(s,n[s]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const s of this._observers.values())s.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[n,s]of this.domRoots)t.observe(s,n);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:n=20,ancestorOffset:s=20}={}){const o=this.document.selection.getFirstRange();if(!o)return;const r=at({alignToTop:e,forceScroll:t,viewportOffset:n,ancestorOffset:s});typeof n=="number"&&(n={top:n,bottom:n,left:n,right:n});const a={target:this.domConverter.viewRangeToDom(o),viewportOffset:n,ancestorOffset:s,alignToTo
335p:e,forceScroll:t};this.fire("scrollToTheSelection",a,r),xf(a)}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new g("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(t){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(wo).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return k._createAt(e,t)}createPositionAfter(e){return k._createAfter(e)}createPositionBefore(e){return k._createBefore(e)}createRange(e,t){return new M(e,t)}createRangeOn(e){return M._createOn(e)}createRangeIn(e){return M._createIn(e)}createSelection(...e){return new Et(...e)}_disableRendering(e){this._renderingDisabled=e,e==!1&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}/**
336 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
337 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
338 */class Jt{is(){throw new Error("is() method is abstract")}}/**
339 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
340 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
341 */let vn=class extends Jt{constructor(e){super(),this.parent=null,this._attrs=St(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))===null)throw new g("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if((e=this.parent.getChildStartOffset(this))===null)throw new g("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent===null?!1:this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),s=e.getAncestors(t);let o=0;for(;n[o]==s[o]&&n[o];)o++;return o===0?null:n[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),s=Te(t,n);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<n[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((t,n)=>(t[n[0]]=n[1],t),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=St(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};vn.prototype.is=function(i){return i==="node"||i==="model:node"};/**
342 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
343 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
344 */class Vi{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>
344e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return t==-1?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return t===null?null:this._nodes.slice(0,t).reduce((n,s)=>n+s.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new g("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const n of this._nodes){if(e>=t&&e<t+n.offsetSize)return this.getNodeIndex(n);t+=n.offsetSize}if(t!=e)throw new g("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const n of t)if(!(n instanceof vn))throw new g("model-nodelist-insertnodes-not-node",this);this._nodes=Fv(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}/**
345 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
346 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
347 */class q extends vn{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new q(this.data,this.getAttributes())}static fromJSON(e){return new q(e.data,e.attributes)}}q.prototype.is=function(i){return i==="$text"||i==="model:$text"||i==="text"||i==="model:text"||i==="node"||i==="model:node"};/**
348 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
349 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
350 */class nt extends Jt{constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new g("model-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.offsetSize)throw new g("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return this.textNode.startOffset!==null?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset!==null?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}nt.prototype.is=function(i){return i==="$textProxy"||i==="model:$textProxy"||i==="textProxy"||i==="model:textProxy"};/**
351 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
352 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
353 */class H extends vn{constructor(e,t,n){super(t),this._children=new Vi,this.name=e,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));return t}findAncestor(e,t={}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(n=>n._clone(!0)):void 0;return new H(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=eC(t);for(const s of n)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const s of n)s.parent=null;return n}static fromJSON(e){let t;if(e.children){t=[];for(const n of e.children)n.name?t.push(H.fromJSON(n)):t.push(q.fromJSON(n))}return new H(e.name,e.attributes,t)}}H.prototype.is=function(i,e){return e?e===this.name&&(i==="element"||i==="model:element"):i==="element"||i==="model:element"||i==="node"||i==="model:node"};function eC(i){return typeof i=="string"?[new q(i)]:(He(i)||(i=[i]),Array.from(i).map(e=>typeof e=="string"?new q(e):e instanceof nt?new q(e.data,e.getAttributes()):e))}/**
354 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
355 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
356 */class Tt{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new g("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new g("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=y._createAt(this.boundaries[this.direction=="backward"?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n,s,o;do s=this.position,o=this._visitedParent,{done:t,value:n}=this.next();while(!t&&e(n));t||(this._position=s,this._visitedParent=o)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===n.maxOffset)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const s=Bi(t,n),o=s||nm(t,n,s);if(o instanceof H){if(!this.shallow)t.path.push(0),this._visitedParent=o;else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,Yt("elementStart",o,e,t,1)}if(o instanceof q){let r;if(this.singleCharacters)r=1;else{let c=o.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),r=c-t.offset}const a=t.offset-o.startOffset,l=new nt(o,a,r);return t.offset+=r,this._position=t,Yt("text",l,e,t,r)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():Yt("elementEnd",n,e,t)}_previous(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const s=t.parent,o=Bi(t,s),r=o||im(t,s,o);if(r instanceof H)return t.offset--,this.shallow?(this._position=t,Yt("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this._position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():Yt("elementEnd",r,e,t));if(r instanceof q){let a;if(this.singleCharacters)a=1;else{let u=r.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>u&&(u=this.boundaries.start.offset),a=t.offset-u}const l=t.offset-r.startOffset,c=new nt(r,l-a,a);return t.offset-=a,this._position=t,Yt("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=n.parent,Yt("elementStart",n,e,t,1)}}function Yt(i,e,t,n,s){return{done:!1,value:{type:i,item:e,previousPosition:t,nextPosition:n,length:s}}}/**
357 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
358 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
359 */class y extends Jt{constructor(e,t,n="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new g("model-position-root-invalid",e);if(!(t instanceof Array)||t.length===0)throw new g("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=n}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new g("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new g("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Bi(this,this.parent)}get nodeAfter(){const e=this.parent;return nm(this,e,Bi(this,e))}get nodeBefore(){const e=this.parent;return im(this,e,Bi(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=Te(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}
359getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new Tt(t);return n.skip(e),n.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=Te(this.path,e.path),n=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let s=0;for(;t[s]==n[s]&&t[s];)s++;return s===0?null:t[s-1]}getShiftedBy(e){const t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return this.compareWith(e)=="after"}isBefore(e){return this.compareWith(e)=="before"}isEqual(e){return this.compareWith(e)=="same"}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let n=0;n<t;n++){const s=this.path[n]-e.path[n];if(s<-1||s>1)return!1;if(s===1)return jc(e,this,n);if(s===-1)return jc(this,e,n)}return this.path.length===e.path.length?!0:this.path.length>e.path.length?sa(this.path,t):sa(e.path,t)}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),n=e.getParentPath();return Te(t,n)=="same"}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=y._createAt(this);break}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&this.stickiness=="toNext"?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange,n=t.containsPosition(this)||t.start.isEqual(this);let s;return n?(s=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(s=s._getTransformedByDeletion(e.deletionPosition,1))):this.isEqual(e.deletionPosition)?s=y._createAt(e.deletionPosition):s=this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),s}_getTransformedByDeletion(e,t){const n=y._createAt(this);if(this.root!=e.root)return n;if(Te(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;n.offset-=t}}else if(Te(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;if(e.offset<=this.path[s]){if(e.offset+t>this.path[s])return null;n.path[s]-=t}}return n}_getTransformedByInsertion(e,t){const n=y._createAt(this);if(this.root!=e.root)return n;if(Te(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(n.offset+=t);else if(Te(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;e.offset<=this.path[s]&&(n.path[s]+=t)}return n}_getTransformedByMove(e,t,n){if(t=t._getTransformedByDeletion(e,n),e.isEqual(t))return y._createAt(this);const s=this._getTransformedByDeletion(e,n);return s===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(n).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):s._getTransformedByInsertion(t,n)}_getCombined(e,t){const n=e.path.length-1,s=y._createAt(t);return s.stickiness=this.stickiness,s.offset=s.offset+this.path[n]-e.offset,s.path=[...s.path,...this.path.slice(n+1)],s}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,n="toNone"){if(e instanceof y)return new y(e.root,e.path,e.stickiness);{const s=e;if(t=="end")t=s.maxOffset;else{if(t=="before")return this._createBefore(s,n);if(t=="after")return this._createAfter(s,n);if(t!==0&&!t)throw new g("model-createpositionat-offset-required",[this,e])}if(!s.is("element")&&!s.is("documentFragment"))throw new g("model-position-parent-incorrect",[this,e]);const o=s.getPath();return o.push(t),new this(s.root,o,n)}}static _createAfter(e,t){if(!e.parent)throw new g("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new g("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const n=new y(t.graveyard,e.path);return n.stickiness=e.stickiness,n}if(!t.getRoot(e.root))throw new g("model-position-fromjson-no-root",t,{rootName:e.root});return new y(t.getRoot(e.root),e.path,e.stickiness)}}y.prototype.is=function(i){return i==="position"||i==="model:position"};function Bi(i,e){const t=e.getChild(e.offsetToIndex(i.offset));return t&&t.is("$text")&&t.startOffset<i.offset?t:null}function nm(i,e,t){return t!==null?null:e.getChild(e.offsetToIndex(i.offset))}function im(i,e,t){return t!==null?null:e.getChild(e.offsetToIndex(i.offset)-1)}function jc(i,e,t){return!(t+1===i.path.length||!sa(e.path,t+1)||!tC(i,t+1))}function sa(i,e){for(;e<i.length;){if(i[e]!==0)return!1;e++}return!0}function tC(i,e){let t=i.parent,n=i.path.length-1,s=0;for(;n>=e;){if(i.path[n]+s!==t.maxOffset)return!1;s=1,n--,t=t.parent}return!0}/**
360 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
361 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
362 */class w extends Jt{constructor(e,t){super(),this.start=y._createAt(e),this.end=t?y._createAt(t):y._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new Tt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return Te(e,t)=="same"}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&s}containsItem(e){const t=y._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new w(this.start,e.start)),this.containsPosition(e.end)&&t.pu
362sh(new w(e.end,this.end))):t.push(new w(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new w(t,n)}return null}getJoined(e,t=!1){let n=this.isIntersecting(e);if(n||(this.start.isBefore(e.start)?n=t?this.end.isTouching(e.start):this.end.isEqual(e.start):n=t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!n)return null;let s=this.start,o=this.end;return e.start.isBefore(s)&&(s=e.start),e.end.isAfter(o)&&(o=e.end),new w(s,o)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,n=y._createAt(this.start);let s=n.parent;for(;n.path.length>t+1;){const o=s.maxOffset-n.offset;o!==0&&e.push(new w(n,n.getShiftedBy(o))),n.path=n.path.slice(0,-1),n.offset++,s=s.parent}for(;n.path.length<=this.end.path.length;){const o=this.end.path[n.path.length-1],r=o-n.offset;r!==0&&e.push(new w(n,n.getShiftedBy(r))),n.offset=o,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Tt(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Tt(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new Tt(e);yield t.position;for(const n of t)yield n.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new w(this.start,this.end)]}getTransformedByOperations(e){const t=[new w(this.start,this.end)];for(const n of e)for(let s=0;s<t.length;s++){const o=t[s].getTransformedByOperation(n);t.splice(s,1,...o),s+=o.length-1}for(let n=0;n<t.length;n++){const s=t[n];for(let o=n+1;o<t.length;o++){const r=t[o];(s.containsRange(r)||r.containsRange(s)||s.isEqual(r))&&t.splice(o,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const n=e.sourcePosition,s=e.howMany,o=e.targetPosition;return this._getTransformedByMove(n,o,s,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let n=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(n=this.end.getShiftedBy(1)),t.root!=n.root&&(n=this.end.getShiftedBy(-1)),new w(t,n)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new w(this.start);let t=this.start._getTransformedByMergeOperation(e),n=this.end._getTransformedByMergeOperation(e);return t.root!=n.root&&(n=this.end.getShiftedBy(-1)),t.isAfter(n)?(e.sourcePosition.isBefore(e.targetPosition)?(t=y._createAt(n),t.offset=0):(e.deletionPosition.isEqual(t)||(n=e.deletionPosition),t=e.targetPosition),new w(t,n)):new w(t,n)}_getTransformedByInsertion(e,t,n=!1){if(n&&this.containsPosition(e))return[new w(this.start,e),new w(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const s=new w(this.start,this.end);return s.start=s.start._getTransformedByInsertion(e,t),s.end=s.end._getTransformedByInsertion(e,t),[s]}}_getTransformedByMove(e,t,n,s=!1){if(this.isCollapsed){const d=this.start._getTransformedByMove(e,t,n);return[new w(d)]}const o=w._createFromPositionAndShift(e,n),r=t._getTransformedByDeletion(e,n);if(this.containsPosition(t)&&!s&&(o.containsPosition(this.start)||o.containsPosition(this.end))){const d=this.start._getTransformedByMove(e,t,n),h=this.end._getTransformedByMove(e,t,n);return[new w(d,h)]}let a;const l=this.getDifference(o);let c=null;const u=this.getIntersection(o);if(l.length==1?c=new w(l[0].start._getTransformedByDeletion(e,n),l[0].end._getTransformedByDeletion(e,n)):l.length==2&&(c=new w(this.start,this.end._getTransformedByDeletion(e,n))),c?a=c._getTransformedByInsertion(r,n,u!==null||s):a=[],u){const d=new w(u.start._getCombined(o.start,r),u.end._getCombined(o.start,r));a.length==2?a.splice(1,0,d):a.push(d)}return a}_getTransformedByDeletion(e,t){let n=this.start._getTransformedByDeletion(e,t),s=this.end._getTransformedByDeletion(e,t);return n==null&&s==null?null:(n==null&&(n=e),s==null&&(s=e),new w(n,s))}static _createFromPositionAndShift(e,t){const n=e,s=e.getShiftedBy(t);return t>0?new this(n,s):new this(s,n)}static _createIn(e){return new this(y._createAt(e,0),y._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(y._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new g("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((o,r)=>o.start.isAfter(r.start)?1:-1);const n=e.indexOf(t),s=new this(t.start,t.end);if(n>0)for(let o=n-1;e[o].end.isEqual(s.start);o++)s.start=y._createAt(e[o].start);for(let o=n+1;o<e.length&&e[o].start.isEqual(s.end);o++)s.end=y._createAt(e[o].end);return s}static fromJSON(e,t){return new this(y.fromJSON(e.start,t),y.fromJSON(e.end,t))}}w.prototype.is=function(i){return i==="range"||i==="model:range"};/**
363 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
364 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
365 */class sm extends G(){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);if(!n)throw new g("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),s=this._viewToModelMapping.get(n),o=this._toModelOff
365set(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=y._createAt(s,o)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const n=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const s of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(s);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(n)==e&&this._modelToViewMapping.delete(n))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const n=this._markerNameToElements.get(t)||new Set;n.add(e);const s=this._elementToMarkerNames.get(e)||new Set;s.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,s)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),n.size==0&&this._markerNameToElements.delete(t));const s=this._elementToMarkerNames.get(e);s&&(s.delete(t),s.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new w(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new M(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const s of t)if(s.is("attributeElement"))for(const o of s.getElementsWithSameId())n.add(o);else n.add(s);return n}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,n){if(n!=e){const o=this._toModelOffset(e.parent,e.index,n),r=this._toModelOffset(e,t,e);return o+r}if(e.is("$text"))return t;let s=0;for(let o=0;o<t;o++)s+=this.getModelLength(e.getChild(o));return s}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name))return this._viewToModelLengthCallbacks.get(e.name)(e);if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const n of e.getChildren())t+=this.getModelLength(n);return t}}findPositionIn(e,t){let n,s=0,o=0,r=0;if(e.is("$text"))return new k(e,t);for(;o<t;)n=e.getChild(r),s=this.getModelLength(n),o+=s,r++;return o==t?this._moveViewPositionToTextNode(new k(e,r)):this.findPositionIn(n,t-(o-s))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,n=e.nodeAfter;return t instanceof ne?new k(t,t.data.length):n instanceof ne?new k(n,0):e}}/**
366 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
367 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
368 */class nC{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Cs(t),e instanceof nt&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=Cs(t),e instanceof nt&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=Cs(t),e instanceof nt&&(e=this._getSymbolForTextProxy(e));const n=this._consumable.get(e);if(n===void 0)return null;const s=n.get(t);return s===void 0?null:s}revert(e,t){t=Cs(t),e instanceof nt&&(e=this._getSymbolForTextProxy(e));const n=this.test(e,t);return n===!1?(this._consumable.get(e).set(t,!0),!0):n===!0?!1:null}verifyAllConsumed(e){const t=[];for(const[n,s]of this._consumable)for(const[o,r]of s){const a=o.split(":")[0];r&&e==a&&t.push({event:o,item:n.name||n.description})}if(t.length)throw new g("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const n=this._textProxyRegistry.get(e.startOffset);if(n){const s=n.get(e.endOffset);s&&(t=s.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,n=e.endOffset,s=e.parent,o=Symbol("$textProxy:"+e.data);let r,a;return r=this._textProxyRegistry.get(t),r||(r=new Map,this._textProxyRegistry.set(t,r)),a=r.get(n),a||(a=new Map,r.set(n,a)),a.set(s,o),o}}function Cs(i){const e=i.split(":");return e[0]=="insert"?e[0]:e[0]=="addMarker"||e[0]=="removeMarker"?i:e.length>1?e[0]+":"+e[1]:e[0]}/**
369 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
370 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
371 */class om extends G(){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}
371convertChanges(e,t,n){const s=this._createConversionApi(n,e.getRefreshedItems());for(const r of e.getMarkersToRemove())this._convertMarkerRemove(r.name,r.range,s);const o=this._reduceChanges(e.getChanges());for(const r of o)r.type==="insert"?this._convertInsert(w._createFromPositionAndShift(r.position,r.length),s):r.type==="reinsert"?this._convertReinsert(w._createFromPositionAndShift(r.position,r.length),s):r.type==="remove"?this._convertRemove(r.position,r.length,r.name,s):this._convertAttribute(r.range,r.attributeKey,r.attributeOldValue,r.attributeNewValue,s);s.mapper.flushDeferredBindings();for(const r of s.mapper.flushUnboundMarkerNames()){const a=t.get(r).getRange();this._convertMarkerRemove(r,a,s),this._convertMarkerAdd(r,a,s)}for(const r of e.getMarkersToAdd())this._convertMarkerAdd(r.name,r.range,s);s.consumable.verifyAllConsumed("insert")}convert(e,t,n,s={}){const o=this._createConversionApi(n,void 0,s);this._convertInsert(e,o);for(const[r,a]of t)this._convertMarkerAdd(r,a,o);o.consumable.verifyAllConsumed("insert")}convertSelection(e,t,n){const s=this._createConversionApi(n);this.fire("cleanSelection",{selection:e},s);const o=e.getFirstPosition().root;if(!s.mapper.toViewElement(o))return;const r=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(s.consumable,e,r),this.fire("selection",{selection:e},s),!!e.isCollapsed){for(const a of r)if(s.consumable.test(e,"addMarker:"+a.name)){const l=a.getRange();if(!iC(e.getFirstPosition(),a,s.mapper))continue;const c={item:e,markerName:a.name,markerRange:l};this.fire(`addMarker:${a.name}`,c,s)}for(const a of e.getAttributeKeys())if(s.consumable.test(e,"attribute:"+a)){const l={item:e,range:e.getFirstRange(),attributeKey:a,attributeOldValue:null,attributeNewValue:e.getAttribute(a)};this.fire(`attribute:${a}:$text`,l,s)}}}_convertInsert(e,t,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const s of Array.from(e.getWalker({shallow:!0})).map(Gc))this._testAndFire("insert",s,t)}_convertRemove(e,t,n,s){this.fire(`remove:${n}`,{position:e,length:t},s)}_convertAttribute(e,t,n,s,o){this._addConsumablesForRange(o.consumable,e,`attribute:${t}`);for(const r of e){const a={item:r.item,range:w._createFromPositionAndShift(r.previousPosition,r.length),attributeKey:t,attributeOldValue:n,attributeNewValue:s};this._testAndFire(`attribute:${t}`,a,o)}}_convertReinsert(e,t){const n=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,n);for(const s of n.map(Gc))this._testAndFire("insert",{...s,reconversion:!0},t)}
371_convertMarkerAdd(e,t,n){if(t.root.rootName=="$graveyard")return;const s=`addMarker:${e}`;if(n.consumable.add(t,s),this.fire(s,{markerName:e,markerRange:t},n),!!n.consumable.consume(t,s)){this._addConsumablesForRange(n.consumable,t,s);for(const o of t.getItems()){if(!n.consumable.test(o,s))continue;const r={item:o,range:w._createOn(o),markerName:e,markerRange:t};this.fire(s,r,n)}}}_convertMarkerRemove(e,t,n){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},n)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const n of t){const s=n.item;if(e.test(s,"insert")===null){e.add(s,"insert");for(const o of s.getAttributeKeys())e.add(s,"attribute:"+o)}}return e}_addConsumablesForRange(e,t,n){for(const s of t.getItems())e.add(s,n);return e}_addConsumablesForSelection(e,t,n){e.add(t,"selection");for(const s of n)e.add(t,"addMarker:"+s.name);for(const s of t.getAttributeKeys())e.add(t,"attribute:"+s);return e}_testAndFire(e,t,n){const s=sC(e,t),o=t.item.is("$textProxy")?n.consumable._getSymbolForTextProxy(t.item):t.item,r=this._firedEventsMap.get(n),a=r.get(o);if(!a)r.set(o,new Set([s]));else if(!a.has(s))a.add(s);else return;this.fire(s,t,n)}_testAndFireAddAttributes(e,t){const n={item:e,range:w._createOn(e)};for(const s of n.item.getAttributeKeys())n.attributeKey=s,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(s),this._testAndFire(`attribute:${s}`,n,t)}_createConversionApi(e,t=new Set,n={}){const s={...this._conversionApi,consumable:new nC,writer:e,options:n,convertItem:o=>this._convertInsert(w._createOn(o),s),convertChildren:o=>this._convertInsert(w._createIn(o),s,{doNotAddConsumables:!0}),convertAttributes:o=>this._testAndFireAddAttributes(o,s),canReuseView:o=>!t.has(s.mapper.toModelElement(o))};return this._firedEventsMap.set(s,new Map),s}}function iC(i,e,t){const n=e.getRange(),s=Array.from(i.getAncestors());return s.shift(),s.reverse(),!s.some(r=>{if(n.containsItem(r))return!!t.toViewElement(r).getCustomProperty("addHighlight")})}function sC(i,e){const t=e.item.is("element")?e.item.name:"$text";return`${i}:${t}`}function Gc(i){const e=i.item,t=w._createFromPositionAndShift(i.previousPosition,i.length);return{item:e,range:t}}/**
372 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
373 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
374 */class Le extends G(Jt){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return this._ranges.length===1?this._ranges[0].isCollapsed:!1}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const s of e._ranges)if(t.isEqual(s)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new w(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?new w(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?new w(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,n,s]=e;if(typeof n=="object"&&(s=n,n=void 0),t===null)this._setRanges([]);else if(t instanceof Le)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof w)this._setRanges([t],!!s&&!!s.backward);else if(t instanceof y)this._setRanges([new w(t)]);else if(t instanceof vn){const o=!!s&&!!s.backward;let r;if(n=="in")r=w._createIn(t);else if(n=="on")r=w._createOn(t);else if(n!==void 0)r=new w(y._createAt(t,n));else throw new g("model-selection-setto-required-second-parameter",[this,t]);this._setRanges([r],o)}else if(He(t))this._setRanges(t,s&&!!s.backward);else throw new g("model-selection-setto-not-selectable",[this,t])}_setRanges(e,t=!1){const n=Array.from(e),s=n.some(o=>{if(!(o instanceof w))throw new g("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(r=>!r.isEqual(o))});n.length===this._ranges.length&&!s||(this._replaceAllRanges(n),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new g("model-selection-setfocus-no-ranges",[this,e]);const n=y._createAt(e,t);if(n.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.length&&this._popRange(),n.compareWith(s)=="before"?(this._pushRange(new w(n,s)),this._lastRangeBackward=!0):(this._pushRange(new w(s,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const n=Kc(t.start,e);rC(n,t)&&(yield n);for(const o of t.getWalker()){const r=o.item;o.type=="elementEnd"&&oC(r,e,t)&&(yield r)}const s=Kc(t.end,e);aC(s,t)&&(yield s)}}containsEntireContent(e=this.anchor.root){const t=y._createAt(e,0),n=y._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new w(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new g("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}
374_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}Le.prototype.is=function(i){return i==="selection"||i==="model:selection"};function rm(i,e){return e.has(i)?!1:(e.add(i),i.root.document.model.schema.isBlock(i)&&!!i.parent)}function oC(i,e,t){return rm(i,e)&&il(i,t)}function Kc(i,e){const n=i.parent.root.document.model.schema,s=i.parent.getAncestors({parentFirst:!0,includeSelf:!0});let o=!1;const r=s.find(a=>o?!1:(o=n.isLimit(a),!o&&rm(a,e)));return s.forEach(a=>e.add(a)),r}function il(i,e){const t=lC(i);return t?!e.containsRange(w._createOn(t),!0):!0}function rC(i,e){return i?e.isCollapsed||i.isEmpty?!0:e.start.isTouching(y._createAt(i,i.maxOffset))?!1:il(i,e):!1}function aC(i,e){return i?e.isCollapsed||i.isEmpty?!0:e.end.isTouching(y._createAt(i,0))?!1:il(i,e):!1}function lC(i){const e=i.root.document.model.schema;let t=i.parent;for(;t;){if(e.isBlock(t))return t;t=t.parent}}/**
375 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
376 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
377 */class Fe extends G(w){constructor(e,t){super(e,t),cC.call(this)}detach(){this.stopListening()}toRange(){return new w(this.start,this.end)}static fromRange(e){return new Fe(e.start,e.end)}}Fe.prototype.is=function(i){return i==="liveRange"||i==="model:liveRange"||i=="range"||i==="model:range"};function cC(){this.listenTo(this.root.document.model,"applyOperation",(i,e)=>{const t=e[0];t.isDocumentOperation&&uC.call(this,t)},{priority:"low"})}function uC(i){const e=this.getTransformedByOperation(i),t=w._createFromRanges(e),n=!t.isEqual(this),s=dC(this,i);let o=null;if(n){t.root.rootName=="$graveyard"&&(i.type=="remove"?o=i.sourcePosition:o=i.deletionPosition);const r=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",r,{deletionPosition:o})}else s&&this.fire("change:content",this.toRange(),{deletionPosition:o})}function dC(i,e){switch(e.type){case"insert":return i.containsPosition(e.position);case"move":case"remove":case"reinsert":case"merge":return i.containsPosition(e.sourcePosition)||i.start.isEqual(e.sourcePosition)||i.containsPosition(e.targetPosition);case"split":return i.containsPosition(e.splitPosition)||i.containsPosition(e.insertionPosition)}return!1}/**
378 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
379 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
380 */const Ki="selection:";class ot extends G(Jt){constructor(e){super(),this._selection=new hC(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Ki+e}static _isStoreAttributeKey(e){return e.startsWith(Ki)}}ot.prototype.is=function(i){return i==="selection"||i=="model:selection"||i=="documentSelection"||i=="model:documentSelection"};class hC extends Le{constructor(e){super(),this.markers=new me({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,n)=>{const s=n[0];!s.isDocumentOperation||s.type=="marker"||s.type=="rename"||s.type=="noop"||(this._ranges.length==0&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>
380{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,n,s,o)=>{this._updateMarker(n,o)}),this.listenTo(this._document,"change",(t,n)=>{fC(this._model,n)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const n=[e];this.fire("change:attribute",{attributeKeys:n,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=$e();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new g("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new g("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Fe.fromRange(e);return t.on("change:range",(n,s,o)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const r=this._ranges.indexOf(t);this._ranges.splice(r,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const s of this._model.markers){const o=s.name.split(":",1)[0];if(!this._observedMarkers.has(o))continue;const r=s.getRange();for(const a of this.getRanges())r.containsRange(a,!a.isCollapsed)&&e.push(s)}const n=Array.from(this.markers);for(const s of e)this.markers.has(s)||(this.markers.add(s),t=!0);for(const s of Array.from(this.markers))e.includes(s)||(this.markers.remove(s),t=!0);t&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateMarker(e,t){const n=e.name.split(":",1)[0];if(!this._observedMarkers.has(n))return;let s=!1;const o=Array.from(this.markers),r=this.markers.has(e);if(!t)r&&(this.markers.remove(e),s=!0);else{let a=!1;for(const l of this.getRanges())if(t.containsRange(l,!l.isCollapsed)){a=!0;break}a&&!r?(this.markers.add(e),s=!0):!a&&r&&(this.markers.remove(e),s=!0)}s&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=St(this._getSurroundingAttributes()),n=St(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[o,r]of this._attributePriority)r=="low"&&(this._attrs.delete(o),this._attributePriority.delete(o));this._setAttributesTo(t);const s=[];for(const[o,r]of this.getAttributes())(!n.has(o)||n.get(o)!==r)&&s.push(o);for(const[o]of n)this.hasAttribute(o)||s.push(o);s.length>0&&this.fire("change:attribute",{attributeKeys:s,directChange:!1})}_setAttribute(e,t,n=!0){const s=n?"normal":"low";return s=="low"&&this._attributePriority.get(e)=="normal"||super.getAttribute(e)===t?!1:(this._attrs.set(e,t),this._attributePriority.set(e,s),!0)}
380_removeAttribute(e,t=!0){const n=t?"normal":"low";return n=="low"&&this._attributePriority.get(e)=="normal"||(this._attributePriority.set(e,n),!super.hasAttribute(e))?!1:(this._attrs.delete(e),!0)}_setAttributesTo(e){const t=new Set;for(const[n,s]of this.getAttributes())e.get(n)!==s&&this._removeAttribute(n,!1);for(const[n,s]of e)this._setAttribute(n,s,!1)&&t.add(n);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(Ki)&&(yield[t.substr(Ki.length),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if(e.root.rootName=="$graveyard")return null;let n=null;if(this.isCollapsed){const s=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=gi(s,t)),n||(n=gi(o,t)),!this.isGravityOverridden&&!n){let r=s;for(;r&&!n;)r=r.previousSibling,n=gi(r,t)}if(!n){let r=o;for(;r&&!n;)r=r.nextSibling,n=gi(r,t)}n||(n=this.getStoredAttributes())}else{const s=this.getFirstRange();for(const o of s){if(o.item.is("element")&&t.isObject(o.item)){n=gi(o.item,t);break}if(o.type=="text"){n=o.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function gi(i,e){if(!i)return null;if(i instanceof nt||i instanceof q)return i.getAttributes();if(!e.isInline(i))return null;if(!e.isObject(i))return[];const t=[];for(const[n,s]of i.getAttributes())e.checkAttribute("$text",n)&&e.getAttributeProperties(n).copyFromObject!==!1&&t.push([n,s]);return t}function fC(i,e){const t=i.document.differ;for(const n of t.getChanges()){if(n.type!="insert")continue;const s=n.position.parent;n.length===s.maxOffset&&i.enqueueChange(e,r=>{const a=Array.from(s.getAttributeKeys()).filter(l=>l.startsWith(Ki));for(const l of a)r.removeAttribute(l,s)})}}/**
381 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
382 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
383 */class am{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}/**
384 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
385 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
386 */class mC extends am{elementToElement(e){return this.add(VC(e))}elementToStructure(e){return this.add(BC(e))}attributeToElement(e){return this.add(MC(e))}attributeToAttribute(e){return this.add(OC(e))}markerToElement(e){return this.add(LC(e))}markerToHighlight(e){return this.add(NC(e))}markerToData(e){return this.add(FC(e))}}function lm(){return(i,e,t)=>{if(!t.consumable.consume(e.item,i.name))return;const n=t.writer,s=t.mapper.toViewPosition(e.range.start),o=n.createText(e.item.data);n.insert(s,o)}}function cm(){return(i,e,t)=>{t.convertAttributes(e.item),!e.reconversion&&e.item.is("element")&&!e.item.isEmpty&&t.convertChildren(e.item)}}function gC(){return(i,e,t)=>{const n=t.mapper.toViewPosition(e.position),s=e.position.getShiftedBy(e.length),o=t.mapper.toViewPosition(s,{isPhantom:!0}),r=t.writer.createRange(n,o),a=t.writer.remove(r.getTrimmed());for(const l of t.writer.createRangeIn(a).getItems())t.mapper.unbindViewElement(l,{defer:!0})}}function um(i,e){const t=i.createAttributeElement("span",e.attributes);return e.classes&&t._addClass(e.classes),typeof e.priority=="number"&&(t._priority=e.priority),t._id=e.id,t}function pC(){return(i,e,t)=>{const n=e.selection;if(n.isCollapsed||!t.consumable.consume(n,"selection"))return;const s=[];for(const o of n.getRanges())s.push(t.mapper.toViewRange(o));t.writer.setSelection(s,{backward:n.isBackward})}}function bC(){return(i,e,t)=>{const n=e.selection;if(!n.isCollapsed||!t.consumable.consume(n,"selection"))return;const s=t.writer,o=n.getFirstPosition(),r=t.mapper.toViewPosition(o),a=s.breakAttributes(r);s.setSelection(a)}}function wC(){return(i,e,t)=>{const n=t.writer,s=n.document.selection;for(const o of s.getRanges())o.isCollapsed&&o.end.parent.isAttached()&&t.writer.mergeAttributes(o.start);n.setSelection(null)}}function _C(i){return(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;const s=i(t.attributeOldValue,n,t),o=i(t.attributeNewValue,n,t);if(!s&&!o)return;n.consumable.consume(t.item,e.name);const r=n.writer,a=r.document.selection;if(t.item instanceof Le||t.item instanceof ot)r.wrap(a.getFirstRange(),o);else{let l=n.mapper.toViewRange(t.range);
386t.attributeOldValue!==null&&s&&(l=r.unwrap(l,s)),t.attributeNewValue!==null&&o&&r.wrap(l,o)}}}function yC(i,e=qC){return(t,n,s)=>{if(!e(n.item,s.consumable,{preflight:!0}))return;const o=i(n.item,s,n);if(!o)return;e(n.item,s.consumable);const r=s.mapper.toViewPosition(n.range.start);s.mapper.bindElements(n.item,o),s.writer.insert(r,o),s.convertAttributes(n.item),gm(o,n.item.getChildren(),s,{reconversion:n.reconversion})}}function vC(i,e){return(t,n,s)=>{if(!e(n.item,s.consumable,{preflight:!0}))return;const o=new Map;s.writer._registerSlotFactory(UC(n.item,o,s));const r=i(n.item,s,n);if(s.writer._clearSlotFactory(),!r)return;HC(n.item,o,s),e(n.item,s.consumable);const a=s.mapper.toViewPosition(n.range.start);s.mapper.bindElements(n.item,r),s.writer.insert(a,r),s.convertAttributes(n.item),zC(r,o,s,{reconversion:n.reconversion})}}function kC(i){return(e,t,n)=>{t.isOpening=!0;const s=i(t,n);t.isOpening=!1;const o=i(t,n);if(!s||!o)return;const r=t.markerRange;if(r.isCollapsed&&!n.consumable.consume(r,e.name))return;for(const c of r)if(!n.consumable.consume(c.item,e.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(r.start),s),n.mapper.bindElementToMarker(s,t.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),o),n.mapper.bindElementToMarker(o,t.markerName)),e.stop()}}function CC(){return(i,e,t)=>{const n=t.mapper.markerNameToElements(e.markerName);if(n){for(const s of n)t.mapper.unbindElementFromMarkerName(s,e.markerName),t.writer.clear(t.writer.createRangeOn(s),s);t.writer.clearClonedElementsGroup(e.markerName),i.stop()}}}function TC(i){return(e,t,n)=>{const s=i(t.markerName,n);if(!s)return;const o=t.markerRange;n.consumable.consume(o,e.name)&&(Jc(o,!1,n,t,s),Jc(o,!0,n,t,s),e.stop())}}function Jc(i,e,t,n,s){const o=e?i.start:i.end,r=o.nodeAfter&&o.nodeAfter.is("element")?o.nodeAfter:null,a=o.nodeBefore&&o.nodeBefore.is("element")?o.nodeBefore:null;if(r||a){let c,u;e&&r||!e&&!a?(c=r,u=!0):(c=a,u=!1);const d=t.mapper.toViewElement(c);if(d){EC(d,e,u,t,n,s);return}}const l=t.mapper.toViewPosition(o);AC(l,e,t,n,s)}function EC(i,e,t,n,s,o){const r=`data-${o.group}-${e?"start":"end"}-${t?"before":"after"}`,a=i.hasAttribute(r)?i.getAttribute(r).split(","):[];a.unshift(o.name),n.writer.setAttribute(r,a.join(","),i),n.mapper.bindElementToMarker(i,s.markerName)}function AC(i,e,t,n,s){const o=`${s.group}-${e?"start":"end"}`,r=s.name?{name:s.name}:null,a=t.writer.createUIElement(o,r);t.writer.insert(i,a),t.mapper.bindElementToMarker(a,n.markerName)}function xC(i){return(e,t,n)=>{const s=i(t.markerName,n);if(!s)return;const o=n.mapper.markerNameToElements(t.markerName);if(!o)return;for(const a of o)n.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("containerElement")?(r(`data-${s.group}-start-before`,a),r(`data-${s.group}-start-after`,a),r(`data-${s.group}-end-before`,a),r(`data-${s.group}-end-after`,a)):n.writer.clear(n.writer.createRangeOn(a),a);n.writer.clearClonedElementsGroup(t.markerName),e.stop();function r(a,l){if(l.hasAttribute(a)){const c=new Set(l.getAttribute(a).split(","));c.delete(s.name),c.size==0?n.writer.removeAttribute(a,l):n.writer.setAttribute(a,Array.from(c).join(","),l)}}}}function SC(i){return(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;const s=i(t.attributeOldValue,n,t),o=i(t.attributeNewValue,n,t);if(!s&&!o)return;n.consumable.consume(t.item,e.name);const r=n.mapper.toViewElement(t.item),a=n.writer;if(!r)throw new g("conversion-attribute-to-attribute-on-text",n.dispatcher,t);if(t.attributeOldValue!==null&&s)if(s.key=="class"){const l=typeof s.value=="string"?s.value.split(/\s+/):s.value;for(const c of l)a.removeClass(c,r)}else if(s.key=="style")if(typeof s.value=="string"){const l=new Xr(a.document.stylesProcessor);l.setTo(s.value);for(const[c]of l.getStylesEntries())a.removeStyle(c,r)}else{const l=Object.keys(s.value);for(const c of l)a.removeStyle(c,r)}else a.removeAttribute(s.key,r);if(t.attributeNewValue!==null&&o)if(o.key=="class"){const l=typeof o.value=="string"?o.value.split(/\s+/):o.value;for(const c of l)a.addClass(c,r)}else if(o.key=="style")if(typeof o.value=="string"){const l=new Xr(a.document.stylesProcessor);l.setTo(o.value);for(const[c,u]of l.getStylesEntries())a.setStyle(c,u,r)}else{const l=Object.keys(o.value);for(const c of l)a.setStyle(c,o.value[c],r)}else a.setAttribute(o.key,o.value,r)}}function IC(i){return(e,t,n)=>{if(!t.item||!(t.item instanceof Le||t.item instanceof ot)&&!t.item.is("$textProxy"))return;const s=sl(i,t,n);if(!s||!n.consumable.consume(t.item,e.name))return;const o=n.writer,r=um(o,s),a=o.document.selection;if(t.item instanceof Le||t.item instanceof ot)o.wrap(a.getFirstRange(),r);else{const l=n.mapper.toViewRange(t.range),c=o.wrap(l,r);for(const u of c.getItems())if(u.is("attributeElement")&&u.isSimilar(r)){n.mapper.bindElementToMarker(u,t.markerName);break}}}}function PC(i){return(e,t,n)=>{if(!t.item||!(t.item instanceof H))return;const s=sl(i,t,n);if(!s||!n.consumable.test(t.item,e.name))return;const o=n.mapper.toViewElement(t.item);if(o&&o.getCustomProperty("addHighlight")){n.consumable.consume(t.item,e.name);for(const a of w._createIn(t.item))n.consumable.consume(a.item,e.name);o.getCustomProperty("addHighlight")(o,s,n.writer),n.mapper.bindElementToMarker(o,t.markerName)}}}function RC(i){return(e,t,n)=>{if(t.markerRange.isCollapsed)return;const s=sl(i,t,n);if(!s)return;
386const o=um(n.writer,s),r=n.mapper.markerNameToElements(t.markerName);if(r){for(const a of r)n.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("attributeElement")?n.writer.unwrap(n.writer.createRangeOn(a),o):a.getCustomProperty("removeHighlight")(a,s.id,n.writer);n.writer.clearClonedElementsGroup(t.markerName),e.stop()}}}function VC(i){const e=dm(i.model),t=Ji(i.view,"container");return e.attributes.length&&(e.children=!0),n=>{n.on(`insert:${e.name}`,yC(t,mm(e)),{priority:i.converterPriority||"normal"}),(e.children||e.attributes.length)&&n.on("reduceChanges",fm(e),{priority:"low"})}}function BC(i){const e=dm(i.model),t=Ji(i.view,"container");return e.children=!0,n=>{if(n._conversionApi.schema.checkChild(e.name,"$text"))throw new g("conversion-element-to-structure-disallowed-text",n,{elementName:e.name});n.on(`insert:${e.name}`,vC(t,mm(e)),{priority:i.converterPriority||"normal"}),n.on("reduceChanges",fm(e),{priority:"low"})}}function MC(i){i=at(i);let e=i.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)i.view[s]=Ji(i.view[s],"attribute");else i.view=Ji(i.view,"attribute");const n=hm(i);return s=>{s.on(t,_C(n),{priority:i.converterPriority||"normal"})}}function OC(i){i=at(i);let e=i.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)i.view[s]=Zc(i.view[s]);else i.view=Zc(i.view);const n=hm(i);return s=>{s.on(t,SC(n),{priority:i.converterPriority||"normal"})}}function LC(i){const e=Ji(i.view,"ui");return t=>{t.on(`addMarker:${i.model}`,kC(e),{priority:i.converterPriority||"normal"}),t.on(`removeMarker:${i.model}`,CC(),{priority:i.converterPriority||"normal"})}}function FC(i){i=at(i);const e=i.model;let t=i.view;return t||(t=n=>({group:e,name:n.substr(i.model.length+1)})),n=>{n.on(`addMarker:${e}`,TC(t),{priority:i.converterPriority||"normal"}),n.on(`removeMarker:${e}`,xC(t),{priority:i.converterPriority||"normal"})}}function NC(i){return e=>{e.on(`addMarker:${i.model}`,IC(i.view),{priority:i.converterPriority||"normal"}),e.on(`addMarker:${i.model}`,PC(i.view),{priority:i.converterPriority||"normal"}),e.on(`removeMarker:${i.model}`,RC(i.view),{priority:i.converterPriority||"normal"})}}function dm(i){return typeof i=="string"&&(i={name:i}),{name:i.name,attributes:i.attributes?J(i.attributes):[],children:!!i.children}}function Ji(i,e){return typeof i=="function"?i:(t,n)=>DC(i,n,e)}function DC(i,e,t){typeof i=="string"&&(i={name:i});let n;const s=e.writer,o=Object.assign({},i.attributes);if(t=="container")n=s.createContainerElement(i.name,o);else if(t=="attribute"){const r={priority:i.priority||an.DEFAULT_PRIORITY};n=s.createAttributeElement(i.name,o,r)}else n=s.createUIElement(i.name,o);if(i.styles){const r=Object.keys(i.styles);for(const a of r)s.setStyle(a,i.styles[a],n)}if(i.classes){const r=i.classes;if(typeof r=="string")s.addClass(r,n);else for(const a of r)s.addClass(a,n)}return n}function hm(i){return i.model.values?(e,t,n)=>{const s=i.view[e];return s?s(e,t,n):null}:i.view}function Zc(i){return typeof i=="string"?e=>({key:i,value:e}):typeof i=="object"?i.value?()=>i:e=>({key:i.key,value:e}):i}function sl(i,e,t){const n=typeof i=="function"?i(e,t):i;return n?(n.priority||(n.priority=10),n.id||(n.id=e.markerName),n):null}function $C(i){return(e,t)=>{if(!e.is("element",i.name))return!1;if(t.type=="attribute"){if(i.attributes.includes(t.attributeKey))return!0}else{/* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */if(i.children)return!0}return!1}}function fm(i){const e=$C(i);return(t,n)=>{const s=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const o of n.changes){const r=o.type=="attribute"?o.range.start.nodeAfter:o.position.parent;if(!r||!e(r,o)){s.push(o);continue}if(!n.reconvertedElements.has(r)){n.reconvertedElements.add(r);const a=y._createBefore(r);let l=s.length;for(let c=s.length-1;c>=0;c--){const u=s[c],h=(u.type=="attribute"?u.range.start:u.position).compareWith(a);if(h=="before"||u.type=="remove"&&h=="same")break;l=c}s.splice(l,0,{type:"remove",name:r.name,position:a,length:1},{type:"reinsert",name:r.name,position:a,length:1})}}n.changes=s}}function mm(i){return(e,t,n={})=>{const s=["insert"];for(const o of i.attributes)e.hasAttribute(o)&&s.push(`attribute:${o}`);return s.every(o=>
386t.test(e,o))?(n.preflight||s.forEach(o=>t.consume(e,o)),!0):!1}}function UC(i,e,t){return(n,s)=>{const o=n.createContainerElement("$slot");let r=null;if(s==="children")r=Array.from(i.getChildren());else if(typeof s=="function")r=Array.from(i.getChildren()).filter(a=>s(a));else throw new g("conversion-slot-mode-unknown",t.dispatcher,{modeOrFilter:s});return e.set(o,r),o}}function HC(i,e,t){const n=Array.from(e.values()).flat(),s=new Set(n);if(s.size!=n.length)throw new g("conversion-slot-filter-overlap",t.dispatcher,{element:i});if(s.size!=i.childCount)throw new g("conversion-slot-filter-incomplete",t.dispatcher,{element:i})}function zC(i,e,t,n){t.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of e)gm(i,o,t,n),t.writer.move(t.writer.createRangeIn(s),t.writer.createPositionBefore(s)),t.writer.remove(s);t.mapper.off("modelToViewPosition",r);function r(a,l){const c=l.modelPosition.nodeAfter,u=o.indexOf(c);u<0||(l.viewPosition=l.mapper.findPositionIn(s,u))}}function gm(i,e,t,n){for(const s of e)WC(i.root,s,t,n)||t.convertItem(s)}function WC(i,e,t,n){const{writer:s,mapper:o}=t;if(!n.reconversion)return!1;const r=o.toViewElement(e);return!r||r.root==i||!t.canReuseView(r)?!1:(s.move(s.createRangeOn(r),o.toViewPosition(y._createBefore(e))),!0)}function qC(i,e,{preflight:t}={}){return t?e.test(i,"insert"):e.consume(i,"insert")}/**
387 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
388 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
389 */function pm(i){const{schema:e,document:t}=i.model;for(const n of t.getRoots())if(n.isEmpty&&!e.checkChild(n,"$text")&&e.checkChild(n,"paragraph"))return i.insertElement("paragraph",n),!0;return!1}function bm(i,e,t){const n=t.createContext(i);return!(!t.checkChild(n,"paragraph")||!t.checkChild(n.push("paragraph"),e))}function wm(i,e){const t=e.createElement("paragraph");return e.insert(t,i),e.createPositionAt(t,0)}/**
390 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
391 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
392 */class jC extends am{elementToElement(e){return this.add(_m(e))}elementToAttribute(e){return this.add(JC(e))}attributeToAttribute(e){return this.add(ZC(e))}elementToMarker(e){return this.add(QC(e))}dataToMarker(e){return this.add(YC(e))}}function Qc(){return(i,e,t)=>{if(!e.modelRange&&t.consumable.consume(e.viewItem,{name:!0})){const{modelRange:n,modelCursor:s}=t.convertChildren(e.viewItem,e.modelCursor);e.modelRange=n,e.modelCursor=s}}}function GC(){return(i,e,{schema:t,consumable:n,writer:s})=>{let o=e.modelCursor;if(!n.test(e.viewItem))return;if(!t.checkChild(o,"$text")){if(!bm(o,"$text",t)||e.viewItem.data.trim().length==0)return;const a=o.nodeBefore;o=wm(o,s),a&&a.is("element","$marker")&&(s.move(s.createRangeOn(a),o),o=s.createPositionAfter(a))}n.consume(e.viewItem);const r=s.createText(e.viewItem.data);s.insert(r,o),e.modelRange=s.createRange(o,o.getShiftedBy(r.offsetSize)),e.modelCursor=e.modelRange.end}}function KC(i,e){return(t,n)=>{const s=n.newSelection,o=[];for(const a of s.getRanges())o.push(e.toModelRange(a));const r=i.createSelection(o,{backward:s.isBackward});r.isEqual(i.document.selection)||i.change(a=>{a.setSelection(r)})}}function _m(i){i=at(i);const e=oa(i),t=ol(i.view),n=t?`element:${t}`:"element";return s=>{s.on(n,e,{priority:i.converterPriority||"normal"})}}function JC(i){i=at(i),ym(i);const e=vm(i,!1),t=ol(i.view),n=t?`element:${t}`:"element";return s=>{s.on(n,e,{priority:i.converterPriority||"low"})}}function ZC(i){i=at(i);let e=null;(typeof i.view=="string"||i.view.key)&&(e=tT(i)),ym(i,e);const t=vm(i,!0);return n=>{n.on("element",t,{priority:i.converterPriority||"low"})}}function QC(i){const e=sT(i.model);return _m({...i,model:e})}function YC(i){i=at(i),i.model||(i.model=s=>s?i.view+":"+s:i.view);const e={view:i.view,model:i.model},t=oa(Yc(e,"start")),n=oa(Yc(e,"end"));return s=>{s.on(`element:${i.view}-start`,t,{priority:i.converterPriority||"normal"}),s.on(`element:${i.view}-end`,n,{priority:i.converterPriority||"normal"});const o=Ut.low,r=Ut.highest,a=Ut.get(i.converterPriority)/r;s.on("element",XC(e),{priority:o+a})}}function XC(i){return(e,t,n)=>{const s=`data-${i.view}`;if(!n.consumable.test(t.viewItem,{attributes:s+"-end-after"})&&!n.consumable.test(t.viewItem,{attributes:s+"-start-after"})&&!n.consumable.test(t.viewItem,{attributes:s+"-end-before"})&&!n.consumable.test(t.viewItem,{attributes:s+"-start-before"}))return;t.modelRange||Object.assign(t,n.convertChildren(t.viewItem,t.modelCursor)),n.consumable.consume(t.viewItem,{attributes:s+"-end-after"})&&o(t.modelRange.end,t.viewItem.getAttribute(s+"-end-after").split(",")),n.consumable.consume(t.viewItem,{attributes:s+"-start-after"})&&o(t.modelRange.end,t.viewItem.getAttribute(s+"-start-after").split(",")),n.consumable.consume(t.viewItem,{attributes:s+"-end-before"})&&o(t.modelRange.start,t.viewItem.getAttribute(s+"-end-before").split(",")),n.consumable.consume(t.viewItem,{attributes:s+"-start-before"})&&o(t.modelRange.start,t.viewItem.getAttribute(s+"-start-before").split(","));function o(r,a){for(const l of a){const c=i.model(l,n),u=n.writer.createElement("$marker",{"data-name":c});n.writer.insert(u,r),t.modelCursor.isEqual(r)?t.modelCursor=t.modelCursor.getShiftedBy(1):t.modelCursor=t.modelCursor._getTransformedByInsertion(r,1),t.modelRange=t.modelRange._getTransformedByInsertion(r,1)[0]}}}}function ol(i){return typeof i=="string"?i:typeof i=="object"&&typeof i.name=="string"?i.name:null}function oa(i){const e=new Ke(i.view);return(t,n,s)=>{const o=e.match(n.viewItem);if(!o)return;const r=o.match;if(r.name=!0,!s.consumable.test(n.viewItem,r))return;const a=eT(i.model,n.viewItem,s);a&&s.safeInsert(a,n.modelCursor)&&(s.consumable.consume(n.viewItem,r),s.convertChildren(n.viewItem,a),s.updateConversionResult(a,n))}}function eT(i,e,t){return i instanceof Function?i(e,t):t.writer.createElement(i)}function tT(i){typeof i.view=="string"&&(i.view={key:i.view});const e=i.view.key,t=typeof i.view.value>"u"?/[\s\S]*/:i.view.value;let n;return e=="class"||e=="style"?n={[e=="class"?"classes":"styles"]:t}:n={attributes:{[e]:t}},i.view.name&&(n.name=i.view.name),i.view=n,e}function ym(i,e=null){const t=e===null?!0:o=>o.getAttribute(e),n=typeof i.model!="object"?i.model:i.model.key,s=typeof i.model!="object"||typeof i.model.value>"u"?t:i.model.value;i.model={key:n,value:s}}function vm(i,e){const t=new Ke(i.view);return(n,s,o)=>
392{if(!s.modelRange&&e)return;const r=t.match(s.viewItem);if(!r||(nT(i.view,s.viewItem)?r.match.name=!0:delete r.match.name,!o.consumable.test(s.viewItem,r.match)))return;const a=i.model.key,l=typeof i.model.value=="function"?i.model.value(s.viewItem,o):i.model.value;if(l===null)return;s.modelRange||Object.assign(s,o.convertChildren(s.viewItem,s.modelCursor)),iT(s.modelRange,{key:a,value:l},e,o)&&(o.consumable.test(s.viewItem,{name:!0})&&(r.match.name=!0),o.consumable.consume(s.viewItem,r.match))}}function nT(i,e){const t=typeof i=="function"?i(e):i;return typeof t=="object"&&!ol(t)?!1:!t.classes&&!t.attributes&&!t.styles}function iT(i,e,t,n){let s=!1;for(const o of Array.from(i.getItems({shallow:t})))n.schema.checkAttribute(o,e.key)&&(s=!0,!o.hasAttribute(e.key)&&n.writer.setAttribute(e.key,e.value,o));return s}function sT(i){return(e,t)=>{const n=typeof i=="string"?i:i(e,t);return t.writer.createElement("$marker",{"data-name":n})}}function Yc(i,e){const t=(n,s)=>{const o=n.getAttribute("name"),r=i.model(o,s);return s.writer.createElement("$marker",{"data-name":r})};return{view:`${i.view}-${e}`,model:t}}/**
393 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
394 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
395 */function oT(i){i.document.registerPostFixer(e=>rT(e,i))}function rT(i,e){const t=e.document.selection,n=e.schema,s=[];let o=!1;for(const r of t.getRanges()){const a=km(r,n);a&&!a.isEqual(r)?(s.push(a),o=!0):s.push(r)}return o&&i.setSelection(uT(s),{backward:t.isBackward}),!1}function km(i,e){return i.isCollapsed?aT(i,e):lT(i,e)}function aT(i,e){const t=i.start,n=e.getNearestSelectionRange(t);if(!n){const o=t.getAncestors().reverse().find(r=>e.isObject(r));return o?w._createOn(o):null}if(!n.isCollapsed)return n;const s=n.start;return t.isEqual(s)?null:new w(s)}function lT(i,e){const{start:t,end:n}=i,s=e.checkChild(t,"$text"),o=e.checkChild(n,"$text"),r=e.getLimitElement(t),a=e.getLimitElement(n);if(r===a){if(s&&o)return null;if(cT(t,n,e)){const d=t.nodeAfter&&e.isSelectable(t.nodeAfter)?null:e.getNearestSelectionRange(t,"forward"),f=n.nodeBefore&&e.isSelectable(n.nodeBefore)?null:e.getNearestSelectionRange(n,"backward"),m=d?d.start:t,p=f?f.end:n;return new w(m,p)}}
395const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const u=t.nodeAfter&&n.nodeBefore&&t.nodeAfter.parent===n.nodeBefore.parent,d=l&&(!u||!eu(t.nodeAfter,e)),h=c&&(!u||!eu(n.nodeBefore,e));let f=t,m=n;return d&&(f=y._createBefore(Xc(r,e))),h&&(m=y._createAfter(Xc(a,e))),new w(f,m)}return null}function Xc(i,e){let t=i,n=t;for(;e.isLimit(n)&&n.parent;)t=n,n=n.parent;return t}function cT(i,e,t){const n=i.nodeAfter&&!t.isLimit(i.nodeAfter)||t.checkChild(i,"$text"),s=e.nodeBefore&&!t.isLimit(e.nodeBefore)||t.checkChild(e,"$text");return n||s}function uT(i){const e=[...i],t=new Set;let n=1;for(;n<e.length;){const o=e[n],r=e.slice(0,n);for(const[a,l]of r.entries())if(!t.has(a)){if(o.isEqual(l))t.add(a);else if(o.isIntersecting(l)){t.add(a),t.add(n);const c=o.getJoined(l);e.push(c)}}n++}return e.filter((o,r)=>!t.has(r))}function eu(i,e){return i&&e.isSelectable(i)}/**
396 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
397 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
398 */class dT extends W(){constructor(e,t){super(),this.model=e,this.view=new Xk(t),this.mapper=new sm,this.downcastDispatcher=new om({mapper:this.mapper,schema:e.schema});const n=this.model.document,s=n.selection,o=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(n,"change",()=>{this.view.change(r=>{this.downcastDispatcher.convertChanges(n.differ,o,r),this.downcastDispatcher.convertSelection(s,o,r)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",KC(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",hT(this.mapper,this.model.schema,this.view),{priority:"high"}),this.downcastDispatcher.on("insert:$text",lm(),{priority:"lowest"}),this.downcastDispatcher.on("insert",cm(),{priority:"lowest"}),this.downcastDispatcher.on("remove",gC(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",wC()),this.downcastDispatcher.on("selection",pC(),{priority:"low"}),this.downcastDispatcher.on("selection",bC(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(r=>{if(r.rootName=="$graveyard")return null;const a=new Wf(this.view.document,r.name);return a.rootName=r.rootName,this.mapper.bindElements(r,a),a})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,n=this.model.markers.get(t);if(!n)throw new g("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(n)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}function hT(i,e,t){return(n,s)=>{if(!(t.document.isComposing&&!B.isAndroid))for(let o=0;o<s.targetRanges.length;o++){const r=s.targetRanges[o],a=i.toModelRange(r),l=km(a,e);!l||l.isEqual(a)||(s.targetRanges[o]=i.toViewRange(l))}}}/**
399 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
400 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
401 */class Mi{constructor(){this._consumables=new Map}add(e,t){let n;if(e.is("$text")||e.is("documentFragment")){this._consumables.set(e,!0);return}this._consumables.has(e)?n=this._consumables.get(e):(n=new fT(e),this._consumables.set(e,n)),n.add(t)}test(e,t){const n=this._consumables.get(e);return n===void 0?null:e.is("$text")||e.is("documentFragment")?n:n.test(t)}consume(e,t){return this.test(e,t)?(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0):!1}revert(e,t){const n=this._consumables.get(e);n!==void 0&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const r of n)r=="style"||r=="class"||t.attributes.push(r);const s=e.getClassNames();for(const r of s)t.classes.push(r);const o=e.getStyleNames();for(const r of o)t.styles.push(r);return t}static createFrom(e,t){if(t||(t=new Mi),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,Mi.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=Mi.createFrom(n,t);return t}}const Ts=["attributes","classes","styles"];class fT{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of Ts)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of Ts)if(t in e){const n=this._test(t,e[t]);if(n!==!0)return n}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of Ts)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of Ts)t in e&&this._revert(t,e[t])}_add(e,t){const n=J(t),s=this._consumables[e];for(const o of n){if(e==="attributes"&&(o==="class"||o==="style"))throw new g("viewconsumable-invalid-attribute",this);if(s.set(o,!0),e==="styles")for(const r of this.element.document.stylesProcessor.getRelatedStyles(o))s.set(r,!0)}}_test(e,t){const n=J(t),s=this._consumables[e];for(const o of n)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles",a=this._test(r,[...this._consumables[r].keys()]);if(a!==!0)return a}else{const r=s.get(o);if(r===void 0)return null;if(!r)return!1}return!0}_consume(e,t){const n=J(t),s=this._consumables[e];for(const o of n)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles";this._consume(r,[...this._consumables[r].keys()])}else if(s.set(o,!1),e=="styles")for(const r of this.element.document.stylesProcessor.getRelatedStyles(o))s.set(r,!1)}_revert(e,t){const n=J(t),s=this._consumables[e];for(const o of n)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles";this._revert(r,[...this._consumables[r].keys()])}else s.get(o)===!1&&s.set(o,!0)}}/**
402 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
403 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
404 */class mT extends W(){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new cn(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new cn(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new g("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new g("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return typeof e=="string"?t=e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?t="$text":t=e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!!(t&&t.isBlock)}isLimit(e){const t=this.getDefinition(e);return t?!!(t.isLimit||t.isObject):!1}isObject(e){const t=this.getDefinition(e);return t?!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent):!1}isInline(e){const t=this.getDefinition(e);return!!(t&&t.isInline)}isSelectable(e){const t=this.getDefinition(e);return t?!!(t.isSelectable||t.isObject):!1}isContent(e){const t=this.getDefinition(e);return t?!!(t.isContent||t.isObject):!1}checkChild(e,t){return t?this._checkContextMatch(t,e):!1}checkAttribute(e,t){const n=this.getDefinition(e.last);return n?n.allowAttributes.includes(t):!1}checkMerge(e,t){if(e instanceof y){const n=e.nodeBefore,s=e.nodeAfter;if(!(n instanceof H))throw new g("schema-check-merge-no-element-before",this);if(!(s instanceof H))throw new g("schema-check-merge-no-element-after",this);return this.checkMerge(n,s)}for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[n,s])=>{if(!s)return;const o=e(n,s);typeof o=="boolean"&&(t.stop(),t.return=o)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[n,s])=>{const o=e(n,s);typeof o=="boolean"&&(t.stop(),t.return=o)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(e instanceof y?t=e.parent:t=(e instanceof w?[e]:Array.from(e.getRanges())).reduce((s,o)=>{const r=o.getCommonAncestor();return s?s.getCommonAncestor(r,{includeSelf:!0}):r},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const s=[...e.getFirstPosition().getAncestors(),new q("",e.getAttributes())];return this.checkAttribute(s,t)}else{const n=e.getRanges();for(const s of n)for(const o of s)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=PT(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new w(e);let n,s;const o=e.getAncestors().reverse().find(r=>this.isLimit(r))||e.root;(t=="both"||t=="backward")&&(n=new Tt({boundaries:w._createIn(o),startPosition:e,direction:"backward"})),(t=="both"||t=="forward")&&(s=new Tt({boundaries:w._createIn(o),startPosition:e}));for(const r of IT(n,s)){const a=r.walker==n?"elementEnd":"elementStart",l=r.value;if(l.type==a&&this.isObject(l.item))return w._createOn(l.item);if(this.checkChild(l.nextPosition,"$text"))return new w(l.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}
404setAllowedAttributes(e,t,n){const s=n.model;for(const[o,r]of Object.entries(t))s.schema.checkAttribute(e,o)&&n.setAttribute(o,r,e)}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("$text"))tu(this,n,t);else{const o=w._createIn(n).getPositions();for(const r of o){const a=r.nodeBefore||r.parent;tu(this,a,t)}}}getAttributesWithProperty(e,t,n){const s={};for(const[o,r]of e.getAttributes()){const a=this.getAttributeProperties(o);a[t]!==void 0&&(n===void 0||n===a[t])&&(s[o]=r)}return s}createContext(e){return new cn(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const s of n)e[s]=gT(t[s],s);for(const s of n)pT(e,s);for(const s of n)bT(e,s);for(const s of n)wT(e,s);for(const s of n)_T(e,s),yT(e,s);for(const s of n)vT(e,s),kT(e,s),CT(e,s);this._compiledDefinitions=e}_checkContextMatch(e,t,n=t.length-1){const s=t.getItem(n);if(e.allowIn.includes(s.name)){if(n==0)return!0;{const o=this.getDefinition(s);return this._checkContextMatch(o,t,n-1)}}else return!1}*_getValidRangesForRange(e,t){let n=e.start,s=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(w._createIn(o),t)),this.checkAttribute(o,t)||(n.isEqual(s)||(yield new w(n,s)),n=y._createAfter(o)),s=y._createAfter(o);n.isEqual(s)||(yield new w(n,s))}findOptimalInsertionRange(e,t){const n=e.getSelectedElement();if(n&&this.isObject(n)&&!this.isInline(n))return t=="before"||t=="after"?new w(y._createAt(n,t)):w._createOn(n);const s=ie(e.getSelectedBlocks());if(!s)return new w(e.focus);if(s.isEmpty)return new w(y._createAt(s,0));const o=y._createAfter(s);return e.focus.isTouching(o)?new w(o):new w(y._createBefore(s))}}class cn{constructor(e){if(e instanceof cn)return e;let t;typeof e=="string"?t=[e]:Array.isArray(e)?t=e:t=e.getAncestors({includeSelf:!0}),this._items=t.map(ST)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new cn([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function gT(i,e){const t={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return TT(i,t),Xt(i,t,"allowIn"),Xt(i,t,"allowContentOf"),Xt(i,t,"allowWhere"),Xt(i,t,"allowAttributes"),Xt(i,t,"allowAttributesOf"),Xt(i,t,"allowChildren"),Xt(i,t,"inheritTypesFrom"),ET(i,t),t}function pT(i,e){const t=i[e];for(const n of t.allowChildren){const s=i[n];s&&s.allowIn.push(e)}t.allowChildren.length=0}function bT(i,e){for(const t of i[e].allowContentOf)i[t]&&AT(i,t).forEach(s=>{s.allowIn.push(e)});delete i[e].allowContentOf}function wT(i,e){for(const t of i[e].allowWhere){const n=i[t];if(n){const s=n.allowIn;i[e].allowIn.push(...s)}}delete i[e].allowWhere}function _T(i,e){for(const t of i[e].allowAttributesOf){const n=i[t];if(n){const s=n.allowAttributes;i[e].allowAttributes.push(...s)}}delete i[e].allowAttributesOf}function yT(i,e){const t=i[e];for(const n of t.inheritTypesFrom){const s=i[n];if(s){const o=Object.keys(s).filter(r=>r.startsWith("is"));for(const r of o)r in t||(t[r]=s[r])}}delete t.inheritTypesFrom}function vT(i,e){const t=i[e],n=t.allowIn.filter(s=>i[s]);t.allowIn=Array.from(new Set(n))}function kT(i,e){const t=i[e];for(const n of t.allowIn)i[n].allowChildren.push(e)}function CT(i,e){const t=i[e];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function TT(i,e){for(const t of i){const n=Object.keys(t).filter(s=>s.startsWith("is"));for(const s of n)e[s]=!!t[s]}}function Xt(i,e,t){for(const n of i){const s=n[t];typeof s=="string"?e[t].push(s):Array.isArray(s)&&e[t].push(...s)}}function ET(i,e){for(const t of i){const n=t.inheritAllFrom;n&&(e.allowContentOf.push(n),e.allowWhere.push(n),e.allowAttributesOf.push(n),e.inheritTypesFrom.push(n))}}function AT(i,e){const t=i[e];return xT(i).filter(n=>n.allowIn.includes(t.name))}function xT(i){return Object.keys(i).map(e=>i[e])}function ST(i){return typeof i=="string"||i.is("documentFragment")?{name:typeof i=="string"?i:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:i.is("element")?i.name:"$text",*getAttributeKeys(){yield*i.getAttributeKeys()},getAttribute(e){return i.getAttribute(e)}}}function*IT(i,e){let t=!1;for(;!t;){if(t=!0,i){const n=i.next();n.done||(t=!1,yield{walker:i,value:n.value})}if(e){const n=e.next();n.done||(t=!1,yield{walker:e,value:n.value})}}}function*PT(i){for(const e of i)yield*e.getMinimalFlatRanges()}function tu(i,e,t){for(const n of e.getAttributeKeys())i.checkAttribute(e,n)||t.removeAttribute(n,e)}/**
405 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
406 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
407 */class RT extends G(){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(t,
407n)=>this._convertItem(t,n),convertChildren:(t,n)=>this._convertChildren(t,n),safeInsert:(t,n)=>this._safeInsert(t,n),updateConversionResult:(t,n)=>this._updateConversionResult(t,n),splitToAllowedParent:(t,n)=>this._splitToAllowedParent(t,n),getSplitParts:t=>this._getSplitParts(t),keepEmptyElement:t=>this._keepEmptyElement(t)}}convert(e,t,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=BT(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=Mi.createFrom(e),this.conversionApi.store={};const{modelRange:s}=this._convertItem(e,this._modelCursor),o=t.createDocumentFragment();if(s){this._removeEmptyElements();for(const r of Array.from(this._modelCursor.parent.getChildren()))t.append(r,o);o.markers=VT(o,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,t){const n={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,n,this.conversionApi):e.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof w))throw new g("view-conversion-dispatcher-incorrect-result",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is("position")?t:y._createAt(t,0);const s=new w(n);for(const o of Array.from(e.getChildren())){const r=this._convertItem(o,n);r.modelRange instanceof w&&(s.end=r.modelRange.end,n=r.modelCursor)}return{modelRange:s,modelCursor:n}}_safeInsert(e,t){const n=this._splitToAllowedParent(e,t);return n?(this.conversionApi.writer.insert(e,n.position),!0):!1}_updateConversionResult(e,t){const n=this._getSplitParts(e),s=this.conversionApi.writer;t.modelRange||(t.modelRange=s.createRange(s.createPositionBefore(e),s.createPositionAfter(n[n.length-1])));const o=this._cursorParents.get(e);o?t.modelCursor=s.createPositionAt(o,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){const{schema:n,writer:s}=this.conversionApi;let o=n.findAllowedParent(t,e);if(o){if(o===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return bm(t,e,n)?{position:wm(t,s)}:null;const r=this.conversionApi.writer.split(t,o),a=[];for(const c of r.range.getWalker())if(c.type=="elementEnd")a.push(c.item);else{const u=a.pop(),d=c.item;this._registerSplitPair(u,d)}const l=r.range.end.parent;return this._cursorParents.set(e,l),{position:r.position,cursorParent:l}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return this._splitParts.has(e)?t=this._splitParts.get(e):t=[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}function VT(i,e){const t=new Set,n=new Map,s=w._createIn(i).getItems();for(const o of s)o.is("element","$marker")&&t.add(o);for(const o of t){const r=o.getAttribute("data-name"),a=e.createPositionBefore(o);n.has(r)?n.get(r).end=a.clone():n.set(r,new w(a.clone())),e.remove(o)}return n}function BT(i,e){let t;for(const n of new cn(i)){const s={};for(const r of n.getAttributeKeys())s[r]=n.getAttribute(r);const o=e.createElement(n.name,s);t&&e.insert(o,t),t=y._createAt(o,0)}return t}/**
408 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
409 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
410 */class MT{getHtml(e){const n=A.document.implementation.createHTMLDocument("").createElement("div");return n.appendChild(e),n.innerHTML}}/**
411 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
412 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
413 */class OT{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new Jo(e,{renderingMode:"data"}),this.htmlWriter=new MT}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}
413toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e=="marked"?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),s=t.body.childNodes;for(;s.length>0;)n.appendChild(s[0]);return n}}/**
414 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
415 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
416 */class LT extends G(){constructor(e,t){super(),this.model=e,this.mapper=new sm,this.downcastDispatcher=new om({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",lm(),{priority:"lowest"}),this.downcastDispatcher.on("insert",cm(),{priority:"lowest"}),this.upcastDispatcher=new RT({schema:e.schema}),this.viewDocument=new Go(t),this.stylesProcessor=t,this.htmlProcessor=new OT(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Kf(this.viewDocument),this.upcastDispatcher.on("text",GC(),{priority:"lowest"}),this.upcastDispatcher.on("element",Qc(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",Qc(),{priority:"lowest"}),W().prototype.decorate.call(this,"init"),W().prototype.decorate.call(this,"set"),W().prototype.decorate.call(this,"get"),W().prototype.decorate.call(this,"toView"),W().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},pm)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:n="empty"}=e;if(!this._checkIfRootsExists([t]))throw new g("datacontroller-get-non-existent-root",this);const s=this.model.document.getRoot(t);return s.isAttached()||N("datacontroller-get-detached-root",this),n==="empty"&&!this.model.hasContent(s,{ignoreWhitespaces:!0})?"":this.stringify(s,e)}stringify(e,t={}){const n=this.toView(e,t);return this.processor.toData(n)}toView(e,t={}){const n=this.viewDocument,s=this._viewWriter;this.mapper.clearBindings();const o=w._createIn(e),r=new ln(n);this.mapper.bindElements(e,r);const a=e.is("documentFragment")?e.markers:FT(e);return this.downcastDispatcher.convert(o,a,s,t),r}init(e){if(this.model.document.version)throw new g("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new g("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},n=>{for(const s of Object.keys(t)){const o=this.model.document.getRoot(s);n.insert(this.parse(t[s],o),o,0)}}),Promise.resolve()}set(e,t={}){let n={};if(typeof e=="string"?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new g("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},s=>{s.setSelection(null),s.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(n)){const r=this.model.document.getRoot(o);s.remove(s.createRangeIn(r)),s.insert(this.parse(n[o],r),r,0)}})}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change(n=>this.upcastDispatcher.convert(e,n,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}function FT(i){const e=[],t=i.root.document;if(!t)return new Map;const n=w._createIn(i);for(const s of t.model.markers){const o=s.getRange(),r=o.isCollapsed,a=o.start.isEqual(n.start)||o.end.isEqual(n.end);if(r&&a)e.push([s.name,o]);else{const l=n.getIntersection(o);l&&e.push([s.name,l])}}return e.sort(([s,o],[r,a])=>{if(o.end.compareWith(a.start)!=="after")return 1;if(o.start.compareWith(a.end)!=="before")return-1;switch(o.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(o.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return r.localeCompare(s)}}}),new Map(e)}/**
417 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
418 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
419 */class NT{constructor(e,t){this._helpers=new Map,this._downcast=J(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=J(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new g("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new g("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of vr(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of vr(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of vr(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new g("conversion-group-exists",this);const s=n?new mC(t):new jC(t);this._helpers.set(e,s)}}function*vr(i){if(i.model.values)for(const e of i.model.values){const t={key:i.model.key,value:e},n=i.view[e],s=i.upcastAlso?i.upcastAlso[e]:void 0;yield*nu(t,n,s)}else yield*nu(i.model,i.view,i.upcastAlso)}function*nu(i,e,t){if(yield{model:i,view:e},t)for(const n of J(t))yield{model:i,view:n}}/**
420 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
421 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
422 */class ze{constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}/**
423 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
424 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
425 */function rl(i,e){const t=Tm(e),n=t.reduce((r,a)=>r+a.offsetSize,0),s=i.parent;Yi(i);const o=i.index;return s._insertChild(o,t),Qi(s,o+t.length),Qi(s,o),new w(i,i.getShiftedBy(n))}function Cm(i){if(!i.isFlat)throw new g("operation-utils-remove-range-not-flat",this);const e=i.start.parent;Yi(i.start),Yi(i.end);const t=e._removeChildren(i.start.index,i.end.index-i.start.index);return Qi(e,i.start.index),t}function Zi(i,e){if(!i.isFlat)throw new g("operation-utils-move-range-not-flat",this);const t=Cm(i);return e=e._getTransformedByDeletion(i.start,i.end.offset-i.start.offset),rl(e,t)}function DT(i,e,t){Yi(i.start),Yi(i.end);for(const n of i.getItems({shallow:!0})){const s=n.is("$textProxy")?n.textNode:n;t!==null?s._setAttribute(e,t):s._removeAttribute(e),Qi(s.parent,s.index)}Qi(i.end.parent,i.end.index)}function Tm(i){const e=[];function t(n){if(typeof n=="string")e.push(new q(n));else if(n instanceof nt)e.push(new q(n.data,n.getAttributes()));else if(n instanceof vn)e.push(n);else if(He(n))for(const s of n)t(s)}t(i);for(let n=1;n<e.length;n++){const s=e[n],o=e[n-1];s instanceof q&&o instanceof q&&Em(s,o)&&(e.splice(n-1,2,new q(o.data+s.data,o.getAttributes())),n--)}return e}function Qi(i,e){const t=i.getChild(e-1),n=i.getChild(e);if(t&&n&&t.is("$text")&&n.is("$text")&&Em(t,n)){const s=new q(t.data+n.data,t.getAttributes());i._removeChildren(e-1,2),i._insertChild(e-1,s)}}function Yi(i){const e=i.textNode,t=i.parent;if(e){const n=i.offset-e.startOffset,s=e.index;t._removeChildren(s,1);const o=new q(e.data.substr(0,n),e.getAttributes()),r=new q(e.data.substr(n),e.getAttributes());t._insertChild(s,[o,r])}}function Em(i,e){const t=i.getAttributes(),n=e.getAttributes();for(const s of t){if(s[1]!==e.getAttribute(s[0]))return!1;n.next()}return n.next().done}/**
426 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
427 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
428 */class $ extends ze{constructor(e,t,n,s){super(s),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[w._createFromPositionAndShift(this.sourcePosition,this.howMany),w._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new $(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new $(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,s=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new g("move-operation-nodes-do-not-exist",this);if(e===t&&n<s&&s<n+this.howMany)throw new g("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&Te(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const o=this.sourcePosition.path.length-1;if(this.targetPosition.path[o]>=n&&this.targetPosition.path[o]<n+this.howMany)throw new g("move-operation-node-into-itself",this)}}_execute(){Zi(w._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const n=y.fromJSON(e.sourcePosition,t),s=y.fromJSON(e.targetPosition,t);return new this(n,e.howMany,s,e.baseVersion)}}/**
429 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
430 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
431 */class be extends ze{constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Vi(Tm(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new Vi([...this.nodes].map(n=>n._clone(!0))),t=new be(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new y(e,[0]);return new $(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new g("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Vi([...e].map(t=>t._clone(!0))),rl(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const n=[];
431for(const o of e.nodes)o.name?n.push(H.fromJSON(o)):n.push(q.fromJSON(o));const s=new be(y.fromJSON(e.position,t),n,e.baseVersion);return s.shouldReceiveAttributes=e.shouldReceiveAttributes,s}}/**
432 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
433 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
434 */class j extends ze{constructor(e,t,n,s,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=n,this.graveyardPosition=s?s.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new y(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new w(this.splitPosition,e)}get affectedSelectable(){const e=[w._createFromPositionAndShift(this.splitPosition,0),w._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(w._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new j(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new y(e,[0]);return new re(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new g("split-operation-position-invalid",this);if(e.parent){if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new g("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new g("split-operation-graveyard-position-invalid",this)}else throw new g("split-operation-split-in-root",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Zi(w._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const n=e._clone();rl(this.insertionPosition,n)}const t=new w(y._createAt(e,this.splitPosition.offset),y._createAt(e,e.maxOffset));Zi(t,this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new y(e.root,t,"toPrevious")}static fromJSON(e,t){const n=y.fromJSON(e.splitPosition,t),s=y.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?y.fromJSON(e.graveyardPosition,t):null;return new this(n,e.howMany,s,o,e.baseVersion)}}/**
435 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
436 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
437 */class re extends ze{constructor(e,t,n,s,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=s.clone()}get type(){return"merge"}get deletionPosition(){return new y(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new w(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[w._createOn(e),w._createFromPositionAndShift(this.targetPosition,0),w._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new re(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new y(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new j(e,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(e.parent)if(t.parent){if(this.howMany!=e.maxOffset)throw new g("merge-operation-how-many-invalid",this)}else throw new g("merge-operation-target-position-invalid",this);else throw new g("merge-operation-source-position-invalid",this)}_execute(){const e=this.sourcePosition.parent,t=w._createIn(e);Zi(t,this.targetPosition),Zi(w._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const n=y.fromJSON(e.sourcePosition,t),s=y.fromJSON(e.targetPosition,t),o=y.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,s,o,e.baseVersion)}}/**
438 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
439 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
440 */class Se extends ze{constructor(e,t,n,s,o,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=o,this._markers=s}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new Se(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Se(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Se(e.name,e.oldRange?w.fromJSON(e.oldRange,t):null,e.newRange?w.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}/**
441 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
442 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
443 */class ue extends ze{constructor(e,t,n,s,o){super(o),this.range=e.clone(),this.key=t,this.oldValue=n===void 0?null:n,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new ue(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new ue(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new g("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!cc(e.getAttribute(this.key),this.oldValue))throw new g("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new g("attribute-operation-attribute-exists",this,{node:e,ke
443y:this.key})}}_execute(){cc(this.oldValue,this.newValue)||DT(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new ue(w.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
444 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
445 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
446 */class fe extends ze{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new fe(this.baseVersion)}getReversed(){return new fe(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}/**
447 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
448 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
449 */class Ie extends ze{constructor(e,t,n,s){super(s),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new Ie(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ie(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(e instanceof H){if(e.name!==this.oldName)throw new g("rename-operation-wrong-name",this)}else throw new g("rename-operation-wrong-position",this)}_execute(){const e=this.position.nodeAfter;e.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Ie(y.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}/**
450 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
451 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
452 */class At extends ze{constructor(e,t,n,s,o){super(o),this.root=e,this.key=t,this.oldValue=n===void 0?null:n,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new At(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new At(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new g("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new g("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new g("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new g("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new At(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
453 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
454 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
455 */class ft extends ze{constructor(e,t,n,s,o){if(super(o),this.rootName=e,this.elementName=t,this.isAdd=n,this._document=s,!this._document.getRoot(this.rootName)){const r=this._document.createRoot(this.elementName,this.rootName);r._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new ft(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new ft(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new ft(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}/**
456 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
457 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
458 */const Ye={};Ye[ue.className]=ue;Ye[be.className]=be;Ye[Se.className]=Se;Ye[$.className]=$;Ye[fe.className]=fe;Ye[ze.className]=ze;Ye[Ie.className]=Ie;Ye[At.className]=At;Ye[ft.className]=ft;Ye[j.className]=j;Ye[re.className]=re;class $T{static fromJSON(e,t){return Ye[e.__className].fromJSON(e,t)}}/**
459 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
460 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
461 */const ra=new Map;function D(i,e,t){let n=ra.get(i);
461n||(n=new Map,ra.set(i,n)),n.set(e,t)}function UT(i,e){const t=ra.get(i);return t&&t.has(e)?t.get(e):HT}function HT(i){return[i]}function iu(i,e,t={}){const n=UT(i.constructor,e.constructor);try{return i=i.clone(),n(i,e,t)}catch(s){throw s}}function zT(i,e,t){i=i.slice(),e=e.slice();const n=new WT(t.document,t.useRelations,t.forceWeakRemove);n.setOriginalOperations(i),n.setOriginalOperations(e);const s=n.originalOperations;if(i.length==0||e.length==0)return{operationsA:i,operationsB:e,originalOperations:s};const o=new WeakMap;for(const l of i)o.set(l,0);const r={nextBaseVersionA:i[i.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:i.length,originalOperationsBCount:e.length};let a=0;for(;a<i.length;){const l=i[a],c=o.get(l);if(c==e.length){a++;continue}const u=e[c],d=iu(l,u,n.getContext(l,u,!0)),h=iu(u,l,n.getContext(u,l,!1));n.updateRelation(l,u),n.setOriginalOperations(d,l),n.setOriginalOperations(h,u);for(const f of d)o.set(f,c+h.length);i.splice(a,1,...d),e.splice(c,1,...h)}return su(i,r.nextBaseVersionB),su(e,r.nextBaseVersionA),{operationsA:i,operationsB:e,originalOperations:s}}class WT{constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){const n=t?this.originalOperations.get(t):null;for(const s of e)this.originalOperations.set(s,n||s)}updateRelation(e,t){if(e instanceof $)t instanceof re?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof $&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof j){if(t instanceof re)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof $)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const n=w._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const s=n.end.offset-e.splitPosition.offset,o=e.splitPosition.offset-n.start.offset;this._setRelation(e,t,{howMany:s,offset:o})}}}else if(e instanceof re)t instanceof re?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof j?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof $&&t.howMany>0&&(e.sourcePosition.isEqual(t.sourcePosition.getShiftedBy(t.howMany))&&this._setRelation(e,t,"mergeSourceAffected"),e.targetPosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeTargetWasBefore"));else if(e instanceof Se){const n=e.newRange;if(!n)return;if(t instanceof $){const s=w._createFromPositionAndShift(t.sourcePosition,t.howMany),o=s.containsPosition(n.start)||s.start.isEqual(n.start),r=s.containsPosition(n.end)||s.end.isEqual(n.end);(o||r)&&!s.containsRange(n)&&this._setRelation(e,t,{side:o?"left":"right",path:o?n.start.path.slice():n.end.path.slice()})}else if(t instanceof re){const s=n.start.isEqual(t.targetPosition),o=n.start.isEqual(t.deletionPosition),r=n.end.isEqual(t.deletionPosition),a=n.end.isEqual(t.sourcePosition);(s||o||r||a)&&this._setRelation(e,t,{wasInLeftElement:s,wasStartBeforeMergedElement:o,wasEndBeforeMergedElement:r,wasInRightElement:a})}}}getContext(e,t,n){return{aIsStrong:n,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const n=this.originalOperations.get(t),s=this._history.getUndoneOperation(n);if(!s)return null;const o=this.originalOperations.get(e),r=this._relations.get(o);return r&&r.get(s)||null}_setRelation(e,t,n){const s=this.originalOperations.get(e),o=this.originalOperations.get(t);let r=this._relations.get(s);r||(r=new Map,this._relations.set(s,r)),r.set(o,n)}}function su(i,e){for(const t of i)t.baseVersion=e++}D(ue,ue,(i,e,t)=>{if(i.key===e.key&&i.range.start.hasSameParentAs(e.range.start)){const n=i.range.getDifference(e.range).map(o=>new ue(o,i.key,i.oldValue,i.newValue,0)),s=i.range.getIntersection(e.range);return s&&t.aIsStrong&&n.push(new ue(s,e.key,e.newValue,i.newValue,0)),n.length==0?[new fe(0)]:n}else return[i]});D(ue,be,(i,e)=>{if(i.range.start.hasSameParentAs(e.position)&&i.range.containsPosition(e.position)){const n=i.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(s=>new ue(s,i.key,i.oldValue,i.newValue,i.baseVersion));if(e.shouldReceiveAttributes){const s=Am(e,i.key,i.oldValue);s&&n.unshift(s)}return n}return i.range=i.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[i]});function Am(i,e,t){const s=i.nodes.getNode(0).getAttribute(e);
461if(s==t)return null;const o=new w(i.position,i.position.getShiftedBy(i.howMany));return new ue(o,e,s,t,0)}D(ue,re,(i,e)=>{const t=[];i.range.start.hasSameParentAs(e.deletionPosition)&&(i.range.containsPosition(e.deletionPosition)||i.range.start.isEqual(e.deletionPosition))&&t.push(w._createFromPositionAndShift(e.graveyardPosition,1));const n=i.range._getTransformedByMergeOperation(e);return n.isCollapsed||t.push(n),t.map(s=>new ue(s,i.key,i.oldValue,i.newValue,i.baseVersion))});D(ue,$,(i,e)=>qT(i.range,e).map(n=>new ue(n,i.key,i.oldValue,i.newValue,i.baseVersion)));function qT(i,e){const t=w._createFromPositionAndShift(e.sourcePosition,e.howMany);let n=null,s=[];t.containsRange(i,!0)?n=i:i.start.hasSameParentAs(t.start)?(s=i.getDifference(t),n=i.getIntersection(t)):s=[i];const o=[];for(let r of s){r=r._getTransformedByDeletion(e.sourcePosition,e.howMany);const a=e.getMovedRangeStart(),l=r.start.hasSameParentAs(a),c=r._getTransformedByInsertion(a,e.howMany,l);o.push(...c)}return n&&o.push(n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany,!1)[0]),o}D(ue,j,(i,e)=>{if(i.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||i.range.end.offset++,[i];if(i.range.start.hasSameParentAs(e.splitPosition)&&i.range.containsPosition(e.splitPosition)){const t=i.clone();return t.range=new w(e.moveTargetPosition.clone(),i.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),i.range.end=e.splitPosition.clone(),i.range.end.stickiness="toPrevious",[i,t]}return i.range=i.range._getTransformedBySplitOperation(e),[i]});D(be,ue,(i,e)=>{const t=[i];if(i.shouldReceiveAttributes&&i.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(i.position)){const n=Am(i,e.key,e.newValue);
461n&&t.push(n)}return t});D(be,be,(i,e,t)=>i.position.isEqual(e.position)&&t.aIsStrong?[i]:(i.position=i.position._getTransformedByInsertOperation(e),[i]));D(be,$,(i,e)=>(i.position=i.position._getTransformedByMoveOperation(e),[i]));D(be,j,(i,e)=>(i.position=i.position._getTransformedBySplitOperation(e),[i]));D(be,re,(i,e)=>(i.position=i.position._getTransformedByMergeOperation(e),[i]));D(Se,be,(i,e)=>(i.oldRange&&(i.oldRange=i.oldRange._getTransformedByInsertOperation(e)[0]),i.newRange&&(i.newRange=i.newRange._getTransformedByInsertOperation(e)[0]),[i]));D(Se,Se,(i,e,t)=>{if(i.name==e.name)if(t.aIsStrong)i.oldRange=e.newRange?e.newRange.clone():null;else return[new fe(0)];return[i]});D(Se,re,(i,e)=>(i.oldRange&&(i.oldRange=i.oldRange._getTransformedByMergeOperation(e)),i.newRange&&(i.newRange=i.newRange._getTransformedByMergeOperation(e)),[i]));D(Se,$,(i,e,t)=>{if(i.oldRange&&(i.oldRange=w._createFromRanges(i.oldRange._getTransformedByMoveOperation(e))),i.newRange){if(t.abRelation){const n=w._createFromRanges(i.newRange._getTransformedByMoveOperation(e));if(t.abRelation.side=="left"&&e.targetPosition.isEqual(i.newRange.start))return i.newRange.end=n.end,i.newRange.start.path=t.abRelation.path,[i];if(t.abRelation.side=="right"&&e.targetPosition.isEqual(i.newRange.end))return i.newRange.start=n.start,i.newRange.end.path=t.abRelation.path,[i]}i.newRange=w._createFromRanges(i.newRange._getTransformedByMoveOperation(e))}return[i]});D(Se,j,(i,e,t)=>{if(i.oldRange&&(i.oldRange=i.oldRange._getTransformedBySplitOperation(e)),i.newRange){if(t.abRelation){const n=i.newRange._getTransformedBySplitOperation(e);return i.newRange.start.isEqual(e.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?i.newRange.start=y._createAt(e.insertionPosition):i.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(i.newRange.start=y._createAt(e.moveTargetPosition)),i.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?i.newRange.end=y._createAt(e.moveTargetPosition):i.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?i.newRange.end=y._createAt(e.insertionPosition):i.newRange.end=n.end,[i]}i.newRange=i.newRange._getTransformedBySplitOperation(e)}return[i]});D(re,be,(i,e)=>(i.sourcePosition.hasSameParentAs(e.position)&&(i.howMany+=e.howMany),i.sourcePosition=i.sourcePosition._getTransformedByInsertOperation(e),i.targetPosition=i.targetPosition._getTransformedByInsertOperation(e),[i]));D(re,re,(i,e,t)=>{if(i.sourcePosition.isEqual(e.sourcePosition)&&i.targetPosition.isEqual(e.targetPosition))if(t.bWasUndone){const n=e.graveyardPosition.path.slice();return n.push(0),i.sourcePosition=new y(e.graveyardPosition.root,n),i.howMany=0,[i]}else return[new fe(0)];if(i.sourcePosition.isEqual(e.sourcePosition)&&!i.targetPosition.isEqual(e.targetPosition)&&!t.bWasUndone&&t.abRelation!="splitAtSource"){const n=i.targetPosition.root.rootName=="$graveyard",s=e.targetPosition.root.rootName=="$graveyard";if(s&&!n||!(n&&!s)&&t.aIsStrong){const l=e.targetPosition._getTransformedByMergeOperation(e),c=i.targetPosition._getTransformedByMergeOperation(e);return[new $(l,i.howMany,c,0)]}else return[new fe(0)]}return i.sourcePosition.hasSameParentAs(e.targetPosition)&&(i.howMany+=e.howMany),i.sourcePosition=i.sourcePosition._getTransformedByMergeOperation(e),i.targetPosition=i.targetPosition._getTransformedByMergeOperation(e),(!i.graveyardPosition.isEqual(e.graveyardPosition)||!t.aIsStrong)&&(i.graveyardPosition=i.graveyardPosition._getTransformedByMergeOperation(e)),[i]});D(re,$,(i,e,t)=>{const n=w._createFromPositionAndShift(e.sourcePosition,e.howMany);return e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&i.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(i.sourcePosition)?[new fe(0)]:(e.sourcePosition.getShiftedBy(e.howMany).isEqual(i.sourcePosition)?i.sourcePosition.stickiness="toNone":e.targetPosition.isEqual(i.sourcePosition)&&t.abRelation=="mergeSourceAffected"?i.sourcePosition.stickiness="toNext":e.sourcePosition.isEqual(i.targetPosition)?(i.targetPosition.stickiness="toNone",i.howMany-=e.howMany):e.targetPosition.isEqual(i.targetPosition)&&t.abRelation=="mergeTargetWasBefore"?(i.targetPosition.stickiness="toPrevious",i.howMany+=e.howMany):(i.sourcePosition.hasSameParentAs(e.targetPosition)&&(i.howMany+=e.howMany),i.sourcePosition.hasSameParentAs(e.sourcePosition)&&(i.howMany-=e.howMany)),i.sourcePosition=i.sourcePosition._getTransformedByMoveOperation(e),i.targetPosition=i.targetPosition._getTransformedByMoveOperation(e),i.sourcePosition.stickiness="toPrevious",i.targetPosition.stickiness="toNext",i.graveyardPosition.isEqual(e.targetPosition)||(i.graveyardPosition=i.graveyardPosition._getTransformedByMoveOperation(e)),[i])});D(re,j,(i,e,t)=>{if(e.graveyardPosition&&(i.graveyardPosition=i.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),i.deleti
461onPosition.isEqual(e.graveyardPosition)&&(i.howMany=e.howMany)),i.targetPosition.isEqual(e.splitPosition)){const n=e.howMany!=0,s=e.graveyardPosition&&i.deletionPosition.isEqual(e.graveyardPosition);if(n||s||t.abRelation=="mergeTargetNotMoved")return i.sourcePosition=i.sourcePosition._getTransformedBySplitOperation(e),[i]}if(i.sourcePosition.isEqual(e.splitPosition)){if(t.abRelation=="mergeSourceNotMoved")return i.howMany=0,i.targetPosition=i.targetPosition._getTransformedBySplitOperation(e),[i];if(t.abRelation=="mergeSameElement"||i.sourcePosition.offset>0)return i.sourcePosition=e.moveTargetPosition.clone(),i.targetPosition=i.targetPosition._getTransformedBySplitOperation(e),[i]}return i.sourcePosition.hasSameParentAs(e.splitPosition)&&(i.howMany=e.splitPosition.offset),i.sourcePosition=i.sourcePosition._getTransformedBySplitOperation(e),i.targetPosition=i.targetPosition._getTransformedBySplitOperation(e),[i]});D($,be,(i,e)=>{const n=w._createFromPositionAndShift(i.sourcePosition,i.howMany)._getTransformedByInsertOperation(e,!1)[0];return i.sourcePosition=n.start,i.howMany=n.end.offset-n.start.offset,i.targetPosition.isEqual(e.position)||(i.targetPosition=i.targetPosition._getTransformedByInsertOperation(e)),[i]});D($,$,(i,e,t)=>{const n=w._createFromPositionAndShift(i.sourcePosition,i.howMany),s=w._createFromPositionAndShift(e.sourcePosition,e.howMany);let o=t.aIsStrong,r=!t.aIsStrong;t.abRelation=="insertBefore"||t.baRelation=="insertAfter"?r=!0:(t.abRelation=="insertAfter"||t.baRelation=="insertBefore")&&(r=!1);let a;if(i.targetPosition.isEqual(e.targetPosition)&&r?a=i.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):a=i.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),ou(i,e)&&ou(e,i))return[e.getReversed()];if(n.containsPosition(e.targetPosition)&&n.containsRange(s,!0))return n.start=n.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),n.end=n.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Gn([n],a);if(s.containsPosition(i.targetPosition)&&s.containsRange(n,!0))return n.start=n.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),n.end=n.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),Gn([n],a);const u=Te(i.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if(u=="prefix"||u=="extension")return n.start=n.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),n.end=n.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Gn([n],a);i.type=="remove"&&e.type!="remove"&&!t.aWasUndone&&!t.forceWeakRemove?o=!0:i.type!="remove"&&e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&(o=!1);const d=[],h=n.getDifference(s);for(const m of h){m.start=m.start._getTransformedByDeletion(e.sourcePosition,e.howMany),m.end=m.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const p=Te(m.start.getParentPath(),e.getMovedRangeStart().getParentPath())=="same",_=m._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,p);d.push(..._)}const f=n.getIntersection(s);return f!==null&&o&&(f.start=f.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),f.end=f.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),d.length===0?d.push(f):d.length==1?s.start.isBefore(n.start)||s.start.isEqual(n.start)?d.unshift(f):d.push(f):d.splice(1,0,f)),d.length===0?[new fe(i.baseVersion)]:Gn(d,a)});D($,j,(i,e,t)=>{let n=i.targetPosition.clone();(!i.targetPosition.isEqual(e.insertionPosition)||!e.graveyardPosition||t.abRelation=="moveTargetAfter")&&(n=i.targetPosition._getTransformedBySplitOperation(e));const s=w._createFromPositionAndShift(i.sourcePosition,i.howMany);if(s.end.isEqual(e.insertionPosition))return e.graveyardPosition||i.howMany++,i.targetPosition=n,[i];if(s.start.hasSameParentAs(e.splitPosition)&&s.containsPosition(e.splitPosition)){let a=new w(e.splitPosition,s.end);a=a._getTransformedBySplitOperation(e);const l=[new w(s.start,e.splitPosition),a];return Gn(l,n)}i.targetPosition.isEqual(e.splitPosition)&&t.abRelation=="insertAtSource"&&(n=e.moveTargetPosition),i.targetPosition.isEqual(e.insertionPosition)&&t.abRelation=="insertBetween"&&(n=i.targetPosition);const r=[s._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const a=s.start.isEqual(e.graveyardPosition)||s.containsPosition(e.graveyardPosition);i.howMany>1&&a&&!t.aWasUndone&&r.push(w._createFromPositionAndShift(e.insertionPosition,1))}return Gn(r,n)});D($,re,(i,e,t)=>{const n=w._createFromPositionAndShift(i.sourcePosition,i.howMany);if(e.deletionPosition.hasSameParentAs(i.sourcePosition)&&n.containsPosition(e.sourcePosition)){if
461(i.type=="remove"&&!t.forceWeakRemove){if(!t.aWasUndone){const r=[];let a=e.graveyardPosition.clone(),l=e.targetPosition._getTransformedByMergeOperation(e);i.howMany>1&&(r.push(new $(i.sourcePosition,i.howMany-1,i.targetPosition,0)),a=a._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany-1),l=l._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany-1));const c=e.deletionPosition._getCombined(i.sourcePosition,i.targetPosition),u=new $(a,1,c,0),d=u.getMovedRangeStart().path.slice();d.push(0);const h=new y(u.targetPosition.root,d);l=l._getTransformedByMove(a,c,1);const f=new $(l,e.howMany,h,0);return r.push(u),r.push(f),r}}else if(i.howMany==1)return t.bWasUndone?(i.sourcePosition=e.graveyardPosition.clone(),i.targetPosition=i.targetPosition._getTransformedByMergeOperation(e),[i]):[new fe(0)]}const o=w._createFromPositionAndShift(i.sourcePosition,i.howMany)._getTransformedByMergeOperation(e);return i.sourcePosition=o.start,i.howMany=o.end.offset-o.start.offset,i.targetPosition=i.targetPosition._getTransformedByMergeOperation(e),[i]});D(Ie,be,(i,e)=>(i.position=i.position._getTransformedByInsertOperation(e),[i]));D(Ie,re,(i,e)=>i.position.isEqual(e.deletionPosition)?(i.position=e.graveyardPosition.clone(),i.position.stickiness="toNext",[i]):(i.position=i.position._getTransformedByMergeOperation(e),[i]));D(Ie,$,(i,e)=>(i.position=i.position._getTransformedByMoveOperation(e),[i]));D(Ie,Ie,(i,e,t)=>{if(i.position.isEqual(e.position))if(t.aIsStrong)i.oldName=e.newName;else return[new fe(0)];return[i]});D(Ie,j,(i,e)=>{const t=i.position.path,n=e.splitPosition.getParentPath();if(Te(t,n)=="same"&&!e.graveyardPosition){const s=new Ie(i.position.getShiftedBy(1),i.oldName,i.newName,0);return[i,s]}return i.position=i.position._getTransformedBySplitOperation(e),[i]});D(At,At,(i,e,t)=>{if(i.root===e.root&&i.key===e.key){if(!t.aIsStrong||i.newValue===e.newValue)return[new fe(0)];i.oldValue=e.newValue}return[i]});D(ft,ft,(i,e)=>i.rootName===e.rootName&&i.isAdd===e.isAdd?[new fe(0)]:[i]);D(j,be,(i,e)=>(i.splitPosition.hasSameParentAs(e.position)&&i.splitPosition.offset<e.position.offset&&(i.howMany+=e.howMany),i.splitPosition=i.splitPosition._getTransformedByInsertOperation(e),i.insertionPosition=i.insertionPosition._getTransformedByInsertOperation(e),[i]));D(j,re,(i,e,t)=>{if(!i.graveyardPosition&&!t.bWasUndone&&i.splitPosition.hasSameParentAs(e.sourcePosition)){const n=e.graveyardPosition.path.slice();n.push(0);const s=new y(e.graveyardPosition.root,n),o=j.getInsertionPosition(new y(e.graveyardPosition.root,n)),r=new j(s,0,o,null,0);return i.splitPosition=i.splitPosition._getTransformedByMergeOperation(e),i.insertionPosition=j.getInsertionPosition(i.splitPosition),i.graveyardPosition=r.insertionPosition.clone(),i.graveyardPosition.stickiness="toNext",[r,i]}return i.splitPosition.hasSameParentAs(e.deletionPosition)&&!i.splitPosition.isAfter(e.deletionPosition)&&i.howMany--,i.splitPosition.hasSameParentAs(e.targetPosition)&&(i.howMany+=e.howMany),i.splitPosition=i.splitPosition._getTransformedByMergeOperation(e),i.insertionPosition=j.getInsertionPosition(i.splitPosition),i.graveyardPosition&&(i.graveyardPosition=i.graveyardPosition._getTransformedByMergeOperation(e)),[i]});D(j,$,(i,e,t)=>{const n=w._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.graveyardPosition){const o=n.start.isEqual(i.graveyardPosition)||n.containsPosition(i.graveyardPosition);if(!t.bWasUndone&&o){const r=i.splitPosition._getTransformedByMoveOperation(e),a=i.graveyardPosition._getTransformedByMoveOperation(e),l=a.path.slice();l.push(0);const c=new y(a.root,l);return[new $(r,i.howMany,c,0)]}i.graveyardPosition=i.graveyardPosition._getTransformedByMoveOperation(e)}const s=i.splitPosition.isEqual(e.targetPosition);if(s&&(t.baRelation=="insertAtSource"||t.abRelation=="splitBefore"))return i.howMany+=e.howMany,i.splitPosition=i.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),i.insertionPosition=j.getInsertionPosition(i.splitPosition),[i];if(s&&t.abRelation&&t.abRelation.howMany){const{howMany:o,offset:r}=t.abRelation;return i.howMany+=o,i.splitPosition=i.splitPosition.getShiftedBy(r),[i]}if(i.splitPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(i.splitPosition)){const o=e.howMany-(i.splitPosition.offset-e.sourcePosition.offset);return i.howMany-=o,i.splitPosition.hasSameParentAs(e.targetPosition)&&i.splitPosition.offset<e.targetPosition.offset&&(i.howMany+=e.howMany),i.splitPosition=e.sourcePosition.clone(),i.insertionPosition=j.getInsertionPosition(i.splitPosition),[i]}return e.sourcePosition.isEqual(e.targetPosition)||(i.splitPosition.hasSameParentAs(e.sourcePosition)&&i.splitPosition.offset<=e.sourcePosition.offset&&(i.howMany-=e.howMany),i.splitPosition.hasSameParentAs(e.targetPosition)&&i.splitPosition.offset<e.targetPosition.offset&&(i.howMany+=e.howMany)),i.splitPosition.stickiness="toNone",i.splitPosition=i.splitPosition._getTransformedByMoveOperation(e),i.splitPosition.stickiness="toNext",i.graveyardPosition?i.insertionPosition=i.insertionPosition._getTransformedByMoveOperation(e):i.insertionPosition=j.getInsertionPosition(i.splitPosition),[i]});D(j,j,(i,e,t)=>
461{if(i.splitPosition.isEqual(e.splitPosition)){if(!i.graveyardPosition&&!e.graveyardPosition)return[new fe(0)];if(i.graveyardPosition&&e.graveyardPosition&&i.graveyardPosition.isEqual(e.graveyardPosition))return[new fe(0)];if(t.abRelation=="splitBefore")return i.howMany=0,i.graveyardPosition=i.graveyardPosition._getTransformedBySplitOperation(e),[i]}if(i.graveyardPosition&&e.graveyardPosition&&i.graveyardPosition.isEqual(e.graveyardPosition)){const n=i.splitPosition.root.rootName=="$graveyard",s=e.splitPosition.root.rootName=="$graveyard";if(s&&!n||!(n&&!s)&&t.aIsStrong){const l=[];return e.howMany&&l.push(new $(e.moveTargetPosition,e.howMany,e.splitPosition,0)),i.howMany&&l.push(new $(i.splitPosition,i.howMany,i.moveTargetPosition,0)),l}else return[new fe(0)]}if(i.graveyardPosition&&(i.graveyardPosition=i.graveyardPosition._getTransformedBySplitOperation(e)),i.splitPosition.isEqual(e.insertionPosition)&&t.abRelation=="splitBefore")return i.howMany++,[i];if(e.splitPosition.isEqual(i.insertionPosition)&&t.baRelation=="splitBefore"){const n=e.insertionPosition.path.slice();n.push(0);const s=new y(e.insertionPosition.root,n),o=new $(i.insertionPosition,1,s,0);return[i,o]}return i.splitPosition.hasSameParentAs(e.splitPosition)&&i.splitPosition.offset<e.splitPosition.offset&&(i.howMany-=e.howMany),i.splitPosition=i.splitPosition._getTransformedBySplitOperation(e),i.insertionPosition=j.getInsertionPosition(i.splitPosition),[i]});function ou(i,e){return i.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function Gn(i,e){const t=[];for(let n=0;n<i.length;n++){const s=i[n],o=new $(s.start,s.end.offset-s.start.offset,e,0);t.push(o);for(let r=n+1;r<i.length;r++)i[r]=i[r]._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)[0];e=e._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)}return t}/**
462 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
463 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
464 */class we extends G(y){constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new g("model-liveposition-root-not-rootelement",e);jT.call(this)}detach(){this.stopListening()}toPosition(){return new y(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}we.prototype.is=function(i){return i==="livePosition"||i==="model:livePosition"||i=="position"||i==="model:position"};function jT(){this.listenTo(this.root.document.model,"applyOperation",(i,e)=>{const t=e[0];t.isDocumentOperation&&GT.call(this,t)},{priority:"low"})}function GT(i){const e=this.getTransformedByOperation(i);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}/**
465 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
466 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
467 */class Bn{constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},N("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:n=!0,isUndo:s=!1,isTyping:o=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=n,this.isUndo=s,this.isTyping=o}get type(){return N("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}/**
468 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
469 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
470 */class KT{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){const t=e;switch(t.type){case"insert":{if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break}case"addAttribute":case"removeAttribute":case"changeAttribute":{for(const n of t.range.getItems({shallow:!0}))this._isInInsertedElement(n.parent)||this._markAttribute(n);break}case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const n=this._isInInsertedElement(t.sourcePosition.parent),s=this._isInInsertedElement(t.targetPosition.parent);n||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),s||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const n=w._createFromPositionAndShift(t.position,1);for(const s of this._markerCollection.getMarkersIntersectingRange(n)){const o=s.getData();this.bufferMarkerChange(s.name,o,o)}break}case"split":{const n=t.splitPosition.parent;this._isInInsertedElement(n)||this._markRemove(n,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const n=t.sourcePosition.parent;this._isInInsertedElement(n.parent)||this._markRemove(n.parent,n.startOffset,1);const s=t.graveyardPosition.parent;this._markInsert(s,t.graveyardPosition.offset,1);const o=t.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,t.targetPosition.offset,n.maxOffset);break}case"detachRoot":case"addRoot":{const n=t.affectedSelectable;if(!n._isLoaded||n.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const n=t.root.rootName;this._bufferRootAttributeChange(n,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),n.range&&n.range.root.is("rootElement")&&!n.range.root._isLoaded&&(n.range=null);let s=this._changedMarkers.get(e);s?s.newMarkerData=n:(s={newMarkerData:n,oldMarkerData:t},this._changedMarkers.set(e,s)),s.oldMarkerData.range==null&&n.range==null&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)n.oldMarkerData.range!=null&&e.push({name:t,range:n.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)n.newMarkerData.range!=null&&e.push({name:t,range:n.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}
470hasDataChanges(){if(this.getChanges().length||this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const n=e.range&&!t.range,s=!e.range&&t.range,o=e.range&&t.range&&!e.range.isEqual(t.range);if(n||s||o)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const n of this._changesInElement.keys()){const s=this._changesInElement.get(n).sort((u,d)=>u.offset===d.offset?u.type!=d.type?u.type=="remove"?-1:1:0:u.offset<d.offset?-1:1),o=this._elementSnapshots.get(n),r=ru(n.getChildren()),a=JT(o.length,s);let l=0,c=0;for(const u of a)if(u==="i")t.push(this._getInsertDiff(n,l,r[l])),l++;else if(u==="r")t.push(this._getRemoveDiff(n,l,o[c])),c++;else if(u==="a"){const d=r[l].attributes,h=o[c].attributes;let f;if(r[l].name=="$text")f=new w(y._createAt(n,l),y._createAt(n,l+1));else{const m=n.offsetToIndex(l);f=new w(y._createAt(n,l),y._createAt(n.getChild(m),0))}t.push(...this._getAttributesDiff(f,h,d)),l++,c++}else l++,c++}t.sort((n,s)=>n.position.root!=s.position.root?n.position.root.rootName<s.position.root.rootName?-1:1:n.position.isEqual(s.position)?n.changeCount-s.changeCount:n.position.isBefore(s.position)?-1:1);for(let n=1,s=0;n<t.length;n++){const o=t[s],r=t[n],a=o.type=="remove"&&r.type=="remove"&&o.name=="$text"&&r.name=="$text"&&o.position.isEqual(r.position),l=o.type=="insert"&&r.type=="insert"&&o.name=="$text"&&r.name=="$text"&&o.position.parent==r.position.parent&&o.position.offset+o.length==r.position.offset,c=o.type=="attribute"&&r.type=="attribute"&&o.position.parent==r.position.parent&&o.range.isFlat&&r.range.isFlat&&o.position.offset+o.length==r.position.offset&&o.attributeKey==r.attributeKey&&o.attributeOldValue==r.attributeOldValue&&o.attributeNewValue==r.attributeNewValue;a||l||c?(o.length++,c&&(o.range.end=o.range.end.getShiftedBy(1)),t[n]=null):s=n}t=t.filter(n=>n);for(const n of t)delete n.changeCount,n.type=="attribute"&&(delete n.position,delete n.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(ZT),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}
470getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t={...e};return t.state!==void 0&&delete t.attributes,t})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e)){this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});return}const n=this._changedRoots.get(e);n.state!==void 0?(delete n.state,n.attributes===void 0&&this._changedRoots.delete(e)):n.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,n,s){const o=this._changedRoots.get(e)||{name:e},r=o.attributes||{};if(r[t]){const a=r[t];s===a.oldValue?delete r[t]:a.newValue=s}else r[t]={oldValue:n,newValue:s};Object.entries(r).length===0?(delete o.attributes,o.state===void 0&&this._changedRoots.delete(e)):(o.attributes=r,this._changedRoots.set(e,o))}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e);const t=w._createOn(e);for(const n of this._markerCollection.getMarkersIntersectingRange(t)){const s=n.getData();this.bufferMarkerChange(n.name,s,s)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const n=t.getData();this.bufferMarkerChange(t.name,{...n,range:null},n)}}}_markInsert(e,t,n){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const s={type:"insert",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,s)}_markRemove(e,t,n){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const s={type:"remove",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,s),this._removeAllNestedChanges(e,t,n)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let s=0;s<n.length;s++)n[s].howMany<1&&(n.splice(s,1),s--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,ru(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const n of t){const s=e.offset+e.howMany,o=n.offset+n.howMany;if(e.type=="insert"&&(n.type=="insert"&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<o&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),n.type=="remove"&&e.offset<n.offset&&(n.offset+=e.howMany),n.type=="attribute")){if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<o){const r=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:"attribute",offset:s,howMany:r-n.howMany,count:this._changeCount++})}}if(e.type=="remove"){if(n.type=="insert"){if(s<=n.offset)n.offset-=e.howMany;else if(s<=o)if(e.offset<n.offset){const r=s-n.offset;n.offset=e.offset,n.howMany-=r,e.nodesToHandle-=r}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<o){const r=o-e.offset;n.howMany-=r,e.nodesToHandle-=r}}if(n.type=="remove"&&(s<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),n.type=="attribute"){if(s<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){const r=s-n.offset;n.offset=e.offset,n.howMany-=r}else if(e.offset<o)if(s<=o){const r=n.howMany;n.howMany=e.offset-n.offset;const a=r-n.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:a,count:this._changeCount++})}else n.howMany-=o-e.offset}}if(e.type=="attribute"){if(n.type=="insert")if(e.offset<n.offset&&s>n.offset){if(s>o){const r={type:"attribute",offset:o,howMany:s-o,count:this._changeCount++};this._handleChange(r,t),t.push(r)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<o&&(s>o?(e.nodesToHandle=s-o,e.offset=o):e.nodesToHandle=0);if(n.type=="remove"&&e.offset<n.offset&&s>n.offset){const r={type:"attribute",offset:n.offset,howMany:s-n.offset,count:this._changeCount++};this._handleChange(r,t),t.push(r),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}n.type=="attribute"&&(e.offset>=n.offset&&s<=o?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&s>=o&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n){return{type:"insert",position:y._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++,_element:n.element}}_getRemoveDiff(e,t,n){return{type:"remove",position:y._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++,_element:n.element}}_getAttributesDiff(e,t,n){const s=[];n=new Map(n);for(const[o,r]of t){const a=n.has(o)?n.get(o):null;a!==r&&s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:r,attributeNewValue:a,changeCount:this._changeCount++}),n.delete(o)}for(const[o,r]of n)s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:null,attributeNewValue:r,changeCount:this._changeCount++});return s}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),s=e.startOffset;if(n){for(const o of n)if(o.type=="insert"&&s>=o.offset&&s<o.offset+o.howMany)return!0}return this._isInInsertedElement(t)}
470_removeAllNestedChanges(e,t,n){const s=new w(y._createAt(e,t),y._createAt(e,t+n));for(const o of s.getItems({shallow:!0}))o.is("element")&&(this._elementSnapshots.delete(o),this._changesInElement.delete(o),this._removeAllNestedChanges(o,0,o.maxOffset))}}function ru(i){const e=[];for(const t of i)if(t.is("$text"))for(let n=0;n<t.data.length;n++)e.push({name:"$text",attributes:new Map(t.getAttributes())});else e.push({name:t.name,attributes:new Map(t.getAttributes()),element:t});return e}function JT(i,e){const t=[];let n=0,s=0;for(const o of e){if(o.offset>n){for(let r=0;r<o.offset-n;r++)t.push("e");s+=o.offset-n}if(o.type=="insert"){for(let r=0;r<o.howMany;r++)t.push("i");n=o.offset+o.howMany}else if(o.type=="remove"){for(let r=0;r<o.howMany;r++)t.push("r");n=o.offset,s+=o.howMany}else t.push(..."a".repeat(o.howMany).split("")),n=o.offset+o.howMany,s+=o.howMany}if(s<i)for(let o=0;o<i-s-n;o++)t.push("e");return t}function ZT(i){const e="position"in i&&i.position.root.rootName=="$graveyard",t="range"in i&&i.range.root.rootName=="$graveyard";return!e&&!t}/**
471 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
472 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
473 */class QT{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new g("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const n=this._operations[0];e===void 0&&(e=n.baseVersion);let s=t-1;for(const[a,l]of this._gaps)e>a&&e<l&&(e=l),s>a&&s<l&&(s=a-1);if(s<n.baseVersion||e>this.lastOperation.baseVersion)return[];let o=this._baseVersionToOperationIndex.get(e);o===void 0&&(o=0);let r=this._baseVersionToOperationIndex.get(s);return r===void 0&&(r=this._operations.length-1),this._operations.slice(o,r+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}/**
474 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
475 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
476 */class _o extends H{constructor(e,t,n="main"){super(t),this._isAttached=!0,this._isLoaded=!0,this._document=e,this.rootName=n}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}_o.prototype.is=function(i,e){return e?e===this.name&&(i==="rootElement"||i==="model:rootElement"||i==="element"||i==="model:element"):i==="rootElement"||i==="model:rootElement"||i==="element"||i==="model:element"||i==="node"||i==="model:node"};/**
477 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
478 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
479 */const au="$graveyard";class YT extends G(){constructor(e){super(),this.model=e,this.history=new QT,this.selection=new ot(this),this.roots=new me({idProperty:"rootName"}),this.differ=new KT(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",au),this.listenTo(e,"applyOperation",(t,n)=>{const s=n[0];s.isDocumentOperation&&this.differ.bufferOperation(s)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,n)=>{const s=n[0];s.isDocumentOperation&&this.history.addOperation(s)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,n,s,o,r)=>{const a={...n.getData(),range:o};this.differ.bufferMarkerChange(n.name,r,a),s===null&&n.on("change",(l,c)=>{const u=n.getData();this.differ.bufferMarkerChange(n.name,{...u,range:c},u)})}),this.registerPostFixer(t=>{let n=!1;for(const s of this.roots)!s.isAttached()&&!s.isEmpty&&(t.remove(t.createRangeIn(s)),n=!0);for(const s of this.model.markers)s.getRange().root.isAttached()||(t.removeMarker(s),n=!0);return n})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(au)}
479createRoot(e="$root",t="main"){if(this.roots.get(t))throw new g("model-document-createroot-name-exists",this,{name:t});const n=new _o(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map(t=>t.rootName)}getRoots(e=!1){return this.roots.filter(t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=cf(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,n=t.schema,s=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(s)||t.createRange(s)}_validateSelectionRange(e){return lu(e.start)&&lu(e.end)}_callPostFixers(e){let t=!1;do for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break;while(t)}}function lu(i){const e=i.textNode;if(e){const t=e.data,n=i.offset-e.startOffset;return!Ja(t,n)&&!Za(t,n)}return!0}/**
480 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
481 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
482 */class XT extends G(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof $n?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,s=!1){const o=e instanceof $n?e.name:e;if(o.includes(","))throw new g("markercollection-incorrect-marker-name",this);const r=this._markers.get(o);if(r){const c=r.getData(),u=r.getRange();let d=!1;return u.isEqual(t)||(r._attachLiveRange(Fe.fromRange(t)),d=!0),n!=r.managedUsingOperations&&(r._managedUsingOperations=n,d=!0),typeof s=="boolean"&&s!=r.affectsData&&(r._affectsData=s,d=!0),d&&this.fire(`update:${o}`,r,u,t,c),r}const a=Fe.fromRange(t),l=new $n(o,a,n,s);return this._markers.set(o,l),this.fire(`update:${o}`,l,null,t,{...l.getData(),range:null}),l}_remove(e){const t=e instanceof $n?e.name:e,n=this._markers.get(t);return n?(this._markers.delete(t),this.fire(`update:${t}`,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0):!1}_refresh(e){const t=e instanceof $n?e.name:e,n=this._markers.get(t);if(!n)throw new g("markercollection-refresh-marker-not-exists",this);const s=n.getRange();this.fire(`update:${t}`,n,s,s,n.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class $n extends G(Jt){constructor(e,t,n,s){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=s}get managedUsingOperations(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}$n.prototype.is=function(i){return i==="marker"||i==="model:marker"};/**
483 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
484 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
485 */class eE extends ze{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new g("detach-operation-on-document-node",this)}_execute(){Cm(w._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}/**
486 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
487 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
488 */class kt extends Jt{constructor(e){super(),this.markers=new Map,this._children=new Vi,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const n of e)n.name?t.push(H.fromJSON(n)):t.push(q.fromJSON(n));return new kt(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=tE(t);for(const s of n)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const s of n)s.parent=null;return n}}kt.prototype.is=function(i){return i==="documentFragment"||i==="model:documentFragment"};function tE(i){return typeof i=="string"?[new q(i)]:(He(i)||(i=[i]),Array.from(i).map(e=>typeof e=="string"?new q(e):e instanceof nt?new q(e.data,e.getAttributes()):e))}/**
489 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
490 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
491 */class nE{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new q(e,t)}createElement(e,t){return new H(e,t)}createDocumentFragment(){return new kt}
491cloneElement(e,t=!0){return e._clone(t)}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof q&&e.data=="")return;const s=y._createAt(t,n);if(e.parent)if(du(e.root,s.root)){this.move(w._createOn(e),s);return}else{if(e.root.document)throw new g("model-writer-insert-forbidden-move",this);this.remove(e)}const o=s.root.document?s.root.document.version:null,r=new be(s,e,o);if(e instanceof q&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof kt)for(const[a,l]of e.markers){const c=y._createAt(l.root,0),d={range:new w(l.start._getCombined(c,s),l.end._getCombined(c,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(a)?this.updateMarker(a,d):this.addMarker(a,d)}}insertText(e,t,n,s){t instanceof kt||t instanceof H||t instanceof y?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,s)}insertElement(e,t,n,s){t instanceof kt||t instanceof H||t instanceof y?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,s)}append(e,t){this.insert(e,t,"end")}appendText(e,t,n){t instanceof kt||t instanceof H?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),n,"end")}appendElement(e,t,n){t instanceof kt||t instanceof H?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),n,"end")}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof w){const s=n.getMinimalFlatRanges();for(const o of s)cu(this,e,t,o)}else uu(this,e,t,n)}setAttributes(e,t){for(const[n,s]of St(e))this.setAttribute(n,s,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof w){const n=t.getMinimalFlatRanges();for(const s of n)cu(this,e,null,s)}else uu(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=n=>{for(const s of n.getAttributeKeys())this.removeAttribute(s,n)};if(!(e instanceof w))t(e);else for(const n of e.getItems())t(n)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof w))throw new g("writer-move-invalid-range",this);if(!e.isFlat)throw new g("writer-move-range-not-flat",this);const s=y._createAt(t,n);if(s.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!du(e.root,s.root))throw new g("writer-move-different-document",this);const o=e.root.document?e.root.document.version:null,r=new $(e.start,e.end.offset-e.start.offset,s,o);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const n=(e instanceof w?e:w._createOn(e)).getMinimalFlatRanges().reverse();for(const s of n)this._addOperationForAffectedMarkers("move",s),iE(s.start,s.end.offset-s.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof H))throw new g("writer-merge-no-element-before",this);if(!(n instanceof H))throw new g("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(w._createIn(n),y._createAt(t,"end")),this.remove(n)}_merge(e){const t=y._createAt(e.nodeBefore,"end"),n=y._createAt(e.nodeAfter,0),s=e.root.document.graveyard,o=new y(s,[0]),r=e.root.document.version,a=new re(n,e.nodeAfter.maxOffset,t,o,r);this.batch.addOperation(a),this.model.applyOperation(a)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof H))throw new g("writer-rename-not-element-instance",this);const n=e.root.document?e.root.document.version:null,s=new Ie(y._createBefore(e),e.name,t,n);this.batch.addOperation(s),this.model.applyOperation(s)}split(e,t){this._assertWriterUsedCorrectly();let n=e.parent;if(!n.parent)throw new g("writer-split-element-no-parent",this);if(t||(t=n.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new g("writer-split-invalid-limit-element",this);let s,o;do{const r=n.root.document?n.root.document.version:null,a=n.maxOffset-e.offset,l=j.getInsertionPosition(e),c=new j(e,a,l,null,r);this.batch.addOperation(c),this.model.applyOperation(c),!s&&!o&&(s=n,o=e.parent.nextSibling),e=this.createPositionAfter(e.parent),n=e.parent}while(n!==t);return{position:e,range:new w(y._createAt(s,"end"),y._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new g("writer-wrap-range-not-flat",this);const n=t instanceof H?t:new H(t);if(n.childCount>0)throw new g("writer-wrap-element-not-empty",this);if(n.parent!==null)throw new g("writer-wrap-element-attached",this);this.insert(n,e.start);const s=new w(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(s,y._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new g("writer-unwrap-element-no-parent",this);this.move(w._createIn(e),this.createPositionAfter(e)),this.remove(e)}
491addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!="boolean")throw new g("writer-addmarker-no-usingoperation",this);const n=t.usingOperation,s=t.range,o=t.affectsData===void 0?!1:t.affectsData;if(this.model.markers.has(e))throw new g("writer-addmarker-marker-exists",this);if(!s)throw new g("writer-addmarker-no-range",this);return n?(pi(this,e,null,s,o),this.model.markers.get(e)):this.model.markers._set(e,s,n,o)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n=typeof e=="string"?e:e.name,s=this.model.markers.get(n);if(!s)throw new g("writer-updatemarker-marker-not-exists",this);if(!t){N("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),this.model.markers._refresh(s);return}const o=typeof t.usingOperation=="boolean",r=typeof t.affectsData=="boolean",a=r?t.affectsData:s.affectsData;if(!o&&!t.range&&!r)throw new g("writer-updatemarker-wrong-options",this);const l=s.getRange(),c=t.range?t.range:l;if(o&&t.usingOperation!==s.managedUsingOperations){t.usingOperation?pi(this,n,null,c,a):(pi(this,n,l,null,a),this.model.markers._set(n,c,void 0,a));return}s.managedUsingOperations?pi(this,n,l,c,a):this.model.markers._set(n,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new g("writer-removemarker-no-marker",this);const n=this.model.markers.get(t);if(!n.managedUsingOperations){this.model.markers._remove(t);return}const s=n.getRange();pi(this,t,s,null,n.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const n=this.model.document.getRoot(e);if(n&&n.isAttached())throw new g("writer-addroot-root-exists",this);const s=this.model.document,o=new ft(e,t,!0,s,s.version);return this.batch.addOperation(o),this.model.applyOperation(o),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new g("writer-detachroot-no-root",this);for(const o of this.model.markers)o.getRange().root===t&&this.removeMarker(o);for(const o of t.getAttributeKeys())this.removeAttribute(o,t);this.remove(this.createRangeIn(t));const n=this.model.document,s=new ft(t.rootName,t.name,!1,n,n.version);this.batch.addOperation(s),this.model.applyOperation(s)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._setSelectionAttribute(e,t);else for(const[n,s]of St(e))this._setSelectionAttribute(n,s)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const s=ot._getStoreAttributeKey(e);this.setAttribute(s,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=ot._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new g("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const s=n.getRange();let o=!1;if(e==="move"){const r=t;o=r.containsPosition(s.start)||r.start.isEqual(s.start)||r.containsPosition(s.end)||r.end.isEqual(s.end)}else{const r=t,a=r.nodeBefore,l=r.nodeAfter,c=s.start.parent==a&&s.start.isAtEnd,u=s.end.parent==l&&s.end.offset==0,d=s.end.nodeAfter==l,h=s.start.nodeAfter==l;o=c||u||d||h}o&&this.updateMarker(n.name,{range:s})}}}function cu(i,e,t,n){const s=i.model,o=s.document;let r=n.start,a,l,c;for(const d of n.getWalker({shallow:!0}))c=d.item.getAttribute(e),a&&l!=c&&(l!=t&&u(),r=a),a=d.nextPosition,l=c;a instanceof y&&a!=r&&l!=t&&u();function u(){const d=new w(r,a),h=d.root.document?o.version:null,f=new ue(d,e,l,t,h);i.batch.addOperation(f),s.applyOperation(f)}}function uu(i,e,t,n){const s=i.model,o=s.document,r=n.getAttribute(e);let a,l;if(r!=t){if(n.root===n){const u=n.document?o.version:null;l=new At(n,e,r,t,u)}else{a=new w(y._createBefore(n),i.createPositionAfter(n));const u=a.root.document?o.version:null;l=new ue(a,e,r,t,u)}i.batch.addOperation(l),s.applyOperation(l)}}function pi(i,e,t,n,s){const o=i.model,r=o.document,a=new Se(e,t,n,o.markers,!!s,r.version);i.batch.addOperation(a),o.applyOperation(a)}function iE(i,e,t,n){let s;if(i.root.document){const o=n.document,r=new y(o.graveyard,[0]);s=new $(i,e,r,o.version)}else s=new eE(i,e);t.addOperation(s),n.applyOperation(s)}function du(i,e){return i===e||i instanceof _o&&e instanceof _o}/**
492 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
493 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
494 */function sE(i,e,t={}){if(e.isCollapsed)return;const n=e.getFirstRange();if(n.root.rootName=="$graveyard")return;const s=i.schema;i.change(o=>{if(!t.doNotResetEntireContent&&fE(s,e)){hE(o,e);return}const r={};if(!t.doNotAutoparagraph){const c=e.getSelectedElement();c&&Object.assign(r,s.getAttributesWithProperty(c,"copyOnReplace",!0))}const[a,l]=oE(n);a.isTouching(l)||o.remove(o.createRange(a,l)),t.leaveUnmerged||(aE(o,a,l),s.removeDisallowedAttributes(a.parent.getChildren(),o)),Pm(o,e,a),!t.doNotAutoparagraph&&uE(s,a)&&Im(o,a,e,r),a.detach(),l.detach()})}function oE(i){const e=i.root.document.model,t=i.start;let n=i.end;if(e.hasContent(i,{ignoreMarkers:!0})){const s=rE(n);if(s&&n.isTouching(e.createPositionAt(s,0))){const o=e.createSelection(i);e.modifySelection(o,{direction:"backward"});const r=o.getLastPosition(),a=e.createRange(r,n);e.hasContent(a,{ignoreMarkers:!0})||(n=r)}}return[we.fromPosition(t,"toPrevious"),we.fromPosition(n,"toNext")]}function rE(i){const e=i.parent,t=e.root.document.model.schema,n=e.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of n){if(t.isLimit(s))return null;if(t.isBlock(s))return s}}function aE(i,e,t){const n=i.model;if(!al(i.model.schema,e,t))return;const[s,o]=cE(e,t);!s||!o||(!n.hasContent(s,{ignoreMarkers:!0})&&n.hasContent(o,{ignoreMarkers:!0})?Sm(i,e,t,s.parent):xm(i,e,t,s.parent))}function xm(i,e,t,n){const s=e.parent,o=t.parent;if(!(s==n||o==n)){for(e=i.createPositionAfter(s),t=i.createPositionBefore(o),t.isEqual(e)||i.insert(o,e),i.merge(e);t.parent.isEmpty;){const r=t.parent;t=i.createPositionBefore(r),i.remove(r)}al(i.model.schema,e,t)&&xm(i,e,t,n)}}function Sm(i,e,t,n){const s=e.parent,o=t.parent;if(!(s==n||o==n)){for(e=i.createPositionAfter(s),t=i.createPositionBefore(o),t.isEqual(e)||i.insert(s,t);e.parent.isEmpty;){const r=e.parent;e=i.createPositionBefore(r),i.remove(r)}t=i.createPositionBefore(o),lE(i,t),al(i.model.schema,e,t)&&Sm(i,e,t,n)}}function lE(i,e){const t=e.nodeBefore,n=e.nodeAfter;
494t.name!=n.name&&i.rename(t,n.name),i.clearAttributes(t),i.setAttributes(Object.fromEntries(n.getAttributes()),t),i.merge(e)}function al(i,e,t){const n=e.parent,s=t.parent;return n==s||i.isLimit(n)||i.isLimit(s)?!1:dE(e,t,i)}function cE(i,e){const t=i.getAncestors(),n=e.getAncestors();let s=0;for(;t[s]&&t[s]==n[s];)s++;return[t[s],n[s]]}function uE(i,e){const t=i.checkChild(e,"$text"),n=i.checkChild(e,"paragraph");return!t&&n}function dE(i,e,t){const n=new w(i,e);for(const s of n.getWalker())if(t.isLimit(s.item))return!1;return!0}function Im(i,e,t,n={}){const s=i.createElement("paragraph");i.model.schema.setAllowedAttributes(s,n,i),i.insert(s,e),Pm(i,t,i.createPositionAt(s,0))}function hE(i,e){const t=i.model.schema.getLimitElement(e);i.remove(i.createRangeIn(t)),Im(i,i.createPositionAt(t,0),e)}function fE(i,e){const t=i.getLimitElement(e);if(!e.containsEntireContent(t))return!1;const n=e.getFirstRange();return n.start.parent==n.end.parent?!1:i.checkChild(t,"paragraph")}function Pm(i,e,t){e instanceof ot?i.setSelection(t):e.setTo(t)}/**
495 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
496 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
497 */function mE(i,e){return i.change(t=>{const n=t.createDocumentFragment(),s=e.getFirstRange();if(!s||s.isCollapsed)return n;const o=s.start.root,r=s.start.getCommonPath(s.end),a=o.getNodeByPath(r);let l;s.start.parent==s.end.parent?l=s:l=t.createRange(t.createPositionAt(a,s.start.path[r.length]),t.createPositionAt(a,s.end.path[r.length]+1));const c=l.end.offset-l.start.offset;for(const u of l.getItems({shallow:!0}))u.is("$textProxy")?t.appendText(u.data,u.getAttributes(),n):t.append(t.cloneElement(u,!0),n);if(l!=s){const u=s._getTransformedByMove(l.start,t.createPositionAt(n,0),c)[0],d=t.createRange(t.createPositionAt(n,0),u.start),h=t.createRange(u.end,t.createPositionAt(n,"end"));hu(h,t),hu(d,t)}return n})}function hu(i,e){const t=[];Array.from(i.getItems({direction:"backward"})).map(n=>e.createRangeOn(n)).filter(n=>(n.start.isAfter(i.start)||n.start.isEqual(i.start))&&(n.end.isBefore(i.end)||n.end.isEqual(i.end))).forEach(n=>{t.push(n.start.parent),e.remove(n)}),t.forEach(n=>{let s=n;for(;s.parent&&s.isEmpty;){const o=e.createRangeOn(s);s=s.parent,e.remove(o)}})}/**
498 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
499 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
500 */function gE(i,e,t){return i.change(n=>{const s=t||i.document.selection;s.isCollapsed||i.deleteContent(s,{doNotAutoparagraph:!0});const o=new pE(i,n,s.anchor),r=[];let a;if(e.is("documentFragment")){if(e.markers.size){const u=[];for(const[d,h]of e.markers){const{start:f,end:m}=h,p=f.isEqual(m);u.push({position:f,name:d,isCollapsed:p},{position:m,name:d,isCollapsed:p})}u.sort(({position:d},{position:h})=>d.isBefore(h)?1:-1);for(const{position:d,name:h,isCollapsed:f}of u){let m=null,p=null;const _=d.parent===e&&d.isAtStart,v=d.parent===e&&d.isAtEnd;!_&&!v?(m=n.createElement("$marker"),n.insert(m,d)):f&&(p=_?"start":"end"),r.push({name:h,element:m,collapsed:p})}}a=e.getChildren()}else a=[e];o.handleNodes(a);let l=o.getSelectionRange();if(e.is("documentFragment")&&r.length){const u=l?Fe.fromRange(l):null,d={};for(let h=r.length-1;h>=0;h--){const{name:f,element:m,collapsed:p}=r[h],_=!d[f];if(_&&(d[f]=[]),m){const v=n.createPositionAt(m,"before");d[f].push(v),n.remove(m)}else{const v=o.getAffectedRange();if(!v){p&&d[f].push(o.position);continue}p?d[f].push(v[p]):d[f].push(_?v.start:v.end)}}for(const[h,[f,m]]of Object.entries(d))f&&m&&f.root===m.root&&f.root.document&&!n.model.markers.has(h)&&n.addMarker(h,{usingOperation:!0,affectsData:!0,range:new w(f,m)});u&&(l=u.toRange(),u.detach())}/* istanbul ignore else -- @preserve */l&&(s instanceof ot?n.setSelection(l):s.setTo(l));const c=o.getAffectedRange()||i.createRange(s.anchor);return o.destroy(),c})}class pE{constructor(e,t,n){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(e);if(n.isAfter(t)){this._lastNode=e;/* istanbul ignore if -- @preserve */if(this.position.parent!=e||!this.position.isAt
500End)throw new g("insertcontent-invalid-insertion-position",this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?w._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new w(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(this.schema.isObject(e)){this._handleObject(e);return}let t=this._checkAndAutoParagraphToAllowedPosition(e);if(!t&&(t=this._checkAndSplitToAllowedPosition(e),!t)){this._handleDisallowedNode(e);return}this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=we.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){/* istanbul ignore if -- @preserve */if(!this.schema.checkChild(this.position,e))throw new g("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=we.fromPosition(e,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=we.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof H)||!this._canMergeLeft(e))return;const t=we._createBefore(e);t.stickiness="toNext";const n=we.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=we._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=we._createAt(t.nodeBefore,"end","toNext")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof H)||!this._canMergeRight(e))return;const t=we._createAfter(e);t.stickiness="toNext";/* istanbul ignore if -- @preserve */if(!this.position.isEqual(t))throw new g("insertcontent-invalid-insertion-position",this);this.position=y._createAt(t.nodeBefore,"end");const n=we.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=we._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=we._createAt(t.nodeBefore,0,"toPrevious")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof H&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof H&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;
500if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!0}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const n=this.position.parent;this.position=this.writer.createPositionBefore(n),n.isEmpty&&n.parent===t&&this.writer.remove(n)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const n=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=n,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}/**
501 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
502 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
503 */function bE(i,e,t,n={}){if(!i.schema.isObject(e))throw new g("insertobject-element-not-an-object",i,{object:e});const s=t||i.document.selection;let o=s;n.findOptimalPosition&&i.schema.isBlock(e)&&(o=i.createSelection(i.schema.findOptimalInsertionRange(s,n.findOptimalPosition)));const r=ie(s.getSelectedBlocks()),a={};return r&&Object.assign(a,i.schema.getAttributesWithProperty(r,"copyOnReplace",!0)),i.change(l=>{o.isCollapsed||i.deleteContent(o,{doNotAutoparagraph:!0});let c=e;const u=o.anchor.parent;!i.schema.checkChild(u,e)&&i.schema.checkChild(u,"paragraph")&&i.schema.checkChild("paragraph",e)&&(c=l.createElement("paragraph"),l.insert(e,c)),i.schema.setAllowedAttributes(c,a,l);const d=i.insertContent(c,o);return d.isCollapsed||n.setSelection&&wE(l,e,n.setSelection,a),d})}function wE(i,e,t,n){const s=i.model;if(t=="on"){i.setSelection(e,"on");return}if(t!="after")throw new g("insertobject-invalid-place-parameter-value",s);let o=e.nextSibling;if(s.schema.isInline(e)){i.setSelection(e,"after");return}!(o&&s.schema.checkChild(o,"$text"))&&s.schema.checkChild(e.parent,"paragraph")&&(o=i.createElement("paragraph"),s.schema.setAllowedAttributes(o,n,i),s.insertContent(o,i.createPositionAfter(e))),o&&i.setSelection(o,0)}/**
504 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
505 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
506 */const _E=' ,.?!:;"-()';function yE(i,e,t={}){const n=i.schema,s=t.direction!="backward",o=t.unit?t.unit:"character",r=!!t.treatEmojiAsSingleUnit,a=e.focus,l=new Tt({boundaries:TE(a,s),singleCharacters:!0,direction:s?"forward":"backward"}),c={walker:l,schema:n,isForward:s,unit:o,treatEmojiAsSingleUnit:r};let u;for(;u=l.next();){if(u.done)return;const d=vE(c,u.value);if(d){e instanceof ot?i.change(h=>{h.setSelectionFocus(d)}):e.setFocus(d);return}}}function vE(i,e){const{isForward:t,walker:n,unit:s,schema:o,treatEmojiAsSingleUnit:r}=i,{type:a,item:l,nextPosition:c}=e;if(a=="text")return i.unit==="word"?CE(n,t):kE(n,s,r);if(a==(t?"elementStart":"elementEnd")){if(o.isSelectable(l))return y._createAt(l,t?"after":"before");if(o.checkChild(c,"$text"))return c}else{if(o.isLimit(l)){n.skip(()=>!0);return}if(o.checkChild(c,"$text"))return c}}function kE(i,e,t){const n=i.position.textNode;if(n){const s=n.data;let o=i.position.offset-n.startOffset;for(;Ja(s,o)||e=="character"&&Za(s,o)||t&&Vf(s,o);)i.next(),o=i.position.offset-n.startOffset}return i.position}function CE(i,e){let t=i.position.textNode;for(t||(t=e?i.position.nodeAfter:i.position.nodeBefore);t&&t.is("$text");){const n=i.position.offset-t.startOffset;if(AE(t,n,e))t=e?i.position.nodeAfter:i.position.nodeBefore;else{if(EE(t.data,n,e))break;i.next()}}return i.position}function TE(i,e){const t=i.root,n=y._createAt(t,e?"end":0);return e?new w(i,n):new w(n,i)}function EE(i,e,t){const n=e+(t?0:-1);return _E.includes(i.charAt(n))}function AE(i,e,t){return e===(t?i.offsetSize:0)}/**
507 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
508 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
509 */let xE=class extends W(){constructor(){super(),this.markers=new XT,this.document=new YT(this),this.schema=new mT,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e
509=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if(t.name==="$marker")return!0}),oT(this),this.document.registerPostFixer(pm),this.on("insertContent",(e,[t,n])=>{e.return=gE(this,t,n)}),this.on("insertObject",(e,[t,n,s])=>{e.return=bE(this,t,n,s)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new Bn,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new Bn):e instanceof Bn||(e=new Bn(e)):e=new Bn,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(n){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(n,this)}}applyOperation(e){e._execute()}insertContent(e,t,n,...s){const o=kr(t,n);return this.fire("insertContent",[e,o,n,...s])}insertObject(e,t,n,s,...o){const r=kr(t,n);return this.fire("insertObject",[e,r,s,s,...o])}deleteContent(e,t){sE(this,e,t)}modifySelection(e,t){yE(this,e,t)}getSelectedContent(e){return mE(this,e)}hasContent(e,t={}){const n=e instanceof w?e:w._createIn(e);if(n.isCollapsed)return!1;const{ignoreWhitespaces:s=!1,ignoreMarkers:o=!1}=t;if(!o){for(const r of this.markers.getMarkersIntersectingRange(n))if(r.affectsData)return!0}for(const r of n.getItems())if(this.schema.isContent(r))if(r.is("$textProxy"))if(s){if(r.data.search(/\S/)!==-1)return!0}else return!0;else return!0;return!1}canEditAt(e){const t=kr(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,n){return new y(e,t,n)}createPositionAt(e,t){return y._createAt(e,t)}createPositionAfter(e){return y._createAfter(e)}createPositionBefore(e){return y._createBefore(e)}createRange(e,t){return new w(e,t)}createRangeIn(e){return w._createIn(e)}createRangeOn(e){return w._createOn(e)}createSelection(...e){return new Le(...e)}createBatch(e){return new Bn(e)}createOperationFromJSON(e){return $T.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new nE(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}
509return e}};function kr(i,e){if(i)return i instanceof Le||i instanceof ot?i:i instanceof vn?e||e===0?new Le(i,e):i.is("rootElement")?new Le(i,"in"):new Le(i,"on"):new Le(i)}/**
510 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
511 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
512 */class SE extends Mt{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}/**
513 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
514 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
515 */class ll extends Mt{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}/**
516 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
517 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
518 */class bt{constructor(e){this.document=e}createDocumentFragment(e){return new ln(this.document,e)}createElement(e,t,n){return new st(this.document,e,t,n)}createText(e){return new ne(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const n=e.parent;if(n){const s=n.getChildIndex(e);return this.removeChildren(s,1,n),this.insertChild(s,t,n),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){const n=new st(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Oe(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return k._createAt(e,t)}createPositionAfter(e){return k._createAfter(e)}createPositionBefore(e){return k._createBefore(e)}createRange(e,t){return new M(e,t)}createRangeOn(e){return M._createOn(e)}createRangeIn(e){return M._createIn(e)}createSelection(...e){return new Et(...e)}}/**
519 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
520 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
521 */const IE=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,PE=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,RE=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,VE=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,BE=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,ME=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,OE=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function Rm(i){return i.startsWith("#")?IE.test(i):i.startsWith("rgb")?PE.test(i)||RE.test(i):i.startsWith("hsl")?VE.test(i)||BE.test(i):OE.has(i.toLowerCase())}const LE=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function FE(i){return LE.includes(i)}const NE=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Zo(i){return NE.test(i)}const DE=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Vm(i){return DE.test(i)}const $E=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function UE(i){return $E.includes(i)}const HE=["center","top","bottom","left","right"];function zE(i){return HE.includes(i)}const WE=["fixed","scroll","local"];function qE(i){return WE.includes(i)}const jE=/^url\(/;function GE(i){return jE.test(i)}function Oi(i=""){if(i==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const e=cl(i),t=e[0],n=e[2]||t,s=e[1]||t,o=e[3]||s;return{top:t,bottom:n,right:s,left:o}}function Li(i){return e=>{const{top:t,right:n,bottom:s,left:o}=e,r=[];return[t,n,o,s].every(a=>!!a)?r.push([i,KE(e)]):(t&&r.push([i+"-top",t]),n&&r.push([i+"-right",n]),s&&r.push([i+"-bottom",s]),o&&r.push([i+"-left",o])),r}}function KE({top:i,right:e,bottom:t,left:n}){const s=[];return n!==e?s.push(i,e,t,n):t!==i?s.push(i,e,t):e!==i?s.push(i,e):s.push(i),s.join(" ")}function Bm(i){return e=>({path:i,value:Oi(e)})}function cl(i){const e=i.matchAll(ME);return Array.from(e).map(t=>t[0])}/**
522 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
523 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
524 */function ul(i){i.setNormalizer("background",JE()),i.setNormalizer("background-color",ZE()),i.setReducer("background",QE()),i.setStyleRelation("background",["background-color"])}function JE(){return i=>{const e={},t=cl(i);for(const n of t)UE(n)?(e.repeat=e.repeat||[],e.repeat.push(n)):zE(n)?(e.position=e.position||[],e.position.push(n)):qE(n)?e.attachment=n:Rm(n)?e.color=n:GE(n)&&(e.image=n);return{path:"background",value:e}}}function ZE(){return i=>({path:"background.color",value:i})}function QE(){return i=>{const e=[];return e.push(["background-color",i.color]),e}}/**
525 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
526 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
527 */function Mm(i){i.setNormalizer("border",YE()),i.setNormalizer("border-top",Es("top")),i.setNormalizer("border-right",Es("right")),i.setNormalizer("border-bottom",Es("bottom")),i.setNormalizer("border-left",Es("left")),i.setNormalizer("border-color",Cr("color")),i.setNormalizer("border-width",Cr("width")),i.setNormalizer("border-style",Cr("style")),i.setNormalizer("border-top-color",We("color","top")),i.setNormalizer("border-top-style",We("style","top")),i.setNormalizer("border-top-width",We("width","top")),i.setNormalizer("border-right-color",We("color","right")),i.setNormalizer("border-right-style",We("style","right")),i.setNormalizer("border-right-width",We("width","right")),i.setNormalizer("border-bottom-color",We("color","bottom")),i.setNormalizer("border-bottom-style",We("style","bottom")),i.setNormalizer("border-bottom-width",We("width","bottom")),i.setNormalizer("border-left-color",We("color","left")),i.setNormalizer("border-left-style",We("style","left")),i.setNormalizer("border-left-width",We("width","left")),i.setExtractor("border-top",As("top")),i.setExtractor("border-right",As("right")),i.setExtractor("border-bottom",As("bottom")),i.setExtractor("border-left",As("left")),i.setExtractor("border-top-color","border.color.top"),i.setExtractor("border-right-color","border.color.right"),i.setExtractor("border-bottom-color","border.color.bottom"),i.setExtractor("border-left-color","border.color.left"),i.setExtractor("border-top-width","border.width.top"),i.setExtractor("border-right-width","border.width.right"),i.setExtractor("border-bottom-width","border.width.bottom"),i.setExtractor("border-left-width","border.width.left"),i.setExtractor("border-top-style","border.style.top"),i.setExtractor("border-right-style","border.style.right"),i.setExtractor("border-bottom-style","border.style.bottom"),i.setExtractor("border-left-style","border.style.left"),i.setReducer("border-color",Li("border-color")),i.setReducer("border-style",Li("border-style")),i.setReducer("border-width",Li("border-width")),i.setReducer("border-top",xs("top")),i.setReducer("border-right",xs("right")),i.setReducer("border-bottom",xs("bottom")),i.setReducer("border-left",xs("left")),i.setReducer("border",eA()),i.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),i.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),i.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),i.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),i.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),i.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),i.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),i.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function YE(){return i=>{const{color:e,style:t,width:n}=Om(i);return{path:"border",value:{color:Oi(e),style:Oi(t),width:Oi(n)}}}}function Es(i){return e=>{const{color:t,style:n,width:s}=Om(e),o={};return t!==void 0&&(o.color={[i]:t}),n!==void 0&&(o.style={[i]:n}
527),s!==void 0&&(o.width={[i]:s}),{path:"border",value:o}}}function Cr(i){return e=>({path:"border",value:XE(e,i)})}function XE(i,e){return{[e]:Oi(i)}}function We(i,e){return t=>({path:"border",value:{[i]:{[e]:t}}})}function As(i){return(e,t)=>{if(t.border)return Ai(t.border,i)}}function Ai(i,e){const t={};return i.width&&i.width[e]&&(t.width=i.width[e]),i.style&&i.style[e]&&(t.style=i.style[e]),i.color&&i.color[e]&&(t.color=i.color[e]),t}function Om(i){const e={},t=cl(i);for(const n of t)Zo(n)||/thin|medium|thick/.test(n)?e.width=n:FE(n)?e.style=n:e.color=n;return e}function eA(){return e=>{const t=Ai(e,"top"),n=Ai(e,"right"),s=Ai(e,"bottom"),o=Ai(e,"left"),r=[t,n,s,o],a={width:i(r,"width"),style:i(r,"style"),color:i(r,"color")},l=Un(a,"all");return l.length?l:[...Object.entries(a).reduce((u,[d,h])=>(h&&(u.push([`border-${d}`,h]),r.forEach(f=>delete f[d])),u),[]),...Un(t,"top"),...Un(n,"right"),...Un(s,"bottom"),...Un(o,"left")]};function i(e,t){return e.map(n=>n[t]).reduce((n,s)=>n==s?n:null)}}function xs(i){return e=>Un(e,i)}function Un(i,e){const t=[];if(i&&i.width&&t.push("width"),i&&i.style&&t.push("style"),i&&i.color&&t.push("color"),t.length==3){const n=t.map(s=>i[s]).join(" ");return[e=="all"?["border",n]:[`border-${e}`,n]]}return e=="all"?[]:t.map(n=>[`border-${e}-${n}`,i[n]])}/**
528 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
529 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
530 */function tA(i){i.setNormalizer("margin",Bm("margin")),i.setNormalizer("margin-top",e=>({path:"margin.top",value:e})),i.setNormalizer("margin-right",e=>({path:"margin.right",value:e})),i.setNormalizer("margin-bottom",e=>({path:"margin.bottom",value:e})),i.setNormalizer("margin-left",e=>({path:"margin.left",value:e})),i.setReducer("margin",Li("margin")),i.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}/**
531 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
532 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
533 */function nA(i){i.setNormalizer("padding",Bm("padding")),i.setNormalizer("padding-top",e=>({path:"padding.top",value:e})),i.setNormalizer("padding-right",e=>({path:"padding.right",value:e})),i.setNormalizer("padding-bottom",e=>({path:"padding.bottom",value:e})),i.setNormalizer("padding-left",e=>({path:"padding.left",value:e})),i.setReducer("padding",Li("padding")),i.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}/**
534 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
535 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
536 */class iA{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new g("commandcollection-command-not-found",this,{commandName:e});return n.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}/**
537 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
538 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
539 */class sA extends de{constructor(e){super(),this.editor=e}set(e,t,n={}){if(typeof t=="string"){const s=t;t=(o,r)=>{this.editor.execute(s),r()}}super.set(e,t,n)}}/**
540 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
541 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
542 */const Tr="contentEditing",fu="common";class oA{constructor(e){this.keystrokeInfos=new Map,this._editor=e;const t=e.config.get("menuBar.isVisible"),n=e.locale.t;this.addKeystrokeInfoCategory({id:Tr,label:n("Content editing keystrokes"),description:n("These keyboard shortcuts allow for quick access to content editing features.")});const s=[{label:n("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:n("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:n("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:n("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:n("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:n("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&s.push({label:n("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:n("User interface and content navigation keystrokes"),description:n("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:s}]})}addKeystrokeInfoCategory({id:e,label:t,description:n,groups:s}){this.keystrokeInfos.set(e,{id:e,label:t,description:n,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:fu}
542),s&&s.forEach(o=>{this.addKeystrokeInfoGroup({categoryId:e,...o})})}addKeystrokeInfoGroup({categoryId:e=Tr,id:t,label:n,keystrokes:s}){const o=this.keystrokeInfos.get(e);if(!o)throw new g("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});o.groups.set(t,{id:t,label:n,keystrokes:s||[]})}addKeystrokeInfos({categoryId:e=Tr,groupId:t=fu,keystrokes:n}){if(!this.keystrokeInfos.has(e))throw new g("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:n});const s=this.keystrokeInfos.get(e);if(!s.groups.has(t))throw new g("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:n});s.groups.get(t).keystrokes.push(...n)}}/**
543 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
544 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
545 */class rA extends W(){constructor(e={}){super();const t=this.constructor,{translations:n,...s}=t.defaultConfig||{},{translations:o=n,...r}=e,a=e.language||s.language;this._context=e.context||new $f({language:a,translations:o}),this._context._addEditor(this,!e.context);const l=Array.from(t.builtinPlugins||[]);this.config=new _f(r,s),this.config.define("plugins",l),this.config.define(this._context._getEditorConfig()),this.plugins=new Df(this,l,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new iA,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new xE,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const c=new fk;this.data=new LT(this.model,c),this.editing=new dT(this.model,c),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new NT([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new sA(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new oA(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new g("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new g("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new g("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],o=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(s),n,o)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(n){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(n,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}/**
546 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
547 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
548 */function aA(i){if(!hn(i.updateSourceElement))throw new g("attachtoform-missing-elementapi-interface",i);const e=i.sourceElement;if(lA(e)&&e.form){let t;const n=e.form,s=()=>i.updateSourceElement();hn(n.submit)&&(t=n.submit,n.submit=()=>{s(),t.apply(n)}),n.addEventListener("submit",s),i.on("destroy",()=>{n.removeEventListener("submit",s),t&&(n.submit=t)})}}function lA(i){return!!i&&i.tagName.toLowerCase()==="textarea"}/**
549 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
550 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
551 */function aa(i){class e extends i{updateSourceElement(n){if(!this.sourceElement)throw new g("editor-missing-sourceelement",this);const s=this.config.get("updateSourceElementOnDestroy"),o=this.sourceElement instanceof HTMLTextAreaElement;if(!s&&!o){gc(this.sourceElement,"");return}const r=typeof n=="string"?n:this.data.get();gc(this.sourceElement,r)}}return e}aa.updateSourceElement=aa(Object).prototype.updateSourceElement;/**
552 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
553 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
554 */class yo extends Uf{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new me({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new g("pendingactions-add-invalid-message",this);const t=new(W());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const cA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',uA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',dA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',hA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',fA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',mA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z"/></svg>',gA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/></svg>',pA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/>
554</svg>',bA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',wA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/></svg>',_A='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',yA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',vA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',kA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',CA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',TA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',EA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',AA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',xA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',SA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',IA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',PA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',RA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',VA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',BA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',MA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',OA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',LA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',FA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',NA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.
5546 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',DA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',$A='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',UA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',HA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',zA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',WA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',qA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>',jA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',GA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',KA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',JA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',ZA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',QA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',YA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>';/**
555 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
556 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
557 */const E={bold:NA,cancel:cA,caption:uA,check:dA,colorPalette:hA,eraser:fA,imageUpload:wA,textAlternative:mA,loupe:gA,previousArrow:pA,nextArrow:bA,importExport:HA,paragraph:DA,plus:$A,text:UA,alignBottom:_A,alignMiddle:yA,alignTop:vA,alignLeft:kA,alignCenter:CA,alignRight:TA,alignJustify:EA,objectLeft:RA,objectCenter:xA,objectRight:VA,objectFullWidth:IA,objectInline:PA,objectBlockLeft:AA,objectBlockRight:SA,pencil:BA,pilcrow:MA,quote:OA,threeVerticalDots:LA,dragIndicator:FA,redo:zA,undo:WA,bulletedList:qA,numberedList:jA,todoList:GA,codeBlock:KA,horizontalLine:JA,indent:ZA,outdent:QA,table:YA};/**
558 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
559 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
560 */class Ne extends C{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${$e()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}/**
561 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
562 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
563 */class XA extends C{constructor(e,t){super(e);const n=e.t,s=new Ne;s.text=n("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":s.id,role:"document",tabindex:-1},children:[Ve(document,"p",{},n("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())
563),s]})}focus(){this.element.focus()}_createCategories(e){return e.map(t=>{const n=[Ve(document,"h3",{},t.label),...Array.from(t.groups.values()).map(s=>this._createGroup(s)).flat()];return t.description&&n.splice(1,0,Ve(document,"p",{},t.description)),Ve(document,"section",{},n)})}_createGroup(e){const t=e.keystrokes.sort((s,o)=>s.label.localeCompare(o.label)).map(s=>this._createGroupRow(s)).flat(),n=[Ve(document,"dl",{},t)];return e.label&&n.unshift(Ve(document,"h4",{},e.label)),n}_createGroupRow(e){const t=this.locale.t,n=Ve(document,"dt"),s=Ve(document,"dd"),o=tx(e.keystroke),r=[];for(const a of o)r.push(a.map(ex).join(""));return n.innerHTML=e.label,s.innerHTML=r.join(", ")+(e.mayRequireFn&&B.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[n,s]}}function ex(i){return po(i).split("+").map(e=>`<kbd>${e}</kbd>`).join("+")}function tx(i){return typeof i=="string"?[[i]]:typeof i[0]=="string"?[i]:i}const mu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103V9.125Z"/><path clip-rule="evenodd" d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17Zm0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z"/></svg>';/**
564 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
565 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
566 */class nx extends b{constructor(){super(...arguments),this.contentView=null}static get requires(){return[dt]}static get pluginName(){return"AccessibilityHelp"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",()=>{const n=this._createButton(P);return n.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),n}),e.ui.componentFactory.add("menuBar:accessibilityHelp",()=>{const n=this._createButton(Q);return n.label=t("Accessibility"),n}),e.keystrokes.set("Alt+0",(n,s)=>{this._showDialog(),s()}),this._setupRootLabels()}_createButton(e){const n=this.editor.locale,s=new e(n);return s.set({keystroke:"Alt+0",icon:mu}),s.on("execute",()=>this._showDialog()),s}_setupRootLabels(){const e=this.editor,t=e.editing.view,n=e.t;e.ui.on("ready",()=>{t.change(o=>{for(const r of t.document.roots)s(o,r)}),e.on("addRoot",(o,r)=>{const a=e.editing.view.document.getRoot(r.rootName);t.change(l=>s(l,a))},{priority:"low"})});function s(o,r){const l=`${r.getAttribute("aria-label")}. ${n("Press %0 for help.",[po("Alt+0")])}`;o.setAttribute("aria-label",l,r)}}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.locale.t;this.contentView||(this.contentView=new XA(e.locale,e.accessibility.keystrokeInfos)),t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:n("Accessibility help"),icon:mu,hasCloseButton:!0,content:this.contentView})}}/**
567 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
568 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
569 */class ix extends ve{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new xe({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=Ve(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&e.childElementCount==0&&e.remove()}}/**
570 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
571 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
572 */class lt extends C{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",e.if("isVisible","ck-hidden",t=>!t),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const t=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),n=t.getAttribute("viewBox");n&&(this.viewBox=n);for(const{name:s,value:o}of Array.from(t.attributes))lt.presentationalAttributeNames.includes(s)&&this.element.setAttribute(s,o);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e
572=>{e.style.fill=this.fillColor})}}lt.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];/**
573 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
574 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
575 */class sx extends C{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}}/**
576 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
577 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
578 */class P extends C{constructor(e,t=new sx){super(e),this._focusDelayed=null;const n=this.bindTemplate,s=$e();this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${s}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new lt,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const o={tag:"button",attributes:{class:["ck","ck-button",n.to("class"),n.if("isEnabled","ck-disabled",r=>!r),n.if("isVisible","ck-hidden",r=>!r),n.to("isOn",r=>r?"ck-on":"ck-off"),n.if("withText","ck-button_with-text"),n.if("withKeystroke","ck-button_with-keystroke")],role:n.to("role"),type:n.to("type",r=>r||"button"),tabindex:n.to("tabindex"),"aria-checked":n.to("ariaChecked"),"aria-label":n.to("ariaLabel"),"aria-labelledby":n.to("ariaLabelledBy"),"aria-disabled":n.if("isEnabled",!0,r=>!r),"aria-pressed":n.to("isOn",r=>this.isToggleable?String(!!r):!1),"data-cke-tooltip-text":n.to("_tooltipString"),"data-cke-tooltip-position":n.to("tooltipPosition")},children:this.children,on:{click:n.to(r=>{this.isEnabled?this.fire("execute"):r.preventDefault()})}};B.isSafari&&(this._focusDelayed||(this._focusDelayed=Ka(()=>this.focus(),0)),o.on.mousedown=n.to(()=>{this._focusDelayed()}),o.on.mouseup=n.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(o)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new C;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>po(t))}]}),e}_getTooltipString(e,t,n){return e?typeof e=="string"?e:(n&&(n=po(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}/**
579 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
580 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
581 */class Yn extends P{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new C;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}/**
582 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
583 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
584 */class Lm extends P{constructor(e){super(e),this.buttonView=this,this._fileInputView=new ox(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",()=>{this._fileInputView.open()}),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}class ox extends C{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 Qo='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';/**
585 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
586 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
587 */class Fm extends C{constructor(e,t){super(e);const n=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),t&&this.children.addMany(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",n.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:n.if("isCollapsed","hidden"),"aria-labelledby":n.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.i
587d}focus(){this.buttonView.focus()}_createButtonView(){const e=new P(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:Qo}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",n=>String(n))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",n=>!n),e.on("execute",()=>{this.isCollapsed=!this.isCollapsed}),e}}/**
588 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
589 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
590 */function Xi(i,e){const t=i.t,n={Black:t("Black"),"Dim grey":t("Dim grey"),Grey:t("Grey"),"Light grey":t("Light grey"),White:t("White"),Red:t("Red"),Orange:t("Orange"),Yellow:t("Yellow"),"Light green":t("Light green"),Green:t("Green"),Aquamarine:t("Aquamarine"),Turquoise:t("Turquoise"),"Light blue":t("Light blue"),Blue:t("Blue"),Purple:t("Purple")};return e.map(s=>{const o=n[s.label];return o&&o!=s.label&&(s.label=o),s})}function es(i){return i.map(rx).filter(e=>!!e)}function rx(i){return typeof i=="string"?{model:i,label:i,hasBorder:!1,view:{name:"span",styles:{color:i}}}:{model:i.color,label:i.label||i.color,hasBorder:i.hasBorder===void 0?!1:i.hasBorder,view:{name:"span",styles:{color:`${i.color}`}}}}const ax='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>';/**
591 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
592 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
593 */class Nm extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=ax,this.extendTemplate({attributes:{style:{backgroundColor:t.to("color",n=>B.isMediaForcedColors?null:n)},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}/**
594 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
595 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
596 */class gu extends C{constructor(e,t){super(e);const n=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const s={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new se,this.keystrokes=new de,this.items.on("add",(o,r)=>{r.isOn=r.color===this.selectedColor}
596),n.forEach(o=>{const r=new Nm;r.set({color:o.color,label:o.label,tooltip:!0,hasBorder:o.options.hasBorder}),r.on("execute",()=>{this.fire("execute",{value:o.color,hasBorder:o.options.hasBorder,label:o.label})}),this.items.add(r)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:s}}),this.on("change:selectedColor",(o,r,a)=>{for(const l of this.items)l.isOn=l.color===a})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),Nf({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var Dm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const pu=kh(Dm);var bu={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function wu(i){var e,t=[],n=1,s;if(typeof i=="string")if(pu[i])t=pu[i].slice(),s="rgb";else if(i==="transparent")n=0,s="rgb",t=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(i)){var o=i.slice(1),r=o.length,a=r<=4;n=1,a?(t=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],r===4&&(n=parseInt(o[3]+o[3],16)/255)):(t=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],r===8&&(n=parseInt(o[6]+o[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(i)){var l=e[1],c=l==="rgb",o=l.replace(/a$/,"");s=o;var r=o==="cmyk"?4:o==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(h,f){if(/%$/.test(h))return f===r?parseFloat(h)/100:o==="rgb"?parseFloat(h)*255/100:parseFloat(h);if(o[f]==="h"){if(/deg$/.test(h))return parseFloat(h);if(bu[h]!==void 0)return bu[h]}return parseFloat(h)}),l===o&&t.push(1),n=c||t[r]===void 0?1:t[r],t=t.slice(0,r)}else i.length>10&&/[0-9](?:\s|\/)/.test(i)&&(t=i.match(/([0-9]+)/g).map(function(u){return parseFloat(u)}),s=i.match(/([a-z])/ig).join("").toLowerCase());else isNaN(i)?Array.isArray(i)||i.length?(t=[i[0],i[1],i[2]],s="rgb",n=i.length===4?i[3]:1):i instanceof Object&&(i.r!=null||i.red!=null||i.R!=null?(s="rgb",t=[i.r||i.red||i.R||0,i.g||i.green||i.G||0,i.b||i.blue||i.B||0]):(s="hsl",t=[i.h||i.hue||i.H||0,i.s||i.saturation||i.S||0,i.l||i.lightness||i.L||i.b||i.brightness]),n=i.a||i.alpha||i.opacity||1,i.opacity!=null&&(n/=100)):(s="rgb",t=[i>>>16,(i&65280)>>>8,i&255]);
596return{space:s,values:t,alpha:n}}const ts=Dm,$m={};for(const i of Object.keys(ts))$m[ts[i]]=i;const S={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Um=S;for(const i of Object.keys(S)){if(!("channels"in S[i]))throw new Error("missing channels property: "+i);if(!("labels"in S[i]))throw new Error("missing channel labels property: "+i);if(S[i].labels.length!==S[i].channels)throw new Error("channel and label counts mismatch: "+i);const{channels:e,labels:t}=S[i];delete S[i].channels,delete S[i].labels,Object.defineProperty(S[i],"channels",{value:e}),Object.defineProperty(S[i],"labels",{value:t})}S.rgb.hsl=function(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,s=Math.min(e,t,n),o=Math.max(e,t,n),r=o-s;let a,l;o===s?a=0:e===o?a=(t-n)/r:t===o?a=2+(n-e)/r:n===o&&(a=4+(e-t)/r),a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+o)/2;return o===s?l=0:c<=.5?l=r/(o+s):l=r/(2-o-s),[a,l*100,c*100]};S.rgb.hsv=function(i){let e,t,n,s,o;const r=i[0]/255,a=i[1]/255,l=i[2]/255,c=Math.max(r,a,l),u=c-Math.min(r,a,l),d=function(h){return(c-h)/6/u+1/2};return u===0?(s=0,o=0):(o=u/c,e=d(r),t=d(a),n=d(l),r===c?s=n-t:a===c?s=1/3+e-n:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,o*100,c*100]};S.rgb.hwb=function(i){const e=i[0],t=i[1];let n=i[2];const s=S.rgb.hsl(i)[0],o=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[s,o*100,n*100]};S.rgb.cmyk=function(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,s=Math.min(1-e,1-t,1-n),o=(1-e-s)/(1-s)||0,r=(1-t-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[o*100,r*100,a*100,s*100]};function lx(i,e){return(i[0]-e[0])**2+(i[1]-e[1])**2+(i[2]-e[2])**2}S.rgb.keyword=function(i){const e=$m[i];if(e)return e;let t=1/0,n;for(const s of Object.keys(ts)){const o=ts[s],r=lx(i,o);r<t&&(t=r,n=s)}return n};S.keyword.rgb=function(i){return ts[i]};S.rgb.xyz=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;const s=e*.4124+t*.3576+n*.1805,o=e*.2126+t*.7152+n*.0722,r=e*.0193+t*.1192+n*.9505;return[s*100,o*100,r*100]};S.rgb.lab=function(i){const e=S.rgb.xyz(i);let t=e[0],n=e[1],s=e[2];t/=95.047,n/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const o=116*n-16,r=500*(t-n),a=200*(n-s);return[o,r,a]};S.hsl.rgb=function(i){const e=i[0]/360,t=i[1]/100,n=i[2]/100;let s,o,r;if(t===0)return r=n*255,[r,r,r];n<.5?s=n*(1+t):s=n+t-n*t;const a=2*n-s,l=[0,0,0];for(let c=0;c<3;c++)o=e+1/3*-(c-1),o<0&&o++,o>1&&o--,6*o<1?r=a+(s-a)*6*o:2*o<1?r=s:3*o<2?r=a+(s-a)*(2/3-o)*6:r=a,l[c]=r*255;return l};S.hsl.hsv=function(i){const e=i[0];let t=i[1]/100,n=i[2]/100,s=t;const o=Math.max(n,.01);n*=2,t*=n<=1?n:2-n,s*=o<=1?o:2-o;const r=(n+t)/2,a=n===0?2*s/(o+s):2*t/(n+t);return[e,a*100,r*100]};S.hsv.rgb=function(i){const e=i[0]/60,t=i[1]/100;let n=i[2]/100;const s=Math.floor(e)%6,o=e-Math.floor(e),r=255*n*(1-t),a=255*n*(1-t*o),l=255*n*(1-t*(1-o));switch(n*=255,s){case 0:return[n,l,r];case 1:return[a,n,r];case 2:return[r,n,l];case 3:return[r,a,n];case 4:return[l,r,n];case 5:return[n,r,a]}};S.hsv.hsl=function(i){const e=i[0],t=i[1]/100,n=i[2]/100,s=Math.max(n,.01);let o,r;r=(2-t)*n;const a=(2-t)*s;return o=t*s,o/=a<=1?a:2-a,o=o||0,r/=2,[e,o*100,r*100]};S.hwb.rgb=function(i){const e=i[0]/360;let t=i[1]/100,n=i[2]/100;const s=t+n;let o;s>1&&(t/=s,n/=s);const r=Math.floor(6*e),a=1-n;o=6*e-r,r&1&&(o=1-o);const l=t+o*(a-t);let c,u,d;switch(r){default:case 6:case 0:c=a,u=l,d=t;break;case 1:c=l,u=a,d=t;break;case 2:c=t,u=a,d=l;break;case 3:c=t,u=l,d=a;break;case 4:c=l,u=t,d=a;break;case 5:c=a,u=t,d=l;break}return[c*255,u*255,d*255]};S.cmyk.rgb=function(i){const e=i[0]/100,t=i[1]/100,n=i[2]/100,s=i[3]/100,o=1-Math.min(1,e*(1-s)+s),r=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[o*255,r*255,a*255]};S.xyz.rgb=function(i){const e=i[0]/100,t=i[1]/100,n=i[2]/100;let s,o,r;return s=e*3.2406+t*-1.5372+n*-.4986,o=e*-.9689+t*1.8758+n*.0415,r=e*.0557+t*-.204+n*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),[s*255,o*255,r*255]};S.xyz.lab=function(i){let e=i[0],t=i[1],n=i[2];e/=95.047,t/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;const s=116*t-16,o=500*(e-t),r=200*(t-n);return[s,o,r]};S.lab.xyz=function(i){const e=i[0],t=i[1],n=i[2];let s,o,r;o=(e+16)/116,s=t/500+o,r=o-n/200;const a=o**3,l=s**3,c=r**3;return o=a>.008856?a:(o-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,s*=95.047,o*=100,r*=108.883,[s,o,r]};S.lab.lch=function(i){const e=i[0],t=i[1],n=i[2];let s;s=Math.atan2(n,t)*360/2/Math.PI,s<0&&(s+=360);const r=Math.sqrt(t*t+n*n);return[e,r,s]};S.lch.lab=function(i){const e=i[0],t=i[1],s=i[2]/360*2*Math.PI,o=t*Math.cos(s),r=t*Math.sin(s);return[e,o,r]};S.rgb.ansi16=function(i,e=null){const[t,n,s]=i;let o=e===null?S.rgb.hsv(i)[2]:e;if(o=Math.round(o/50),o===0)return 30;let r=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return o===2&&(r+=60),r};S.hsv.ansi16=function(i){return S.rgb.ansi16(S.hsv.rgb(i),i[2])};S.rgb.ansi256=function(i){const e=i[0],t=i[1],n=i[2];return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)};S.ansi16.rgb=function(i){let e=i%10;if(e===0||e===7)return i>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(~~(i>50)+1)*.5,n=(e&1)*t*255,s=(e>>1&1)*t*255,o=(e>>
5962&1)*t*255;return[n,s,o]};S.ansi256.rgb=function(i){if(i>=232){const o=(i-232)*10+8;return[o,o,o]}i-=16;let e;const t=Math.floor(i/36)/5*255,n=Math.floor((e=i%36)/6)/5*255,s=e%6/5*255;return[t,n,s]};S.rgb.hex=function(i){const t=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};S.hex.rgb=function(i){const e=i.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));const n=parseInt(t,16),s=n>>16&255,o=n>>8&255,r=n&255;return[s,o,r]};S.rgb.hcg=function(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,s=Math.max(Math.max(e,t),n),o=Math.min(Math.min(e,t),n),r=s-o;let a,l;return r<1?a=o/(1-r):a=0,r<=0?l=0:s===e?l=(t-n)/r%6:s===t?l=2+(n-e)/r:l=4+(e-t)/r,l/=6,l%=1,[l*360,r*100,a*100]};S.hsl.hcg=function(i){const e=i[1]/100,t=i[2]/100,n=t<.5?2*e*t:2*e*(1-t);let s=0;return n<1&&(s=(t-.5*n)/(1-n)),[i[0],n*100,s*100]};S.hsv.hcg=function(i){const e=i[1]/100,t=i[2]/100,n=e*t;let s=0;return n<1&&(s=(t-n)/(1-n)),[i[0],n*100,s*100]};S.hcg.rgb=function(i){const e=i[0]/360,t=i[1]/100,n=i[2]/100;if(t===0)return[n*255,n*255,n*255];const s=[0,0,0],o=e%1*6,r=o%1,a=1-r;let l=0;switch(Math.floor(o)){case 0:s[0]=1,s[1]=r,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=r;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=r,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*n,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]};S.hcg.hsv=function(i){const e=i[1]/100,t=i[2]/100,n=e+t*(1-e);let s=0;return n>0&&(s=e/n),[i[0],s*100,n*100]};S.hcg.hsl=function(i){const e=i[1]/100,n=i[2]/100*(1-e)+.5*e;let s=0;return n>0&&n<.5?s=e/(2*n):n>=.5&&n<1&&(s=e/(2*(1-n))),[i[0],s*100,n*100]};S.hcg.hwb=function(i){const e=i[1]/100,t=i[2]/100,n=e+t*(1-e);return[i[0],(n-e)*100,(1-n)*100]};S.hwb.hcg=function(i){const e=i[1]/100,n=1-i[2]/100,s=n-e;let o=0;return s<1&&(o=(n-s)/(1-s)),[i[0],s*100,o*100]};S.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]};S.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]};S.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]};S.gray.hsl=function(i){return[0,0,i[0]]};S.gray.hsv=S.gray.hsl;S.gray.hwb=function(i){return[0,100,i[0]]};S.gray.cmyk=function(i){return[0,0,0,i[0]]};S.gray.lab=function(i){return[i[0],0,0]};S.gray.hex=function(i){const e=Math.round(i[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};S.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]};const vo=Um;function cx(){const i={},e=Object.keys(vo);for(let t=e.length,n=0;n<t;n++)i[e[n]]={distance:-1,parent:null};return i}function ux(i){const e=cx(),t=[i];for(e[i].distance=0;t.length;){const n=t.pop(),s=Object.keys(vo[n]);for(let o=s.length,r=0;r<o;r++){const a=s[r],l=e[a];l.distance===-1&&(l.distance=e[n].distance+1,l.parent=n,t.unshift(a))}}return e}function dx(i,e){return function(t){return e(i(t))}}function hx(i,e){const t=[e[i].parent,i];let n=vo[e[i].parent][i],s=e[i].parent;for(;e[s].parent;)t.unshift(e[s].parent),n=dx(vo[e[s].parent][s],n),s=e[s].parent;return n.conversion=t,n}var fx=function(i){const e=ux(i),t={},n=Object.keys(e);for(let s=n.length,o=0;o<s;o++){const r=n[o];e[r].parent!==null&&(t[r]=hx(r,e))}return t};const la=Um,mx=fx,Hn={},gx=Object.keys(la);function px(i){const e=function(...t){const n=t[0];return n==null?n:(n.length>1&&(t=n),i(t))};return"conversion"in i&&(e.conversion=i.conversion),e}function bx(i){const e=function(...t){const n=t[0];if(n==null)return n;n.length>1&&(t=n);const s=i(t);if(typeof s=="object")for(let o=s.length,r=0;r<o;r++)s[r]=Math.round(s[r]);return s};return"conversion"in i&&(e.conversion=i.conversion),e}gx.forEach(i=>{Hn[i]={},Object.defineProperty(Hn[i],"channels",{value:la[i].channels}),Object.defineProperty(Hn[i],"labels",{value:la[i].labels});const e=mx(i);Object.keys(e).forEach(n=>{const s=e[n];Hn[i][n]=bx(s),Hn[i][n].raw=px(s)})});var Hm=Hn;const wx=kh(Hm),zm=jp({__proto__:null,default:wx},[Hm]);/**
597 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
598 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
599 */function Wm(i,e){if(!i)return"";const t=qm(i);if(!t)return"";if(t.space===e)return i;if(!kx(t))return"";const s=zm[t.space][e];if(!s)return"";const o=s(t.space==="hex"?t.hexValue:t.values);return vx(o,e)}function _x(i){if(!i)return"";const e=qm(i);return e?e.space==="hex"?e.hexValue:Wm(i,"hex"):"#000"}function yx(i,e){customElements.get(i)===void 0&&customElements.define(i,e)}function vx(i,e){switch(e){case"hex":return`#${i}`;case"rgb":return`rgb( ${i[0]}, ${i[1]}, ${i[2]} )`;case"hsl":return`hsl( ${i[0]}, ${i[1]}%, ${i[2]}% )`;case"hwb":return`hwb( ${i[0]}, ${i[1]}, ${i[2]} )`;case"lab":return`lab( ${i[0]}% ${i[1]} ${i[2]} )`;case"lch":return`lch( ${i[0]}% ${i[1]} ${i[2]} )`;default:return""}}function qm(i){if(i.startsWith("#")){const t=wu(i);
599return{space:"hex",values:t.values,hexValue:i,alpha:t.alpha}}const e=wu(i);return e.space?e:null}function kx(i){return Object.keys(zm).includes(i.space)}/**
600 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
601 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
602 */class he extends C{constructor(e,t){super(e);const n=`ck-labeled-field-view-${$e()}`,s=`ck-labeled-field-view-status-${$e()}`;this.fieldView=t(this,n,s),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(s),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(r,a)=>r||a);const o=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",o.to("class"),o.if("isEnabled","ck-disabled",r=>!r),o.if("isEmpty","ck-labeled-field-view_empty"),o.if("isFocused","ck-labeled-field-view_focused"),o.if("placeholder","ck-labeled-field-view_placeholder"),o.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new Ne(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new C(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",s=>!s)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}/**
603 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
604 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
605 */class Cx extends C{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new se,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),tabindex:t.to("tabIndex"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById"),"aria-label":t.to("ariaLabel")},on:{input:t.to((...n)=>{this.fire("input",...n),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,n)=>{this._setDomElementValue(n),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=Tx(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?"":e}}function Tx(i){return!i.value}/**
606 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
607 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
608 */class Ex extends Cx{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}/**
609 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
610 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
611 */class jm extends Ex{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}/**
612 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
613 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
614 */class Ax extends C{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",n=>`ck-dropdown__panel_${n}`),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to(n=>{n.target.tagName.toLocaleLowerCase()!=="input"&&n.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():N("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}/**
615 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
616 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
617 */class gn extends C{constructor(e,t,n){super(e);const s=this.bindTemplate;this.buttonView=t,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new de,this.focusTracker=new se,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",s.to("class"),s.if("isEnabled","ck-disabled",o=>!o)],id:s.to("id"),"aria-describedby":s.to("ariaDescribedById")},children:[t,n]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":s.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.on("change:isOpen",(t,n,s)=>{if(s)if(this.panelPosition==="auto"){const o=gn._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=o?o.name:this._panelPositions[0].name}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);const e=(t,n)=>{this.isOpen&&(this.isOpen=!1,n())};this.keystrokes.set("arrowdown",(t,n)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,n())}),this.keystrokes.set("arrowright",(t,n)=>{this.isOpen&&n()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:n,southWest:s,northEast:o,northWest:r,southMiddleEast:a,southMiddleWest:l,northMiddleEast:c,northMiddleWest:u}=gn.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[n,s,a,l,e,o,r,c,u,t]:[s,n,l,a,e,r,o,u,c,t]}}gn.defaultPanelPositions={south:(i,e)=>({top:i.bottom,left:i.left-(e.width-i.width)/2,name:"s"}),southEast:i=>({top:i.bottom,left:i.left,name:"se"}),southWest:(i,e)=>({top:i.bottom,left:i.left-e.width+i.width,name:"sw"}),southMiddleEast:(i,e)=>({top:i.bottom,left:i.left-(e.width-i.width)/4,name:"sme"}),southMiddleWest:(i,e)=>({top:i.bottom,left:i.left-(e.width-i.width)*3/4,name:"smw"}),north:(i,e)=>({top:i.top-e.height,left:i.left-(e.width-i.width)/2,name:"n"}),northEast:(i,e)=>({top:i.top-e.height,left:i.left,name:"ne"}),northWest:(i,e)=>({top:i.top-e.height,left:i.left-e.width+i.width,name:"nw"}),northMiddleEast:(i,e)=>({top:i.top-e.height,left:i.left-(e.width-i.width)/4,name:"nme"}),northMiddleWest:(i,e)=>({top:i.top-e.height,left:i.left-(e.width-i.width)*3/4,name:"nmw"})};gn._getOptimalPosition=zo;/**
618 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
619 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
620 */class xx extends P{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",t=>String(t))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new lt;return e.content=Qo,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}/**
621 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
622 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
623 */class ke extends G(){constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];typeof n=="string"&&(n=[n]);for(const s of n)e.keystrokeHandler.set(s,(o,r)=>{this[t](),r()})}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"})}get first(){return this.focusables.find(Er)||null}get last(){return this.focusables.filter(Er).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return this.focusTracker.focusedElement===null?null:(this.focusables.find((t,n)=>{const s=t.element===this.focusTracker.focusedElement;return s&&(e=n),s}),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const e=this.next;if(e&&this.focusables.getIndex(e)===this.current){this.fire("forwardCycle");return}e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){const e=this.previous;if(e&&this.focusables.getIndex(e)===this.current){this.fire("backwardCycle");return}e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const n=this.current;if(n===null)return this[e===1?"first":"last"];let s=this.focusables.get(n),o=(n+t+e)%t;do{const r=this.focusables.get(o);if(Er(r)){s=r;break}o=(o+t+e)%t}while(o!==n);return s}}function Er(i){return hs(i)&&Wt(i.element)}function hs(i){return"focus"in i&&typeof i.focus=="function"}function Sx(i){return hs(i)&&"focusCycler"in i&&i.focusCycler instanceof ke}/**
624 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
625 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
626 */class dl extends C{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}/**
627 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
628 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
629 */class Ix extends C{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}/**
630 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
631 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
632 */function Px(i){return i.bindTemplate.to(e=>{e.target===i.element&&e.preventDefault()})}/**
633 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
634 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
635 */function Gm(i){if(Array.isArray(i))return{items:i,removeItems:[]};const e={items:[],removeItems:[]};return i?{...e,...i}:e}/**
636 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
637 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
638 */const Rx={alignLeft:E.alignLeft,bold:E.bold,importExport:E.importExport,paragraph:E.paragraph,plus:E.plus,text:E.text,threeVerticalDots:E.threeVerticalDots,pilcrow:E.pilcrow,dragIndicator:E.dragIndicator};class Xn extends C{constructor(e,t){super(e);const n=this.bindTemplate,s=this.t;this.options=t||{},this.set("ariaLabel",s("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new se,this.keystrokes=new de,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new Vx(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const o=e.uiLanguageDirection==="rtl";this._focusCycler=new ke({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[o?"arrowright":"arrowleft","arrowup"],focusNext:[o?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:Px(this)}}),this._behavior=this.options.shouldGroupWhenFull?new Mx(this):new Bx(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,n){this.items.addMany(this._buildItemsFromConfig(e,t,n))}_buildItemsFromConfig(e,t,n){const s=Gm(e),o=n||s.removeItems;return this._cleanItemsConfiguration(s.items,t,o).map(a=>Z(a)?this._createNestedToolbarDropdown(a,t,o):a==="|"?new dl:a==="-"?new Ix:t.create(a)).filter(a=>!!a)}_cleanItemsConfiguration(e,t,n){const s=e.filter((o,r,a)=>
638o==="|"?!0:n.indexOf(o)!==-1?!1:o==="-"?this.options.shouldGroupWhenFull?(N("toolbarview-line-break-ignored-when-grouping-items",a),!1):!0:!Z(o)&&!t.has(o)?(N("toolbarview-item-unavailable",{item:o}),!1):!0);return this._cleanSeparatorsAndLineBreaks(s)}_cleanSeparatorsAndLineBreaks(e){const t=r=>r!=="-"&&r!=="|",n=e.length,s=e.findIndex(t);if(s===-1)return[];const o=n-e.slice().reverse().findIndex(t);return e.slice(s,o).filter((r,a,l)=>t(r)?!0:!(a>0&&l[a-1]===r))}_createNestedToolbarDropdown(e,t,n){let{label:s,icon:o,items:r,tooltip:a=!0,withText:l=!1}=e;if(r=this._cleanItemsConfiguration(r,t,n),!r.length)return null;const c=this.locale,u=pe(c);return s||N("toolbarview-nested-toolbar-dropdown-missing-label",e),u.class="ck-toolbar__nested-toolbar-dropdown",u.buttonView.set({label:s,tooltip:a,withText:!!l}),o!==!1?u.buttonView.icon=Rx[o]||o||E.threeVerticalDots:u.buttonView.withText=!0,fs(u,()=>u.toolbarView._buildItemsFromConfig(r,t,n)),u}}class Vx extends C{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Bx{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(n=>n),e.focusables.bindTo(e.items).using(n=>hs(n)?n:null),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Mx{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using(t=>t),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",(t,n)=>{const s=n.index,o=Array.from(n.added);for(const r of n.removed)s>=this.ungroupedItems.length?this.groupedItems.remove(r):this.ungroupedItems.remove(r);for(let r=s;r<s+o.length;r++){const a=o[r-s];r>this.ungroupedItems.length?this.groupedItems.add(a,r-this.ungroupedItems.length):this.ungroupedItems.add(a,r)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Wt(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,n=new O(e.lastChild),s=new O(e);if(!this.cachedPadding){const o=A.window.getComputedStyle(e),r=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[r])}return t==="ltr"?n.right>s.right-this.cachedPadding:n.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new X(this.viewElement,t=>{(!e||e!==t.contentRect.width||this.shouldUpdateGroupingOnNextResize)&&(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new dl),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,n=pe(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",fs(n,this.groupedItems),n.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:E.threeVerticalDots}),n}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{hs(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}/**
639 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
640 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
641 */class ei extends C{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",n=>!n)],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}/**
642 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
643 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
644 */class Yo extends C{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}/**
645 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
646 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
647 */class to extends C{constructor(e,t=new Ne){super(e);const n=this.bindTemplate,s=new hl(e);this.set({label:"",isVisible:!0}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,s]),s.set({role:"group",ariaLabelledBy:t.id}),s.focusTracker.destroy(),s.keystrokes.destroy(),this.items=s.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",n.if("isVisible","ck-hidden",o=>!o)]},children:this.children})}focus(){if(this.items){const e=this.items.find(t=>!(t instanceof Yo));e&&e.focus()}}}/**
648 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
649 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
650 */class hl extends C{constructor(e){super(e),this._listItemGroupToChangeListeners=new WeakMap;const t=this.bindTemplate;this.focusables=new ve,this.items=this.createCollection(),this.focusTracker=new se,this.keystrokes=new de,this._focusCycler=new ke({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(const e of this.items)e instanceof to?this._registerFocusableItemsGroup(e):e instanceof ei&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(const n of t.removed)n instanceof to?this._deregisterFocusableItemsGroup(n):n instanceof ei&&this._deregisterFocusableListItem(n);for(const n of Array.from(t.added).reverse())n instanceof to?this._registerFocusableItemsGroup(n,t.index):this._registerFocusableListItem(n,t.index)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,n)=>{for(const s of n.removed)this._deregisterFocusableListItem(s);for(const s of Array.from(n.added).reverse())this._registerFocusableListItem(s,this.items.getIndex(e)+n.index)}}
650_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((s,o)=>{const r=typeof t<"u"?t+o:void 0;this._registerFocusableListItem(s,r)});const n=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,n),e.items.on("change",n)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}/**
651 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
652 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
653 */class ci extends C{constructor(e,t){super(e);const n=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new de,this.focusTracker=new se,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",n.to("class"),n.if("isVisible","ck-hidden",s=>!s),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(e){const t=e||new P;return e||t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){const e=new P,t=e.bindTemplate;return e.icon=Qo,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",n=>String(n))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}/**
654 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
655 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
656 */function pe(i,e=xx){const t=typeof e=="function"?new e(i):e,n=new Ax(i),s=new gn(i,t,n);return t.bind("isEnabled").to(s),t instanceof ci?t.arrowView.bind("isOn").to(s,"isOpen"):t.bind("isOn").to(s,"isOpen"),Ox(s),s}function fs(i,e,t={}){i.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),i.isOpen?_u(i,e,t):i.once("change:isOpen",()=>_u(i,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&fl(i,()=>i.toolbarView.items.find(n=>n.isOn))}function _u(i,e,t){const n=i.locale,s=n.t,o=i.toolbarView=new Xn(n),r=typeof e=="function"?e():e;o.ariaLabel=t.ariaLabel||s("Dropdown toolbar"),t.maxWidth&&(o.maxWidth=t.maxWidth),t.class&&(o.class=t.class),t.isCompact&&(o.isCompact=t.isCompact),t.isVertical&&(o.isVertical=!0),r instanceof ve?o.items.bindTo(r).using(a=>a):o.items.addMany(r),i.panelView.children.add(o),o.items.delegate("execute").to(i)}function kn(i,e,t={}){i.isOpen?yu(i,e,t):i.once("change:isOpen",()=>yu(i,e,t),{priority:"highest"}),fl(i,()=>i.listView.items.find(n=>n instanceof ei?n.children.first.isOn:!1))}function yu(i,e,t){const n=i.locale,s=i.listView=new hl(n),o=typeof e=="function"?e():e;s.ariaLabel=t.ariaLabel,s.role=t.role,Km(i,s.items,o,n),i.panelView.children.add(s),s.items.delegate("execute").to(i)}function fl(i,e){i.on("change:isOpen",()=>{if(!i.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():N("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:Ut.low-10})}function Ox(i){Lx(i),Fx(i),Nx(i),Dx(i),$x(i),Ux(i)}function Lx(i){i.on("render",()=>{ai({emitter:i,activator:()=>i.isOpen,callback:()=>{i.isOpen=!1},contextElements:()=>[i.element,...i.focusTracker._elements]})})}
656function Fx(i){i.on("execute",e=>{e.source instanceof Yn||(i.isOpen=!1)})}function Nx(i){i.focusTracker.on("change:isFocused",(e,t,n)=>{i.isOpen&&!n&&(i.isOpen=!1)})}function Dx(i){i.keystrokes.set("arrowdown",(e,t)=>{i.isOpen&&(i.panelView.focus(),t())}),i.keystrokes.set("arrowup",(e,t)=>{i.isOpen&&(i.panelView.focusLast(),t())})}function $x(i){i.on("change:isOpen",(e,t,n)=>{if(n)return;const s=i.panelView.element;s&&s.contains(A.document.activeElement)&&i.buttonView.focus()})}function Ux(i){i.on("change:isOpen",(e,t,n)=>{n&&i.panelView.focus()},{priority:"low"})}function Km(i,e,t,n){e.bindTo(t).using(s=>{if(s.type==="separator")return new Yo(n);if(s.type==="group"){const o=new to(n);return o.set({label:s.label}),Km(i,o.items,s.items,n),o.items.delegate("execute").to(i),o}else if(s.type==="button"||s.type==="switchbutton"){const o=new ei(n);let r;return s.type==="button"?(r=new P(n),r.bind("ariaChecked").to(r,"isOn")):r=new Yn(n),r.bind(...Object.keys(s.model)).to(s.model),r.delegate("execute").to(o),o.children.add(r),o}return null})}/**
657 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
658 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
659 */const De=(i,e,t)=>{const n=new jm(i.locale);return n.set({id:e,ariaDescribedById:t}),n.bind("isReadOnly").to(i,"isEnabled",s=>!s),n.bind("hasError").to(i,"errorText",s=>!!s),n.on("input",()=>{i.errorText=null}),i.bind("isEmpty","isFocused","placeholder").to(n),n},Jm=(i,e,t)=>{const n=pe(i.locale);return n.set({id:e,ariaDescribedById:t}),n.bind("isEnabled").to(i),n};/**
660 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
661 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
662 */const Hx=150;class zx extends C{constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const n=this.createCollection();t.hideInput||n.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:n}),this._config=t,this._debounceColorPickerEvent=gt(s=>{this.set("color",s),this.fire("colorSelected",{color:this.color})},Hx,{leading:!0}),this.on("set:color",(s,o,r)=>{s.return=Wm(r,this._config.format||"hsl")}),this.on("change:color",()=>{this._hexColor=Ar(this.color)}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Ar(this.color)!=Ar(this._hexColor)&&(this.color=this._hexColor)})}render(){if(super.render(),yx("hex-color-picker",qp),this.picker=A.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",e=>{const t=e.detail.value;this._debounceColorPickerEvent(t)})}focus(){/* istanbul ignore next -- @preserve */!this._config.hideInput&&(B.isGecko||B.isiOS||B.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const n=[...this.picker.shadowRoot.children].filter(s=>s.getAttribute("role")==="slider").map(s=>new Wx(s));this.slidersView=this.createCollection(),n.forEach(s=>{this.slidersView.add(s)})}_createInputRow(){const e=this._createColorInput();return new jx(this.locale,e)}_createColorInput(){const e=new he(this.locale,De),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",n=>e.isFocused?e.fieldView.value:n.startsWith("#")?n.substring(1):n),e.fieldView.on("input",()=>{const n=e.fieldView.element.value;if(n){const s=Zm(n);s&&this._debounceColorPickerEvent(s)}}),e}isValid(){const{t:e}=this.locale;return this.resetValidationStatus(),this.hexInputRow.getParsedColor()?!0:(this.hexInputRow.inputVie
662w.errorText=e('Please enter a valid color (e.g. "ff0000").'),!1)}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function Ar(i){let e=_x(i);return e||(e="#000"),e.length===4&&(e="#"+[e[1],e[1],e[2],e[2],e[3],e[3]].join("")),e.toLowerCase()}class Wx extends C{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class qx extends C{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class jx extends C{constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new qx,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return Zm(this.inputView.fieldView.element.value)}}function Zm(i){if(!i)return null;const e=i.trim().replace(/^#/,"");return![3,4,6,8].includes(e.length)||!/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(e)?null:`#${e}`}/**
663 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
664 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
665 */class Gx extends W(me){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",this.length===0)})}add(e,t){return this.find(n=>n.color===e.color)?this:super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}/**
666 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
667 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
668 */const{eraser:Kx,colorPalette:Jx}=E;class Zx extends C{constructor(e,{colors:t,columns:n,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:l,focusables:c}){super(e);const u=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=l,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=n,this.documentColors=new Gx,this.documentColorsCount=r,this._focusables=c,this._removeButtonLabel=s,this._colorPickerLabel=a,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",u.if("isVisible","ck-hidden",d=>!d)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const n=e.document,s=this.documentColorsCount;this.documentColors.clear();for(const o of n.getRoots()){const r=e.createRangeIn(o);for(const a of r.getItems())if(a.is("$textProxy")&&a.hasAttribute(t)&&(this._addColorToDocumentColors(a.getAttribute(t)),this.documentColors.length>=s))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,n=this.selectedColor;t.selectedColor=n,e&&(e.selectedColor=n)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=xe.bind(this.documentColors,this.documentColors),t=new Ne(this.locale);t.text=this._documentColorsLabel,t.extendTemplate({attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]}}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new P,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:Jx,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show")})}_createRemoveColorButton(){const e=new P;return e.set({withText:!0,icon:Kx,label:this._removeButtonLabel}),e.class="ck-color-selector__remove-color",e.on("execute",()=>{this.fire("execute",{value:null,source:"removeColorButton"})}),e.render(),e}_createStaticColorsGrid(){const e=new gu(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",(t,n)=>{this.fire("execute",{value:n.value,source:"staticColorsGrid"})}),e}_createDocumentColorsGrid(){const e=xe.bind(this.documentColors,this.documentColors),t=new gu(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(n=>{const s=new Nm;return s.set({color:n.color,hasBorder:n.options&&n.options.hasBorder}),n.label&&s.set({label:n.label,tooltip:!0}),s.on("execute",()=>{this.fire("execute",{value:n.color,source:"documentColorsGrid"})}),s}),this.documentColors.on("change:isEmpty",(n,s,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(n=>n.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}/**
669 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
670 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
671 */class Qx extends C{constructor(e,{focusTracker:t,focusables:n,keystrokes:s,colorPickerViewConfig:o}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=s,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=n,this._colorPickerViewConfig=o;const r=this.bindTemplate,{saveButtonView:a,cancelButtonView:l}=this._createActionButtons();this.saveButtonView=a,this.cancelButtonView=l,this.actionBarView=this._createActionBarView({saveButtonView:a,cancelButtonView:l}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",r.if("isVisible","ck-hidden",c=>!c)]},children:this.items})}render(){super.render();const e=new zx(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,n,s)=>{e.color=s}),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set("enter",e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&this.colorPickerView.isValid()&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())})}_stopPropagationOnArrowsKeys(){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)}_addColorPickersElementsToFocusTracker(){for(const t of this.colorPickerView.slidersView)this.focusTracker.add(t.element),this._focusables.add(t);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const n=new C,s=this.createCollection();return s.add(e),s.add(t),n.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:s}),n}_createActionButtons(){const e=this.locale,t=e.t,n=new P(e),s=new P(e);return n.set({icon:E.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),s.set({icon:E.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),n.on("execute",()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})}),s.on("execute",()=>{this.fire("colorPicker:cancel")}),{saveButtonView:n,cancelButtonView:s}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",(e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)})}}/**
672 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
673 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
674 */class ml extends C{constructor(e,{colors:t,columns:n,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,c
674olorPickerViewConfig:l}){super(e),this.items=this.createCollection(),this.focusTracker=new se,this.keystrokes=new de,this._focusables=new ve,this._colorPickerViewConfig=l,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new Zx(e,{colors:t,columns:n,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new Qx(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:l}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",(c,u,d)=>{this.colorGridsFragmentView.set("selectedColor",d),this.colorPickerFragmentView.set("selectedColor",d)}),this.colorGridsFragmentView.on("change:selectedColor",(c,u,d)=>{this.set("selectedColor",d)}),this.colorPickerFragmentView.on("change:selectedColor",(c,u,d)=>{this.set("selectedColor",d)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){!this.colorPickerFragmentView.colorPickerView||this._isColorPickerFragmentVisible||(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsFragmentView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate("execute").to(this),this.colorGridsFragmentView.delegate("colorPicker:show").to(this))}_appendColorPickerFragment(){this.items.length!==2&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{this.showColorPickerFragment()}),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}/**
675 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
676 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
677 */class Yx{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(xr(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new g("componentfactory-item-missing",this,{name:e});return this._components.get(xr(e)).callback(this.editor.locale)}has(e){return this._components.has(xr(e))}}function xr(i){return String(i).toLowerCase()}/**
678 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
679 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
680 */class Xo extends C{constructor(e,t={}){super(e);const n=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",n.to("class")]},children:this.children}),t.icon&&(this.iconView=new lt,this.iconView.content=t.icon,this.children.add(this.iconView));const s=new C(e);s.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:n.to("label")}]}),this.children.add(s)}}/**
681 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
682 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
683 */function Xx(i){class e extends i{constructor(...n){super(...n),this._onDragBound=this._onDrag.bind(this),this._onDragEndBound=this._onDragEnd.bind(this),this._lastDraggingCoordinates={x:0,y:0},this.on("render",()=>{this._attachListeners()}),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(A.document,"mouseup",this._onDragEndBound),this.listenTo(A.document,"touchend",this._onDragEndBound),this.listenTo(A.document,"mousemove",this._onDragBound),this.listenTo(A.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(A.document,"mouseup",this._onDragEndBound),this.stopListening(A.document,"touchend",this._onDragEndBound),this.stopListening(A.document,"mousemove",this._onDragBound),this.stopListening(A.document,"touchmove",this._onDragBound)}
683_onDragStart(n,s){if(!this._isHandleElementPressed(s))return;this._attachDragListeners();let o=0,r=0;s instanceof MouseEvent?(o=s.clientX,r=s.clientY):(o=s.touches[0].clientX,r=s.touches[0].clientY),this._lastDraggingCoordinates={x:o,y:r},this.isDragging=!0}_onDrag(n,s){if(!this.isDragging){this._detachDragListeners();return}let o=0,r=0;s instanceof MouseEvent?(o=s.clientX,r=s.clientY):(o=s.touches[0].clientX,r=s.touches[0].clientY),s.preventDefault(),this.fire("drag",{deltaX:Math.round(o-this._lastDraggingCoordinates.x),deltaY:Math.round(r-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:o,y:r}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(n){return this.dragHandleElement?this.dragHandleElement===n.target||n.target instanceof HTMLElement&&this.dragHandleElement.contains(n.target):!1}}return e}/**
684 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
685 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
686 */class e2 extends C{constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new de,this._focusTracker=new se,this._focusables=new ve,this.focusCycler=new ke({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(e){for(const t of e){const n=new P(this.locale);let s;n.on("execute",()=>t.onExecute()),t.onCreate&&t.onCreate(n);for(s in t)s!="onExecute"&&s!="onCreate"&&n.set(s,t[s]);this.children.add(n)}this._updateFocusCyclableItems()}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}_updateFocusCyclableItems(){Array.from(this.children).forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}}/**
687 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
688 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
689 */class t2 extends C{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}}/**
690 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
691 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
692 */const je={SCREEN_CENTER:"screen-center",EDITOR_CENTER:"editor-center",EDITOR_TOP_SIDE:"editor-top-side",EDITOR_TOP_CENTER:"editor-top-center",EDITOR_BOTTOM_CENTER:"editor-bottom-center",EDITOR_ABOVE_CENTER:"editor-above-center",EDITOR_BELOW_CENTER:"editor-below-center"},vu=ri("px");class ti extends Xx(C){constructor(e,{getCurrentDomRoot:t,getViewportOffset:n}){super(e),this.wasMoved=!1;const s=this.bindTemplate,o=e.t;this.set("className",""),this.set("ariaLabel",o("Editor dialog")),this.set("isModal",!1),this.set("position",je.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=n,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new de,this.focusTracker=new se,this._focusables=new ve,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",s.if("isModal","ck-dialog-overlay__transparent",r=>!r),s.if("_isVisible","ck-hidden",r=>!r)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",s.to("className")],role:"dialog","aria-label":s.to("ariaLabel"),style:{top:s.to("_top",r=>vu(r)),left:s.to("_left",r=>vu(r)),visibility:s.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",(e,t)=>{this.fire("close",{source:"escKeyPress"}),t()}),this.on("drag",(e,{deltaX:t,deltaY:n})=>{this.wasMoved=!0,this.moveBy(t,n)}),this.listenTo(A.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(A.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on("change:_isVisible",(e,t,n)=>{n&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:n=!0,content:s,actionButtons:o}){t&&(this.headerView=new Xo(this.locale,{icon:e}),n&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),s&&(s instanceof C&&(s=[s]),this.contentView=new t2(this.locale),this.contentView.children.addMany(s),this.parts.add(this.contentView)),o&&(this.actionsView=new e2(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const n=this._getViewportRect(),s=this._getDialogRect
692();e+s.width>n.right&&(e=n.right-s.width),e<n.left&&(e=n.left),t<n.top&&(t=n.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t=this.position,n;this._getCurrentDomRoot()?n=this._getVisibleDomRootRect(e):t=je.SCREEN_CENTER;const s=ti.defaultOffset,o=this._getDialogRect();switch(t){case je.EDITOR_TOP_SIDE:{if(n){const r=this.locale.contentLanguageDirection==="ltr"?n.right-o.width-s:n.left+s;this.moveTo(r,n.top+s)}else this._moveOffScreen();break}case je.EDITOR_CENTER:{n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),Math.round(n.top+n.height/2-o.height/2)):this._moveOffScreen();break}case je.SCREEN_CENTER:{this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break}case je.EDITOR_TOP_CENTER:{n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.top+s):this._moveOffScreen();break}case je.EDITOR_BOTTOM_CENTER:{n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.bottom-o.height-s):this._moveOffScreen();break}case je.EDITOR_ABOVE_CENTER:{n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.top-o.height-s):this._moveOffScreen();break}case je.EDITOR_BELOW_CENTER:{n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.bottom+s):this._moveOffScreen();break}}}_getVisibleDomRootRect(e){let t=new O(this._getCurrentDomRoot()).getVisible();if(t){if(t=e.getIntersection(t),!t)return null}else return null;return t}_getDialogRect(){return new O(this.element.firstElementChild)}_getViewportRect(){return n2(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)hs(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element),Sx(t)&&(this.listenTo(t.focusCycler,"forwardCycle",n=>{this._focusCycler.focusNext(),this._focusCycler.next!==this._focusCycler.focusables.get(this._focusCycler.current)&&n.stop()}),this.listenTo(t.focusCycler,"backwardCycle",n=>{this._focusCycler.focusPrevious(),this._focusCycler.previous!==this._focusCycler.focusables.get(this._focusCycler.current)&&n.stop()}))})}_createCloseButton(){const e=new P(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:E.cancel}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}}ti.defaultOffset=15;function n2(i){i=Object.assign({top:0,bottom:0,left:0,right:0},i);const e=new O(A.window);return e.top+=i.top,e.height-=i.top,e.bottom-=i.bottom,e.height-=i.bottom,e.left+=i.left,e.right-=i.right,e.width-=i.left+i.right,e}/**
693 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
694 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
695 */class dt extends b{static get pluginName(){return"Dialog"}constructor(e){super(e);const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set("id",null),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}_initShowHideListeners(){this.on("show",(e,t)=>{this._show(t)}),this.on("show",(e,t)=>{t.onShow&&t.onShow(this)},{priority:"low"}),this.on("hide",()=>{dt._visibleDialogPlugin&&dt._visibleDialogPlugin._hide()}),this.on("hide",()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)},{priority:"low"})}_initFocusToggler(){const e=this.editor;e.keystrokes.set("Ctrl+F6",(t,n)=>{!this.isOpen||this.view.isModal||(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),n())})}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",()=>{if(!this.view)return;const t=e.document.differ.getChangedRoots();for(const n of t)n.state&&this.view.updatePosition()})}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:n,hasCloseButton:s=!0,content:o,actionButtons:r,className:a,isModal:l,position:c,onHide:u}){const d=this.editor;this.view=new ti(d.locale,{getCurrentDomRoot:()=>d.editing.view.getDomRoot(d.model.document.selection.anchor.root.rootName),getViewportOffset:()=>d.ui.viewportOffset});const h=this.view;h.on("close",()=>{this.hide()}),d.ui.view.body.add(h),d.ui.focusTracker.add(h.element),d.keystrokes.listenTo(h.element),c||(c=l?je.SCREEN_CENTER:je.EDITOR_CENTER),h.set({position:c,_isVisible:!0,className:a,isModal:l}),h.setupParts({icon:t,title:n,hasCloseButton:s,content:o,actionButtons:r}),this.id=e,u&&(this._onHide=u),this.isOpen=!0,dt._visibleDialogPlugin=this}hide(){dt._visibleDialogPlugin&&dt._visibleDialogPlugin.fire(`hide:${dt._visibleDialogPlugin.id}`)}
695_hide(){if(!this.view)return;const e=this.editor,t=this.view;t.contentView&&t.contentView.reset(),e.ui.view.body.remove(t),e.ui.focusTracker.remove(t.element),e.keystrokes.stopListening(t.element),t.destroy(),e.editing.view.focus(),this.id=null,this.isOpen=!1,dt._visibleDialogPlugin=null}}/**
696 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
697 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
698 */const ku=ri("px"),Cu=A.document.body,i2={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class ye extends C{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",n=>`ck-balloon-panel_${n}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",ku),left:t.to("left",ku)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=ye.defaultPositions,n=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast,t.viewportStickyNorth],limiter:Cu,fitInViewport:!0},e),s=ye._getOptimalPosition(n)||i2,o=parseInt(s.left),r=parseInt(s.top),a=s.name,l=s.config||{},{withArrow:c=!0}=l;this.top=r,this.left=o,this.position=a,this.withArrow=c}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=ca(e.target),n=e.limiter?ca(e.limiter):Cu;this.listenTo(A.document,"scroll",(s,o)=>{const r=o.target,a=t&&r.contains(t),l=n&&r.contains(n);(a||l||!t||!n)&&this.attachTo(e)},{useCapture:!0}),this.listenTo(A.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(A.document,"scroll"),this.stopListening(A.window,"resize")}}ye.arrowSideOffset=25;ye.arrowHeightOffset=10;ye.stickyVerticalOffset=20;ye._getOptimalPosition=zo;ye.defaultPositions=Qm();function ca(i){return Ht(i)?i:Ho(i)?i.commonAncestorContainer:typeof i=="function"?ca(i()):null}function Qm(i={}){const{sideOffset:e=ye.arrowSideOffset,heightOffset:t=ye.arrowHeightOffset,stickyVerticalOffset:n=ye.stickyVerticalOffset,config:s}=i;return{northWestArrowSouthWest:(a,l)=>({top:o(a,l),left:a.left-e,name:"arrow_sw",...s&&{config:s}}),northWestArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.left-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northWestArrowSouth:(a,l)=>({top:o(a,l),left:a.left-l.width/2,name:"arrow_s",...s&&{config:s}}),northWestArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.left-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northWestArrowSouthEast:(a,l)=>({top:o(a,l),left:a.left-l.width+e,name:"arrow_se",...s&&{config:s}}),northArrowSouthWest:(a,l)=>({top:o(a,l),left:a.left+a.width/2-e,name:"arrow_sw",...s&&{config:s}}),northArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northArrowSouth:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width/2,name:"arrow_s",...s&&{config:s}}),northArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northArrowSouthEast:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width+e,name:"arrow_se",...s&&{config:s}}),northEastArrowSouthWest:(a,l)=>({top:o(a,l),left:a.right-e,name:"arrow_sw",...s&&{config:s}}),northEastArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.right-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northEastArrowSouth:(a,l)=>({top:o(a,l),left:a.right-l.width/2,name:"arrow_s",...s&&{config:s}}),northEastArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.right-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northEastArrowSouthEast:(a,l)=>({top:o(a,l),left:a.right-l.width+e,name:"arrow_se",...s&&{config:s}}),southWestArrowNorthWest:a=>
698({top:r(a),left:a.left-e,name:"arrow_nw",...s&&{config:s}}),southWestArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.left-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southWestArrowNorth:(a,l)=>({top:r(a),left:a.left-l.width/2,name:"arrow_n",...s&&{config:s}}),southWestArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.left-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southWestArrowNorthEast:(a,l)=>({top:r(a),left:a.left-l.width+e,name:"arrow_ne",...s&&{config:s}}),southArrowNorthWest:a=>({top:r(a),left:a.left+a.width/2-e,name:"arrow_nw",...s&&{config:s}}),southArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southArrowNorth:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width/2,name:"arrow_n",...s&&{config:s}}),southArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southArrowNorthEast:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width+e,name:"arrow_ne",...s&&{config:s}}),southEastArrowNorthWest:a=>({top:r(a),left:a.right-e,name:"arrow_nw",...s&&{config:s}}),southEastArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.right-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southEastArrowNorth:(a,l)=>({top:r(a),left:a.right-l.width/2,name:"arrow_n",...s&&{config:s}}),southEastArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.right-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southEastArrowNorthEast:(a,l)=>({top:r(a),left:a.right-l.width+e,name:"arrow_ne",...s&&{config:s}}),westArrowEast:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.left-l.width-t,name:"arrow_e",...s&&{config:s}}),eastArrowWest:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.right+t,name:"arrow_w",...s&&{config:s}}),viewportStickyNorth:(a,l,c,u)=>{const d=u||c;return!a.getIntersection(d)||d.height-a.height>n?null:{top:d.top+n,left:a.left+a.width/2-l.width/2,name:"arrowless",config:{withArrow:!1,...s}}}};function o(a,l){return a.top-l.height-t}function r(a){return a.bottom+t}}/**
699 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
700 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
701 */const Tu="ck-tooltip";class ge extends Qe(){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,this._mutationObserver=null,ge._editors.add(e),ge._instance)return ge._instance;ge._instance=this,this.tooltipTextView=new C(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new ye(e.locale),this.balloonPanelView.class=Tu,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=s2(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=gt(this._pinTooltip,600),this._unpinTooltipDebounced=gt(this._unpinTooltip,400),this.listenTo(A.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(A.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(A.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(A.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(A.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(A.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;ge._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),ge._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),ge._instance=null)}static getPositioningFunctions(e){const t=ge.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onKeyDown(e,t){t.key==="Escape"&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const n=Sr(t);if(!n){e.name==="focus"&&this._unpinTooltip();return}n!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(n,Eu(n)))}_onLeaveOrBlur(e,{target:t,relatedTarget:n}){if(e.name==="mouseleave"){if(!Ht(t))return;const s=this.balloonPanelView.element,o=s&&(s===n||s.contains(n)),r=!o&&t===s;if(o){this._unpinTooltipDebounced.cancel();return}if(!r&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const a=Sr(t),l=Sr(n);(r||a&&a!==l)&&this._unpinTooltipDebounced()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:n,cssClass:s}){this._unpinTooltip();const o=ie(ge._editors.values()).ui.view.body;o.has(this.balloonPanelView)||o.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.pin({target:e,positions:ge.getPositioningFunctions(n)}),this._resizeObserver=new X(e,()=>{Wt(e)||this._unpinTooltip()}),this._mutationObserver.attach(e),this.balloonPanelView.class=[Tu,s].filter(r=>r).join(" ");for(const r of ge._editors)this.listenTo(r.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=n}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of ge._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._resizeObserver&&this._resizeObserver.destroy(),this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;const e=Eu(this._currentElementWithTooltip);if(!Wt(this._currentElementWithTooltip)||!e.text){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:ge.getPositioningFunctions(e.position)})}}ge.defaultBalloonPositions=Qm({heightOffset:5,sideOffset:13});ge._editors=new Set;ge._instance=null;function Sr(i){return Ht(i)?i.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function Eu(i){return{text:i.dataset.ckeTooltipText,position:i.dataset.ckeTooltipPosition||"s",cssClass:i.dataset.ckeTooltipClass||""}}function s2(i){const e=new MutationObserver(()=>{i()});return{attach(t){e.observe(t,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){e.disconnect()}}}const o2=`<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewB
701ox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/>
701<path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></svg>
702`;/**
703 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
704 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
705 */const r2=53,a2=10,l2=50,c2=350,u2="Powered by";class d2 extends Qe(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=qi(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor,t=!!e.config.get("ui.poweredBy.forceVisible");/* istanbul ignore next -- @preserve */!t&&Nv(e.config.get("licenseKey"))==="VALID"||e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(n,s,o)=>{this._updateLastFocusedEditableElement(),o?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(n,s,o)=>{this._updateLastFocusedEditableElement(),o&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new ye,n=Xm(e),s=new h2(e.locale,n.label);t.content.add(s),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=f2(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,n=e.ui.focusTracker.focusedElement;if(!t||!n){this._lastFocusedEditableElement=null;return}const s=Array.from(e.ui.getEditableElementsNames()).map(o=>e.ui.getEditableElement(o));s.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=s[0]}}class h2 extends C{constructor(e,t){super(e);const n=new lt,s=this.bindTemplate;n.set({content:o2,isColorInherited:!1}),n.extendTemplate({attributes:{style:{width:r2+"px",height:a2+"px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],n],on:{dragstart:s.to(o=>o.preventDefault())}}]})}}function f2(i,e){const t=Xm(i),n=t.side==="right"?m2(e,t):g2(e,t);return{target:e,positions:[n]}}function m2(i,e){return Ym(i,e,(t,n)=>t.left+t.width-n.width-e.horizontalOffset)}function g2(i,e){return Ym(i,e,t=>t.left+e.horizontalOffset)}function Ym(i,e,t){return(n,s)=>{const o=new O(i);if(o.width<c2||o.height<l2)return null;let r;e.position==="inside"?r=o.bottom-s.height:r=o.bottom-s.height/2,r-=e.verticalOffset;const a=t(o,s),c=n.clone().moveTo(a,r).getIntersection(s.clone().moveTo(a,r)).getVisible();return!c||c.getArea()<s.getArea()?null:{top:r,left:a,name:`position_${e.position}-side_${e.side}`,config:{withArrow:!1}
705}}}function Xm(i){const e=i.config.get("ui.poweredBy"),t=e&&e.position||"border";return{position:t,label:u2,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:i.locale.contentLanguageDirection==="ltr"?"right":"left",...e}}/**
706 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
707 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
708 */const Au={POLITE:"polite",ASSERTIVE:"assertive"};class p2{constructor(e){this.editor=e,e.once("ready",()=>{for(const t of Object.values(Au))this.announce("",t)})}announce(e,t=Au.POLITE){const n=this.editor;if(!n.ui.view)return;this.view||(this.view=new b2(n.locale),n.ui.view.body.add(this.view));const{politeness:s,isUnsafeHTML:o}=typeof t=="string"?{politeness:t}:t;let r=this.view.regionViews.find(a=>a.politeness===s);r||(r=new w2(n,s),this.view.regionViews.add(r)),r.announce({announcement:e,isUnsafeHTML:o})}}class b2 extends C{constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class w2 extends C{constructor(e,t){super(e.locale),this.setTemplate({tag:"div",attributes:{role:"region","aria-live":t,"aria-relevant":"additions"},children:[{tag:"ul",attributes:{class:["ck","ck-aria-live-region-list"]}}]}),e.on("destroy",()=>{this._pruneAnnouncementsInterval!==null&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)}),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval(()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()},5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;const n=document.createElement("li");t?this._domConverter.setContentOf(n,e):n.innerText=e,this._listElement.appendChild(n)}get _listElement(){return this.element.querySelector("ul")}}/**
709 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
710 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
711 */class _2 extends W(){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[];const t=e.editing.view;this.editor=e,this.componentFactory=new Yx(e),this.focusTracker=new se,this.tooltipManager=new ge(e),this.poweredBy=new d2(e),this.ariaLiveAnnouncer=new p2(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",()=>{this.isReady=!0}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const n=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?n():this.once("ready",n)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const n=e.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let n,s;e.keystrokes.set("Alt+F10",(o,r)=>{const a=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(a)&&!Array.from(t.domRoots.values()).includes(a)&&(n=a);const l=this._getCurrentFocusedToolbarDefinition();(!l||!s)&&(s=this._getFocusableCandidateToolbarDefinitions());for(let c=0;c<s.length;c++){const u=s.shift();if(s.push(u),u!==l&&this._focusFocusableCandidateToolbar(u)){l&&l.options.afterBlur&&l.options.afterBlur();break}}r()}),e.keystrokes.set("Esc",(o,r)=>{const a=this._getCurrentFocusedToolbarDefinition();a&&(n?(n.focus(),n=null):e.editing.view.focus(),a.options.afterBlur&&a.options.afterBlur(),r())})}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:n,options:s}=t;(Wt(n.element)||s.beforeFocus)&&e.push(t)}return e.sort((t,n)=>xu(t)-xu(n)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:n}}=e;return n&&n(),Wt(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){const n={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=n.top,t.viewportOffset.bottom+=n.bottom,t.viewportOffset.left+=n.left,t.viewportOffset.right+=n.right}}function xu(i){const{toolbarView:e,options:t}=i;let n=10;return Wt(e.element)&&n--,t.isContextual&&n--,n}/**
712 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
713 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
714 */class y2 extends C{constructor(e){super(e),this.body=new ix(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}/**
715 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
716 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
717 */class v2 extends y2{constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createV
717oiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new Ne;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}/**
718 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
719 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
720 */class k2 extends C{constructor(e,t,n){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;e.isRenderingInProgress?n(this):t(this);function t(s){e.change(o=>{const r=e.document.getRoot(s.name);o.addClass(s.isFocused?"ck-focused":"ck-blurred",r),o.removeClass(s.isFocused?"ck-blurred":"ck-focused",r)})}function n(s){e.once("change:isRenderingInProgress",(o,r,a)=>{a?n(s):t(s)})}}}/**
721 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
722 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
723 */class C2 extends k2{constructor(e,t,n,s={}){super(e,t,n);const o=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=s.label||(()=>o("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change(t=>{const n=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),n)})}}/**
724 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
725 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
726 */class Su extends Uf{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}/**
727 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
728 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
729 */class ui extends W(){constructor(e,t){super(),t&&Uh(this,t),e&&this.set(e)}}/**
730 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
731 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
732 */const Ss=ri("px");class qt extends b{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,s=t.document.selection.editableElement;return s?t.domConverter.mapViewToDom(s.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new g("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t)){this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,(!this._visibleStack||e.singleViewMode)&&this.showStack(t);return}const n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new g("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new g("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new ye(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(n=>n[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new T2(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(n,s)=>!s&&n>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(n,s)=>{if(s<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,s])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new E2(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,n)=>!n&&t>=2?Math.min(t-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:n=!0,singleViewMode:s=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),s&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class T2 extends C{constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new se,this.buttonPrevView=this._createButtonView(t("Previous"),E.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),E.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",n.to("isNavigationVisible",s=>s?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const n=new P(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class E2 extends C{constructor(e,t){super(e);const n=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",s=>
732s?"":"ck-hidden")],style:{top:n.to("top",Ss),left:n.to("left",Ss),width:n.to("width",Ss),height:n.to("height",Ss)}},children:this.content}),this.on("change:numberOfPanels",(s,o,r,a)=>{r>a?this._addPanels(r-a):this._removePanels(a-r),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new C;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:n,height:s}=new O(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:s})}}}/**
733 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
734 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
735 */const Mn=ri("px");class A2 extends C{constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new xe({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",n=>n?"block":"none"),height:t.to("isSticky",n=>n?Mn(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new xe({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",n=>n?Mn(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",n=>n&&Mn(n)),bottom:t.to("_stickyBottomOffset",n=>n&&Mn(n)),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this.contentPanelElement]})}render(){super.render(),this.checkIfShouldBeSticky(),this.listenTo(A.document,"scroll",()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky()})}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive){this._unstick();return}const e=new O(this.limiterElement);let t=e.getVisible();if(t){const n=new O(A.window);n.top+=this.viewportTopOffset,n.height-=this.viewportTopOffset,t=t.getIntersection(n)}if(t&&e.top<t.top){const n=t.top;if(n+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const s=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-s>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(s):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(n):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=Mn(-A.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=Mn(-A.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new O(this.contentPanelElement)}}/**
736 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
737 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
738 */class x2 extends he{constructor(e,t){const n=e.t,s=Object.assign({},{showResetButton:!0,showIcon:!0,creator:De},t);super(e,s.creator),this.label=t.label,this._viewConfig=s,this._viewConfig.showIcon&&(this.iconView=new lt,this.iconView.content=E.loupe,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new P(e),this.resetButtonView.set({label:n("Clear"),icon:E.cancel,class:"ck-search__reset",isVisible:!1,tooltip:!0}),this.resetButtonView.on("execute",()=>{this.reset(),this.focus(),this.fire("reset")}),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",o=>!o),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}))}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=!1)}}/**
739 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
740 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
741 */class S2 extends C{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",e.if("isVisible","ck-hidden",t=>!t)],tabindex:-1},children:[{tag:"span",children:[{text:[e.to("primaryText")]}]},{tag:"span",children:[{text:[e.to("secondaryText")]}]}]})}focus(){this.element.focus()}}/**
742 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
743 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
744 */class I2 extends C{constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new se,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new ke({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}/**
745 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
746 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
747 */class P2 extends C{constructor(e,t){super(e),this._config=t,this.filteredView=t.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new se,this.keystrokes=new de,this.resultsView=new I2(e),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set("isEnabled",!0),this.set("resultsCount",0),this.set("totalItemsCount",0),t.infoView&&t.infoView.instance?this.infoView=t.infoView.instance:(this.infoView=new S2,this._enableDefaultInfoViewBehavior(),this.on("render",()=>{this.search("")})),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new ke({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",(n,{resultsCount:s,totalItemsCount:o})=>{this.resultsCount=s,this.totalItemsCount=o}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",t.class||null],tabindex:"-1"},children:this.children})}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const e=t=>t.stopPropagation();for(const t of this.focusableChildren)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}focus(){this.queryView.focus()}reset(){this.queryView.reset(),this.search("")}search(e){const t=e?new RegExp(qa(e),"ig"):null,n=this.filteredView.filter(t);this.fire("search",{query:e,...n})}_createSearchTextQueryView(){const e=new x2(this.locale,this._config.queryView);return this.listenTo(e.fieldView,"input",()=>{this.search(e.fieldView.element.value)}),e.on("reset",()=>this.reset()),e.bind("isEnabled").to(this),e}_enableDefaultInfoViewBehavior(){const e=this.locale.t,t=this.infoView;this.on("search",(s,o)=>
747{if(o.resultsCount)t.set({isVisible:!1});else{const r=this._config.infoView&&this._config.infoView.text;let a,l;o.totalItemsCount?r&&r.notFound?(a=r.notFound.primary,l=r.notFound.secondary):(a=e("No results found"),l=""):r&&r.noSearchableItems?(a=r.noSearchableItems.primary,l=r.noSearchableItems.secondary):(a=e("No searchable items"),l=""),t.set({primaryText:n(a,o),secondaryText:n(l,o),isVisible:!0})}});function n(s,{query:o,resultsCount:r,totalItemsCount:a}){return typeof s=="function"?s(o,r,a):s}}}/**
748 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
749 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
750 */class ns extends P2{constructor(e,t){super(e,t),this._config=t;const n=ri("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const s=this.resultsView.bindTemplate;this.resultsView.set("isVisible",!1),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[s.if("isVisible","ck-hidden",o=>!o),s.to("_position",o=>`ck-search__results_${o}`)],style:{width:s.to("_width",n)}}}),this.focusTracker.on("change:isFocused",(o,r,a)=>{this._updateResultsVisibility(),a?this.resultsView.element.scrollTop=0:t.resetOnBlur&&this.queryView.reset()}),this.on("search",()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition()}),this.keystrokes.set("esc",(o,r)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=!1,r())}),this.listenTo(A.document,"scroll",()=>{this._updateResultsViewWidthAndPosition()}),this.on("change:isEnabled",()=>{this._updateResultsVisibility()}),this.filteredView.on("execute",(o,{value:r})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=r,this.resultsView.isVisible=!1}),this.resultsView.on("change:isVisible",()=>{this._updateResultsViewWidthAndPosition()})}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new O(this.queryView.fieldView.element).width;const e=ns._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:ns.defaultResultsPositions});this.resultsView._position=e?e.name:"s"}_updateResultsVisibility(){const e=typeof this._config.queryMinChars>"u"?0:this._config.queryMinChars,t=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&t>=e}}ns.defaultResultsPositions=[i=>({top:i.bottom,left:i.left,name:"s"}),(i,e)=>({top:i.top-e.height,left:i.left,name:"n"})];ns._getOptimalPosition=zo;/**
751 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
752 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
753 */class R2 extends P{constructor(e){super(e);const t=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",n=>String(n)),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new lt;return e.content=Qo,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}/**
754 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
755 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
756 */class It extends ei{constructor(e,t){super(e);const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:n.to("mouseenter")}}),this.delegate("mouseenter").to(t)}}/**
757 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
758 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
759 */const Is=5,bi={toggleMenusAndFocusItemsOnHover(i){i.on("menu:mouseenter",e=>{if(i.isOpen){for(const t of i.menus){const n=e.path[0],s=n instanceof It&&n.children.first===t;t.isOpen=(e.path.includes(t)||s)&&t.isEnabled}
759e.source.focus()}})},focusCycleMenusOnArrows(i){const e=i.locale.uiLanguageDirection==="rtl";i.on("menu:arrowright",n=>{t(n.source,e?-1:1)}),i.on("menu:arrowleft",n=>{t(n.source,e?1:-1)});function t(n,s){const o=i.children.getIndex(n),r=n.isOpen,a=i.children.length,l=i.children.get((o+a+s)%a);n.isOpen=!1,r&&(l.isOpen=!0),l.buttonView.focus()}},closeMenusWhenTheBarCloses(i){i.on("change:isOpen",()=>{i.isOpen||i.menus.forEach(e=>{e.isOpen=!1})})},closeMenuWhenAnotherOnTheSameLevelOpens(i){i.on("menu:change:isOpen",(e,t,n)=>{n&&i.menus.filter(s=>e.source.parentMenuView===s.parentMenuView&&e.source!==s&&s.isOpen).forEach(s=>{s.isOpen=!1})})},closeOnClickOutside(i){ai({emitter:i,activator:()=>i.isOpen,callback:()=>i.close(),contextElements:()=>i.children.map(e=>e.element)})}},en={openAndFocusPanelOnArrowDownKey(i){i.keystrokes.set("arrowdown",(e,t)=>{i.focusTracker.focusedElement===i.buttonView.element&&(i.isOpen||(i.isOpen=!0),i.panelView.focus(),t())})},openOnArrowRightKey(i){const e=i.locale.uiLanguageDirection==="rtl"?"arrowleft":"arrowright";i.keystrokes.set(e,(t,n)=>{i.focusTracker.focusedElement!==i.buttonView.element||!i.isEnabled||(i.isOpen||(i.isOpen=!0),i.panelView.focus(),n())})},openOnButtonClick(i){i.buttonView.on("execute",()=>{i.isOpen=!0,i.panelView.focus()})},toggleOnButtonClick(i){i.buttonView.on("execute",()=>{i.isOpen=!i.isOpen,i.isOpen&&i.panelView.focus()})},closeOnArrowLeftKey(i){const e=i.locale.uiLanguageDirection==="rtl"?"arrowright":"arrowleft";i.keystrokes.set(e,(t,n)=>{i.isOpen&&(i.isOpen=!1,i.focus(),n())})},closeOnEscKey(i){i.keystrokes.set("esc",(e,t)=>{i.isOpen&&(i.isOpen=!1,i.focus(),t())})},closeOnParentClose(i){i.parentMenuView.on("change:isOpen",(e,t,n)=>{!n&&e.source===i.parentMenuView&&(i.isOpen=!1)})}},V2={southEast:i=>({top:i.bottom,left:i.left,name:"se"}),southWest:(i,e)=>({top:i.bottom,left:i.left-e.width+i.width,name:"sw"}),northEast:(i,e)=>({top:i.top-e.height,left:i.left,name:"ne"}),northWest:(i,e)=>({top:i.top-e.height,left:i.left-e.width+i.width,name:"nw"}),eastSouth:i=>({top:i.top,left:i.right-Is,name:"es"}),eastNorth:(i,e)=>({top:i.top-e.height,left:i.right-Is,name:"en"}),westSouth:(i,e)=>({top:i.top,left:i.left-e.width+Is,name:"ws"}),westNorth:(i,e)=>({top:i.top-e.height,left:i.left-e.width+Is,name:"wn"})},B2=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:uploadImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:comment"]},{groupId:"insertMinorWidgets",items:["menuBar:insertTemplate","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroun
759dColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function M2(i){let e;return!("items"in i)||!i.items?e={items:at(B2),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...i}:e={items:i.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...i},e}function O2({normalizedConfig:i,locale:e,componentFactory:t}){const n=at(i);return L2(i,n),F2(i,n),N2(i,n,t),eg(i,n),D2(n,e),n}function L2(i,e){const t=e.removeItems,n=[];e.items=e.items.filter(({menuId:s})=>t.includes(s)?(n.push(s),!1):!0),di(e.items,s=>{s.groups=s.groups.filter(({groupId:o})=>t.includes(o)?(n.push(o),!1):!0);for(const o of s.groups)o.items=o.items.filter(r=>{const a=tg(r);return t.includes(a)?(n.push(a),!1):!0})});for(const s of t)n.includes(s)||N("menu-bar-item-could-not-be-removed",{menuBarConfig:i,itemName:s})}function F2(i,e){const t=e.addItems,n=[];for(const s of t){const o=H2(s.position),r=z2(s.position);if($2(s))if(!r)o==="start"?(e.items.unshift(s.menu),n.push(s)):o==="end"&&(e.items.push(s.menu),n.push(s));else{const a=e.items.findIndex(l=>l.menuId===r);a!=-1?o==="before"?(e.items.splice(a,0,s.menu),n.push(s)):o==="after"&&(e.items.splice(a+1,0,s.menu),n.push(s)):Iu(e,s.menu,r,o)&&n.push(s)}else U2(s)?di(e.items,a=>{if(a.menuId===r)o==="start"?(a.groups.unshift(s.group),n.push(s)):o==="end"&&(a.groups.push(s.group),n.push(s));else{const l=a.groups.findIndex(c=>c.groupId===r);l!==-1&&(o==="before"?(a.groups.splice(l,0,s.group),n.push(s)):o==="after"&&(a.groups.splice(l+1,0,s.group),n.push(s)))}}):Iu(e,s.item,r,o)&&n.push(s)}for(const s of t)n.includes(s)||N("menu-bar-item-could-not-be-added",{menuBarConfig:i,addedItemConfig:s})}function Iu(i,e,t,n){let s=!1;return di(i.items,o=>{for(const{groupId:r,items:a}of o.groups){if(s)return;if(r===t)n==="start"?(a.unshift(e),s=!0):n==="end"&&(a.push(e),s=!0);else{const l=a.findIndex(c=>tg(c)===t);l!==-1&&(n==="before"?(a.splice(l,0,e),s=!0):n==="after"&&(a.splice(l+1,0,e),s=!0))}}}),s}function N2(i,e,t){di(e.items,n=>{for(const s of n.groups)s.items=s.items.filter(o=>{const r=typeof o=="string"&&!t.has(o);return r&&!e.isUsingDefaultConfig&&N("menu-bar-item-unavailable",{menuBarConfig:i,parentMenuConfig:at(n),componentName:o}),!r})})}function eg(i,e){const t=e.isUsingDefaultConfig;let n=!1;if(e.items=e.items.filter(s=>s.groups.length?!0:(Ir(i,s,t),!1)),!e.items.length){Ir(i,i,t);return}di(e.items,s=>{s.groups=s.groups.filter(o=>o.items.length?!0:(n=!0,!1));for(const o of s.groups)o.items=o.items.filter(r=>ng(r)&&!r.groups.length?(Ir(i,r,t),n=!0,!1):!0)}),n&&eg(i,e)}function Ir(i,e,t){t||N("menu-bar-menu-empty",{menuBarConfig:i,emptyMenuConfig:e})}function D2(i,e){const t=e.t,n={File:t({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:t({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:t({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:t({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:t({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:t({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:t({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:t({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:t({string:"Font",id:"MENU_BAR_MENU_FONT"})};di(i.items,s=>{s.label in n&&(s.label=n[s.label])})}function di(i,e){if(Array.isArray(i))for(const n of i)t(n);function t(n){e(n);for(const s of n.groups)for(const o of s.items)ng(o)&&t(o)}}function $2(i){return typeof i=="object"&&"menu"in i}function U2(i){return typeof i=="object"&&"group"in i}function H2(i){return i.startsWith("start")?"start":i.startsWith("end")?"end":i.startsWith("after")?"after":"before"}function z2(i){const e=i.match(/^[^:]+:(.+)/);return e?e[1]:null}function tg(i){return typeof i=="string"?i:i.menuId}function ng(i){return typeof i=="object"&&"menuId"in i}function W2(i,e){const t=e.element;i.ui.focusTracker.add(t),i.keystrokes.listenTo(t);const n=M2(i.config.get("menuBar")||{});e.fillFromConfig(n,i.ui.componentFactory),i.keystrokes.set("Esc",(s,o)=>{t.contains(i.ui.focusTracker.focusedElement)&&(i.editing.view.focus(),o())}),i.keystrokes.set("Alt+F9",(s,o)=>{t.contains(i.ui.focusTracker.focusedElement)||(e.focus(),o())})}/**
760 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
761 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
762 */class q2 extends C{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-menu-bar__menu__panel",t.to("position",n=>`ck-menu-bar__menu__panel_position_${n}`),t.if("isVisible","ck-hidden",n=>!n)],tabindex:"-1"},children:this.children,on:{selectstart:t.to(n=>{n.target.tagName.toLocaleLowerCase()!=="input"&&n.preventDefault()})}})}focus(e=1){this.children.length&&(e===1?this.children.first.focus():this.children.last.focus())}}/**
763 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
764 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
765 */class Pe extends C{constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new R2(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new q2(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new de,this.focusTracker=new se,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("panelPosition","w"),this.set("class",void 0),this.set("parentMenuView",null),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar__menu",t.to("class"),t.if("isEnabled","ck-disabled",n=>!n),t.if("parentMenuView","ck-menu-bar__menu_top-level",n=>!n)]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),en.closeOnEscKey(this),this._repositionPanelOnOpen()}
765_attachBehaviors(){this.parentMenuView?(en.openOnButtonClick(this),en.openOnArrowRightKey(this),en.closeOnArrowLeftKey(this),en.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),en.openAndFocusPanelOnArrowDownKey(this),en.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",(e,t)=>{this.fire("arrowright"),t()}),this.keystrokes.set("arrowleft",(e,t)=>{this.fire("arrowleft"),t()})}_repositionPanelOnOpen(){this.on("change:isOpen",(e,t,n)=>{if(!n)return;const s=Pe._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=s?s.name:this._panelPositions[0].name})}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:n,northWest:s,westSouth:o,eastSouth:r,westNorth:a,eastNorth:l}=V2;return this.locale.uiLanguageDirection==="ltr"?this.parentMenuView?[r,l,o,a]:[e,t,n,s]:this.parentMenuView?[o,a,r,l]:[t,e,s,n]}}Pe._getOptimalPosition=zo;/**
766 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
767 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
768 */class jt extends hl{constructor(e){super(e),this.role="menu"}}/**
769 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
770 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
771 */class Q extends P{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}/**
772 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
773 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
774 */class ig extends Lm{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}/**
775 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
776 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
777 */const Pu=["mouseenter","arrowleft","arrowright","change:isOpen"];class j2 extends C{constructor(e){super(e),this.menus=[];const t=e.t;this.set("isOpen",!1),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar"],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t){const n=this.locale,o=O2({normalizedConfig:e,locale:n,componentFactory:t}).items.map(r=>this._createMenu({componentFactory:t,menuDefinition:r}));this.children.addMany(o)}render(){super.render(),bi.toggleMenusAndFocusItemsOnHover(this),bi.closeMenusWhenTheBarCloses(this),bi.closeMenuWhenAnotherOnTheSameLevelOpens(this),bi.focusCycleMenusOnArrows(this),bi.closeOnClickOutside(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}registerMenu(e,t=null){t?(e.delegate(...Pu).to(t),e.parentMenuView=t):e.delegate(...Pu).to(this,n=>"menu:"+n),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:n}){const s=this.locale,o=new Pe(s);return this.registerMenu(o,n),o.buttonView.set({label:t.label}),o.once("change:isOpen",()=>{const r=new jt(s);r.ariaLabel=t.label,o.panelView.children.add(r),r.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:o,componentFactory:e}))}),o}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:n}){const s=this.locale,o=[];for(const r of e.groups){for(const a of r.items){const l=new It(s,t);if(Z(a))l.children.add(this._createMenu({componentFactory:n,menuDefinition:a,parentMenuView:t}));else{const c=this._createMenuItemContentFromFactory({componentName:a,componentFactory:n,parentMenuView:t});if(!c)continue;l.children.add(c)}o.push(l)}r!==e.groups[e.groups.length-1]&&o.push(new Yo(s))}return o}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:n}){const s=n.create(e);return s instanceof Pe||s instanceof Q||s instanceof ig?(this._registerMenuTree(s,t),s.on("execute",()=>{this.close()}),s):(N("menu-bar-component-unsupported",{componentName:e,componentView:s}),null)}_registerMenuTree(e,t){if(!(e instanceof Pe)){e.delegate("mouseenter").to(t);return}this.registerMenu(e,t);const n=e.panelView.children.filter(o=>o instanceof jt)[0];if(!n){e.delegate("mouseenter").to(t);return}const s=n.items.filter(o=>o instanceof ei);for(const o of s)this._registerMenuTree(o.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",(t,n,s)=>{clearTimeout(e),s?this.isOpen=!0:e=setTimeout(()=>{this.isOpen=Array.from(this.children).some(o=>o.isOpen)},0)})}}/**
778 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
779 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
780 */class G2 extends _2{constructor(e,t){super(e),this.view=t,this._toolbarConfig=Gm(e.config.get("toolbar")),this._elementReplacer=new wf,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}
780get element(){return this.view.element}init(e){const t=this.editor,n=this.view,s=t.editing.view,o=n.editable,r=s.document.getRoot();o.name=r.rootName,n.render();const a=o.element;this.setEditableElement(o.name,a),n.editable.bind("isFocused").to(this.focusTracker),s.attachDomRoot(a),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),n.menuBarView&&W2(t,n.menuBarView),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({top:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),s=e.sourceElement;let o;const r=e.config.get("placeholder");r&&(o=typeof r=="string"?r:r[this.view.editable.name]),!o&&s&&s.tagName.toLowerCase()==="textarea"&&(o=s.getAttribute("placeholder")),o&&(n.placeholder=o),Hf({view:t,element:n,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,n){const s=this.view.stickyPanel;if(s.isSticky){const o=new O(s.element).height;t.viewportOffset.top+=o}else{const o=()=>{this.editor.editing.view.scrollToTheSelection(n)};this.listenTo(s,"change:isSticky",o),setTimeout(()=>{this.stopListening(s,"change:isSticky",o)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",()=>{const n=t.view;n.on("moveTo",(s,o)=>{if(!e.isSticky||n.wasMoved)return;const r=new O(e.contentPanelElement);o[1]<r.bottom+ti.defaultOffset&&(o[1]=r.bottom+ti.defaultOffset)},{priority:"high"})},{priority:"low"})}}/**
781 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
782 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
783 */class K2 extends v2{constructor(e,t,n={}){super(e),this.stickyPanel=new A2(e),this.toolbar=new Xn(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),n.useMenuBar&&(this.menuBarView=new j2(e)),this.editable=new C2(e,t)}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}/**
784 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
785 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
786 */class sg{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const n="error"in t?t.error:t.reason;n instanceof Error&&this._handleError(n,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(n=>n!==t)}_fire(e,...t){const n=this._listeners[e]||[];for(const s of n)s.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const n=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:n}),n?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&e.context!==void 0&&e.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(e)}
786_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;const e=this.crashes[this.crashes.length-1].date,t=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(e-t)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}/**
787 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
788 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
789 */function ua(i,e=new Set){const t=[i],n=new Set;let s=0;for(;t.length>s;){const o=t[s++];if(!(n.has(o)||!J2(o)||e.has(o)))if(n.add(o),Symbol.iterator in o)try{for(const r of o)t.push(r)}catch{}else for(const r in o)r!=="defaultValue"&&t.push(o[r])}return n}function J2(i){const e=Object.prototype.toString.call(i),t=typeof i;return!(t==="number"||t==="boolean"||t==="string"||t==="symbol"||t==="function"||e==="[object Date]"||e==="[object RegExp]"||e==="[object Module]"||i===void 0||i===null||i._watchdogExcluded||i instanceof EventTarget||i instanceof Event)}/**
790 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
791 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
792 */function og(i,e,t=new Set){if(i===e&&Z2(i))return!0;const n=ua(i,t),s=ua(e,t);for(const o of n)if(s.has(o))return!0;return!1}function Z2(i){return typeof i=="object"&&i!==null}/**
793 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
794 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
795 */class rg extends sg{constructor(e,t={}){super(t),this._editor=null,this._lifecyclePromise=null,this._initUsingData=!0,this._editables={},this._throttledSave=qi(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(n,s)=>e.create(n,s)),this._destructor=n=>n.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{const e={},t=[],n=this._config.rootsAttributes||{},s={};for(const[r,a]of Object.entries(this._data.roots))a.isLoaded?(e[r]="",s[r]=n[r]||{}):t.push(r);const o={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:s,_watchdogInitialData:this._data};return delete o.initialData,o.extraPlugins.push(Q2),this._initUsingData?this.create(e,o,o.context):Ht(this._elementOrData)?this.create(this._elementOrData,o,o.context):this.create(this._editables,o,o.context)}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,n){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData=typeof e=="string"||Object.keys(e).length>0&&typeof Object.values(e)[0]=="string",this._config=this._cloneEditorConfiguration(t)||{},this._config.context=n,this._creator(e,this._config))).then(s=>{this._editor=s,s.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=s.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")}).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.cancel();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=e}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter(a=>a.isAttached()&&a.rootName!="$graveyard"),{plugins:n}=e,s=n.has("CommentsRepository")&&n.get("CommentsRepository"),o=n.has("TrackChanges")&&n.get("TrackChanges"),r={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(a=>{r.roots[a.rootName]={content:JSON.stringify(Array.from(a.getChildren())),attributes:JSON.stringify(Array.from(a.getAttributes())),isLoaded:a._isLoaded}});for(const a of e.model.markers)a._affectsData&&(r.markers[a.name]={rangeJSON:a.getRange().toJSON(),usingOperation:a._managedUsingOperations,affectsData:a._affectsData});return s&&(r.commentThreads=JSON.stringify(s.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),o&&(r.suggestions=JSON.stringify(o.getSuggestions({toJSON:!0,skipNotAttached:!0}))),r}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const n=this.editor.ui.getEditableElement(t);n&&(e[t]=n)}return e}_isErrorComingFromThisItem(e){return og(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Wa(e,(t,n)=>{if(Ht(t)||n==="context")return t})}}class Q2{constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},t=>{this._restoreCollaborationData(),this._restoreEditorData(t)}),this.editor.data.fire("ready")},{priority:999})}_createNode(e,t){if("name"in t){const n=e.createElement(t.name,t.attributes);if(t.children)for(const s of t.children)n._appendChild(this._createNode(e,s));return n}else return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;
795Object.entries(this._data.roots).forEach(([n,{content:s,attributes:o}])=>{const r=JSON.parse(s),a=JSON.parse(o),l=t.model.document.getRoot(n);for(const[c,u]of a)e.setAttribute(c,u,l);for(const c of r){const u=this._createNode(e,c);e.insert(u,l,"end")}}),Object.entries(this._data.markers).forEach(([n,s])=>{const{document:o}=t.model,{rangeJSON:{start:r,end:a},...l}=s,c=o.getRoot(r.root),u=e.createPositionFromPath(c,r.path,r.stickiness),d=e.createPositionFromPath(c,a.path,a.stickiness),h=e.createRange(u,d);e.addMarker(n,{range:h,...l})})}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach(n=>{const s=this.editor.config.get("collaboration.channelId"),o=this.editor.plugins.get("CommentsRepository");o.hasCommentThread(n.threadId)&&o.getCommentThread(n.threadId).remove(),o.addCommentThread({channelId:s,...n})}),t.forEach(n=>{const s=this.editor.plugins.get("TrackChangesEditing");if(s.hasSuggestion(n.id)){const o=s.getSuggestion(n.id);o.attributes=n.attributes}else s.addSuggestionData(n)})}}/**
796 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
797 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
798 */const Fi=Symbol("MainQueueId");class Y2 extends sg{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new X2,this._watchdogConfig=t,this._creator=n=>e.create(n),this._destructor=n=>n.destroy(),this._actionQueues.onEmpty(()=>{this.state==="initializing"&&(this.state="ready",this._fire("stateChange"))})}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}get context(){return this._context}create(e={}){return this._actionQueues.enqueue(Fi,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=Ru(e);return Promise.all(t.map(n=>this._actionQueues.enqueue(n.id,()=>{if(this.state==="destroyed")throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let s;if(this._watchdogs.has(n.id))throw new Error(`Item with the given id is already added: '${n.id}'.`);if(n.type==="editor")return s=new rg(null,this._watchdogConfig),s.setCreator(n.creator),s._setExcludedProperties(this._contextProps),n.destructor&&s.setDestructor(n.destructor),this._watchdogs.set(n.id,s),s.on("error",(o,{error:r,causesRestart:a})=>{this._fire("itemError",{itemId:n.id,error:r}),a&&this._actionQueues.enqueue(n.id,()=>new Promise(l=>{const c=()=>{s.off("restart",c),this._fire("itemRestart",{itemId:n.id}),l()};s.on("restart",c)}))}),s.create(n.sourceElementOrData,n.config,this._context);throw new Error(`Not supported item type: '${n.type}'.`)})))}remove(e){const t=Ru(e);return Promise.all(t.map(n=>this._actionQueues.enqueue(n,()=>{const s=this._getWatchdog(n);return this._watchdogs.delete(n),s.destroy()})))}destroy(){return this._actionQueues.enqueue(Fi,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Fi,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(e=>{console.error("An error happened during destroying the context or items.",e)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(e=>(this._context=e,this._contextProps=ua(this._context),Promise.all(Array.from(this._watchdogs.values()).map(t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(t=>t.destroy())).then(()=>this._destructor(e))})}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return og(this._context,e.context)}}class X2{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const n=e===Fi;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const o=(n?Promise.all(this._queues.values()):Promise.all([this._queues.get(Fi),this._queues.get(e)])).then(t),r=o.catch(()=>{});return this._queues.set(e,r),o.finally(()=>{this._activeActions--,this._queues.get(e)===r&&this._activeActions===0&&this._onEmptyCallbacks.forEach(a=>a())})}}function Ru(i){return Array.isArray(i)?i:[i]}/**
799 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
800 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
801 */class er extends aa(rA){constructor(e,t={}){if(!no(e)&&t.initialData!==void 0)throw new g("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",eS(e)),no(e)&&(this.sourceElement=e),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),s=this.config.get("menuBar"),o=new K2(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:n,useMenuBar:s.isVisible});this.ui=new G2(this,o),aA(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(n=>{const s=new this(e,t);n(s.initPlugins().then(()=>s.ui.init(no(e)?e:null)).then(()=>s.data.init(s.config.get("initialData"))).then(()=>s.fire("ready")).then(()=>s))})}}er.Context=$f;er.EditorWatchdog=rg;er.ContextWatchdog=Y2;function eS(i){return no(i)?dv(i):i}function no(i){return Ht(i)}/**
802 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
803 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
804 */class is extends Mt{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;this.listenTo(t,"paste",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",n("dragging"),{priority:"low"});function n(s){return(o,r)=>{r.preventDefault();const a=r.dropRange?[r.dropRange]:null,l=new xt(t,s);t.fire(l,{dataTransfer:r.dataTransfer,method:o.name,targetRanges:a,target:r.target,domEvent:r.domEvent}),l.stop.called&&r.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,n=e.type=="drop"||e.type=="paste",s={dataTransfer:new tm(t,{cacheFiles:n})};(e.type=="drop"||e.type=="dragover")&&(s.dropRange=tS(this.view,e)),this.fire(e.type,e,s)}}function tS(i,e){const t=e.target.ownerDocument,n=e.clientX,s=e.clientY;let o;return t.caretRangeFromPoint&&t.caretRangeFromPoint(n,s)?o=t.caretRangeFromPoint(n,s):e.rangeParent&&(o=t.createRange(),o.setStart(e.rangeParent,e.rangeOffset),o.collapse(!0)),o?i.domConverter.domRangeToView(o):null}/**
805 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
806 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
807 */function nS(i){return i=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;"),(i.includes("</p><p>")||i.includes("<br>"))&&(i=`<p>${i}</p>`),i}/**
808 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
809 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
810 */function iS(i){return i.replace(/<span(?: class="Apple-converted-s
810pace"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}/**
811 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
812 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
813 */const Vu=["figcaption","li"],Bu=["ol","ul"];function ag(i){if(i.is("$text")||i.is("$textProxy"))return i.data;if(i.is("element","img")&&i.hasAttribute("alt"))return i.getAttribute("alt");if(i.is("element","br"))return`
814`;let e="",t=null;for(const n of i.getChildren())e+=sS(n,t)+ag(n),t=n;return e}function sS(i,e){return e?i.is("element","li")&&!i.isEmpty&&i.getChild(0).is("containerElement")||Bu.includes(i.name)&&Bu.includes(e.name)?`
815
816`:!i.is("containerElement")&&!e.is("containerElement")?"":Vu.includes(i.name)||Vu.includes(e.name)?`
817`:`
818
819`:""}/**
820 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
821 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
822 */class Ni extends b{constructor(){super(...arguments),this._markersToCopy=new Map}static get pluginName(){return"ClipboardMarkersUtils"}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,n=s=>s.model.getSelectedContent(s.model.document.selection)){return this.editor.model.change(s=>{const o=s.model.document.selection;s.setSelection(t);const r=this._insertFakeMarkersIntoSelection(s,s.model.document.selection,e),a=n(s),l=this._removeFakeMarkersInsideElement(s,a);for(const[c,u]of Object.entries(r)){l[c]||(l[c]=s.createRangeIn(a));for(const d of u)s.remove(d)}a.markers.clear();for(const[c,u]of Object.entries(l))a.markers.set(c,u);return s.setSelection(o),a})}_pasteMarkersIntoTransformedElement(e,t){const n=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(s=>{const o=this._insertFakeMarkersElements(s,n),r=t(s),a=this._removeFakeMarkersInsideElement(s,r);for(const l of Object.values(o).flat())s.remove(l);for(const[l,c]of Object.entries(a))s.model.markers.has(l)||s.addMarker(l,{usingOperation:!0,affectsData:!0,range:c});return r})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const n of t)e.markers.set(n.name,n.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,n={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const s=this._markersToCopy.get(e);this._markersToCopy.set(e,n),t(),s?this._markersToCopy.set(e,s):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const n=this._getMarkerClipboardConfig(e);if(!n)return!1;if(!t)return!0;const{allowedActions:s}=n;return s==="all"||s.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,n){const s=this._getCopyableMarkersFromSelection(e,t,n);return this._insertFakeMarkersElements(e,s)}_getCopyableMarkersFromSelection(e,t,n){const s=Array.from(t.getRanges()),o=new Set(s.flatMap(a=>Array.from(e.model.markers.getMarkersIntersectingRange(a)))),r=a=>{if(!this._isMarkerCopyable(a.name,n))return!1;const{copyPartiallySelected:c}=this._getMarkerClipboardConfig(a.name);if(!c){const u=a.getRange();return s.some(d=>d.containsRange(u,!0))}return!0};return Array.from(o).filter(r).map(a=>({name:n==="dragstart"?this._getUniqueMarkerName(a.name):a.name,range:a.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:n}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([o,r])=>{if(!this._hasMarkerConfiguration(o))return[{name:o,range:r}];if(this._isMarkerCopyable(o,t)){const a=this._getMarkerClipboardConfig(o),l=n.markers.has(o)&&n.markers.get(o).getRange().root.rootName==="$graveyard";return(a.duplicateOnPaste||l)&&(o=this._getUniqueMarkerName(o)),[{name:o,range:r}]}return[]})}_insertFakeMarkersElements(e,t){const n={},s=t.flatMap(o=>{const{start:r,end:a}=o.range;return[{position:r,marker:o,type:"start"},{position:a,marker:o,type:"end"}]}).sort(({position:o},{position:r})=>o.isBefore(r)?1:-1);for(const{position:o,marker:r,type:a}of s){const l=e.createElement("$marker",{"data-name":r.name,"data-type":a});n[r.name]||(n[r.name]=[]),n[r.name].push(l),e.insert(l,o)}return n}_removeFakeMarkersInsideElement(e,t){const s=this._getAllFakeMarkersFromElement(e,t).reduce((o,r)=>{const a=r.markerElement&&e.createPositionBefore(r.markerElement);let l=o[r.name],c=!1;return l&&l.start&&l.end&&(this._getMarkerClipboardConfig(r.name).duplicateOnPaste?o[this._getUniqueMarkerName(r.name)]=o[r.name]:c=!0,l=null),c||(o[r.name]={...l,[r.type]:a}),r.markerElement&&e.remove(r.markerElement),o},{});return Ky(s,o=>new w(o.start||e.createPositionFromPath(t,[0]),o.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const n=Array.from(e.createRangeIn(t)).flatMap(({item:r})=>{if(!r.is("element","$marker"))return[];const a=r.getAttribute("data-name"),l=r.getAttribute("data-type");return[{markerElement:r,name:a,type:l}]}),s=[],o=[];for(const r of n)r.type==="end"&&(n.some(l=>l.name===r.name&&l.type==="start")||s.push({markerElement:null,name:r.name,type:"start"})),r.type==="start"&&(n.some(l=>l.name===r.name&&l.type==="end")||o.unshift({markerElement:null,name:r.name,type:"end"}));return[...s,...n,...o]}_getUniqueMarkerName(e){const t=e.split(":"),n=$e().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${n}`:`${t.join(":")}:${n}`}}/**
823 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
824 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
825 */class Je extends b{static get pluginName(){return"ClipboardPipeline"}static get requires(){return[Ni]}init(){this.editor.editing.view.addObserver(is),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,n){const s=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:n==="cut"},()=>{const o=s._copySelectedFragmentWithMarkers(n,t);this.fire("outputTransformation",{dataTransfer:e,content:o,method:n})})}_setupPasteDrop(){const e=this.editor,t=e.model,n=e.editing.view,s=n.document,o=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(s,"clipboardInput",(r,a)=>{a.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&r.stop()},{priority:"highest"}),this.listenTo(s,"clipboardInput",(r,a)=>{const l=a.dataTransfer;let c;if(a.content)c=a.content;else{let d="";l.getData("text/html")?d=iS(l.getData("text/html")):l.getData("text/plain")&&(d=nS(l.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(d)}const u=new xt(this,"inputTransformation");this.fire(u,{content:c,dataTransfer:l,targetRanges:a.targetRanges,method:a.method}),u.stop.called&&r.stop(),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(r,a)=>{if(a.content.isEmpty)return;const c=this.editor.data.toModel(a.content,"$clipboardHolder");c.childCount!=0&&(r.stop(),t.change(()=>{this.fire("contentInsertion",{content:c,method:a.method,dataTransfer:a.dataTransfer,targetRanges:a.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(r,a)=>{a.resultRange=o._pasteFragmentWithMarkers(a.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,s=e.editing.view.document,o=(r,a)=>{const l=a.dataTransfer;a.preventDefault(),this._fireOutputTransformationEvent(l,t.selection,r.name)};this.listenTo(s,"copy",o,{priority:"low"}),this.listenTo(s,"cut",(r,a)=>{e.model.canEditAt(e.model.document.selection)?o(r,a):a.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(r,a)=>{const l=e.data.toView(a.content);s.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:l,method:a.method})},{priority:"low"}),this.listenTo(s,"clipboardOutput",(r,a)=>{a.content.isEmpty||(a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content)),a.dataTransfer.setData("text/plain",ag(a.content))),a.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}/**
826 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
827 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
828 */class lg{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(n,s)=>{s.isLocal&&s.isUndoable&&s!==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)}}/**
829 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
830 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
831 */class oS extends R{constructor(e,t){super(e),this._buffer=new lg(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,s=e.text||"",o=s.length;let r=n.selection;if(e.selection?r=e.selection:e.range&&(r=t.createSelection(e.range)),!t.canEditAt(r))return;const a=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const c=Array.from(n.selection.getAttributes());t.deleteContent(r),s&&t.insertContent(l.createText(s,c),r),a?l.setSelection(a):r.is("documentSelection")||l.setSelection(r),this._buffer.unlock(),this._buffer.input(o)})}}/**
832 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
833 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
834 */const Mu=["insertText","insertReplacementText"];class rS extends pt{constructor(e){super(e),this.focusObserver=e.getObserver(wo),B.isAndroid&&Mu.push("insertCompositionText");const t=e.document;t.on("beforeinput",(n,s)=>{if(!this.isEnabled)return;const{data:o,targetRanges:r,inputType:a,domEvent:l}=s;if(!Mu.includes(a))return;this.focusObserver.flush();const c=new xt(t,"insertText");t.fire(c,new Qn(e,l,{text:o,selection:e.createSelection(r)})),c.stop.called&&n.stop()}),t.on("compositionend",(n,{data:s,domEvent:o})=>{!this.isEnabled||B.isAndroid||s&&t.fire("insertText",new Qn(e,o,{text:s,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}/**
835 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
836 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
837 */class cg extends b{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,n=e.editing.view,s=t.document.selection;n.addObserver(rS);const o=new oS(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",o),e.commands.add("input",o),this.listenTo(n.document,"insertText",(r,a)=>{n.document.isComposing||a.preventDefault();const{text:l,selection:c,resultRange:u}=a,d=Array.from(c.getRanges()).map(m=>e.editing.mapper.toModelRange(m));let h=l;if(B.isAndroid){const m=Array.from(d[0].getItems()).reduce((p,_)=>p+(_.is("$textProxy")?_.data:""),"");m&&(m.length<=h.length?h.startsWith(m)&&(h=h.substring(m.length),d[0].start=d[0].start.getShiftedBy(m.length)):m.startsWith(h)&&(d[0].start=d[0].start.getShiftedBy(h.length),h=""))}const f={text:h,selection:t.createSelection(d)};u&&(f.resultRange=e.editing.mapper.toModelRange(u)),e.execute("insertText",f),n.scrollToTheSelection()}),B.isAndroid?this.listenTo(n.document,"keydown",(r,a)=>{s.isCollapsed||a.keyCode!=229||!n.document.isComposing||Ou(t,o)}):this.listenTo(n.document,"compositionstart",()=>{s.isCollapsed||Ou(t,o)})}}function Ou(i,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),i.enqueueChange(t.batch,()=>{i.deleteContent(i.document.selection)}),t.unlock()}/**
838 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
839 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
840 */class Lu extends R{constructor(e,t){super(e),this.direction=t,this._buffer=new lg(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const o=s.createSelection(e.selection||n.selection);if(!t.canEditAt(o))return;const r=e.sequence||1,a=o.isCollapsed;if(o.isCollapsed&&t.modifySelection(o,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(o,r)){this.editor.execute("paragraph",{selection:o});return}if(o.isCollapsed)return;let l=0;
840o.getFirstRange().getMinimalFlatRanges().forEach(c=>{l+=Zr(c.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(o,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),s.setSelection(o),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,o=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(o))||!t.schema.checkChild(o,"paragraph"))return!1;const a=o.getChild(0);return!(a&&a.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,o=t.schema.getLimitElement(s),r=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(r,o),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),o=n.schema.getLimitElement(s),r=o.getChild(0);return!(s.parent!=r||!e.containsEntireContent(r)||!n.schema.checkChild(o,"paragraph")||r.name=="paragraph")}}/**
841 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
842 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
843 */const aS="character",Fu="word",lS="codePoint",$t="selection",zn="backward",xi="forward",ug={deleteContent:{unit:$t,direction:zn},deleteContentBackward:{unit:lS,direction:zn},deleteWordBackward:{unit:Fu,direction:zn},deleteHardLineBackward:{unit:$t,direction:zn},deleteSoftLineBackward:{unit:$t,direction:zn},deleteContentForward:{unit:aS,direction:xi},deleteWordForward:{unit:Fu,direction:xi},deleteHardLineForward:{unit:$t,direction:xi},deleteSoftLineForward:{unit:$t,direction:xi}};class cS extends pt{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:a,inputType:l}=o,c=ug[l];if(!c)return;const u={direction:c.direction,unit:c.unit,sequence:n};u.unit==$t&&(u.selectionToRemove=e.createSelection(r[0])),l==="deleteContentBackward"&&(B.isAndroid&&(u.sequence=1),dS(r)&&(u.unit=$t,u.selectionToRemove=e.createSelection(r)));const d=new li(t,"delete",r[0]);t.fire(d,new Qn(e,a,u)),d.stop.called&&s.stop()}),B.isBlink&&uS(this)}observe(){}stopObserving(){}}function uS(i){const e=i.view,t=e.document;let n=null,s=!1;t.on("keydown",(a,{keyCode:l})=>{n=l,s=!1}),t.on("keyup",(a,{keyCode:l,domEvent:c})=>{const u=t.selection,d=i.isEnabled&&l==n&&o(l)&&!u.isCollapsed&&!s;if(n=null,d){const h=u.getFirstRange(),f=new li(t,"delete",h),m={unit:$t,direction:r(l),selectionToRemove:u};t.fire(f,new Qn(e,c,m))}}),t.on("beforeinput",(a,{inputType:l})=>{const c=ug[l];o(n)&&c&&c.direction==r(n)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(a,{inputType:l,data:c})=>{n==F.delete&&l=="insertText"&&c=="�"&&a.stop()},{priority:"high"});function o(a){return a==F.backspace||a==F.delete}function r(a){return a==F.backspace?zn:xi}}function dS(i){if(i.length!=1||i[0].isCollapsed)return!1;const e=i[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:n,item:s}of e){if(n.parent.is("$text")){const o=n.parent.data,r=n.offset;if(Ja(o,r)||Za(o,r)||Vf(o,r))continue;t++}else(s.is("containerElement")||s.is("emptyElement"))&&t++;if(t>1)return!0}return!1}/**
844 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
845 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
846 */class Pt extends b{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,n=t.document,s=e.model.document;t.addObserver(cS),this._undoOnBackspace=!1;const o=new Lu(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new Lu(e,"backward")),this.listenTo(n,"delete",(r,a)=>{n.isComposing||a.preventDefault();const{direction:l,sequence:c,selectionToRemove:u,unit:d}=a,h=l==="forward"?"deleteForward":"delete",f={sequence:c};if(d=="selection"){const m=Array.from(u.getRanges()).map(p=>e.editing.mapper.toModelRange(p));f.selection=e.model.createSelection(m)}else f.unit=d;e.execute(h,f),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(r,a)=>
846{this._undoOnBackspace&&a.direction=="backward"&&a.sequence==1&&a.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),a.preventDefault(),r.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}/**
847 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
848 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
849 */class hS extends b{static get requires(){return[cg,Pt]}static get pluginName(){return"Typing"}}/**
850 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
851 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
852 */function dg(i,e){let t=i.start;return{text:Array.from(i.getWalker({ignoreElementEnd:!1})).reduce((s,{item:o})=>o.is("$text")||o.is("$textProxy")?s+o.data:(t=e.createPositionAfter(o),""),""),range:e.createRange(t,i.end)}}/**
853 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
854 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
855 */class hg extends W(){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 t=this.model.document;this.listenTo(t.selection,"change:range",(n,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(n,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,o=n.document.selection,r=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:a,range:l}=dg(r,n),c=this.testCallback(a);if(!c&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!c,c){const u=Object.assign(t,{text:a,range:l});typeof c=="object"&&Object.assign(u,c),this.fire(`matched:${e}`,u)}}}/**
856 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
857 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
858 */class ko extends b{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this._isNextGravityRestorationSkipped=!1,this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.locale,o=t.document.selection;this.listenTo(n.document,"arrowKey",(r,a)=>{if(!o.isCollapsed||a.shiftKey||a.altKey||a.ctrlKey)return;const l=a.keyCode==F.arrowright,c=a.keyCode==F.arrowleft;if(!l&&!c)return;const u=s.contentLanguageDirection;let d=!1;u==="ltr"&&l||u==="rtl"&&c?d=this._handleForwardMovement(a):d=this._handleBackwardMovement(a),d===!0&&r.stop()},{context:"$text",priority:"highest"}),this.listenTo(o,"change:range",(r,a)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!a.directChange&&qe(o.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,o=s.getFirstPosition();return this._isGravityOverridden||o.isAtStart&&_t(s,t)?!1:qe(o,t)?(_i(e),_t(s,t)&&qe(o,t,!0)?wi(n,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,o=s.getFirstPosition();return this._isGravityOverridden?(_i(e),this._restoreGravity(),qe(o,t,!0)?wi(n,t):Ps(n,t,o),!0):o.isAtStart?_t(s,t)?(_i(e),Ps(n,t,o),!0):!1:!_t(s,t)&&qe(o,t,!0)?(_i(e),Ps(n,t,o),!0):Nu(o,t)?o.isAtEnd&&!_t(s,t)&&qe(o,t)?(_i(e),Ps(n,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(ll);let o=!1;this.listenTo(s,"mousedown",()=>{o=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!o||(o=!1,!n.isCollapsed)||!_t(n,r))return;const a=n.getFirstPosition();qe(a,r)&&(a.isAtStart||qe(a,r,!0)?wi(t,r):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,n=t.document.selection,s=this.attributes;this.listenTo(t,"insertContent",()=>{const o=n.getFirstPosition();_t(n,s)&&qe(o,s)&&wi(t,s)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view;let o=!1,r=!1;this.listenTo(s.document,"delete",(a,l)=>{o=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!o)return;const a=n.getFirstPosition();r=_t(n,this.attributes)&&!Nu(a,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{o&&(o=!1,!r&&e.model.enqueueChange(()=>{const a=n.getFirstPosition();_t(n,this.attributes)&&qe(a,this.attributes)&&(a.isAtStart||qe(a,this.attributes,!0)?wi(t,this.attributes):this._isGravityOverridden||this._overrideGravity())}))},{priority:"low"})}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 _t(i,e){for(const t of e)if(i.hasAttribute(t))return!0;return!1}function Ps(i,e,t){const n=t.nodeBefore;i.change(s=>{if(n){const o=[],r=i.schema.isObject(n)&&i.schema.isInline(n);for(const[a,l]of n.getAttributes())i.schema.checkAttribute("$text",a)&&(!r||i.schema.getAttributeProperties(a).copyFromObject!==!1)&&o.push([a,l]);s.setSelectionAttribute(o)}else s.removeSelectionAttribute(e)})}function wi(i,e){i.change(t=>{t.removeSelectionAttribute(e)})}function _i(i){i.preventDefault()}function Nu(i,e){const t=i.getShiftedBy(-1);return qe(t,e)}function qe(i,e,t=!1){const{nodeBefore:n,nodeAfter:s}=i;for(const o of e){const r=n?n.getAttribute(o):void 0,a=s?s.getAttribute(o):void 0;if(!(t&&(r===void 0||a===void 0))&&a!==r)return!0}return!1}/**
859 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
860 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
861 */const Du={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:On('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:On("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:On("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:On('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:On('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:On("'"),to:[null,"‚",null,"’"]}},$u={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},fS=["symbols","mathematical","typography","quotes"];class mS extends b{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:fS}})}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,n=e.plugins.get("Delete"),s=wS(e.config.get("typing.transformations")),o=a=>{for(const l of s)if(l.from.test(a))return{normalizedTransformation:l}},r=new hg(e.model,o);r.on("matched:data",(a,l)=>{if(!l.batch.isTyping)return;const{from:c,to:u}=l.normalizedTransformation,d=c.exec(l.text),h=u(d.slice(1)),f=l.range;let m=d.index;t.enqueueChange(p=>{for(let _=1;_<d.length;_++){const v=d[_],T=h[_-1];if(T==null){m+=v.length;continue}const L=f.start.getShiftedBy(m),U=t.createRange(L,L.getShiftedBy(v.length)),K=bS(L);t.insertContent(p.createText(T,K),U),m+=T.length}t.enqueueChange(()=>{n.requestUndoOnBackspace()})})}),r.bind("isEnabled").to(this)}}function gS(i){return typeof i=="string"?new RegExp(`(${qa(i)})$`):i}function pS(i){return typeof i=="string"?()=>[i]:i instanceof Array?()=>i:i}function bS(i){return(i.textNode?i.textNode:i.nodeAfter).getAttributes()}function On(i){return new RegExp(`(^|\\s)(${i})([^${i}]*)(${i})$`)}function wS(i){const e=i.extra||[],t=i.remove||[],n=o=>!t.includes(o),s=i.include.concat(e).filter(n);return _S(s).filter(n).map(o=>
861typeof o=="string"&&Du[o]?Du[o]:o).filter(o=>typeof o=="object").map(o=>({from:gS(o.from),to:pS(o.to)}))}function _S(i){const e=new Set;for(const t of i)if(typeof t=="string"&&$u[t])for(const n of $u[t])e.add(n);else e.add(t);return Array.from(e)}/**
862 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
863 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
864 */function tr(i,e,t,n){return n.createRange(Uu(i,e,t,!0,n),Uu(i,e,t,!1,n))}function Uu(i,e,t,n,s){let o=i.textNode||(n?i.nodeBefore:i.nodeAfter),r=null;for(;o&&o.getAttribute(e)==t;)r=o,o=n?o.previousSibling:o.nextSibling;return r?s.createPositionAt(r,n?"before":"after"):i}/**
865 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
866 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
867 */function fg(i,e,t,n){const s=i.editing.view,o=new Set;s.document.registerPostFixer(r=>{const a=i.model.document.selection;let l=!1;if(a.hasAttribute(e)){const c=tr(a.getFirstPosition(),e,a.getAttribute(e),i.model),u=i.editing.mapper.toViewRange(c);for(const d of u.getItems())d.is("element",t)&&!d.hasClass(n)&&(r.addClass(n,d),o.add(d),l=!0)}return l}),i.conversion.for("editingDowncast").add(r=>{r.on("insert",a,{priority:"highest"}),r.on("remove",a,{priority:"highest"}),r.on("attribute",a,{priority:"highest"}),r.on("selection",a,{priority:"highest"});function a(){s.change(l=>{for(const c of o.values())l.removeClass(n,c),o.delete(c)})}})}/**
868 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
869 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
870 */function*mg(i,e){for(const t of e)t&&i.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}/**
871 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
872 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
873 */class yS extends R{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,s=t.schema,o=n.isCollapsed,r=n.getFirstRange(),a=r.start.parent,l=r.end.parent;if(s.isLimit(a)||s.isLimit(l))return!o&&a==l&&t.deleteContent(n),!1;if(o){const c=mg(e.model.schema,n.getAttributes());return Hu(e,r.start),e.setSelectionAttribute(c),!0}else{const c=!(r.start.isAtStart&&r.end.isAtEnd),u=a==l;if(t.deleteContent(n,{leaveUnmerged:c}),c){if(u)return Hu(e,n.focus),!0;e.setSelection(l,0)}}return!1}}function Hu(i,e){i.split(e),i.setSelection(e.parent.nextSibling,0)}/**
874 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
875 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
876 */const vS={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class gg extends pt{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(s,o)=>{n=o.shiftKey}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;let r=o.inputType;B.isSafari&&n&&r=="insertParagraph"&&(r="insertLineBreak");const a=o.domEvent,l=vS[r];if(!l)return;const c=new li(t,"enter",o.targetRanges[0]);t.fire(c,new Qn(e,a,{isSoft:l.isSoft})),c.stop.called&&s.stop()})}observe(){}stopObserving(){}}/**
877 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
878 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
879 */class nr extends b{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,n=t.document,s=this.editor.t;t.addObserver(gg),e.commands.add("enter",new yS(e)),this.listenTo(n,"enter",(o,r)=>{n.isComposing||r.preventDefault(),!r.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}/**
880 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
881 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
882 */class kS extends R{execute(){const e=this.editor.model,t=e.document;e.change(n=>
882{TS(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=CS(e.schema,t.selection)}}function CS(i,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!i.checkChild(t,"softBreak"))return!1;const n=e.getFirstRange(),s=n.start.parent,o=n.end.parent;return!((da(s,i)||da(o,i))&&s!==o)}function TS(i,e,t){const n=t.isCollapsed,s=t.getFirstRange(),o=s.start.parent,r=s.end.parent,a=o==r;if(n){const l=mg(i.schema,t.getAttributes());zu(i,e,s.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(l)}else{const l=!(s.start.isAtStart&&s.end.isAtEnd);i.deleteContent(t,{leaveUnmerged:l}),a?zu(i,e,t.focus):l&&e.setSelection(r,0)}}function zu(i,e,t){const n=e.createElement("softBreak");i.insertContent(n,t),e.setSelection(n,"after")}function da(i,e){return i.is("rootElement")?!1:e.isLimit(i)||da(i.parent,e)}/**
883 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
884 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
885 */class pg extends b{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,n=e.conversion,s=e.editing.view,o=s.document,r=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(a,{writer:l})=>l.createEmptyElement("br")}),s.addObserver(gg),e.commands.add("shiftEnter",new kS(e)),this.listenTo(o,"enter",(a,l)=>{o.isComposing||l.preventDefault(),l.isSoft&&(e.execute("shiftEnter"),s.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Insert a soft break (a <code>&lt;br&gt;</code> element)"),keystroke:"Shift+Enter"}]})}}/**
886 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
887 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
888 */class ES extends G(){constructor(){super(...arguments),this._stack=[]}add(e,t){const n=this._stack,s=n[0];this._insertDescriptor(e);const o=n[0];s!==o&&!Pr(s,o)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:o,writer:t})}remove(e,t){const n=this._stack,s=n[0];this._removeDescriptor(e);const o=n[0];s!==o&&!Pr(s,o)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex(o=>o.id===e.id);if(Pr(e,t[n]))return;n>-1&&t.splice(n,1);let s=0;for(;t[s]&&AS(t[s],e);)s++;t.splice(s,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex(s=>s.id===e);n>-1&&t.splice(n,1)}}function Pr(i,e){return i&&e&&i.priority==e.priority&&Co(i.classes)==Co(e.classes)}function AS(i,e){return i.priority>e.priority?!0:i.priority<e.priority?!1:Co(i.classes)>Co(e.classes)}function Co(i){return Array.isArray(i)?i.sort().join(","):i}const xS='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>';/**
889 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
890 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
891 */const SS="ck-widget",Wu="ck-widget_selected";function ce(i){return i.is("element")?!!i.getCustomProperty("widget"):!1}function ms(i,e,t={}){if(!i.is("containerElement"))throw new g("widget-to-widget-wrong-element-type",null,{element:i});return e.setAttribute("contenteditable","false",i),e.addClass(SS,i),e.setCustomProperty("widget",!0,i),i.getFillerOffset=BS,e.setCustomProperty("widgetLabel",[],i),t.label&&RS(i,t.label),t.hasSelectionHandle&&MS(i,e),bg(i,e),i}function IS(i,e,t){if(e.classes&&t.addClass(J(e.classes),i),e.attributes)for(const n in e.attributes)t.setAttribute(n,e.attributes[n],i)}function PS(i,e,t){if(e.classes&&t.removeClass(J(e.classes),i),e.attributes)for(const n in e.attributes)t.removeAttribute(n,i)}function bg(i,e,t=IS,n=PS){const s=new ES;s.on("change:top",(a,l)=>{l.oldDescriptor&&n(i,l.oldDescriptor,l.writer),l.newDescriptor&&t(i,l.newDescriptor,l.writer)});const o=(a,l,c)=>
891s.add(l,c),r=(a,l,c)=>s.remove(l,c);e.setCustomProperty("addHighlight",o,i),e.setCustomProperty("removeHighlight",r,i)}function RS(i,e){i.getCustomProperty("widgetLabel").push(e)}function VS(i){return i.getCustomProperty("widgetLabel").reduce((t,n)=>typeof n=="function"?t?t+". "+n():n():t?t+". "+n:n,"")}function wg(i,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],i),e.setAttribute("role","textbox",i),e.setAttribute("tabindex","-1",i),t.label&&e.setAttribute("aria-label",t.label,i),e.setAttribute("contenteditable",i.isReadOnly?"false":"true",i),i.on("change:isReadOnly",(n,s,o)=>{e.setAttribute("contenteditable",o?"false":"true",i)}),i.on("change:isFocused",(n,s,o)=>{o?e.addClass("ck-editor__nested-editable_focused",i):e.removeClass("ck-editor__nested-editable_focused",i)}),bg(i,e),i}function ir(i,e){const t=i.getSelectedElement();if(t){const n=Nt(i);if(n)return e.createRange(e.createPositionAt(t,n))}return e.schema.findOptimalInsertionRange(i)}function BS(){return null}function MS(i,e){const t=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(n){const s=this.toDomElement(n),o=new lt;return o.set("content",xS),o.render(),s.appendChild(o.element),s});e.insert(e.createPositionAt(i,0),t),e.addClass(["ck-widget_with-selection-handle"],i)}/**
892 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
893 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
894 */const vt="widget-type-around";function tn(i,e,t){return!!i&&ce(i)&&!t.isInline(e)}function OS(i){return i.closest(".ck-widget__type-around__button")}function LS(i){return i.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function FS(i,e){const t=i.closest(".ck-widget");return e.mapDomToView(t)}function Nt(i){return i.getAttribute(vt)}const NS='<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>';/**
895 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
896 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
897 */const _g=["before","after"],DS=new DOMParser().parseFromString(NS,"image/svg+xml").firstChild,qu="ck-widget__type-around_disabled";class $S extends b{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[nr,Pt]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(n,s,o)=>{t.change(r=>{for(const a of t.document.roots)o?r.removeClass(qu,a):r.addClass(qu,a)}),o||e.model.change(r=>{r.removeSelectionAttribute(vt)})}),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 n=this.editor,s=n.editing.view,o=n.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(e,t),attributes:o}),s.focus(),s.scrollToTheSelection()}_listenToIfEnabled(e,t,n,s){this.listenTo(e,t,(...o)=>{this.isEnabled&&n(...o)},s)}_insertParagraphAccordingToFakeCaretPosition(){const n=this.editor.model.document.selection,s=Nt(n);if(!s)return!1;const o=n.getSelectedElement();return this._insertParagraph(o,s),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,n=e.locale.t,s={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(o,r,a)=>{const l=a.mapper.toViewElement(r.item);l&&tn(l,r.item,t)&&(US(a.writer,s,l),l.getCustomProperty("widgetLabel").push(()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,n=t.document.selection,s=t.schema,o=e.editing.view;this._listenToIfEnabled(o.document,"arrowKey",(a,l)=>{this._handleArrowKeyPress(a,l)},{context:[ce,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",(a,l)=>{l.directChange&&e.model.change(c=>{c.removeSelectionAttribute(vt)})}),this._listenToIfEnabled(t.document,"change:data",()=>
897{const a=n.getSelectedElement();if(a){const l=e.editing.mapper.toViewElement(a);if(tn(l,a,s))return}e.model.change(l=>{l.removeSelectionAttribute(vt)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(a,l,c)=>{const u=c.writer;if(this._currentFakeCaretModelElement){const m=c.mapper.toViewElement(this._currentFakeCaretModelElement);m&&(u.removeClass(_g.map(r),m),this._currentFakeCaretModelElement=null)}const d=l.selection.getSelectedElement();if(!d)return;const h=c.mapper.toViewElement(d);if(!tn(h,d,s))return;const f=Nt(l.selection);f&&(u.addClass(r(f),h),this._currentFakeCaretModelElement=d)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(a,l,c)=>{c||e.model.change(u=>{u.removeSelectionAttribute(vt)})});function r(a){return`ck-widget_type-around_show-fake-caret_${a}`}}_handleArrowKeyPress(e,t){const n=this.editor,s=n.model,o=s.document.selection,r=s.schema,a=n.editing.view,l=t.keyCode,c=Ev(l,n.locale.contentLanguageDirection),u=a.document.selection.getSelectedElement(),d=n.editing.mapper.toModelElement(u);let h;tn(u,d,r)?h=this._handleArrowKeyPressOnSelectedWidget(c):o.isCollapsed?h=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(h=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),h&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const n=this.editor.model,s=n.document.selection,o=Nt(s);return n.change(r=>{if(o){if(!(o===(e?"after":"before")))return r.removeSelectionAttribute(vt),!0}else return r.setSelectionAttribute(vt,e?"after":"before"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,n=t.model,s=n.schema,o=t.plugins.get("Widget"),r=o._getObjectElementNextToSelection(e),a=t.editing.mapper.toViewElement(r);return tn(a,r,s)?(n.change(l=>{o._setSelectionOverElement(r),l.setSelectionAttribute(vt,e?"before":"after")}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,n=t.model,s=n.schema,o=t.editing.mapper,r=n.document.selection,a=e?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter,l=o.toViewElement(a);return tn(l,a,s)?(n.change(c=>{c.setSelection(a,"on"),c.setSelectionAttribute(vt,e?"after":"before")}),!0):!1}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(n,s)=>{const o=OS(s.domTarget);if(!o)return;const r=LS(o),a=FS(o,t.domConverter),l=e.editing.mapper.toModelElement(a);this._insertParagraph(l,r),s.preventDefault(),n.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,n=e.editing.view;this._listenToIfEnabled(n.document,"enter",(s,o)=>{if(s.eventPhase!="atTarget")return;const r=t.getSelectedElement(),a=e.editing.mapper.toViewElement(r),l=e.model.schema;let c;this._insertParagraphAccordingToFakeCaretPosition()?c=!0:tn(a,r,l)&&(this._insertParagraph(r,o.isSoft?"before":"after"),c=!0),c&&(o.preventDefault(),s.stop())},{context:ce})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",(n,s)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(s.selection=t.selection)},{priority:"high"}),B.isAndroid?this._listenToIfEnabled(t,"keydown",(n,s)=>{s.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(t,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,n=e.model,s=n.schema;this._listenToIfEnabled(t.document,"delete",(o,r)=>{if(o.eventPhase!="atTarget")return;const a=Nt(n.document.selection);if(!a)return;const l=r.direction,c=n.document.selection.getSelectedElement(),u=a==="before",d=l=="forward";if(u===d)e.execute("delete",{selection:n.createSelection(c,"on")});else{const f=s.getNearestSelectionRange(n.createPositionAt(c,a),l);if(f)if(!f.isCollapsed)n.change(m=>{m.setSelection(f),e.execute(d?"deleteForward":"delete")});else{const m=n.createSelection(f.start);if(n.modifySelection(m,{direction:l}),!m.focus.isEqual(f.start))n.change(p=>{p.setSelection(f),e.execute(d?"deleteForward":"delete")});else{const p=WS(s,f.start.parent);n.deleteContent(n.createSelection(p,"on"),{doNotAutoparagraph:!0})}}}r.preventDefault(),o.stop()},{context:ce})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(s,[o,r])=>
897{if(r&&!r.is("documentSelection"))return;const a=Nt(n);if(a)return s.stop(),t.change(l=>{const c=n.getSelectedElement(),u=t.createPositionAt(c,a),d=l.createSelection(u),h=t.insertContent(o,d);return l.setSelection(d),h})},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,n=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(s,o)=>{const[,r,a={}]=o;if(r&&!r.is("documentSelection"))return;const l=Nt(n);l&&(a.findOptimalPosition=l,o[3]=a)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,n=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(s,[o])=>{if(o&&!o.is("documentSelection"))return;Nt(n)&&s.stop()},{priority:"high"})}}function US(i,e,t){const n=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(s){const o=this.toDomElement(s);return HS(o,e),zS(o),o});i.insert(i.createPositionAt(t,"end"),n)}function HS(i,e){for(const t of _g){const n=new xe({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${t}`],title:e[t],"aria-hidden":"true"},children:[i.ownerDocument.importNode(DS,!0)]});i.appendChild(n.render())}}function zS(i){const e=new xe({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});i.appendChild(e.render())}function WS(i,e){let t=e;for(const n of e.getAncestors({parentFirst:!0})){if(n.childCount>1||i.isLimit(n))break;t=n}return t}/**
898 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
899 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
900 */function qS(i){const e=i.model;return(t,n)=>{const s=n.keyCode==F.arrowup,o=n.keyCode==F.arrowdown,r=n.shiftKey,a=e.document.selection;if(!s&&!o)return;const l=o;if(r&&KS(a,l))return;const c=jS(i,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(r)return}(c.isCollapsed||GS(i,c,l))&&(e.change(u=>{const d=l?c.end:c.start;if(r){const h=e.createSelection(a.anchor);h.setFocus(d),u.setSelection(h)}else u.setSelection(d)}),t.stop(),n.preventDefault(),n.stopPropagation())}}}function jS(i,e,t){const n=i.model;if(t){const s=e.isCollapsed?e.focus:e.getLastPosition(),o=ju(n,s,"forward");if(!o)return null;const r=n.createRange(s,o),a=Gu(n.schema,r,"backward");return a?n.createRange(s,a):null}else{const s=e.isCollapsed?e.focus:e.getFirstPosition(),o=ju(n,s,"backward");if(!o)return null;const r=n.createRange(o,s),a=Gu(n.schema,r,"forward");return a?n.createRange(a,s):null}}function ju(i,e,t){const n=i.schema,s=i.createRangeIn(e.root),o=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:r,item:a,type:l}of s.getWalker({startPosition:e,direction:t})){if(n.isLimit(a)&&!n.isInline(a))return r;if(l==o&&n.isBlock(a))return null}return null}function Gu(i,e,t){const n=t=="backward"?e.end:e.start;if(i.checkChild(n,"$text"))return n;for(const{nextPosition:s}of e.getWalker({direction:t}))if(i.checkChild(s,"$text"))return s;return null}function GS(i,e,t){const n=i.model,s=i.view.domConverter;if(t){const c=n.createSelection(e.start);n.modifySelection(c),!c.focus.isAtEnd&&!e.start.isEqual(c.focus)&&(e=n.createRange(c.focus,e.end))}const o=i.mapper.toViewRange(e),r=s.viewRangeToDom(o),a=O.getDomRangeRects(r);let l;for(const c of a){if(l===void 0){l=Math.round(c.bottom);continue}if(Math.round(c.top)>=l)return!1;l=Math.max(l,Math.round(c.bottom))}return!0}function KS(i,e){return!i.isCollapsed&&i.isBackward==e}/**
901 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
902 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
903 */class Cn extends b{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[$S,Pt]}init(){const e=this.editor,t=e.editing.view,n=t.document,s=e.t;this.editor.editing.downcastDispatcher.on("selection",(o,r,a)=>{const l=a.writer,c=r.selection;if(c.isCollapsed)return;const u=c.getSelectedElement();if(!u)return;const d=e.editing.mapper.toViewElement(u);ce(d)&&a.consumable.consume(c,"selection")&&l.setSelection(l.createRangeOn(d),{fake:!0,label:VS(d)})}),this.editor.editing.downcastDispatcher.on("selection",(o,r,a)=>{this._clearPreviouslySelectedWidgets(a.writer);const l=a.writer,c=l.document.selection;let u=null;for(const d of c.getRanges())for(const h of d){const f=h.item;ce(f)&&!ZS(f,u)&&(l.addClass(Wu,f),this._previouslySelected.add(f),u=f)}},{priority:"low"}),t.addObserver(ll),this.listenTo(n,"mousedown",(...o)=>this._onMousedown(...o)),this.listenTo(n,"arrowKey",(...o)=>
903{this._handleSelectionChangeOnArrowKeyPress(...o)},{context:[ce,"$text"]}),this.listenTo(n,"arrowKey",(...o)=>{this._preventDefaultOnArrowKeyPress(...o)},{context:"$root"}),this.listenTo(n,"arrowKey",qS(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",(o,r)=>{this._handleDelete(r.direction=="forward")&&(r.preventDefault(),o.stop())},{context:"$root"}),this.listenTo(n,"tab",(o,r)=>{o.eventPhase=="atTarget"&&(r.shiftKey||this._selectFirstNestedEditable()&&(r.preventDefault(),o.stop()))},{context:ce,priority:"low"}),this.listenTo(n,"tab",(o,r)=>{r.shiftKey&&this._selectAncestorWidget()&&(r.preventDefault(),o.stop())},{priority:"low"}),this.listenTo(n,"keydown",(o,r)=>{r.keystroke==F.esc&&this._selectAncestorWidget()&&(r.preventDefault(),o.stop())},{priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:s("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:s("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:s("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:s("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:s("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){const n=this.editor,s=n.editing.view,o=s.document;let r=t.target;if(t.domEvent.detail>=3){this._selectBlockContent(r)&&t.preventDefault();return}if(JS(r)||!ce(r)&&(r=r.findAncestor(ce),!r))return;B.isAndroid&&t.preventDefault(),o.isFocused||s.focus();const a=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(a)}_selectBlockContent(e){const t=this.editor,n=t.model,s=t.editing.mapper,o=n.schema,r=s.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),a=QS(s.toModelElement(r),n.schema);return a?(n.change(l=>{const c=o.isLimit(a)?null:YS(l.createPositionAfter(a),o),u=l.createPositionAt(a,0),d=c?l.createPositionAt(c,0):l.createPositionAt(a,"end");l.setSelection(l.createRange(u,d))}),!0):!1}_handleSelectionChangeOnArrowKeyPress(e,t){const n=t.keyCode,s=this.editor.model,o=s.schema,r=s.document.selection,a=r.getSelectedElement(),l=Wo(n,this.editor.locale.contentLanguageDirection),c=l=="down"||l=="right",u=l=="up"||l=="down";if(a&&o.isObject(a)){const h=c?r.getLastPosition():r.getFirstPosition(),f=o.getNearestSelectionRange(h,c?"forward":"backward");f&&(s.change(m=>{m.setSelection(f)}),t.preventDefault(),e.stop());return}if(!r.isCollapsed&&!t.shiftKey){const h=r.getFirstPosition(),f=r.getLastPosition(),m=h.nodeAfter,p=f.nodeBefore;(m&&o.isObject(m)||p&&o.isObject(p))&&(s.change(_=>{_.setSelection(c?f:h)}),t.preventDefault(),e.stop());return}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&u)return;this._setSelectionOverElement(d),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const n=this.editor.model,s=n.schema,o=n.document.selection.getSelectedElement();o&&s.isObject(o)&&(t.preventDefault(),e.stop())}_handleDelete(e){const n=this.editor.model.document.selection;if(!this.editor.model.canEditAt(n)||!n.isCollapsed)return;const s=this._getObjectElementNextToSelection(e);if(s)return this.editor.model.change(o=>{let r=n.anchor.parent;for(;r.isEmpty;){const a=r;r=a.parent,o.remove(a)}this._setSelectionOverElement(s)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,s=t.document.selection,o=t.createSelection(s);if(t.modifySelection(o,{direction:e?"forward":"backward"}),o.isEqual(s))return null;const r=e?o.focus.nodeBefore:o.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Wu,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,n=this.editor.editing.view.document;for(const s of n.selection.getFirstRange().getItems())if(s.is("editableElement")){const o=e.editing.mapper.toModelElement(s);/* istanbul ignore next -- @preserve */if(!o)continue;const r=e.model.createPositionAt(o,0),a=e.model.schema.getNearestSelectionRange(r,"forward");return e.model.change(l=>{l.setSelection(a)}),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,s=e.editing.view.document.selection.getFirstPosition().parent,r=(s.is("$text")?s.parent:s).findAnce
903stor(ce);if(!r)return!1;const a=t.toModelElement(r);/* istanbul ignore next -- @preserve */return a?(e.model.change(l=>{l.setSelection(a,"on")}),!0):!1}}function JS(i){let e=i;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(ce(e))return!1;e=e.parent}return!1}function ZS(i,e){return e?Array.from(i.getAncestors()).includes(e):!1}function QS(i,e){for(const t of i.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(t,"$text"))return t;if(e.isLimit(t)&&!e.isObject(t))break}return null}function YS(i,e){const t=new Tt({startPosition:i});for(const{item:n}of t){if(e.isLimit(n)||!n.is("element"))return null;if(e.checkChild(n,"$text"))return n}return null}/**
904 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
905 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
906 */class To extends b{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[qt]}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",n=>{XS(e.editing.view.document.selection)&&n.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:n,getRelatedElement:s,balloonClassName:o="ck-toolbar-container"}){if(!n.length){N("widget-toolbar-no-items",{toolbarId:e});return}const r=this.editor,a=r.t,l=new Xn(r.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new g("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:s,balloonClassName:o,itemsConfig:n,initialized:!1};r.ui.addToolbar(l,{isContextual:!0,beforeFocus:()=>{const u=s(r.editing.view.document.selection);u&&this._showToolbar(c,u)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(e,c)}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(const s of this._toolbarDefinitions.values()){const o=s.getRelatedElement(this.editor.editing.view.document.selection);if(!this.isEnabled||!o)this._isToolbarInBalloon(s)&&this._hideToolbar(s);else if(!this.editor.ui.focusTracker.isFocused)this._isToolbarVisible(s)&&this._hideToolbar(s);else{const r=o.getAncestors().length;r>e&&(e=r,t=o,n=s)}}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Ku(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:yg(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const n of this._toolbarDefinitions.values())if(this._isToolbarVisible(n)){const s=n.getRelatedElement(this.editor.editing.view.document.selection);Ku(this.editor,s)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Ku(i,e){const t=i.plugins.get("ContextualBalloon"),n=yg(i,e);t.updatePosition(n)}function yg(i,e){const t=i.editing.view,n=ye.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}function XS(i){const e=i.getSelectedElement();return!!(e&&ce(e))}/**
907 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
908 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
909 *//* istanbul ignore file -- @preserve */const Rr=ri("px");class e5 extends C{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=>Rr(t)),top:e.to("top",t=>Rr(t)),width:e.to("width",t=>Rr(t))}}})}}/**
910 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
911 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
912 */class Rs extends b{constructor(){super(...arguments),this.removeDropMarkerDelayed=Ka(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=qi(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=qi(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new e5,this._domEmitter=new(Qe()),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,n,s,o,r){this.removeDropMarkerDelayed.cancel();const a=Ju(this.editor,e,t,n,s,o,r);/* istanbul ignore next -- @preserve */if(a){if(r&&r.containsRange(a))return this.removeDropMarker();this._updateDropMarkerThrottled(a)}}getFinalDropRange(e,t,n,s,o,r){const a=Ju(this.editor,e,t,n,s,o,r);return this.removeDropMarker(),a}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
912:n})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,n=t.model.markers;t.model.change(s=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(e)||s.updateMarker("drop-target",{range:e}):s.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 n=this.toDomElement(t);return n.append("⁠",t.createElement("span"),"⁠"),n})}_updateDropTargetLine(e){const t=this.editor.editing,n=e.start.nodeBefore,s=e.start.nodeAfter,o=e.start.parent,r=n?t.mapper.toViewElement(n):null,a=r?t.view.domConverter.mapViewToDom(r):null,l=s?t.mapper.toViewElement(s):null,c=l?t.view.domConverter.mapViewToDom(l):null,u=t.mapper.toViewElement(o);if(!u)return;const d=t.view.domConverter.mapViewToDom(u),h=this._getScrollableRect(u),{scrollX:f,scrollY:m}=A.window,p=a?new O(a):null,_=c?new O(c):null,v=new O(d).excludeScrollbarsAndBorders(),T=p?p.bottom:v.top,L=_?_.top:v.bottom,U=A.window.getComputedStyle(d),K=T<=L?(T+L)/2:L;if(h.top<K&&K<h.bottom){const x=v.left+parseFloat(U.paddingLeft),V=v.right-parseFloat(U.paddingRight),I=Math.max(x+f,h.left),ee=Math.min(V+f,h.right);this._dropTargetLineView.set({isVisible:!0,left:I,top:K+m,width:ee-I})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let n;if(this._scrollables.has(t))n=this._scrollables.get(t).domElement;else{const s=this.editor.editing.view.domConverter.mapViewToDom(e);n=n5(s),this._domEmitter.listenTo(n,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const o=new X(n,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:n,resizeObserver:o})}return new O(n).excludeScrollbarsAndBorders()}}function Ju(i,e,t,n,s,o,r){const a=i.model,l=i.editing.mapper;let u=Zu(i,e);for(;u;){if(!o){if(a.schema.checkChild(u,"$text")){if(t){const d=t[0].start,h=l.toModelPosition(d);if(!r||Array.from(r.getItems()).every(m=>a.schema.checkChild(h,m))){if(a.schema.checkChild(h,"$text"))return a.createRange(h);if(d)return Vs(i,Zu(i,d.parent),n,s)}}}else if(a.schema.isInline(u))return Vs(i,u,n,s)}if(a.schema.isBlock(u))return Vs(i,u,n,s);if(a.schema.checkChild(u,"$block")){const d=Array.from(u.getChildren()).filter(m=>m.is("element")&&!t5(i,m));let h=0,f=d.length;if(f==0)return a.createRange(a.createPositionAt(u,"end"));for(;h<f-1;){const m=Math.floor((h+f)/2);vg(i,d[m],n,s)=="before"?f=m:h=m}return Vs(i,d[h],n,s)}u=u.parent}return null}function t5(i,e){const t=i.editing.mapper,n=i.editing.view.domConverter,s=t.toViewElement(e);if(!s)return!0;const o=n.mapViewToDom(s);return A.window.getComputedStyle(o).float!="none"}function Vs(i,e,t,n){const s=i.model;return s.createRange(s.createPositionAt(e,vg(i,e,t,n)))}function vg(i,e,t,n){const s=i.editing.mapper,o=i.editing.view.domConverter,r=s.toViewElement(e),a=o.mapViewToDom(r),l=new O(a);return i.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":n<(l.top+l.bottom)/2?"before":"after"}function Zu(i,e){const t=i.editing.mapper,n=i.editing.view,s=t.toModelElement(e);if(s)return s;const o=n.createPositionBefore(e),r=t.findMappedViewAncestor(o);return t.toModelElement(r)}function n5(i){let e=i;do{e=e.parentElement;const t=A.window.getComputedStyle(e).overflowY;if(t=="auto"||t=="scroll")break}while(e.tagName!="BODY");return e}/**
913 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
914 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
915 */class i5 extends b{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(Qe())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,n,s)=>{s?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),B.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const n=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(n,"dragstart",(s,o)=>this._handleBlockDragStart(o)),this._domEmitter.listenTo(A.document,"dragover",(s,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(A.document,"drop",(s,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(A.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&n.setAttribute("draggable","true"),this.on("change:isEnabled",(s,o,r)=>
915{n.setAttribute("draggable",r?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,n=t.document.selection,s=this.editor.editing.view,o=Array.from(n.getSelectedBlocks()),r=t.createRange(t.createPositionBefore(o[0]),t.createPositionAfter(o[o.length-1]));t.change(a=>a.setSelection(r)),this._isBlockDragging=!0,s.focus(),s.getObserver(is).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),n=e.clientY,s=document.elementFromPoint(t,n),o=this.editor.editing.view;!s||!s.closest(".ck-editor__editable")||o.getObserver(is).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:s,clientX:t,clientY:n,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}/**
916 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
917 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
918 */class s5 extends b{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=Ka(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(Qe())}static get pluginName(){return"DragDrop"}static get requires(){return[Je,Cn,Rs,i5]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(is),t.addObserver(ll),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(n,s,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(n,s,o)=>{o||this._finalizeDragging(!1)}),B.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,n=e.editing.view,s=n.document,o=e.plugins.get(Rs);this.listenTo(s,"dragstart",(r,a)=>{if(a.target&&a.target.is("editableElement")){a.preventDefault();return}if(this._prepareDraggedRange(a.target),!this._draggedRange){a.preventDefault();return}this._draggingUid=$e(),a.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",a.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(a.dataTransfer,l,"dragstart");const{dataTransfer:u,domTarget:d,domEvent:h}=a,{clientX:f}=h;this._updatePreview({dataTransfer:u,domTarget:d,clientX:f}),a.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(s,"dragend",(r,a)=>{this._finalizeDragging(!a.dataTransfer.isCanceled&&a.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(A.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(s,"dragenter",()=>{this.isEnabled&&n.focus()}),this.listenTo(s,"dragleave",()=>{o.removeDropMarkerDelayed()}),this.listenTo(s,"dragging",(r,a)=>{if(!this.isEnabled){a.dataTransfer.dropEffect="none";return}const{clientX:l,clientY:c}=a.domEvent;o.updateDropMarker(a.target,a.targetRanges,l,c,this._blockMode,this._draggedRange),this._draggedRange||(a.dataTransfer.dropEffect="copy"),B.isGecko||(a.dataTransfer.effectAllowed=="copy"?a.dataTransfer.dropEffect="copy":["all","copyMove"].includes(a.dataTransfer.effectAllowed)&&(a.dataTransfer.dropEffect="move")),r.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,n=e.editing.view.document,s=e.plugins.get(Rs);this.listenTo(n,"clipboardInput",(o,r)=>{if(r.method!="drop")return;const{clientX:a,clientY:l}=r.domEvent,c=s.getFinalDropRange(r.target,r.targetRanges,a,l,this._blockMode,this._draggedRange);
918if(!c){this._finalizeDragging(!1),o.stop();return}if(this._draggedRange&&this._draggingUid!=r.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),Qu(r.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(c,!0)){this._finalizeDragging(!1),o.stop();return}r.targetRanges=[e.editing.mapper.toViewRange(c)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Je);e.on("contentInsertion",(t,n)=>{if(!this.isEnabled||n.method!=="drop")return;const s=n.targetRanges.map(o=>this.editor.editing.mapper.toModelRange(o));this.editor.model.change(o=>o.setSelection(s))},{priority:"high"}),e.on("contentInsertion",(t,n)=>{if(!this.isEnabled||n.method!=="drop")return;const s=Qu(n.dataTransfer)=="move",o=!n.resultRange||!n.resultRange.isCollapsed;this._finalizeDragging(o&&s)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,"mousedown",(s,o)=>{if(B.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=Yu(o.target);if(B.isBlink&&!e.isReadOnly&&!r&&!n.selection.isCollapsed){const a=n.selection.getSelectedElement();(!a||!ce(a))&&(r=n.selection.editableElement)}r&&(t.change(a=>{a.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(n,"mouseup",()=>{B.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,n=t.model;t.plugins.get(Rs).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&&n.change(o=>{const r=n.createSelection(this._draggedRange);n.deleteContent(r,{doNotAutoparagraph:!0});const a=r.getFirstPosition().parent;a.isEmpty&&!n.schema.checkChild(a,"$text")&&n.schema.checkChild(a,"paragraph")&&o.insertElement("paragraph",a,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,n=t.model,s=n.document.selection,o=e?Yu(e):null;if(o){const c=t.editing.mapper.toModelElement(o);this._draggedRange=Fe.fromRange(n.createRangeOn(c)),this._blockMode=n.schema.isBlock(c),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(s.isCollapsed&&!s.getFirstPosition().parent.isEmpty)return;const r=Array.from(s.getSelectedBlocks()),a=s.getFirstRange();if(r.length==0){this._draggedRange=Fe.fromRange(a);return}const l=kg(n,r);if(r.length>1)this._draggedRange=Fe.fromRange(l),this._blockMode=!0;else if(r.length==1){const c=a.start.isTouching(l.start)&&a.end.isTouching(l.end);this._draggedRange=Fe.fromRange(c?l:a),this._blockMode=c}n.change(c=>c.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:n}){const s=this.editor.editing.view,o=s.document.selection.editableElement,r=s.domConverter.mapViewToDom(o),a=A.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Ve(A.document,"div",{style:"position: fixed; left: -999999px;"}),A.document.body.appendChild(this._previewContainer));const l=new O(r);if(r.contains(t))return;const c=parseFloat(a.paddingLeft),u=Ve(A.document,"div");u.className="ck ck-content",u.style.width=a.width,u.style.paddingLeft=`${l.left-n+c}px`,B.isiOS&&(u.style.backgroundColor="white"),u.innerHTML=e.getData("text/html"),e.setDragImage(u,0,0),this._previewContainer.appendChild(u)}}function Qu(i){return B.isGecko?i.dropEffect:["all","copyMove"].includes(i.effectAllowed)?"move":"copy"}function Yu(i){if(i.is("editableElement"))return null;
918if(i.hasClass("ck-widget__selection-handle"))return i.findAncestor(ce);if(ce(i))return i;const e=i.findAncestor(t=>ce(t)||t.is("editableElement"));return ce(e)?e:null}function kg(i,e){const t=e[0],n=e[e.length-1],s=t.getCommonAncestor(n),o=i.createPositionBefore(t),r=i.createPositionAfter(n);if(s&&s.is("element")&&!i.schema.isLimit(s)){const a=i.createRangeOn(s),l=o.isTouching(a.start),c=r.isTouching(a.end);if(l&&c)return kg(i,[s])}return i.createRange(o,r)}/**
919 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
920 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
921 */class o5 extends b{static get pluginName(){return"PastePlainText"}static get requires(){return[Je]}init(){const e=this.editor,t=e.model,n=e.editing.view,s=n.document,o=t.document.selection;let r=!1;n.addObserver(is),this.listenTo(s,"keydown",(a,l)=>{r=l.shiftKey}),e.plugins.get(Je).on("contentInsertion",(a,l)=>{!r&&!r5(l.content,t.schema)||t.change(c=>{const u=Array.from(o.getAttributes()).filter(([h])=>t.schema.getAttributeProperties(h).isFormatting);o.isCollapsed||t.deleteContent(o,{doNotAutoparagraph:!0}),u.push(...o.getAttributes());const d=c.createRangeIn(l.content);for(const h of d.getItems())h.is("$textProxy")&&c.setAttributes(u,h)})})}}function r5(i,e){if(i.childCount>1)return!1;const t=i.getChild(0);return e.isObject(t)?!1:Array.from(t.getAttributeKeys()).length==0}/**
922 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
923 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
924 */class Cg extends b{static get pluginName(){return"Clipboard"}static get requires(){return[Ni,Je,s5,o5]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}/**
925 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
926 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
927 */class a5 extends R{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!Xu(e.schema,n))do if(n=n.parent,!n)return;while(!Xu(e.schema,n));e.change(s=>{s.setSelection(n,"in")})}}function Xu(i,e){return i.isLimit(e)&&(i.checkChild(e,"$text")||i.checkChild(e,"paragraph"))}/**
928 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
929 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
930 */const l5=us("Ctrl+A");class c5 extends b{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.t,s=e.editing.view.document;e.commands.add("selectAll",new a5(e)),this.listenTo(s,"keydown",(o,r)=>{mn(r)===l5&&(e.execute("selectAll"),r.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}const u5='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>';/**
931 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
932 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
933 */class d5 extends b{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const t=this._createButton(P);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(Q))}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get("selectAll"),o=new e(t.locale),r=n.t;return o.set({label:r("Select all"),icon:u5,keystroke:"Ctrl+A"}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),o}}/**
934 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
935 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
936 */class h5 extends b{static get requires(){return[c5,d5]}static get pluginName(){return"SelectAll"}}/**
937 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
938 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
939 */class Tg extends R{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,n)=>{n[1]={...n[1]};const s=n[1];s.batchType||(s.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,n)=>{n[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,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const s=this.editor.model,o=s.document,r=[],a=e.map(c=>c.getTransformedByOperations(n)),l=a.flat();for(const c of a){const u=c.filter(d=>d.root!=o.graveyard).filter(d=>!m5(d,l));u.length&&(f5(u),r.push(u[0]))}r.length&&s.change(c=>{c.setSelection(r,{backward:t})})}_undo(e,t){const n=this.editor.model,s=n.document;this._createdBatches.add(t);const o=e.operations.slice().filter(r=>r.isDocumentOperation);o.reverse();for(const r of o){const a=r.baseVersion+1,l=Array.from(s.history.getOperations(a)),u=zT([r.getReversed()],l,{useRelations:!0,document:this.editor.model.document,forceWeakRemove:!0}).operationsA;for(let d of u){const h=d.affectedSelectable;h&&!n.canEditAt(h)&&(d=new fe(d.baseVersion)),t.addOperation(d),n.applyOperation(d),s.history.setOperationAsUndone(r,d)}}}}function f5(i){i.sort((e,t)=>
939e.start.isBefore(t.start)?-1:1);for(let e=1;e<i.length;e++){const n=i[e-1].getJoined(i[e],!0);n&&(e--,i.splice(e,2,n))}}function m5(i,e){return e.some(t=>t!==i&&t.containsRange(i,!0))}/**
940 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
941 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
942 */class g5 extends Tg{execute(e=null){const t=e?this._stack.findIndex(o=>o.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>{this._undo(n.batch,s);const o=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,o)}),this.fire("revert",n.batch,s),this.refresh()}}/**
943 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
944 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
945 */class p5 extends Tg{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const s=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(s);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}/**
946 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
947 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
948 */class b5 extends b{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor,t=e.t;this._undoCommand=new g5(e),this._redoCommand=new p5(e),e.commands.add("undo",this._und
948oCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(n,s)=>{const o=s[0];if(!o.isDocumentOperation)return;const r=o.batch,a=this._redoCommand.createdBatches.has(r),l=this._undoCommand.createdBatches.has(r);this._batchRegistry.has(r)||(this._batchRegistry.add(r),r.isUndoable&&(a?this._undoCommand.addBatch(r):l||(this._undoCommand.addBatch(r),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(n,s,o)=>{this._redoCommand.addBatch(o)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Undo"),keystroke:"CTRL+Z"},{label:t("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}/**
949 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
950 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
951 */class w5 extends b{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,n=e.t,s=t.uiLanguageDirection=="ltr"?E.undo:E.redo,o=t.uiLanguageDirection=="ltr"?E.redo:E.undo;this._addButtonsToFactory("undo",n("Undo"),"CTRL+Z",s),this._addButtonsToFactory("redo",n("Redo"),"CTRL+Y",o)}_addButtonsToFactory(e,t,n,s){const o=this.editor;o.ui.componentFactory.add(e,()=>{const r=this._createButton(P,e,t,n,s);return r.set({tooltip:!0}),r}),o.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(Q,e,t,n,s))}_createButton(e,t,n,s,o){const r=this.editor,a=r.locale,l=r.commands.get(t),c=new e(a);return c.set({label:n,icon:o,keystroke:s}),c.bind("isEnabled").to(l,"isEnabled"),this.listenTo(c,"execute",()=>{r.execute(t),r.editing.view.focus()}),c}}/**
952 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
953 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
954 */class Eg extends b{static get requires(){return[b5,w5]}static get pluginName(){return"Undo"}}/**
955 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
956 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
957 */class _5 extends b{static get requires(){return[nx,Cg,nr,h5,pg,hS,Eg]}static get pluginName(){return"Essentials"}}/**
958 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
959 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
960 */class y5 extends R{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document,n=ie(t.selection.getSelectedBlocks());this.value=!!n&&n.is("element","paragraph"),this.isEnabled=!!n&&ed(n,e.schema)}execute(e={}){const t=this.editor.model,n=t.document,s=e.selection||n.selection;t.canEditAt(s)&&t.change(o=>{const r=s.getSelectedBlocks();for(const a of r)!a.is("element","paragraph")&&ed(a,t.schema)&&o.rename(a,"paragraph")})}}function ed(i,e){return e.checkChild(i.parent,"paragraph")&&!e.isObject(i)}/**
961 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
962 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
963 */class v5 extends R{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,n=e.attributes;let s=e.position;t.canEditAt(s)&&t.change(o=>{if(s=this._findPositionToInsertParagraph(s,o),!s)return;const r=o.createElement("paragraph");n&&t.schema.setAllowedAttributes(r,n,o),t.insertContent(r,s),o.setSelection(r,"in")})}_findPositionToInsertParagraph(e,t){const n=this.editor.model;if(n.schema.checkChild(e,"paragraph"))return e;const s=n.schema.findAllowedParent(e,"paragraph");if(!s)return null;const o=e.parent,r=n.schema.checkChild(o,"$text");return o.isEmpty||r&&e.isAtEnd?n.createPositionAfter(o):!o.isEmpty&&r&&e.isAtStart?n.createPositionBefore(o):t.split(e,s).position}}/**
964 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
965 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
966 */class gs extends b{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new y5(e)),e.commands.add("insertParagraph",new v5(e)),t.schema.register("paragraph",{inheritAllFrom
966:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(n,{writer:s})=>!gs.paragraphLikeElements.has(n.name)||n.isEmpty?null:s.createElement("paragraph"),view:/.+/,converterPriority:"low"})}}gs.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);/**
967 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
968 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
969 */class k5 extends R{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=ie(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>td(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,n=t.document,s=e.value;t.change(o=>{const r=Array.from(n.selection.getSelectedBlocks()).filter(a=>td(a,s,t.schema));for(const a of r)a.is("element",s)||o.rename(a,s)})}}function td(i,e,t){return t.checkChild(i.parent,e)&&!t.isObject(i)}/**
970 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
971 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
972 */const nd="paragraph";class C5 extends b{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[gs]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),n.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new k5(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,o)=>{const r=e.model.document.selection.getFirstPosition().parent;n.some(l=>r.is("element",l.model))&&!r.is("element",nd)&&r.childCount===0&&o.writer.rename(r,nd)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:Ut.low+1})}}/**
973 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
974 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
975 */function T5(i){const e=i.t,t={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return i.config.get("heading.options").map(n=>{const s=t[n.title];return s&&s!=n.title&&(n.title=s),n})}/**
976 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
977 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
978 */class E5 extends b{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,n=T5(e),s=t("Choose heading"),o=t("Heading");e.ui.componentFactory.add("heading",r=>{const a={},l=new me,c=e.commands.get("heading"),u=e.commands.get("paragraph"),d=[c];for(const f of n){const m={type:"button",model:new ui({label:f.title,class:f.class,role:"menuitemradio",withText:!0})};f.model==="paragraph"?(m.model.bind("isOn").to(u,"value"),m.model.set("commandName","paragraph"),d.push(u)):(m.model.bind("isOn").to(c,"value",p=>p===f.model),m.model.set({commandName:"heading",commandValue:f.model})),l.add(m),a[f.model]=f.title}
978const h=pe(r);return kn(h,l,{ariaLabel:o,role:"menu"}),h.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),h.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),h.bind("isEnabled").toMany(d,"isEnabled",(...f)=>f.some(m=>m)),h.buttonView.bind("label").to(c,"value",u,"value",(f,m)=>{const p=m?"paragraph":f;return typeof p=="boolean"||!a[p]?s:a[p]}),h.buttonView.bind("ariaLabel").to(c,"value",u,"value",(f,m)=>{const p=m?"paragraph":f;return typeof p=="boolean"||!a[p]?o:`${a[p]}, ${o}`}),this.listenTo(h,"execute",f=>{const{commandName:m,commandValue:p}=f.source;e.execute(m,p?{value:p}:void 0),e.editing.view.focus()}),h}),e.ui.componentFactory.add("menuBar:heading",r=>{const a=new Pe(r),l=e.commands.get("heading"),c=e.commands.get("paragraph"),u=[l],d=new jt(r);a.set({class:"ck-heading-dropdown"}),d.set({ariaLabel:t("Heading"),role:"menu"}),a.buttonView.set({label:t("Heading")}),a.panelView.children.add(d);for(const h of n){const f=new It(r,a),m=new Q(r);f.children.add(m),d.items.add(f),m.set({label:h.title,role:"menuitemradio",class:h.class}),m.bind("ariaChecked").to(m,"isOn"),m.delegate("execute").to(a),m.on("execute",()=>{const p=h.model==="paragraph"?"paragraph":"heading";e.execute(p,{value:h.model}),e.editing.view.focus()}),h.model==="paragraph"?(m.bind("isOn").to(c,"value"),u.push(c)):m.bind("isOn").to(l,"value",p=>p===h.model)}return a.bind("isEnabled").toMany(u,"isEnabled",(...h)=>h.some(f=>f)),a})}}/**
979 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
980 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
981 */class A5 extends b{static get requires(){return[C5,E5]}static get pluginName(){return"Heading"}}/**
982 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
983 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
984 */class Tn extends R{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,s=t.document.selection,o=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{if(s.isCollapsed)o?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{const a=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const l of a)o?r.setAttribute(this.attributeKey,o,l):r.removeAttribute(this.attributeKey,l)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const s of n.getRanges())for(const o of s.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}}/**
985 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
986 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
987 */const Ln="bold";class x5 extends b{static get pluginName(){return"BoldEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Ln}),e.model.schema.setAttributeProperties(Ln,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Ln,view:"strong",upcastAlso:["b",n=>{const s=n.getStyle("font-weight");return s&&(s=="bold"||Number(s)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Ln,new Tn(e,Ln)),e.keystrokes.set("CTRL+B",Ln),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}/**
988 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
989 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
990 */function En({editor:i,commandName:e,plugin:t,icon:n,label:s,keystroke:o}){return r=>{const a=i.commands.get(e),l=new r(i.locale);return l.set({label:s,icon:n,keystroke:o,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),t.listenTo(l,"execute",()=>{i.execute(e),i.editing.view.focus()}),l}}/**
991 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
992 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
993 */const Bs="bold";class S5 extends b{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.locale.t,n=e.commands.get(Bs),s=En({editor:e,commandName:Bs,plugin:this,icon:E.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(Bs,()=>{const o=s(P);return o.set({tooltip:!0}),o.bind("isOn").to(n,"value"),o}),e.ui.componentFactory.add("menuBar:"+Bs,()=>s(Q))}}/**
994 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
995 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
996 */class I5 extends b{static get requires(){return[x5,S5]}static get pluginName(){return"Bold"}}/**
997 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
998 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
999 */const nn="code",P5="ck-code_selected";class R5 extends b{static get pluginName(){return"CodeEditing"}static get requires(){return[ko]}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:nn}),e.model.schema.setAttributeProperties(nn,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:nn,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(nn,new Tn(e,nn)),e.plugins.get(ko).registerAttribute(nn),fg(e,nn,"code",P5),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const V5='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>';/**
1000 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1001 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1002 */const Ms="code";class B5 extends b{static get pluginName(){return"CodeUI"}init(){const e=this.editor,t=e.locale.t,n=En({editor:e,commandName:Ms,plugin:this,icon:V5,label:t("Code")});e.ui.componentFactory.add(Ms,()=>{const s=n(P),o=e.commands.get(Ms);return s.set({tooltip:!0}),s.bind("isOn").to(o,"value"),s}),e.ui.componentFactory.add("menuBar:"+Ms,()=>n(Q))}}/**
1003 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1004 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1005 */class M5 extends b{static get requires(){return[R5,B5]}static get pluginName(){return"Code"}}/**
1006 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1007 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1008 */const Fn="italic";class O5 extends b{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Fn}),e.model.schema.setAttributeProperties(Fn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Fn,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Fn,new Tn(e,Fn)),e.keystrokes.set("CTRL+I",Fn),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}const L5='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
1008<path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>';/**
1009 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1010 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1011 */const Os="italic";class F5 extends b{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.commands.get(Os),n=e.locale.t,s=En({editor:e,commandName:Os,plugin:this,icon:L5,keystroke:"CTRL+I",label:n("Italic")});e.ui.componentFactory.add(Os,()=>{const o=s(P);return o.set({tooltip:!0}),o.bind("isOn").to(t,"value"),o}),e.ui.componentFactory.add("menuBar:"+Os,()=>s(Q))}}/**
1012 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1013 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1014 */class N5 extends b{static get requires(){return[O5,F5]}static get pluginName(){return"Italic"}}/**
1015 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1016 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1017 */const yi="strikethrough";class D5 extends b{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:yi}),e.model.schema.setAttributeProperties(yi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:yi,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(yi,new Tn(e,yi)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const $5='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>';/**
1018 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1019 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1020 */const Ls="strikethrough";class U5 extends b{static get pluginName(){return"StrikethroughUI"}init(){const e=this.editor,t=e.locale.t,n=En({editor:e,commandName:Ls,plugin:this,icon:$5,keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(Ls,()=>{const s=n(P),o=e.commands.get(Ls);return s.set({tooltip:!0}),s.bind("isOn").to(o,"value"),s}),e.ui.componentFactory.add("menuBar:"+Ls,()=>n(Q))}}/**
1021 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1022 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1023 */class H5 extends b{static get requires(){return[D5,U5]}static get pluginName(){return"Strikethrough"}}/**
1024 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1025 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1026 */const vi="subscript";class z5 extends b{static get pluginName(){return"SubscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:vi}),e.model.schema.setAttributeProperties(vi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:vi,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(vi,new Tn(e,vi))}}const W5='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>';/**
1027 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1028 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1029 */const Fs="subscript";class q5 extends b{static get pluginName(){return"SubscriptUI"}init(){const e=this.editor,t=e.locale.t,n=En({editor:e,commandName:Fs,plugin:this,icon:W5,label:t("Subscript")});e.ui.componentFactory.add(Fs,()=>{const s=n(P),o=e.commands.get(Fs);return s.set({tooltip:!0}),s.bind("isOn").to(o,"value"),s}),e.ui.componentFactory.add("menuBar:"+Fs,()=>n(Q))}}/**
1030 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1031 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1032 */class j5 extends b{static get requires(){return[z5,q5]}static get pluginName(){return"Subscript"}}/**
1033 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1034 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1035 */const ki="superscript";class G5 extends b{static get pluginName(){return"SuperscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:ki}),e.model.schema.setAttributeProperties(ki,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ki,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(ki,new Tn(e,ki))}}const K5='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>';/**
1036 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1037 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1038 */const Ns="superscript";class J5 extends b{static get pluginName(){return"SuperscriptUI"}init(){const e=this.editor,t=e.locale.t,n=En({editor:e,commandName:Ns,plugin:this,icon:K5,label:t("Superscript")});e.ui.componentFactory.add(Ns,()=>{const s=n(P),o=e.commands.get(Ns);return s.set({tooltip:!0}),s.bind("isOn").to(o,"value"),s}),e.ui.componentFactory.add("menuBar:"+Ns,()=>n(Q))}}/**
1039 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1040 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1041 */class Z5 extends b{static get requires(){return[G5,J5]}static get pluginName(){return"Superscript"}}/**
1042 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1043 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1044 */const Ci="underline";class Q5 extends b{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Ci}),e.model.schema.setAttributeProperties(Ci,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Ci,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(Ci,new Tn(e,Ci)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}const Y5='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>';/**
1045 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1046 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1047 */const Ds="underline";class X5 extends b{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.commands.get(Ds),n=e.locale.t,s=En({editor:e,commandName:Ds,plugin:this,icon:Y5,label:n("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(Ds,()=>{const o=s(P);return o.set({tooltip:!0}),o.bind("isOn").to(t,"value"),o}),e.ui.componentFactory.add("menuBar:"+Ds,()=>s(Q))}}/**
1048 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1049 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1050 */class eI extends b{static get requires(){return[Q5,X5]}static get pluginName(){return"Underline"}}/**
1051 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1052 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1053 */class tI extends R{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,s=t.document.selection,o=Array.from(s.getSelectedBlocks()),r=e.forceValue===void 0?!this.value:e.forceValue;t.change(a=>{if(!r)this._removeQuote(a,o.filter($s));else{const l=o.filter(c=>$s(c)||sd(n,c));this._applyQuote(a,l)}})}_getValue(){const e=this.editor.model.document.selection,t=ie(e.getSelectedBlocks());return!!(t&&$s(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ie(e.getSelectedBlocks());return n?sd(t,n):!1}
1053_removeQuote(e,t){id(e,t).reverse().forEach(n=>{if(n.start.isAtStart&&n.end.isAtEnd){e.unwrap(n.start.parent);return}if(n.start.isAtStart){const o=e.createPositionBefore(n.start.parent);e.move(n,o);return}n.end.isAtEnd||e.split(n.end);const s=e.createPositionAfter(n.end.parent);e.move(n,s)})}_applyQuote(e,t){const n=[];id(e,t).reverse().forEach(s=>{let o=$s(s.start);o||(o=e.createElement("blockQuote"),e.wrap(s,o)),n.push(o)}),n.reverse().reduce((s,o)=>s.nextSibling==o?(e.merge(e.createPositionAfter(s)),s):o)}}function $s(i){return i.parent.name=="blockQuote"?i.parent:null}function id(i,e){let t,n=0;const s=[];for(;n<e.length;){const o=e[n],r=e[n+1];t||(t=i.createPositionBefore(o)),(!r||o.nextSibling!=r)&&(s.push(i.createRange(t,i.createPositionAfter(o))),t=null),n++}return s}function sd(i,e){const t=i.checkChild(e.parent,"blockQuote"),n=i.checkChild(["$root","blockQuote"],e);return t&&n}/**
1054 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1055 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1056 */class nI extends b{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[nr,Pt]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new tI(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(r=>{const a=e.model.document.differ.getChanges();for(const l of a)if(l.type=="insert"){const c=l.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(l.position,c))return r.unwrap(c),!0;if(c.is("element")){const u=r.createRangeIn(c);for(const d of u.getItems())if(d.is("element","blockQuote")&&!t.checkChild(r.createPositionBefore(d),d))return r.unwrap(d),!0}}else if(l.type=="remove"){const c=l.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0}return!1});const n=this.editor.editing.view.document,s=e.model.document.selection,o=e.commands.get("blockQuote");this.listenTo(n,"enter",(r,a)=>{if(!s.isCollapsed||!o.value)return;s.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),r.stop())},{context:"blockquote"}),this.listenTo(n,"delete",(r,a)=>{if(a.direction!="backward"||!s.isCollapsed||!o.value)return;const l=s.getLastPosition().parent;l.isEmpty&&!l.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),r.stop())},{context:"blockquote"})}}/**
1057 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1058 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1059 */class iI extends b{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.commands.get("blockQuote");e.ui.componentFactory.add("blockQuote",()=>{const n=this._createButton(P);return n.set({tooltip:!0}),n.bind("isOn").to(t,"value"),n}),e.ui.componentFactory.add("menuBar:blockQuote",()=>this._createButton(Q))}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get("blockQuote"),o=new e(t.locale),r=n.t;return o.set({label:r("Block quote"),icon:E.quote,isToggleable:!0}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),o}}/**
1060 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1061 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1062 */class sI extends b{static get requires(){return[nI,iI]}static get pluginName(){return"BlockQuote"}}/**
1063 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1064 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1065 */class oI{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,n,s)=>{if(!s.consumable.test(n.item,"attribute:linkHref")||!(n.item.is("selection")||s.schema.isInline(n.item)))return;
1065const o=s.writer,r=o.document.selection;for(const a of this._definitions){const l=o.createAttributeElement("a",a.attributes,{priority:5});a.classes&&o.addClass(a.classes,l);for(const c in a.styles)o.setStyle(c,a.styles[c],l);o.setCustomProperty("link",!0,l),a.callback(n.attributeNewValue)?n.item.is("selection")?o.wrap(r.getFirstRange(),l):o.wrap(s.mapper.toViewRange(n.range),l):o.unwrap(s.mapper.toViewRange(n.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,n,{writer:s,mapper:o})=>{const r=o.toViewElement(n.item),a=Array.from(r.getChildren()).find(l=>l.is("element","a"));for(const l of this._definitions){const c=St(l.attributes);if(l.callback(n.attributeNewValue)){for(const[u,d]of c)u==="class"?s.addClass(d,a):s.setAttribute(u,d,a);l.classes&&s.addClass(l.classes,a);for(const u in l.styles)s.setStyle(u,l.styles[u],a)}else{for(const[u,d]of c)u==="class"?s.removeClass(d,a):s.removeAttribute(u,a);l.classes&&s.removeClass(l.classes,a);for(const u in l.styles)s.removeStyle(u,a)}}})}}}/**
1066 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1067 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1068 */const rI=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,aI="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",lI=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,cI=/^((\w+:(\/{2,})?)|(\W))/i,uI=["https?","ftps?","mailto"],Us="Ctrl+K";function dI(i){return i.is("attributeElement")&&!!i.getCustomProperty("link")}function od(i,{writer:e}){const t=e.createAttributeElement("a",{href:i},{priority:5});return e.setCustomProperty("link",!0,t),t}function Ag(i,e=uI){const t=String(i),n=e.join("|"),s=new RegExp(`${aI.replace("<protocols>",n)}`,"i");return hI(t,s)?t:"#"}function hI(i,e){return!!i.replace(rI,"").match(e)}function fI(i,e){const t={"Open in a new tab":i("Open in a new tab"),Downloadable:i("Downloadable")};return e.forEach(n=>("label"in n&&t[n.label]&&(n.label=t[n.label]),n)),e}function mI(i){const e=[];if(i)for(const[t,n]of Object.entries(i)){const s=Object.assign({},n,{id:`link${d0(t)}`});e.push(s)}return e}function ha(i,e){return i?e.checkAttribute(i.name,"linkHref"):!1}function gI(i){return lI.test(i)}function gl(i,e){const t=gI(i)?"mailto:":e,n=!!t&&!xg(i);return i&&n?t+i:i}function xg(i){return cI.test(i)}function rd(i){window.open(i,"_blank","noopener")}/**
1069 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1070 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1071 */class pI extends R{constructor(){super(...arguments),this.manualDecorators=new me,this.automaticDecorators=new oI}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement()||ie(t.getSelectedBlocks());ha(n,e.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(n,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={}){const n=this.editor.model,s=n.document.selection,o=[],r=[];for(const a in t)t[a]?o.push(a):r.push(a);n.change(a=>{if(s.isCollapsed){const l=s.getFirstPosition();if(s.hasAttribute("linkHref")){const c=ad(s);let u=tr(l,"linkHref",s.getAttribute("linkHref"),n);s.getAttribute("linkHref")===c&&(u=this._updateLinkContent(n,a,u,e)),a.setAttribute("linkHref",e,u),o.forEach(d=>{a.setAttribute(d,!0,u)}),r.forEach(d=>{a.removeAttribute(d,u)}),a.setSelection(a.createPositionAfter(u.end.nodeBefore))}else if(e!==""){const c=St(s.getAttributes());c.set("linkHref",e),o.forEach(d=>{c.set(d,!0)});const{end:u}=n.insertContent(a.createText(e,c),l);a.setSelection(u)}["linkHref",...o,...r].forEach(c=>{a.removeSelectionAttribute(c)})}else{const l=n.schema.getValidRanges(s.getRanges(),"linkHref"),c=[];for(const d of s.getSelectedBlocks())n.schema.checkAttribute(d,"linkHref")&&c.push(a.createRangeOn(d));const u=c.slice();for(const d of l)this._isRangeToUpdate(d,c)&&u.push(d);for(const d of u){let h=d;if(u.length===1){const f=ad(s);s.getAttribute("linkHref")===f&&(h=this._updateLinkContent(n,a,d,e),a.setSelection(a.createSelection(h)))}a.setAttribute("linkHref",e,h),o.forEach(f=>{a.setAttribute(f,!0,h)}),r.forEach(f=>{a.removeAttribute(f,h)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,n=t.document.selection,s=n.getSelectedElement();return ha(s,t.schema)?s.getAttribute(e):n.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t)if(n.containsRange(e))return!1;return!0}_updateLinkContent(e,t,n,s){const o=t.createText(s,{linkHref:s});return e.insertContent(o,n)}}
1071function ad(i){if(i.isCollapsed){const e=i.getFirstPosition();return e.textNode&&e.textNode.data}else{const e=Array.from(i.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}/**
1072 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1073 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1074 */class bI extends R{refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement();ha(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,s=e.commands.get("link");t.change(o=>{const r=n.isCollapsed?[tr(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),t)]:t.schema.getValidRanges(n.getRanges(),"linkHref");for(const a of r)if(o.removeAttribute("linkHref",a),s)for(const l of s.manualDecorators)o.removeAttribute(l.id,a)})}}/**
1075 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1076 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1077 */class wI extends W(){constructor({id:e,label:t,attributes:n,classes:s,styles:o,defaultValue:r}){super(),this.id=e,this.set("value",void 0),this.defaultValue=r,this.label=t,this.attributes=n,this.classes=s,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}/**
1078 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1079 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1080 */const _I="ck-link_selected",ld="automatic",yI="manual",vI=/^(https?:)?\/\//;class Sg extends b{static get pluginName(){return"LinkEditing"}static get requires(){return[ko,cg,Je]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:od}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(o,r)=>od(Ag(o,t),r)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:o=>o.getAttribute("href")}}),e.commands.add("link",new pI(e)),e.commands.add("unlink",new bI(e));const n=fI(e.t,mI(e.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter(o=>o.mode===ld)),this._enableManualDecorators(n.filter(o=>o.mode===yI)),e.plugins.get(ko).registerAttribute("linkHref"),fg(e,"linkHref","a",_I),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:ld,callback:o=>!!o&&vI.test(o),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(o=>{t.model.schema.extend("$text",{allowAttributes:o.id});const r=new wI(o);s.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(a,{writer:l,schema:c},{item:u})=>{if((u.is("selection")||c.isInline(u))&&a){const d=l.createAttributeElement("a",r.attributes,{priority:5});r.classes&&l.addClass(r.classes,d);for(const h in r.styles)l.setStyle(h,r.styles[h],d);return l.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...r._createPattern()},model:{key:r.id}})})}_enableLinkOpen(){const e=this.editor,n=e.editing.view.document;this.listenTo(n,"click",(s,o)=>{if(!(B.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let a=o.domTarget;if(a.tagName.toLowerCase()!="a"&&(a=a.closest("a")),!a)return;const l=a.getAttribute("href");l&&(s.stop(),o.preventDefault(),rd(l))},{context:"$capture"}),this.listenTo(n,"keydown",(s,o)=>{const a=e.commands.get("link").value;
1080a&&o.keyCode===F.enter&&o.altKey&&(s.stop(),rd(a))})}_enableSelectionAttributesFixer(){const t=this.editor.model,n=t.document.selection;this.listenTo(n,"change:attribute",(s,{attributeKeys:o})=>{!o.includes("linkHref")||n.hasAttribute("linkHref")||t.change(r=>{kI(r,CI(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,o)=>{t.change(r=>{const a=r.createRangeIn(o.content);for(const l of a.getItems())if(l.hasAttribute("linkHref")){const c=gl(l.getAttribute("linkHref"),n);r.setAttribute("linkHref",c,l)}})})}}function kI(i,e){i.removeSelectionAttribute("linkHref");for(const t of e)i.removeSelectionAttribute(t)}function CI(i){return i.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}/**
1081 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1082 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1083 */class TI extends C{constructor(e,t,n){super(e),this.focusTracker=new se,this.keystrokes=new de,this._focusables=new ve;const s=e.t;this._validators=n,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(s("Save"),E.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(s("Cancel"),E.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),wn({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const e=this.locale.t,t=new he(this.locale,De);return t.label=e("Link URL"),t}_createButton(e,t,n,s){const o=new P(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),s&&o.delegate("execute").to(this,s),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e.manualDecorators){const s=new Yn(this.locale);s.set({name:n.id,label:n.label,withText:!0}),s.bind("isOn").toMany([n,e],"value",(o,r)=>r===void 0&&o===void 0?!!n.defaultValue:!!o),s.on("execute",()=>{n.set("value",!s.isOn)}),t.add(s)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const n=new C;n.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(s=>({tag:"li",children:[s],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(n)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}const EI='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>';/**
1084 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1085 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1086 */class AI extends C{constructor(e,t={}){super(e),this.focusTracker=new se,this.keystrokes=new de,this._focusables=new ve;const n=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(n("Unlink"),EI,"unlink"),this.editButtonView=this._createButton(n("Edit link"),E.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new ke({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].forEac
1086h(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n){const s=new P(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s.delegate("execute").to(this,n),s}_createPreviewButton(){const e=new P(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0,tooltip:n("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",s=>s&&Ag(s,this._linkConfig.allowedProtocols)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",s=>s||n("This link has no URL")),e.bind("isEnabled").to(this,"href",s=>!!s),e.template.tag="a",e.template.eventListeners={},e}}const xI='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>';/**
1087 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1088 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1089 */const ct="link-ui";class SI extends b{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[qt]}static get pluginName(){return"LinkUI"}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver(SE),this._balloon=e.plugins.get(qt),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:ct,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:ct,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:Us},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new AI(e.locale,e.config.get("link")),n=e.commands.get("link"),s=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(s),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(o,r)=>{this._hideUI(),r()}),t.keystrokes.set(Us,(o,r)=>{this._addFormView(),r()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),s=new(qo(TI))(e.locale,t,II(e));return s.urlInputView.fieldView.bind("value").to(t,"value"),s.urlInputView.bind("isEnabled").to(t,"isEnabled"),s.saveButtonView.bind("isEnabled").to(t,"isEnabled"),this.listenTo(s,"submit",()=>{if(s.isValid()){const{value:o}=s.urlInputView.fieldView.element,r=gl(o,n);e.execute("link",r,s.getDecoratorSwitchesState()),this._closeFormView()}}),this.listenTo(s.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(s,"cancel",()=>{this._closeFormView()}),s.keystrokes.set("Esc",(o,r)=>{this._closeFormView(),r()}),s}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link");e.ui.componentFactory.add("link",()=>{const n=this._createButton(P);return n.set({tooltip:!0,isToggleable:!0}),n.bind("isOn").to(t,"value",s=>!!s),n}),e.ui.componentFactory.add("menuBar:link",()=>this._createButton(Q))}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get("link"),o=new e(t.locale),r=n.t;return o.set({label:r("Link"),icon:xI,keystroke:Us}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>this._showUI(!0)),o}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(Us,(n,s)=>{s(),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())}),ai({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),!this._areActionsInPanel&&this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=t.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(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._startUpd
1089atingUI()}_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 n=this._getSelectedLinkElement(),s=r();const o=()=>{const a=this._getSelectedLinkElement(),l=r();n&&!a||!n&&l!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=a,s=l};function r(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,n=e.document;let s;if(t.markers.has(ct)){const o=Array.from(this.editor.editing.mapper.markerNameToElements(ct)),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));s=e.domConverter.viewRangeToDom(r)}else s=()=>{const o=this._getSelectedLinkElement();return o?e.domConverter.mapViewToDom(o):e.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:s}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,n=t.getSelectedElement();if(t.isCollapsed||n&&ce(n))return Vr(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),o=Vr(s.start),r=Vr(s.end);return!o||o!=r?null:e.createRangeIn(o).getTrimmed().isEqual(s)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const n=e.document.selection.getFirstRange();if(e.markers.has(ct))t.updateMarker(ct,{range:n});else if(n.start.isAtEnd){const s=n.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:n});t.addMarker(ct,{usingOperation:!1,affectsData:!1,range:t.createRange(s,n.end)})}else t.addMarker(ct,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(ct)&&e.change(t=>{t.removeMarker(ct)})}}function Vr(i){return i.getAncestors().find(e=>dI(e))||null}function II(i){const e=i.t,t=i.config.get("link.allowCreatingEmptyLinks");return[n=>{if(!t&&!n.url.length)return e("Link URL must not be empty.")}]}/**
1090 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1091 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1092 */const PI=4,Ig=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"),RI=2;class VI extends b{static get requires(){return[Pt,Sg]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?tr(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const s=this.editor.model,o=s.document.selection,r=o.getFirstPosition(),a=o.getLastPosition();let l=t.getJoined(this._expandLinkRange(s,r)||t);l&&(l=l.getJoined(this._expandLinkRange(s,a)||t)),l&&(l.start.isBefore(r)||l.end.isAfter(a))&&e.setSelection(l)}_enablePasteLinking(){const e=this.editor,t=e.model,n=t.document.selection,s=e.plugins.get("ClipboardPipeline"),o=e.commands.get("link");s.on("inputTransformation",(r,a)=>{if(!this.isEnabled||!o.isEnabled||n.isCollapsed||a.method!=="paste"||n.rangeCount>1)return;const l=n.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const u=c.match(Ig);u&&u[2]===c&&(t.change(d=>{this._selectEntireLinks(d,l),o.execute(c)}),r.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new hg(e.model,n=>{if(!BI(n))return;const s=cd(n.substr(0,n.length-1));if(s)return{url:s}});t.on("matched:data",(n,s)=>{const{batch:o,range:r,url:a}=s;
1092if(!o.isTyping)return;const l=r.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),u=e.model.createRange(c,l);this._applyAutoLink(a,u)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("enter");n&&n.on("execute",()=>{const s=t.document.selection.getFirstPosition();if(!s.parent.previousSibling)return;const o=t.createRangeIn(s.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(o)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("shiftEnter");n&&n.on("execute",()=>{const s=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(o)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:n,range:s}=dg(e,t),o=cd(n);if(o){const r=t.createRange(s.end.getShiftedBy(-o.length),s.end);this._applyAutoLink(o,r)}}_applyAutoLink(e,t){const n=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),o=gl(e,s);!this.isEnabled||!MI(t,n)||!xg(o)||OI(t)||this._persistAutoLink(o,t)}_persistAutoLink(e,t){const n=this.editor.model,s=this.editor.plugins.get("Delete");n.enqueueChange(o=>{o.setAttribute("linkHref",e,t),n.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function BI(i){return i.length>PI&&i[i.length-1]===" "&&i[i.length-2]!==" "}function cd(i){const e=Ig.exec(i);return e?e[RI]:null}function MI(i,e){return e.schema.checkAttributeInSelection(e.createSelection(i),"linkHref")}function OI(i){const e=i.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}/**
1093 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1094 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1095 */class LI extends b{static get requires(){return[Sg,SI,VI]}static get pluginName(){return"Link"}}/**
1096 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1097 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1098 */class Ze{constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward=t.direction=="forward",this._includeSelf=!!t.includeSelf,this._sameAttributes=J(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){const s=new this(e,t)[Symbol.iterator]();return ie(s)}*[Symbol.iterator](){const e=[];for(const{node:t}of ps(this._getStartNode(),this._isForward?"forward":"backward")){const n=t.getAttribute("listIndent");if(n<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=n}else if(n>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some(s=>t.getAttribute(s)!==this._startElement.getAttribute(s)))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*ps(i,e="forward"){const t=e=="forward",n=[];let s=null;for(;ae(i);){let o=null;if(s){const r=i.getAttribute("listIndent"),a=s.getAttribute("listIndent");r>a?n[a]=s:r<a?(o=n[r],n.length=r):o=s}yield{node:i,previous:s,previousNodeInList:o},s=i,i=t?i.nextSibling:i.previousSibling}}class FI{constructor(e){this._listHead=e}[Symbol.iterator](){return ps(this._listHead,"forward")}}/**
1099 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1100 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1101 */class ni{static next(){return $e()}}function ae(i){return!!i&&i.is("element")&&i.hasAttribute("listItemId")}function ss(i,e={}){return[...Gt(i,{...e,direction:"backward"}),...Gt(i,{...e,direction:"forward"})]}function Gt(i,e={}){const t=e.direction=="forward",n=Array.from(new Ze(i,{...e,includeSelf:t,sameIndent:!0,sameAttributes:"listItemId"}));return t?n:n.reverse()}function NI(i){return Array.from(new Ze(i,{direction:"forward",higherIndent:!0}))}function Pg(i,e){const t=new Ze(i,{sameIndent:!0,sameAttributes:"listType",...e}),n=new Ze(i,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...e});return[...Array.from(t).reverse(),...n]}function Rt(i){return!Ze.first(i,{sameIndent:!0,sameAttributes:"listItemId"})}function ud(i){return!Ze.first(i,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function bs(i,e={}){i=J(i);const t=e.withNested!==!1,n=new Set;for(const s of i)for(const o of ss(s,{higherIndent:t}))n.add(o);return An(n)}function DI(i){i=J(i);const e=new Set;for(const t of i)for(const n of Pg(t))e.add(n);return An(e)}function pl(i,e){const t=Gt(i,{direction:"forward"}),n=ni.next();for(const s of t)e.setAttribute("listItemId",n,s);return t}function fa(i,e,t){const n={};for(const[o,r]of e.getAttributes())o.startsWith("list")&&(n[o]=r);const s=Gt(i,{direction:"forward"});for(const o of s)t.setAttributes(n,o);return s}function ma(i,e,{expand:t,indentBy:n=1}={}){i=J(i);const s=t?bs(i):i;for(const o of s){const r=o.getAttribute("listIndent")+n;r<0?sr(o,e):e.setAttribute("listIndent",r,o)}return s}function $I(i,e){i=J(i);const t=bs(i),n=new Set,s=Math.min(...t.map(r=>r.getAttribute("listIndent"))),o=new Map;for(const r of t)o.set(r,Ze.first(r,{lowerIndent:!0}));for(const r of t){if(n.has(r))continue;n.add(r);const a=r.getAttribute("listIndent")-1;if(a<0){sr(r,e);continue}if(r.getAttribute("listIndent")==s){const l=zI(r,o.get(r),e);for(const c of l)n.add(c);if(l.length)continue}e.setAttribute("listIndent",a,r)}return An(n)}function sr(i,e){i=J(i);for(const t of i)t.is("element","listItem")&&e.rename(t,"paragraph");for(const t of i)for(const n of t.getAttributeKeys())n.startsWith("list")&&e.removeAttribute(n,t);return i}function os(i){if(!i.length)return!1;const e=i[0].getAttribute("listItemId");return e?!i.some(t=>t.getAttribute("listItemId")!=e):!1}function UI(i,e){const t=[];let n=Number.POSITIVE_INFINITY;for(const{node:s}of ps(i.nextSibling,"forward")){const o=s.getAttribute("listIndent");if(o==0)break;o<n&&(n=o);const r=o-n;e.setAttribute("listIndent",r,s),t.push(s)}return t}function An(i){return Array.from(i).filter(e=>e.root.rootName!=="$graveyard").sort((e,t)=>
1101e.index-t.index)}function rs(i){const e=i.document.selection.getSelectedElement();return e&&i.schema.isObject(e)&&i.schema.isBlock(e)?e:null}function Br(i,e){return e.checkChild(i.parent,"listItem")&&e.checkChild(i,"$text")&&!e.isObject(i)}function HI(i){return i=="numbered"||i=="customNumbered"}function zI(i,e,t){return Gt(e,{direction:"forward"}).pop().index>i.index?fa(i,e,t):[]}/**
1102 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1103 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1104 */class dd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=hd(e.document.selection);e.change(n=>{const s=[];os(t)&&!Rt(t[0])?(this._direction=="forward"&&s.push(...ma(t,n)),s.push(...pl(t[0],n))):this._direction=="forward"?s.push(...ma(t,n,{expand:!0})):s.push(...$I(t,n));for(const o of s){if(!o.hasAttribute("listType"))continue;const r=Ze.first(o,{sameIndent:!0});r&&n.setAttribute("listType",r.getAttribute("listType"),o)}this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",An(new Set(e)))}_checkEnabled(){let e=hd(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction=="backward"||os(e)&&!Rt(e[0]))return!0;e=bs(e),t=e[0];const n=Ze.first(t,{sameIndent:!0});return n?n.getAttribute("listType")==t.getAttribute("listType"):!1}
1104}function hd(i){const e=Array.from(i.getSelectedBlocks()),t=e.findIndex(n=>!ae(n));return t!=-1&&(e.length=t),e}/**
1105 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1106 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1107 */class Si extends R{constructor(e,t,n={}){super(e),this.type=t,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.document,s=rs(t),o=Array.from(n.selection.getSelectedBlocks()).filter(a=>t.schema.checkAttribute(a,"listType")||Br(a,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(a=>{if(r){const l=o[o.length-1],c=Gt(l,{direction:"forward"}),u=[];c.length>1&&u.push(...pl(c[1],a)),u.push(...sr(o,a)),u.push(...UI(l,a)),this._fireAfterExecute(u)}else if((s||n.selection.isCollapsed)&&ae(o[0])){const l=Pg(s||o[0],this._listWalkerOptions);for(const c of l)a.setAttributes({...e.additionalAttributes,listType:this.type},c);this._fireAfterExecute(l)}else{const l=[];for(const c of o)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&Br(c,t.schema)&&a.rename(c,"listItem"),a.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:ni.next(),listType:this.type},c),l.push(c);else for(const u of bs(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(a.setAttributes({...e.additionalAttributes,listType:this.type},u),l.push(u));this._fireAfterExecute(l)}})}_fireAfterExecute(e){this.fire("afterExecute",An(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const n of t)if(n.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,n=e.document.selection,s=Array.from(n.getSelectedBlocks());if(!s.length)return!1;if(this.value)return!0;for(const o of s)if(t.checkAttribute(o,"listType")||Br(o,t))return!0;return!1}}/**
1108 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1109 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1110 */class fd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,n=t.document.selection,s=[];t.change(o=>{const{firstElement:r,lastElement:a}=this._getMergeSubjectElements(n,e),l=r.getAttribute("listIndent")||0,c=a.getAttribute("listIndent"),u=a.getAttribute("listItemId");if(l!=c){const d=NI(a);s.push(...ma([a,...d],o,{indentBy:l-c,expand:l<c}))}if(e){let d=n;n.isCollapsed&&(d=o.createSelection(o.createRange(o.createPositionAt(r,"end"),o.createPositionAt(a,0)))),t.deleteContent(d,{doNotResetEntireContent:n.isCollapsed});const h=d.getLastPosition().parent,f=h.nextSibling;s.push(h),f&&f!==a&&f.getAttribute("listItemId")==u&&s.push(...fa(f,h,o))}else s.push(...fa(a,r,o));this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",An(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,n=rs(e);if(t.isCollapsed||n){const s=n||t.getFirstPosition().parent;if(!ae(s))return!1;const o=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!o||os([s,o]))return!1}else{const s=t.getLastPosition(),o=t.getFirstPosition();if(s.parent===o.parent||!ae(s.parent))return!1}return!0}_getMergeSubjectElements(e,t){const n=this.editor.model,s=rs(n);let o,r;if(e.isCollapsed||s){const a=s||e.getFirstPosition().parent,l=Rt(a);this._direction=="backward"?(r=a,l&&!t?o=Ze.first(a,{sameIndent:!0,lowerIndent:!0}):o=a.previousSibling):(o=a,r=a.nextSibling)}else o=e.getFirstPosition().parent,r=e.getLastPosition().parent;return{firstElement:o,lastElement:r}}}/**
1111 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1112 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1113 */class md extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(t=>{const n=pl(this._getStartBlock(),t);this._fireAfterExecute(n)})}_fireAfterExecute(e){this.fire("afterExecute",An(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&ae(t)&&!Rt(t)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?t:t.nextSibling}}/**
1114 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1115 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1116 */class WI extends b{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(e){return DI(e)}isFirstBlockOfListItem(e){return Rt(e)}isListItemBlock(e){return ae(e)}expandListBlocksToCompleteItems(e,t={}){return bs(e,t)}isNumberedListType(e){return HI(e)}}/**
1117 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1118 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1119 */function Rg(i){return i.is("element","ol")||i.is("element","ul")}function Eo(i){return i.is("element","li")}function qI(i){let e=0,t=i.parent;for(;t;){if(Eo(t))e++;else{const n=t.previousSibling;n&&Eo(n)&&e++}t=t.parent}return e}function jI(i,e,t,n=Bg(t,e)){return i.createAttributeElement(Vg(t),null,{priority:2*e/100-100,id:n})}function GI(i,e,t){return i.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:t})}function Vg(i){return i=="numbered"||i=="customNumbered"?"ol":"ul"}function Bg(i,e){return`list-${i}-${e}`}/**
1120 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1121 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1122 */function et(i,e){const t=i.nodeBefore;if(ae(t)){let n=t;for(const{node:s}of ps(n,"backward"))if(n=s,e.has(n))return;e.set(t,n)}else{const n=i.nodeAfter;ae(n)&&e.set(n,n)}}function KI(i,e){let t=0,n=-1,s=null,o=!1;for(const{node:r}of i){const a=r.getAttribute("listIndent");if(a>t){let l;s===null?(s=a-t,l=t):(s>a&&(s=a),l=a-s),l>n+1&&(l=n+1),e.setAttribute("listIndent",l,r),o=!0,n=l}else s=null,t=a+1,n=a}return o}function JI(i,e,t){const n=new Set;let s=!1;for(const{node:o}of i){if(n.has(o))continue;let r=o.getAttribute("listType"),a=o.getAttribute("listItemId");if(e.has(a)&&(a=ni.next()),e.add(a),o.is("element","listItem")){o.getAttribute("listItemId")!=a&&(t.setAttribute("listItemId",a,o),s=!0);continue}for(const l of Gt(o,{direction:"forward"}))n.add(l),l.getAttribute("listType")!=r&&(a=ni.next(),r=l.getAttribute("listType")),l.getAttribute("listItemId")!=a&&(t.setAttribute("listItemId",a,l),s=!0)}return s}/**
1123 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1124 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1125 */function ZI(){return(i,e,t)=>{const{writer:n,schema:s}=t;if(!e.modelRange)return;const o=Array.from(e.modelRange.getItems({shallow:!0})).filter(d=>s.checkAttribute(d,"listItemId"));if(!o.length)return;const r=ni.next(),a=qI(e.viewItem);let l=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=o[0].getAttribute("listType");c&&(l=c);const u={listItemId:r,listIndent:a,listType:l};for(const d of o)d.hasAttribute("listItemId")||n.setAttributes(u,d);o.length>1&&o[1].getAttribute("listItemId")!=u.listItemId&&t.keepEmptyElement(o[
11250])}}function gd(){return(i,e,t)=>{if(!t.consumable.test(e.viewItem,{name:!0}))return;const n=new bt(e.viewItem.document);for(const s of Array.from(e.viewItem.getChildren()))!Eo(s)&&!Rg(s)&&n.remove(s)}}function QI(i,e,t,n){return()=>{const a=i.document.differ.getChanges(),l=[],c=new Map,u=new Set;for(const d of a)if(d.type=="insert"&&d.name!="$text")et(d.position,c),d.attributes.has("listItemId")?u.add(d.position.nodeAfter):et(d.position.getShiftedBy(d.length),c);else if(d.type=="remove"&&d.attributes.has("listItemId"))et(d.position,c);else if(d.type=="attribute"){const h=d.range.start.nodeAfter;t.includes(d.attributeKey)?(et(d.range.start,c),d.attributeNewValue===null?(et(d.range.start.getShiftedBy(1),c),o(h)&&l.push(h)):u.add(h)):ae(h)&&o(h)&&l.push(h)}for(const d of c.values())l.push(...s(d,u));for(const d of new Set(l))e.reconvertItem(d)};function s(a,l){const c=[],u=new Set,d=[];for(const{node:h,previous:f}of ps(a,"forward")){if(u.has(h))continue;const m=h.getAttribute("listIndent");f&&m<f.getAttribute("listIndent")&&(d.length=m+1),d[m]=Object.fromEntries(Array.from(h.getAttributes()).filter(([_])=>t.includes(_)));const p=Gt(h,{direction:"forward"});for(const _ of p)u.add(_),(o(_,p)||r(_,d,l))&&c.push(_)}return c}function o(a,l){const c=e.mapper.toViewElement(a);if(!c)return!1;if(n.fire("checkElement",{modelElement:a,viewElement:c}))return!0;if(!a.is("element","paragraph")&&!a.is("element","listItem"))return!1;const d=Og(a,t,l);return d&&c.is("element","p")?!0:!!(!d&&c.is("element","span"))}function r(a,l,c){if(c.has(a))return!1;const u=e.mapper.toViewElement(a);let d=l.length-1;for(let h=u.parent;!h.is("editableElement");h=h.parent){const f=Eo(h),m=Rg(h);if(!m&&!f)continue;const p=`checkAttributes:${f?"item":"list"}`;if(n.fire(p,{viewElement:h,modelAttributes:l[d]}))break;if(m&&(d--,d<0))return!1}return!0}}function pd(i,e,t,{dataPipeline:n}={}){const s=sP(i);return(o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a,d=r.item;if(!i.includes(r.attributeKey)||!s(d,u))return;const h=XI(d,c,t);Mg(h,l,c),nP(h,l);const f=tP(d,h,e,l,{dataPipeline:n});iP(d,f,e,l)}}function YI(i){return(e,t,n)=>{const{writer:s,mapper:o}=n,r=e.name.split(":")[1];if(!i.checkAttribute(r,"listItemId"))return;const a=o.toViewPosition(t.position),l=t.position.getShiftedBy(t.length),c=o.toViewPosition(l,{isPhantom:!0}),d=s.createRange(a,c).getTrimmed().end.nodeBefore;/* istanbul ignore next -- @preserve */d&&Mg(d,s,o)}}function bd(i,{dataPipeline:e}={}){return(t,{writer:n})=>{if(!Og(t,i))return null;if(!e)return n.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function XI(i,e,t){const n=t.createRangeOn(i);return e.toViewRange(n).getTrimmed().end.nodeBefore}function eP(i,e){return(t,n)=>{if(n.modelPosition.offset>0)return;const s=n.modelPosition.parent;if(!ae(s)||!i.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(s)))return;const o=n.mapper.toViewElement(s),r=e.createRangeIn(o),a=r.getWalker();let l=r.start;for(const{item:c}of a){if(c.is("element")&&n.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(l=e.createPositionAfter(c),a.skip(({previousPosition:u})=>!u.isEqual(l)))}n.viewPosition=l}}function Mg(i,e,t){for(;i.parent.is("attributeElement")&&i.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeOn(i),i.parent);const n=[];s(e.createPositionBefore(i).getWalker({direction:"backward"})),s(e.createRangeIn(i).getWalker());for(const o of n)e.remove(o);function s(o){for(const{item:r}of o){if(r.is("element")&&t.toModelElement(r))break;r.is("element")&&r.getCustomProperty("listItemMarker")&&n.push(r)}}}function tP(i,e,t,n,{dataPipeline:s}){let o=n.createRangeOn(e);if(!Rt(i))return o;for(const r of t){if(r.scope!="itemMarker")continue;const a=r.createElement(n,i,{dataPipeline:s});if(!a||(n.setCustomProperty("listItemMarker",!0,a),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(i)?n.insert(n.createPositionAt(e,0),a):(n.insert(o.start,a),o=n.createRange(n.createPositionBefore(a),n.createPositionAfter(e))),!r.createWrapperElement||!r.canWrapElement))continue;const l=r.createWrapperElement(n,i,{dataPipeline:s});n.setCustomProperty("listItemWrapper",!0,l),r.canWrapElement(i)?o=n.wrap(o,l):(o=n.wrap(n.createRangeOn(a),l),o=n.createRange(o.start,n.createPositionAfter(e)))}return o}function nP(i,e){let t=i.parent;for(;t.is("attributeElement")&&["ul","ol","li"].includes(t.name);){const n=t.parent;e.unwrap(e.createRangeOn(i),t),t=n}}function iP(i,e,t,n){if(!i.hasAttribute("listIndent"))return;const s=i.getAttribute("listIndent");let o=i;for(let r=s;r>=0;r--){const a=GI(n,r,o.getAttribute("listItemId")),l=jI(n,r,o.getAttribute("listType"));for(const c of t)(c.scope=="list"||c.scope=="item")&&o.hasAttribute(c.attributeName)&&c.setAttributeOnDowncast(n,o.getAttribute(c.attributeName),c.scope=="list"?l:a);if(e=n.wrap(e,a),e=n.wrap(e,l),r==0||(o=Ze.first(o,{lowerIndent:!0}),!o))break}}function sP(i){return(e,t)=>{const n=[];for(const s of i)e.hasAttribute(s)&&n.push(`attribute:${s}`);return n.every(s=>t.test(e,s)!==!1)?(n.forEach(s=>t.consume(e,s)),!0):!1}}function Og(i,e,t=ss(i)){if(!ae(i))return!1;for(const n of i.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return t.length<2}/**
1126 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1127 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1128 */const io=["listType","listIndent","listItemId"];class ga extends b{static get pluginName(){return"ListEditing"}static get requires(){return[nr,Pt,WI,Je]}constructor(e){super(e),this._downcastStrategies=[],e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,n=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new g("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:io}),n?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"}
1128)):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const s of io)t.schema.setAttributeProperties(s,{copyOnReplace:!0});e.commands.add("numberedList",new Si(e,"numbered")),e.commands.add("bulletedList",new Si(e,"bulleted")),e.commands.add("customNumberedList",new Si(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new Si(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new dd(e,"forward")),e.commands.add("outdentList",new dd(e,"backward")),e.commands.add("splitListItemBefore",new md(e,"before")),e.commands.add("splitListItemAfter",new md(e,"after")),n&&(e.commands.add("mergeListItemBackward",new fd(e,"backward")),e.commands.add("mergeListItemForward",new fd(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const t=this.editor.commands,n=t.get("indent"),s=t.get("outdent");n&&n.registerChildCommand(t.get("indentList"),{priority:"high"}),s&&s.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...io,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),n=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(s,o)=>{const r=e.model.document.selection;rs(e.model)||e.model.change(()=>{const a=r.getFirstPosition();if(r.isCollapsed&&o.direction=="backward"){if(!a.isAtStart)return;const l=a.parent;if(!ae(l))return;if(!Ze.first(l,{sameAttributes:"listType",sameIndent:!0})&&l.getAttribute("listIndent")===0)ud(l)||e.execute("splitListItemAfter"),e.execute("outdentList");else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:wd(e.model,"backward")})}o.preventDefault(),s.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd||!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:wd(e.model,"forward")}),o.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,n=e.commands,s=n.get("enter");this.listenTo(e.editing.view.document,"enter",(o,r)=>{const a=t.document,l=a.selection.getFirstPosition().parent;if(a.selection.isCollapsed&&ae(l)&&l.isEmpty&&!r.isSoft){const c=Rt(l),u=ud(l);c&&u?(e.execute("outdentList"),r.preventDefault(),o.stop()):c&&!u?(e.execute("splitListItemAfter"),r.preventDefault(),o.stop()):u&&(e.execute("splitListItemBefore"),r.preventDefault(),o.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{const o=n.get("splitListItemBefore");if(o.refresh(),!o.isEnabled)return;const a=e.model.document.selection.getLastPosition().parent;ss(a).length===2&&o.execute()})}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,n)=>{const s=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(e.execute(s),n.stopPropagation(),n.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,n=this.getListAttributeNames(),s=e.config.get("list.multiBlock"),o=s?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(a,{writer:l})=>l.createElement(o,{listType:""})}).elementToElement({view:"p",model:(a,{writer:l})=>a.parent&&a.parent.is("element","li")?l.createElement(o,{listType:""}):null,converterPriority:"high"}).add(a=>{a.on("element:li",ZI()),a.on("element:ul",gd(),{priority:"high"}),a.on("element:ol",gd(),{priority:"high"})}),s||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:bd(n),converterPriority:"high"}).add(a=>{a.on("attribute",pd(n,this._downcastStrategies,t)),a.on("remove",YI(t.schema))}),e.conversion.for("dataDowncast").elementToElement({model:o,view:bd(n,{dataPipeline:!0}),converterPriority:"high"}).add(a=>{a.on("attribute",pd(n,this._downcastStrategies,t,{dataPipeline:!0}))});const r=eP(this._downcastStrategies,e.editing.view);e.editing.mapper.on("modelToViewPosition",r),e.data.mapper.on("modelToViewPosition",r),this.listenTo(t.document,"change:data",QI(t,e.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",(a,{viewElement:l,modelAttributes:c})=>{l.id!=c.listItemId&&(a.return=!0,a.stop())}),this.on("checkAttributes:list",(a,{viewElement:l,modelAttributes:c})=>{(l.name!=Vg(c.listType)||l.id!=Bg(c.listType,c.listIndent))&&(a.return=!0,a.stop())})}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(n=>oP(e,n,t,this)),this.on("postFixer",(n,{listNodes:s,writer:o})=>{n.return=KI(s,o)||n.return},{priority:"high"}),this.on("postFixer",(n,{listNodes:s,writer:o,seenIds:r})=>{n.return=JI(s,r,o)||n.return},{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",rP(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(n,s)=>{e.change(o=>{const r=Array.from(s.content.getChildren()),a=r[r.length-1];if(r.length>1&&a.is("element")&&a.isEmpty&&r.slice(0,-1).every(ae)&&o.remove(a),s.method=="copy"||s.method=="cut"){const l=Array.from(s.content.getChildren());os(l)&&sr(l,o)}})})}_setupAccessibilityIntegration(){const e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function oP(i,e,t,n){const s=i.document.differ.getChanges(),o=new Map,r=n.editor.config.get("list.multiBlock");let a=!1;for(const c of s){if(c.type=="insert"&&c.name!="$text"){const u=c.position.nodeAfter;if(!i.schema.checkAttribute(u,"listItemId"))for(const d of Array.from(u.getAttributeKeys()))t.includes(d)&&(e.removeAttribute(d,u),a=!0);et(c.position,o),c.attributes.has("listItemId")||et(c.position.getShiftedBy(c.length),o);for(const{item:d,previousPosition:h}of i.createRangeIn(u))ae(d)&&et(h,o)}else c.type=="remove"?et(c.position,o):c.type=="attribute"&&t.includes(c.attributeKey)&&
1128(et(c.range.start,o),c.attributeNewValue===null&&et(c.range.start.getShiftedBy(1),o));if(!r&&c.type=="attribute"&&io.includes(c.attributeKey)){const u=c.range.start.nodeAfter;c.attributeNewValue===null&&u&&u.is("element","listItem")?(e.rename(u,"paragraph"),a=!0):c.attributeOldValue===null&&u&&u.is("element")&&u.name!="listItem"&&(e.rename(u,"listItem"),a=!0)}}const l=new Set;for(const c of o.values())a=n.fire("postFixer",{listNodes:new FI(c),listHead:c,writer:e,seenIds:l})||a;return a}function rP(i){return(e,[t,n])=>{const s=t.is("documentFragment")?Array.from(t.getChildren()):[t];if(!s.length)return;const r=(n?i.createSelection(n):i.document.selection).getFirstPosition();let a;if(ae(r.parent))a=r.parent;else if(ae(r.nodeBefore))a=r.nodeBefore;else return;i.change(l=>{const c=a.getAttribute("listType"),u=a.getAttribute("listIndent"),d=s[0].getAttribute("listIndent")||0,h=Math.max(u-d,0);for(const f of s){const m=ae(f);a.is("element","listItem")&&f.is("element","paragraph")&&l.rename(f,"listItem"),l.setAttributes({listIndent:(m?f.getAttribute("listIndent"):0)+h,listItemId:m?f.getAttribute("listItemId"):ni.next(),listType:c},f)}})}}function wd(i,e){const t=i.document.selection;if(!t.isCollapsed)return!rs(i);if(e==="forward")return!0;const s=t.getFirstPosition().parent,o=s.previousSibling;return i.schema.isObject(o)?!1:o.isEmpty?!0:os([s,o])}/**
1129 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1130 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1131 */function pa(i,e,t,n){i.ui.componentFactory.add(e,()=>{const s=_d(P,i,e,t,n);return s.set({tooltip:!0,isToggleable:!0}),s}),i.ui.componentFactory.add(`menuBar:${e}`,()=>_d(Q,i,e,t,n))}function _d(i,e,t,n,s){const o=e.commands.get(t),r=new i(e.locale);return r.set({label:n,icon:s}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{e.execute(t),e.editing.view.focus()}),r}/**
1132 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1133 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1134 */class aP extends b{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||pa(this.editor,"numberedList",e("Numbered List"),E.numberedList),this.editor.ui.componentFactory.has("bulletedList")||pa(this.editor,"bulletedList",e("Bulleted List"),E.bulletedList)}}/**
1135 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1136 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1137 */class lP extends b{static get requires(){return[ga,aP]}static get pluginName(){return"List"}}/**
1138 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1139 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1140 */const cP=[{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:i,typeAttribute:e,listType:t}of cP);/**
1141 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1142 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1143 */class uP extends R{constructor(e){super(e),this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){const e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length}execute(e={}){this.editor.model.change(t=>{const n=this._getSelectedItems(),s=e.forceValue===void 0?!this._getValue(n):e.forceValue;for(const o of n)s?t.setAttribute("todoListChecked",!0,o):t.removeAttribute("todoListChecked",o)})}_getValue(e){return e.every(t=>t.getAttribute("todoListChecked"))}_getSelectedItems(){const e=this.editor.model,t=e.schema,n=e.document.selection.getFirstRange(),s=n.start.parent,o=[];t.checkAttribute(s,"todoListChecked")&&o.push(...ss(s));for(const r of n.getItems({shallow:!0}))t.checkAttribute(r,"todoListChecked")&&!o.includes(r)&&o.push(...ss(r));return o}}/**
1144 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1145 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1146 */class dP extends Mt{constructor(){super(...arguments),this.domEventType=["change"]}onDomEvent(e){if(e.target){const t=this.view.domConverter.mapDomToView(e.target);t&&t.is("element","input")&&t.getAttribute("type")=="checkbox"&&t.findAnce
1146stor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e)}}}/**
1147 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1148 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1149 */const hP=us("Ctrl+Enter");class fP extends b{static get pluginName(){return"TodoListEditing"}static get requires(){return[ga]}init(){const e=this.editor,t=e.model,n=e.editing,s=e.plugins.get(ga),r=e.config.get("list.multiBlock")?"paragraph":"listItem";e.commands.add("todoList",new Si(e,"todo")),e.commands.add("checkTodoList",new uP(e)),n.view.addObserver(dP),t.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),t.schema.addAttributeCheck((a,l)=>{const c=a.last;if(l=="todoListChecked"&&(!c.getAttribute("listItemId")||c.getAttribute("listType")!="todo"))return!1}),e.conversion.for("upcast").add(a=>{a.on("element:input",mP()),a.on("element:label",Mr({name:"label",classes:"todo-list__label"})),a.on("element:label",Mr({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),a.on("element:span",Mr({name:"span",classes:"todo-list__label__description"})),a.on("element:ul",gP({name:"ul",classes:"todo-list"}))}),e.conversion.for("downcast").elementToElement({model:r,view:(a,{writer:l})=>{if(Hs(a,s.getListAttributeNames()))return l.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),s.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(a,l,c){l=="todo"?a.addClass("todo-list",c):a.removeClass("todo-list",c)}}),s.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(a,l,{dataPipeline:c}){if(l.getAttribute("listType")!="todo")return null;const u=a.createUIElement("input",{type:"checkbox",...l.getAttribute("todoListChecked")?{checked:"checked"}:null,...c?{disabled:"disabled"}:{tabindex:"-1"}});if(c)return u;const d=a.createContainerElement("span",{contenteditable:"false"},u);return d.getFillerOffset=()=>null,d},canWrapElement(a){return Hs(a,s.getListAttributeNames())},createWrapperElement(a,l,{dataPipeline:c}){const u=["todo-list__label"];return Hs(l,s.getListAttributeNames())||u.push("todo-list__label_without-description"),a.createAttributeElement(c?"label":"span",{class:u.join(" ")})}}),s.on("checkElement",(a,{modelElement:l,viewElement:c})=>{const u=Hs(l,s.getListAttributeNames());c.hasClass("todo-list__label__description")!=u&&(a.return=!0,a.stop())}),s.on("checkElement",(a,{modelElement:l,viewElement:c})=>{const u=l.getAttribute("listType")=="todo"&&Rt(l);let d=!1;const h=e.editing.view.createPositionBefore(c).getWalker({direction:"backward"});for(const{item:f}of h){if(f.is("element")&&e.editing.mapper.toModelElement(f))break;f.is("element","input")&&f.getAttribute("type")=="checkbox"&&(d=!0)}d!=u&&(a.return=!0,a.stop())}),s.on("postFixer",(a,{listNodes:l,writer:c})=>{for(const{node:u,previousNodeInList:d}of l){if(!d||d.getAttribute("listItemId")!=u.getAttribute("listItemId"))continue;const h=d.hasAttribute("todoListChecked"),f=u.hasAttribute("todoListChecked");f&&!h?(c.removeAttribute("todoListChecked",u),a.return=!0):!f&&h&&(c.setAttribute("todoListChecked",!0,u),a.return=!0)}}),t.document.registerPostFixer(a=>{const l=t.document.differ.getChanges();let c=!1;for(const u of l)if(u.type=="attribute"&&u.attributeKey=="listType"){const d=u.range.start.nodeAfter;u.attributeOldValue=="todo"&&d.hasAttribute("todoListChecked")&&(a.removeAttribute("todoListChecked",d),c=!0)}else if(u.type=="insert"&&u.name!="$text")for(const{item:d}of a.createRangeOn(u.position.nodeAfter))d.is("element")&&d.getAttribute("listType")!="todo"&&d.hasAttribute("todoListChecked")&&(a.removeAttribute("todoListChecked",d),c=!0);return c}),this.listenTo(n.view.document,"keydown",(a,l)=>{mn(l)===hP&&(e.execute("checkTodoList"),a.stop())},{priority:"high"}),this.listenTo(n.view.document,"todoCheckboxChange",(a,l)=>{const c=l.target;if(!c||!c.is("element","input"))return;const u=n.view.createPositionAfter(c),h=n.mapper.toModelPosition(u).parent;h&&ae(h)&&h.getAttribute("listType")=="todo"&&this._handleCheckmarkChange(h)}),this.listenTo(n.view.document,"arrowKey",bP(t,e.locale),{context:"$text"}),this.listenTo(n.mapper,"viewToModelPosition",(a,l)=>{const c=l.viewPosition.parent,u=c.is("attributeElement","li")&&l.viewPosition.offset==0,d=yd(c)&&l.viewPosition.offset<=1,h=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&yd(c.parent);if(!u&&!d&&!h)return;const f=l.modelPosition.nodeAfter;f&&f.getAttribute("listType")=="todo"&&(l.modelPosition=t.createPositionAt(f,0))},{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){const t=this.editor,n=t.model,s=Array.from(n.document.selection.getRanges());n.change(o=>{o.setSelection(e,"end"),t.execute("checkTodoList"),o.setSelection(s)})}_initAriaAnnouncements(){const{model:e,ui:t,t:n}=this.editor;let s=null;t&&e.document.selection.on("change:range",()=>{const o=e.document.selection.focus.parent,r=vd(s),a=vd(o);r&&!a?t.ariaLiveAnnouncer.announce(n("Leaving a to-do list")):!r&&a&&t.ariaLiveAnnouncer.announce(n("Entering a to-do list")),s=o})}}function mP(){return(i,e,t)=>{const n=e.modelCursor,s=n.parent,o=e.viewItem;if(!t.consumable.test(o,{name:!0})||o.getAttribute("type")!="checkbox"||!n.isAtStart||!s.hasAttribute("listType"))return;t.consumable.consume(o,{name:!0});const r=t.writer;r.setAttribute("listType","todo",s),e.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,s),e.modelRange=r.createRange(n)}}function Mr(i){const e=new Ke(i);return(t,n,s)=>{const o=e.match(n.viewItem);o&&s.consumable.consume(n.viewItem,o.match)&&Object.assign(n,s.convertChildren(n.viewItem,n.modelCursor))}}function gP(i){const e=new Ke(i);return(t,n,s)=>{const o=e.match(n.viewItem);if(!o)return;const r=o.match;
1149r.name=!1,s.consumable.consume(n.viewItem,r)}}function Hs(i,e){return(i.is("element","paragraph")||i.is("element","listItem"))&&i.getAttribute("listType")=="todo"&&Rt(i)&&pP(i,e)}function pP(i,e){for(const t of i.getAttributeKeys())if(!t.startsWith("selection:")&&!e.includes(t))return!1;return!0}function bP(i,e){return(t,n)=>{const s=Wo(n.keyCode,e.contentLanguageDirection),o=i.schema,r=i.document.selection;if(!r.isCollapsed)return;const a=r.getFirstPosition(),l=a.parent;if(s=="right"&&a.isAtEnd){const c=o.getNearestSelectionRange(i.createPositionAfter(l),"forward");if(!c)return;const u=c.start.parent;u&&ae(u)&&u.getAttribute("listType")=="todo"&&(i.change(d=>d.setSelection(c)),n.preventDefault(),n.stopPropagation(),t.stop())}else if(s=="left"&&a.isAtStart&&ae(l)&&l.getAttribute("listType")=="todo"){const c=o.getNearestSelectionRange(i.createPositionBefore(l),"backward");if(!c)return;i.change(u=>u.setSelection(c)),n.preventDefault(),n.stopPropagation(),t.stop()}}}function yd(i){return!!i&&i.is("attributeElement")&&i.hasClass("todo-list__label")}function vd(i){return!i||!i.is("element","paragraph")&&!i.is("element","listItem")?!1:i.getAttribute("listType")=="todo"}/**
1150 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1151 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1152 */class wP extends b{static get pluginName(){return"TodoListUI"}init(){const e=this.editor.t;pa(this.editor,"todoList",e("To-do List"),E.todoList)}}/**
1153 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1154 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1155 */class _P extends b{static get requires(){return[fP,wP]}static get pluginName(){return"TodoList"}}/**
1156 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1157 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1158 */us("Ctrl+Enter");/**
1159 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1160 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1161 */class yP extends b{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Pc(e)),e.commands.add("outdent",new Pc(e))}}/**
1162 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1163 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1164 */class vP extends b{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,n=e.t,s=t.uiLanguageDirection=="ltr"?E.indent:E.outdent,o=t.uiLanguageDirection=="ltr"?E.outdent:E.indent;this._defineButton("indent",n("Increase indent"),s),this._defineButton("outdent",n("Decrease indent"),o)}_defineButton(e,t,n){const s=this.editor;s.ui.componentFactory.add(e,()=>{const o=this._createButton(P,e,t,n);return o.set({tooltip:!0}),o}),s.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(Q,e,t,n))}_createButton(e,t,n,s){const o=this.editor,r=o.commands.get(t),a=new e(o.locale);return a.set({label:n,icon:s}),a.bind("isEnabled").to(r,"isEnabled"),this.listenTo(a,"execute",()=>{o.execute(t),o.editing.view.focus()}),a}}/**
1165 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1166 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1167 */class kP extends b{static get pluginName(){return"Indent"}static get requires(){return[yP,vP]}}/**
1168 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1169 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1170 */class zs extends R{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const t=this.editor.model,n=ie(t.document.selection.getSelectedBlocks());if(!n||!this._isIndentationChangeAllowed(n)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(n.getAttribute("blockIndent"))}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change(n=>{for(const s of t){const o=s.getAttribute("blockIndent"),r=this._indentBehavior.getNextIndent(o);r?n.setAttribute("blockIndent",r,s):n.removeAttribute("blockIndent",s)}})}_getBlocksToChange(){const t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(s=>this._isIndentationChangeAllowed(s))}_isIndentationChangeAllowed(e){const t=this.editor;return t.model.schema.checkAttribute(e,"blockIndent")?!t.plugins.has("ListUtils")||!this._indentBehavior.isForward?!0:!t.plugins.get("ListUtils").isListItemBlock(e):!1}}/**
1171 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1172 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1173 */class kd{constructor(e){this.isForward=e.direction==="forward",this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const s=this.isForward?this.offset:-this.offset,o=t+s;return o>0?o+this.unit:void 0}}/**
1174 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1175 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1176 */class Cd{constructor(e){this.isForward=e.direction==="forward",this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),n=this.isForward?1:-1;return this.classes[t+n]}}/**
1177 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1178 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1179 */const CP=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class TP extends b{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new zs(e,new Cd({direction:"forward",classes:t.classes}
1179))),e.commands.add("outdentBlock",new zs(e,new Cd({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(tA),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new zs(e,new kd({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new zs(e,new kd({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){const e=this.editor,t=e.model.schema,n=e.commands.get("indent"),s=e.commands.get("outdent"),o=e.config.get("heading.options");(o&&o.map(l=>l.model)||CP).forEach(l=>{t.isRegistered(l)&&t.extend(l,{allowAttributes:"blockIndent"})}),t.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(e.commands.get("indentBlock")),s.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,n=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[n]:/[\s\S]+/}},model:{key:"blockIndent",value:s=>{if(!s.is("element","li"))return s.getStyle(n)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:s=>({key:"style",value:{[n]:s}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const n of e)t.model.values.push(n),t.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(t)}}/**
1180 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1181 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1182 */const bl=["left","right","center","justify"];function Lg(i){return bl.includes(i)}function Fg(i,e){return e.contentLanguageDirection=="rtl"?i==="right":i==="left"}function Ng(i){const e=i.map(n=>{let s;return typeof n=="string"?s={name:n}:s=n,s}).filter(n=>{const s=bl.includes(n.name);return s||N("alignment-config-name-not-recognized",{option:n}),s}),t=e.filter(n=>!!n.className).length;if(t&&t<e.length)throw new g("alignment-config-classnames-are-missing",{configuredOptions:i});return e.forEach((n,s,o)=>{const r=o.slice(s+1);if(r.some(l=>l.name==n.name))throw new g("alignment-config-name-already-defined",{option:n,configuredOptions:i});if(n.className&&r.some(c=>c.className==n.className))throw new g("alignment-config-classname-already-defined",{option:n,configuredOptions:i})}),e}/**
1183 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1184 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1185 */const wl="alignment";class EP extends R{refresh(){const t=this.editor.locale,n=ie(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!n&&this._canBeAligned(n),this.isEnabled&&n.hasAttribute("alignment")?this.value=n.getAttribute("alignment"):this.value=t.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const t=this.editor,n=t.locale,s=t.model,o=s.document,r=e.value;s.change(a=>{const l=Array.from(o.selection.getSelectedBlocks()).filter(d=>this._canBeAligned(d)),c=l[0].getAttribute("alignment");Fg(r,n)||c===r||!r?AP(l,a):xP(l,a,r)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,wl)}}function AP(i,e){for(const t of i)e.removeAttribute(wl,t)}function xP(i,e,t){for(const n of i)e.setAttribute(wl,t,n)}/**
1186 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1187 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1188 */class SP extends b{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:bl.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,n=e.model.schema,o=Ng(e.config.get("alignment.options")).filter(c=>Lg(c.name)&&!Fg(c.name,t)),r=o.some(c=>!!c.className);n.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),r?e.conversion.attributeToAttribute(VP(o)):e.conversion.for("downcast").attributeToAttribute(IP(o));const a=PP(o);for(const c of a)e.conversion.for("upcast").attributeToAttribute(c);const l=RP(o);for(const c of l)e.conversion.for("upcast").attributeToAttribute(c);e.commands.add("alignment",new EP(e))}}function IP(i){const e={};for(const{name:n}of i)e[n]={key:"style",value:{"text-align":n}};return{model:{key:"alignment",values:i.map(n=>n.name)},view:e}}function PP(i){const e=[];for(const{name:t}of i)e.push({view:{key:"style",value:{"text-align":t}},model:{key:"alignment",value:t}});return e}function RP(i){const e=[];for(const{name:t}of i)e.push({view:{key:"align",value:t},model:{key:"alignment",value:t}});return e}function VP(i){const e={};
1188for(const n of i)e[n.name]={key:"class",value:n.className};return{model:{key:"alignment",values:i.map(n=>n.name)},view:e}}/**
1189 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1190 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1191 */const Ti=new Map([["left",E.alignLeft],["right",E.alignRight],["center",E.alignCenter],["justify",E.alignJustify]]);class BP extends b{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=this.editor,t=Ng(e.config.get("alignment.options"));t.map(n=>n.name).filter(Lg).forEach(n=>this._addButton(n)),this._addToolbarDropdown(t),this._addMenuBarMenu(t)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,n=>this._createButton(n,e))}_createButton(e,t,n={}){const s=this.editor,o=s.commands.get("alignment"),r=new P(e);return r.set({label:this.localizedOptionTitles[t],icon:Ti.get(t),tooltip:!0,isToggleable:!0,...n}),r.bind("isEnabled").to(o),r.bind("isOn").to(o,"value",a=>a===t),this.listenTo(r,"execute",()=>{s.execute("alignment",{value:t}),s.editing.view.focus()}),r}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",s=>{const o=pe(s),r=s.uiLanguageDirection==="rtl"?"w":"e",a=s.t;fs(o,()=>e.map(u=>this._createButton(s,u.name,{tooltipPosition:r})),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:a("Text alignment toolbar")}),o.buttonView.set({label:a("Text alignment"),tooltip:!0}),o.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const l=s.contentLanguageDirection==="rtl"?Ti.get("right"):Ti.get("left"),c=t.commands.get("alignment");return o.buttonView.bind("icon").to(c,"value",u=>Ti.get(u)||l),o.bind("isEnabled").to(c,"isEnabled"),this.listenTo(o,"execute",()=>{t.editing.view.focus()}),o})}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",n=>{const s=t.commands.get("alignment"),o=n.t,r=new Pe(n),a=new jt(n);r.bind("isEnabled").to(s),a.set({ariaLabel:o("Text alignment"),role:"menu"}),r.buttonView.set({label:o("Text alignment")});for(const l of e){const c=new It(n,r),u=new Q(n);u.extendTemplate({attributes:{"aria-checked":u.bindTemplate.to("isOn")}}),u.delegate("execute").to(r),u.set({label:this.localizedOptionTitles[l.name],icon:Ti.get(l.name)}),u.on("execute",()=>{t.execute("alignment",{value:l.name}),t.editing.view.focus()}),u.bind("isOn").to(s,"value",d=>d===l.name),u.bind("isEnabled").to(s,"isEnabled"),c.children.add(u),a.items.add(c)}return r.panelView.children.add(a),r})}}/**
1192 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1193 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1194 */class MP extends b{static get requires(){return[SP,BP]}static get pluginName(){return"Alignment"}}/**
1195 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1196 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1197 */class or extends R{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,s=t.document.selection,o=e.value,r=e.batch,a=l=>{if(s.isCollapsed)o?l.setSelectionAttribute(this.attributeKey,o):l.removeSelectionAttribute(this.attributeKey);else{const c=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const u of c)o?l.setAttribute(this.attributeKey,o,u):l.removeAttribute(this.attributeKey,u)}};r?t.enqueueChange(r,l=>{a(l)}):t.change(l=>{a(l)})}}/**
1198 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1199 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1200 */const Ee="fontSize",Ae="fontFamily",ht="fontColor",Ct="fontBackgroun
1200dColor";function Dg(i,e){const t={model:{key:i,values:[]},view:{},upcastAlso:{}};for(const n of e)t.model.values.push(n.model),t.view[n.model]=n.view,n.upcastAlso&&(t.upcastAlso[n.model]=n.upcastAlso);return t}function $g(i){return e=>LP(e.getStyle(i))}function Ug(i){return(e,{writer:t})=>t.createAttributeElement("span",{style:`${i}:${e}`},{priority:7})}function OP({dropdownView:i,colors:e,columns:t,removeButtonLabel:n,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a}){const l=i.locale,c=new ml(l,{colors:e,columns:t,removeButtonLabel:n,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a});return i.colorSelectorView=c,i.panelView.children.add(c),c}function LP(i){return i.replace(/\s/g,"")}/**
1201 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1202 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1203 */class FP extends or{constructor(e){super(e,Ae)}}/**
1204 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1205 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1206 */function Hg(i){return i.map(NP).filter(e=>e!==void 0)}function NP(i){if(typeof i=="object")return i;if(i==="default")return{title:"Default",model:void 0};if(typeof i=="string")return DP(i)}function DP(i){const e=i.replace(/"|'/g,"").split(","),t=e[0],n=e.map($P).join(", ");return{title:t,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}function $P(i){return i=i.trim(),i.indexOf(" ")>0&&(i=`'${i}'`),i}/**
1207 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1208 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1209 */class UP extends b{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(Ae,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ae}),e.model.schema.setAttributeProperties(Ae,{isFormatting:!0,copyOnEnter:!0});const t=Hg(e.config.get("fontFamily.options")).filter(s=>s.model),n=Dg(Ae,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(Ae,new FP(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:Ae,view:(t,{writer:n})=>n.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:Ae,value:t=>t.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:Ae,value:t=>t.getAttribute("face")}})}}const Td='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';/**
1210 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1211 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1212 */class HP extends b{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),s=e.commands.get(Ae),o=t("Font Family"),r=zP(n,s);e.ui.componentFactory.add(Ae,a=>{const l=pe(a);return kn(l,r,{role:"menu",ariaLabel:o}),l.buttonView.set({label:o,icon:Td,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),l.bind("isEnabled").to(s),this.listenTo(l,"execute",c=>{e.execute(c.source.commandName,{value:c.source.commandParam}),e.editing.view.focus()}),l}),e.ui.componentFactory.add(`menuBar:${Ae}`,a=>{const l=new Pe(a);l.buttonView.set({label:o,icon:Td}),l.bind("isEnabled").to(s);const c=new jt(a);for(const u of r){const d=new It(a,l),h=new Q(a);h.bind(...Object.keys(u.model)).to(u.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",()=>{e.execute(u.model.commandName,{value:u.model.commandParam}),e.editing.view.focus()}),d.children.add(h),c.items.add(d)}return l.panelView.children.add(c),l})}_getLocalizedOptions(){const e=this.editor,t=e.t;return Hg(e.config.get(Ae).options).map(s=>(s.title==="Default"&&(s.title=t("Default")),s))}}function zP(i,e){const t=new me;for(const n of i){const s={type:"button",model:new ui({commandName:Ae,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};s.model.bind("isOn").to(e,"value",o=>o===n.model?!0:!o||!n.model?!1:o.split(",")[0].replace(/'/g,"").toLowerCase()===n.model.toLowerCase()),n.view&&typeof n.view!="string"&&n.view.styles&&s.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),t.add(s)}return t}/**
1213 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1214 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1215 */class WP extends b{static get requires(){return[UP,HP]}static get pluginName(){return"FontFamily"}}/**
1216 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1217 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1218 */class qP extends or{constructor(e){super(e,Ee)}}/**
1219 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1220 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1221 */function _l(i){return i.map(e=>jP(e)).filter(e=>e!==void 0)}const Ed={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}}
1221,get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function jP(i){if(typeof i=="number"&&(i=String(i)),typeof i=="object"&&JP(i))return ba(i);const e=KP(i);if(e)return ba(e);if(i==="default")return{model:void 0,title:"Default"};if(!ZP(i))return GP(i)}function GP(i){return typeof i=="string"&&(i={title:i,model:`${parseFloat(i)}px`}),i.view={name:"span",styles:{"font-size":i.model}},ba(i)}function ba(i){return i.view&&typeof i.view!="string"&&!i.view.priority&&(i.view.priority=7),i}function KP(i){return typeof i=="string"?Ed[i]:Ed[i.model]}function JP(i){return i.title&&i.model&&i.view}function ZP(i){let e;if(typeof i=="object")if(i.model)e=parseFloat(i.model);else throw new g("font-size-invalid-definition",null,i);else e=parseFloat(i);return isNaN(e)}/**
1222 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1223 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1224 */const Ad=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class QP extends b{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(Ee,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ee}),e.model.schema.setAttributeProperties(Ee,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),n=_l(this.editor.config.get("fontSize.options")).filter(o=>o.model),s=Dg(Ee,n);t?(this._prepareAnyValueConverters(s),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(s),e.commands.add(Ee,new qP(e))}_prepareAnyValueConverters(e){const t=this.editor,n=e.model.values.filter(s=>!Zo(String(s))&&!Vm(String(s)));if(n.length)throw new g("font-size-invalid-use-of-named-presets",null,{presets:n});t.conversion.for("downcast").attributeToElement({model:Ee,view:(s,{writer:o})=>{if(s)return o.createAttributeElement("span",{style:"font-size:"+s},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:Ee,value:s=>s.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:Ee,value:t=>{const n=t.getAttribute("size"),s=n[0]==="-"||n[0]==="+";let o=parseInt(n,10);s&&(o=3+o);const r=Ad.length-1,a=Math.min(Math.max(o,0),r);return Ad[a]}}})}}const xd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';/**
1225 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1226 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1227 */class YP extends b{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),s=e.commands.get(Ee),o=t("Font Size"),r=XP(n,s);e.ui.componentFactory.add(Ee,a=>{const l=pe(a);return kn(l,r,{role:"menu",ariaLabel:o}),l.buttonView.set({label:o,icon:xd,tooltip:!0}),l.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),l.bind("isEnabled").to(s),this.listenTo(l,"execute",c=>{e.execute(c.source.commandName,{value:c.source.commandParam}),e.editing.view.focus()}),l}),e.ui.componentFactory.add(`menuBar:${Ee}`,a=>{const l=new Pe(a);l.buttonView.set({label:o,icon:xd}),l.bind("isEnabled").to(s);const c=new jt(a);for(const u of r){const d=new It(a,l),h=new Q(a);h.bind(...Object.keys(u.model)).to(u.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",()=>{e.execute(u.model.commandName,{value:u.model.commandParam}),e.editing.view.focus()}),d.children.add(h),c.items.add(d)}return l.panelView.children.add(c),l})}_getLocalizedOptions(){const e=this.editor,t=e.t,n={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t
1227("Big"),Huge:t("Huge")};return _l(e.config.get(Ee).options).map(o=>{const r=n[o.title];return r&&r!=o.title&&(o=Object.assign({},o,{title:r})),o})}}function XP(i,e){const t=new me;for(const n of i){const s={type:"button",model:new ui({commandName:Ee,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&typeof n.view!="string"&&(n.view.styles&&s.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&s.model.set("class",`${s.model.class} ${n.view.classes}`)),s.model.bind("isOn").to(e,"value",o=>o===n.model),t.add(s)}return t}/**
1228 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1229 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1230 */class eR extends b{static get requires(){return[QP,YP]}static get pluginName(){return"FontSize"}normalizeSizeOptions(e){return _l(e)}}/**
1231 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1232 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1233 */class tR extends or{constructor(e){super(e,ht)}}/**
1234 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1235 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1236 */class nR extends b{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define(ht,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:ht,value:$g("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:ht,value:t=>t.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:ht,view:Ug("color")}),e.commands.add(ht,new tR(e)),e.model.schema.extend("$text",{allowAttributes:ht}),e.model.schema.setAttributeProperties(ht,{isFormatting:!0,copyOnEnter:!0})}}/**
1237 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1238 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1239 */class zg extends b{constructor(e,{commandName:t,componentName:n,icon:s,dropdownLabel:o}){super(e),this.commandName=t,this.componentName=n,this.icon=s,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,n=t.t,s=e.commands.get(this.commandName),o=e.config.get(this.componentName),r=es(o.colors),a=Xi(t,r),l=o.documentColors,c=o.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,u=>{const d=pe(u);let h=!1;const f=OP({dropdownView:d,colors:a.map(m=>({label:m.label,color:m.model,options:{hasBorder:m.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:l!==0?n("Document colors"):"",documentColorsCount:l===void 0?this.columns:l,colorPickerViewConfig:c?o.colorPicker||{}:!1});return f.bind("selectedColor").to(s,"value"),d.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),d.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),d.bind("isEnabled").to(s),f.on("execute",(m,p)=>{d.isOpen&&e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),p.source!=="colorPicker"&&e.editing.view.focus(),p.source==="colorPickerSaveButton"&&(d.isOpen=!1)}),f.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),f.on("colorPicker:cancel",()=>
1239{this._undoStepBatch.operations.length&&(d.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),d.on("change:isOpen",(m,p,_)=>{h||(h=!0,d.colorSelectorView.appendUI()),_&&(l!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),fl(d,()=>d.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(m=>m.isOn)),d}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,u=>{const d=new Pe(u);d.buttonView.set({label:this.dropdownLabel,icon:this.icon}),d.bind("isEnabled").to(s);let h=!1;const f=new ml(u,{colors:a.map(m=>({label:m.label,color:m.model,options:{hasBorder:m.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:l!==0?n("Document colors"):"",documentColorsCount:l===void 0?this.columns:l,colorPickerViewConfig:!1});return f.bind("selectedColor").to(s,"value"),f.delegate("execute").to(d),f.on("execute",(m,p)=>{e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),e.editing.view.focus()}),d.on("change:isOpen",(m,p,_)=>{h||(h=!0,f.appendUI()),_&&(l!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),d.panelView.children.add(f),d})}}const iR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>';/**
1240 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1241 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1242 */class sR extends zg{constructor(e){const t=e.locale.t;super(e,{commandName:ht,componentName:ht,icon:iR,dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}/**
1243 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1244 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1245 */class oR extends b{static get requires(){return[nR,sR]}static get pluginName(){return"FontColor"}}/**
1246 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1247 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1248 */class rR extends or{constructor(e){super(e,Ct)}}/**
1249 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1250 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1251 */class aR extends b{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define(Ct,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(ul),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:Ct,value:$g("background-color")}}),e.conversion.for("downcast").attributeToElement({model:Ct,view:Ug("background-color")}),e.commands.add(Ct,new rR(e)),e.model.schema.extend("$text",{allowAttributes:Ct}),e.model.schema.setAttributeProperties(Ct,{isFormatting:!0,copyOnEnter:!0})}}const lR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>';/**
1252 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1253 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1254 */class cR extends zg{constructor(e){const t=e.locale.t;super(e,{commandName:Ct,componentName:Ct,icon:lR,dropdownLabel:t
1254("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}/**
1255 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1256 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1257 */class uR extends b{static get requires(){return[aR,cR]}static get pluginName(){return"FontBackgroundColor"}}/**
1258 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1259 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1260 */class dR extends b{static get requires(){return[WP,eR,oR,uR]}static get pluginName(){return"Font"}}/**
1261 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1262 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1263 */class hR extends R{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,s=t.document.selection,o=e.value;t.change(r=>{if(s.isCollapsed){const a=s.getFirstPosition();if(s.hasAttribute("highlight")){const l=h=>h.item.hasAttribute("highlight")&&h.item.getAttribute("highlight")===this.value,c=a.getLastMatchingPosition(l,{direction:"backward"}),u=a.getLastMatchingPosition(l),d=r.createRange(c,u);!o||this.value===o?(a.isEqual(u)||r.removeAttribute("highlight",d),r.removeSelectionAttribute("highlight")):(a.isEqual(u)||r.setAttribute("highlight",o,d),r.setSelectionAttribute("highlight",o))}else o&&r.setSelectionAttribute("highlight",o)}else{const a=t.schema.getValidRanges(s.getRanges(),"highlight");for(const l of a)o?r.setAttribute("highlight",o,l):r.removeAttribute("highlight",l)}})}}/**
1264 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1265 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1266 */class fR extends b{static get pluginName(){return"HighlightEditing"}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(mR(t)),e.commands.add("highlight",new hR(e))}}function mR(i){const e={model:{key:"highlight",values:[]},view:{}};for(const t of i)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}const gR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z"/><path d="m2.556 16.727.234-.348c-.297-.151-.462-.293-.498-.426-.036-.137.002-.416.115-.837.094-.25.15-.449.169-.595a4.495 4.495 0 0 0 0-.725c-.209-.621-.303-1.041-.284-1.26.02-.218.178-.506.475-.862l6.77-9.414c.539-.91 1.605-.85 3.199.18 1.594 1.032 2.188 1.928 1.784 2.686l-5.877 10.36c-.158.412-.333.673-.526.782-.193.108-.604.179-1.232.21-.362.131-.608.237-.738.318-.13.081-.305.238-.526.47-.293.265-.504.397-.632.397-.096 0-.27-.075-.524-.226l-.31.41-1.6-1.12zm-.279.415 1.575 1.103-.392.515H1.19l1.087-1.618zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574c.175-.25-.188-.647-1.092-1.192-.903-.546-1.412-.652-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5H8.245z"/></svg>',pR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568-2.801-.645z"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97c.165-.233.356-.417.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005-3.055.797H4.5zm-.634.166-1.976.516-.026-1.918 2.002 1.402zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349zM8.245 18.5 9.59 17h9.406v1.5H8.245z"/></svg>';/**
1267 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1268 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1269 */class bR extends b{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),E.eraser,null,n=>{n.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,Ws(e.type),e.model,n);function n(s){s.bind("isEnabled").to(t,"isEnabled"),s.bind("isOn").to(t,"value",o=>o===e.model),s.iconView.fillColor=e.color,s.isToggleable=!0}}_addButton(e,t,n,s,o){const r=this.editor;
1269r.ui.componentFactory.add(e,a=>{const l=new P(a),c=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return l.set({label:c,icon:n,tooltip:!0}),l.on("execute",()=>{r.execute("highlight",{value:s}),r.editing.view.focus()}),o(l),l})}_addDropdown(e){const t=this.editor,n=t.t,s=t.ui.componentFactory,o=e[0],r=e.reduce((a,l)=>(a[l.model]=l,a),{});s.add("highlight",a=>{const l=t.commands.get("highlight"),c=pe(a,ci),u=c.buttonView;u.set({label:n("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),u.bind("icon").to(l,"value",f=>Ws(h(f,"type"))),u.bind("color").to(l,"value",f=>h(f,"color")),u.bind("commandValue").to(l,"value",f=>h(f,"model")),u.bind("isOn").to(l,"value",f=>!!f),u.delegate("execute").to(c);const d=()=>{const f=e.map(m=>{const p=s.create("highlight:"+m.model);return this.listenTo(p,"execute",()=>{c.buttonView.set({lastExecuted:m.model})}),p});return f.push(new dl),f.push(s.create("removeHighlight")),f};c.bind("isEnabled").to(l,"isEnabled"),fs(c,d,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n("Text highlight toolbar")}),wR(c),u.on("execute",()=>{t.execute("highlight",{value:u.commandValue})}),this.listenTo(c,"execute",()=>{t.editing.view.focus()});function h(f,m){const p=!f||f===u.lastExecuted?u.lastExecuted:f;return r[p][m]}return c})}_addMenuBarButton(e){const t=this.editor,n=t.t;t.ui.componentFactory.add("menuBar:highlight",s=>{const o=t.commands.get("highlight"),r=new Pe(s);r.buttonView.set({label:n("Highlight"),icon:Ws("marker")}),r.bind("isEnabled").to(o),r.buttonView.iconView.fillColor="transparent";const a=new jt(s);for(const u of e){const d=new It(s,r),h=new Q(s);h.set({label:u.title,icon:Ws(u.type)}),h.delegate("execute").to(r),h.bind("isOn").to(o,"value",f=>f===u.model),h.bind("ariaChecked").to(h,"isOn"),h.iconView.bind("fillColor").to(h,"isOn",f=>f?"transparent":u.color),h.on("execute",()=>{t.execute("highlight",{value:u.model}),t.editing.view.focus()}),d.children.add(h),a.items.add(d)}a.items.add(new Yo(s));const l=new It(s,r),c=new Q(s);return c.set({label:n("Remove highlight"),icon:E.eraser}),c.delegate("execute").to(r),c.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),l.children.add(c),a.items.add(l),r.panelView.children.add(a),r})}}function wR(i){i.buttonView.actionView.iconView.bind("fillColor").to(i.buttonView,"color")}function Ws(i){return i==="marker"?gR:pR}/**
1270 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1271 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1272 */class _R extends b{static get requires(){return[fR,bR]}static get pluginName(){return"Highlight"}}/**
1273 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1274 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1275 */class yR extends C{constructor(e){super(e);const t=e.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(n,s)=>n>0&&!s),this._findInputView=this._createInputField(t("Find in text…")),this._findPrevButtonView=this._createButton({label:t("Previous result"),class:"ck-button-prev",icon:E.previousArrow,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:t("Next result"),class:"ck-button-next",icon:E.previousArrow,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(t("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:t("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:t("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:t("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new se,this._keystrokes=new de,this._focusables=new ve,this.focusCycler=new ke({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),wn({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}
1275reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const e=this.locale,t=e.t,n=new C(e);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:s})=>s),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:s})=>s),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:s},o)=>s&&o),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(s,o)=>s||!o?"":t("Tip: Find some text first in order to replace it.")),n.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),n}_onFindButtonExecute(){if(!this._textToFind){const e=this.t;this._findInputView.errorText=e("Text to find must not be empty.");return}this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){const e=this.locale,t=e.t,n=this.bindTemplate,s=new C(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(r,a)=>t("%0 of %1",[r,a])),s.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",n.if("isDirty","ck-hidden")]},children:[{text:n.to("_resultsCounterText")}]});const o=()=>{const r=this._findInputView.fieldView.element;if(!r||!Wt(r))return;const a=new O(s.element).width,l=e.uiLanguageDirection==="ltr"?"paddingRight":"paddingLeft";a?r.style[l]=`calc( 2 * var(--ck-spacing-standard) + ${a}px )`:r.style[l]=""};this.on("change:_resultsCounterText",o,{priority:"low"}),this.on("change:isDirty",o,{priority:"low"}),this._findInputView.template.children[0].children.push(s)}_createAdvancedOptionsCollapsible(){const e=this.locale.t,t=new Fm(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e("Advanced options"),isCollapsed:!0}),t}_createActionButtonsDiv(){const e=new C(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:t},n)=>t&&n),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:t},n)=>t&&n),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),e.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),e}_createMatchCaseSwitch(){const e=this.locale.t,t=new Yn(this.locale);return t.set({label:e("Match case"),withText:!0}),t.bind("isOn").to(this,"_matchCase"),t.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),t}_createWholeWordsOnlySwitch(){const e=this.locale.t,t=new Yn(this.locale);return t.set({label:e("Whole words only"),withText:!0}),t.bind("isOn").to(this,"_wholeWordsOnly"),t.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),t}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(t=>{this._focusables.add(t),this._focusTracker.add(t.element)})}_initKeystrokeHandling(){const e=n=>n.stopPropagation(),t=n=>{n.stopPropagation(),n.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",n=>{t(n),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",n=>{t(n),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",n=>{const s=n.target;
1275s===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(n)):s===this._replaceInputView.fieldView.element&&!this.isDirty&&(this._replaceButtonView.fire("execute"),t(n))}),this._keystrokes.set("shift+enter",n=>{n.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(n))}),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e)}_createButton(e){const t=new P(this.locale);return t.set(e),t}_createInputField(e,t){const n=new he(this.locale,De);return n.label=e,n.class=t,n}}const Sd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286l-3.857-4.596z"/><path d="M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306zm-3.4-5.715c.562.305.742 1.106.354 1.494-.388.388-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.469 6.469 0 0 1 3.1.784z"/><path d="M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0zm11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0z"/></svg>';/**
1276 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1277 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1278 */class vR extends b{static get requires(){return[dt]}static get pluginName(){return"FindAndReplaceUI"}constructor(e){super(e),e.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const e=this.editor,t=e.config.get("findAndReplace.uiType")==="dropdown",n=e.commands.get("find"),s=this.editor.t;e.ui.componentFactory.add("findAndReplace",()=>{let o;return t?(o=this._createDropdown(),o.bind("isEnabled").to(n)):o=this._createDialogButtonForToolbar(),e.keystrokes.set("Ctrl+F",(r,a)=>{if(n.isEnabled){if(o instanceof gn){const l=o.buttonView;l.isOn||l.fire("execute")}else o.isOn?e.plugins.get("Dialog").view.focus():o.fire("execute");a()}}),o}),t||e.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const e=this.editor,t=e.locale.t,n=pe(e.locale);return n.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new Xo(e.locale,{label:t("Find and replace")}),0),n.panelView.children.add(this.formView)}),n.on("change:isOpen",(s,o,r)=>{r?this._setupFormView():this.fire("searchReseted")},{priority:"low"}),n.buttonView.set({icon:Sd,label:t("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),n}_createDialogButtonForToolbar(){const e=this.editor,t=this._createButton(P),n=e.plugins.get("Dialog");return t.set({tooltip:!0}),t.bind("isOn").to(n,"id",s=>s==="findAndReplace"),t.on("execute",()=>{t.isOn?n.hide():this._showDialog()}),t}_createDialogButtonForMenuBar(){const e=this._createButton(Q),t=this.editor.plugins.get("Dialog");return e.on("execute",()=>{if(t.id==="findAndReplace"){t.hide();return}this._showDialog()}),e}_createButton(e){const t=this.editor,n=t.commands.get("find"),s=new e(t.locale),o=t.locale.t;return s.bind("isEnabled").to(n),s.set({icon:Sd,label:o("Find and replace"),keystroke:"CTRL+F"}),s}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.locale.t;this.formView||(this.formView=this._createFormView()),t.show({id:"findAndReplace",title:n("Find and replace"),content:this.formView,position:je.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const e=this.editor,t=new(qo(yR))(e.locale),n=e.commands,o=this.editor.plugins.get("FindAndReplaceEditing").state;t.bind("highlightOffset").to(o,"highlightedOffset"),t.listenTo(o.results,"change",()=>{t.matchCount=o.results.length});const r=n.get("findNext"),a=n.get("findPrevious"),l=n.get("replace"),c=n.get("replaceAll");return t.bind("_areCommandsEnabled").to(r,"isEnabled",a,"isEnabled",l,"isEnabled",c,"isEnabled",(u,d,h,f)=>({findNext:u,findPrevious:d,replace:h,replaceAll:f})),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",(u,d,h)=>{h&&this.fire("searchReseted")}),t}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputVie
1278w.fieldView.select(),this.formView.enableCssTransitions()}}/**
1279 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1280 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1281 */class kR extends R{constructor(e,t){super(e),this.isEnabled=!0,this.affectsData=!1,this._state=t}execute(e,{matchCase:t,wholeWords:n}={}){const{editor:s}=this,{model:o}=s,r=s.plugins.get("FindAndReplaceUtils");let a;typeof e=="string"?(a=r.findByTextCallback(e,{matchCase:t,wholeWords:n}),this._state.searchText=e):a=e;const l=o.document.getRootNames().reduce((c,u)=>r.updateFindResultFromRange(o.createRangeIn(o.document.getRoot(u)),o,a,c),null);return this._state.clear(o),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),typeof e=="string"&&(this._state.searchText=e),a&&(this._state.lastSearchCallback=a),this._state.matchCase=!!t,this._state.matchWholeWords=!!n,{results:l,findCallback:a}}}/**
1282 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1283 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1284 */class Wg extends R{constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this._isEnabledBasedOnSelection=!1}_replace(e,t){const{model:n}=this.editor,s=t.marker.getRange();n.canEditAt(s)&&n.change(o=>{if(s.root.rootName==="$graveyard"){this._state.results.remove(t);return}let r={};for(const a of s.getItems())if(a.is("$text")||a.is("$textProxy")){r=a.getAttributes();break}n.insertContent(o.createText(e,r),s),this._state.results.has(t)&&this._state.results.remove(t)})}}/**
1285 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1286 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1287 */class CR extends Wg{execute(e,t){this._replace(e,t)}}/**
1288 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1289 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1290 */class TR extends Wg{execute(e,t){const{editor:n}=this,{model:s}=n,o=n.plugins.get("FindAndReplaceUtils"),r=t instanceof me?t:s.document.getRootNames().reduce((a,l)=>o.updateFindResultFromRange(s.createRangeIn(s.document.getRoot(l)),s,o.findByTextCallback(t,this._state),a),null);r.length&&s.change(()=>{[...r].forEach(a=>{this._replace(e,a)})})}}/**
1291 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1292 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1293 */class qg extends R{constructor(e,t){super(e),this.affectsData=!1,this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){const e=this._state.results,t=e.getIndex(this._state.highlightedResult),n=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(n)}}/**
1294 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1295 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1296 */class ER extends qg{execute(){const t=this._state.results.getIndex(this._state.highlightedResult),n=t-1<0?this._state.results.length-1:t-1;this._state.highlightedResult=this._state.results.get(n)}}/**
1297 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1298 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1299 */class AR extends W(){constructor(e){super(),this.set("results",new me),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(t,{removed:n,index:s})=>{if(Array.from(n).length){let o=!1;if(e.change(r=>{for(const a of n)this.highlightedResult===a&&(o=!0),e.markers.has(a.marker.name)&&r.removeMarker(a.marker)}),o){const r=s>=this.results.length?0:s;this.highlightedResult=this.results.get(r)}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset()})}clear(e){this.searchText="",e.change(t=>{if(this.highlightedResult){const n=this.highlightedResult.marker.name.split(":")[1],s=e.markers.get(`findResultHighlighted:${n}`);s&&t.removeMarker(s)}
1299[...this.results].forEach(({marker:n})=>{t.removeMarker(n)})}),this.results.clear()}refreshHighlightOffset(){const{highlightedResult:e,results:t}=this,n={before:-1,same:0,after:1,different:1};e?this.highlightedOffset=Array.from(t).sort((s,o)=>n[s.marker.getStart().compareWith(o.marker.getStart())]).indexOf(e)+1:this.highlightedOffset=0}}/**
1300 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1301 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1302 */class xR extends b{static get pluginName(){return"FindAndReplaceUtils"}updateFindResultFromRange(e,t,n,s){const o=s||new me,r=a=>o.find(l=>{const{marker:c}=l,u=c.getRange(),d=a.getRange();return u.isEqual(d)});return t.change(a=>{[...e].forEach(({type:l,item:c})=>{if(l==="elementStart"&&t.schema.checkChild(c,"$text")){const u=n({item:c,text:this.rangeToText(t.createRangeIn(c))});if(!u)return;u.forEach(d=>{const h=`findResult:${$e()}`,f=a.addMarker(h,{usingOperation:!1,affectsData:!1,range:a.createRange(a.createPositionAt(c,d.start),a.createPositionAt(c,d.end))}),m=SR(o,f);r(f)||o.add({id:h,label:d.label,marker:f},m)})}})}),o}rangeToText(e){return Array.from(e.getItems()).reduce((t,n)=>n.is("$text")||n.is("$textProxy")?t+n.data:`${t}
1303`,"")}findByTextCallback(e,t){let n="gu";t.matchCase||(n+="i");let s=`(${qa(e)})`;if(t.wholeWords){const a="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+a).test(e)||(s=`(^|${a}|_)${s}`),new RegExp(a+"$").test(e)||(s=`${s}(?=_|${a}|$)`)}const o=new RegExp(s,n);function r({text:a}){return[...a.matchAll(o)].map(IR)}return r}}function SR(i,e){const t=i.find(({marker:n})=>e.getStart().isBefore(n.getStart()));return t?i.getIndex(t):i.length}function IR(i){const e=i.length-1;let t=i.index;return i.length===3&&(t+=i[1].length),{label:i[e],start:t,end:t+i[e].length}}/**
1304 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1305 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1306 */const PR="ck-find-result_selected";class RR extends b{constructor(){super(...arguments),this._onDocumentChange=()=>{const e=new Set,t=new Set,n=this.editor.model,{results:s}=this.state,o=n.document.differ.getChanges(),r=n.document.differ.getChangedMarkers();o.forEach(c=>{c.position&&(c.name==="$text"||c.position.nodeAfter&&n.schema.isInline(c.position.nodeAfter)?(e.add(c.position.parent),[...n.markers.getMarkersAtPosition(c.position)].forEach(u=>{t.add(u.name)})):c.type==="insert"&&c.position.nodeAfter&&e.add(c.position.nodeAfter))}),r.forEach(({name:c,data:{newRange:u}})=>{u&&u.start.root.rootName==="$graveyard"&&t.add(c)}),e.forEach(c=>{[...n.markers.getMarkersIntersectingRange(n.createRangeIn(c))].forEach(d=>t.add(d.name))}),t.forEach(c=>{s.has(c)&&(s.get(c)===this.state.highlightedResult&&(this.state.highlightedResult=null),s.remove(c))});const a=[],l=this.editor.plugins.get("FindAndReplaceUtils");e.forEach(c=>{const u=l.updateFindResultFromRange(n.createRangeOn(c),n,this.state.lastSearchCallback,s);a.push(...u)}),r.forEach(c=>{if(c.data.newRange){const u=l.updateFindResultFromRange(c.data.newRange,n,this.state.lastSearchCallback,s);a.push(...u)}}),!this.state.highlightedResult&&a.length?this.state.highlightedResult=a[0]:this.state.refreshHighlightOffset()}}static get requires(){return[xR]}static get pluginName(){return"FindAndReplaceEditing"}init(){this.state=new AR(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",(n,s,o,r)=>{const{model:a}=this.editor;a.change(l=>{if(r){const c=r.marker.name.split(":")[1],u=a.markers.get(`findResultHighlighted:${c}`);u&&l.removeMarker(u)}if(o){const c=o.marker.name.split(":")[1];l.addMarker(`findResultHighlighted:${c}`,{usingOperation:!1,affectsData:!1,range:o.marker.getRange()})}})});/* istanbul ignore next -- @preserve */const t=gt(((n,s,o)=>{if(o){const r=this.editor.editing.view.domConverter,a=this.editor.editing.mapper.toViewRange(o.marker.getRange());xf({target:r.viewRangeToDom(a),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",t,{priority:"low"}),this.listenTo(this.editor,"destroy",t.cancel),this.on("change:_isSearchActive",(n,s,o)=>{o?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)})}find(e,t){return this._isSearchActive=!0,this.editor.execute("find",e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new kR(this.editor,this.state)),this.editor.commands.add("findNext",new qg(this.editor,this.state)),this.editor.commands.add("findPrevious",new ER(this.editor,this.state)),this.editor.commands.add("replace",new CR(this.editor,this.state)),this.editor.commands.add("replaceAll",new TR(this.editor,this.state))}_defineConverters(){const{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:t})=>{const[,n]=t.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":n}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:t})=>{const[,n]=t.split(":");return{name:"span",classes:[PR],attributes:{"data-find-result":n}}}})}}/**
1307 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1308 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1309 */class VR extends b{static get requires(){return[RR,vR]}static get pluginName(){return"FindAndReplace"}init(){const e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),n=t.state;e.on("findNext",(s,o)=>{o?(n.searchText=o.searchText,t.find(o.searchText,o)):this.editor.execute("findNext")}),e.on("findPrevious",(s,o)=>{o&&n.searchText!==o.searchText?t.find(o.searchText):this.editor.execute("findPrevious")}),e.on("replace",(s,o)=>{n.searchText!==o.searchText&&t.find(o.searchText);const r=n.highlightedResult;r&&this.editor.execute("replace",o.replaceText,r)}),e.on("replaceAll",(s,o)=>{n.searchText!==o.searchText&&t.find(o.searchText),this.editor.execute("replaceAll",o.replaceText,n.results)}),e.on("searchReseted",()=>{n.clear(this.editor.model),t.stop()})}}/**
1310 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1311 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1312 */class BR extends R{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=MR(n,t,e)}execute(){const e=this.editor.model;e.change(t=>{const n=t.createElement("horizontalLine");
1312e.insertObject(n,null,null,{setSelection:"after"})})}}function MR(i,e,t){const n=OR(i,t);return e.checkChild(n,"horizontalLine")}function OR(i,e){const n=ir(i,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}/**
1313 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1314 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1315 */class LR extends b{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,n=e.t,s=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),s.for("dataDowncast").elementToElement({model:"horizontalLine",view:(o,{writer:r})=>r.createEmptyElement("hr")}),s.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(o,{writer:r})=>{const a=n("Horizontal line"),l=r.createContainerElement("div",null,r.createEmptyElement("hr"));return r.addClass("ck-horizontal-line",l),r.setCustomProperty("hr",!0,l),FR(l,r,a)}}),s.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new BR(e))}}function FR(i,e,t){return e.setCustomProperty("horizontalLine",!0,i),ms(i,e,{label:t})}/**
1316 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1317 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1318 */class NR extends b{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",()=>{const t=this._createButton(P);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(Q))}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get("horizontalLine"),o=new e(t.locale),r=n.t;return o.set({label:r("Horizontal line"),icon:E.horizontalLine}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("horizontalLine"),t.editing.view.focus()}),o}}/**
1319 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1320 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1321 */class DR extends b{static get requires(){return[LR,NR,Cn]}static get pluginName(){return"HorizontalLine"}}/**
1322 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1323 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1324 */class $R extends R{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=UR(n,t,e)}execute(){const e=this.editor.model;e.change(t=>{const n=t.createElement("pageBreak");e.insertObject(n,null,null,{setSelection:"after"})})}}function UR(i,e,t){const n=HR(i,t);return e.checkChild(n,"pageBreak")}function HR(i,e){const n=ir(i,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}/**
1325 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1326 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1327 */class zR extends b{static get pluginName(){return"PageBreakEditing"}init(){const e=this.editor,t=e.model.schema,n=e.t,s=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),s.for("dataDowncast").elementToStructure({model:"pageBreak",view:(o,{writer:r})=>r.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},r.createContainerElement("span",{style:"display: none"}))}),s.for("editingDowncast").elementToStructure({model:"pageBreak",view:(o,{writer:r})=>{const a=n("Page break"),l=r.createContainerElement("div"),c=r.createRawElement("span",{class:"page-break__label"},function(u){u.innerText=n("Page break")});return r.addClass("page-break",l),r.insert(r.createPositionAt(l,0),c),WR(l,r,a)}}),s.for("upcast").elementToElement({view:o=>{const r=o.getStyle("page-break-before")=="always",a=o.getStyle("page-break-after")=="always";if(!r&&!a)return null;if(o.childCount==1){const l=o.getChild(0);if(!l.is("element","span")||l.getStyle("display")!="none")return null}else if(o.childCount>1)return null;return{name:!0}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new $R(e))}}function WR(i,e,t){return e.setCustomProperty("pageBreak",!0,i),ms(i,e,{label:t})}const qR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z"/><path d="M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z"/><path d="M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z"/></svg>';/**
1328 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1329 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1330 */class jR extends b{static get pluginName(){return"PageBreakUI"}init(){const e=this.editor;e.ui.componentFactory.add("pageBreak",()=>{const t=this._createButton(P);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:pageBreak",()=>this._createButton(Q))}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get("pageBreak"),o=new e(t.locale),r=n.t;return o.set({label:r("Page break"),icon:qR}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("pageBreak"),t.editing.view.focus()}),o}}/**
1331 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1332 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1333 */class GR extends b{static get requires(){return[zR,jR,Cn]}static get pluginName(){return"PageBreak"}}/**
1334 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1335 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1336 */function yl(i,e){const{modelAttribute:t,styleName:n,viewElement:s,defaultValue:o,reduceBoxSides:r=!1,shouldUpcast:a=()=>!0}=e;i.for("upcast").attributeToAttribute({view:{name:s,styles:{[n]:/[\s\S]+/}},model:{key:t,value:l=>{if(!a(l))return;const c=l.getNormalizedStyle(n),u=r?oo(c):c;if(o!==u)return u}}})}
1336function wa(i,e,t,n){i.for("upcast").add(s=>s.on("element:"+e,(o,r,a)=>{if(!r.modelRange)return;const l=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(f=>r.viewItem.hasStyle(f));if(!l.length)return;const c={styles:l};if(!a.consumable.test(r.viewItem,c))return;const u=[...r.modelRange.getItems({shallow:!0})].pop();a.consumable.consume(r.viewItem,c);const d={style:r.viewItem.getNormalizedStyle("border-style"),color:r.viewItem.getNormalizedStyle("border-color"),width:r.viewItem.getNormalizedStyle("border-width")},h={style:oo(d.style),color:oo(d.color),width:oo(d.width)};h.style!==n.style&&a.writer.setAttribute(t.style,h.style,u),h.color!==n.color&&a.writer.setAttribute(t.color,h.color,u),h.width!==n.width&&a.writer.setAttribute(t.width,h.width,u)}))}function Di(i,e){const{modelElement:t,modelAttribute:n,styleName:s}=e;i.for("downcast").attributeToAttribute({model:{name:t,key:n},view:o=>({key:"style",value:{[s]:o}})})}function so(i,e){const{modelAttribute:t,styleName:n}=e;i.for("downcast").add(s=>s.on(`attribute:${t}:table`,(o,r,a)=>{const{item:l,attributeNewValue:c}=r,{mapper:u,writer:d}=a;if(!a.consumable.consume(r.item,o.name))return;const h=[...u.toViewElement(l).getChildren()].find(f=>f.is("element","table"));c?d.setStyle(n,c,h):d.removeStyle(n,h)}))}function oo(i){if(!i)return;const e=["top","right","bottom","left"];if(!e.every(o=>i[o]))return i;const n=i.top;return e.every(o=>i[o]===n)?n:i}/**
1337 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1338 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1339 */function oe(i,e,t,n,s=1){e!=null&&s!==void 0&&s!==null&&e>s?n.setAttribute(i,e,t):n.removeAttribute(i,t)}function xn(i,e,t={}){const n=i.createElement("tableCell",t);return i.insertElement("paragraph",n),i.insert(n,e),n}function _a(i,e){const t=e.parent.parent,n=parseInt(t.getAttribute("headingColumns")||"0"),{column:s}=i.getCellLocation(e);return!!n&&s<n}function ro(i,e,t){const{modelAttribute:n}=t;i.extend("tableCell",{allowAttributes:[n]}),yl(e,{viewElement:/^(td|th)$/,...t}),Di(e,{modelElement:"tableCell",...t})}function ya(i){const e=i.getSelectedElement();return e&&e.is("element","table")?e:i.getFirstPosition().findAncestor("table")}/**
1340 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1341 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1342 */function KR(){return i=>{i.on("element:figure",(e,t,n)=>{if(!n.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const s=QR(t.viewItem);if(!s||!n.consumable.test(s,{name:!0}))return;n.consumable.consume(t.viewItem,{name:!0,classes:"table"});const o=n.convertItem(s,t.modelCursor),r=ie(o.modelRange.getItems());if(!r){n.consumable.revert(t.viewItem,{name:!0,classes:"table"});return}n.convertChildren(t.viewItem,n.writer.createPositionAt(r,"end")),n.updateConversionResult(r,t)})}}function JR(){return i=>{i.on("element:table",(e,t,n)=>{const s=t.viewItem;if(!n.consumable.test(s,{name:!0}))return;const{rows:o,headingRows:r,headingColumns:a}=YR(s),l={};a&&(l.headingColumns=a),r&&(l.headingRows=r);const c=n.writer.createElement("table",l);if(n.safeInsert(c,t.modelCursor)){if(n.consumable.consume(s,{name:!0}),o.forEach(u=>n.convertItem(u,n.writer.createPositionAt(c,"end"))),n.convertChildren(s,n.writer.createPositionAt(c,"end")),c.isEmpty){const u=n.writer.createElement("tableRow");n.writer.insert(u,n.writer.createPositionAt(c,"end")),xn(n.writer,n.writer.createPositionAt(u,"end"))}n.updateConversionResult(c,t)}})}}function ZR(){return i=>{i.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&t.modelCursor.index==0&&e.stop()},{priority:"high"})}}function Id(i){return e=>{e.on(`element:${i}`,(t,n,{writer:s})=>{if(!n.modelRange)return;const o=n.modelRange.start.nodeAfter,r=s.createPositionAt(o,0);if(n.viewItem.isEmpty){s.insertElement("paragraph",r);return}const a=Array.from(o.getChildren());if(a.every(l=>l.is("element","$marker"))){const l=s.createElement("paragraph");s.insert(l,s.createPositionAt(o,0));for(const c of a)s.move(s.createRangeOn(c),s.createPositionAt(l,"end"))}},{priority:"low"})}}function QR(i){for(const e of i.getChildren())if(e.is("element","table"))return e}function YR(i){let e=0,t;const n=[],s=[];let o;for(const r of Array.from(i.getChildren())){if(r.name!=="tbody"&&r.name!=="thead"&&r.name!=="tfoot")continue;r.name==="thead"&&!o&&(o=r);const a=Array.from(r.getChildren()).filter(l=>l.is("element","tr"));for(const l of a)if(o&&r===o||r.name==="tbody"&&Array.from(l.getChildren()).length&&Array.from(l.getChildren()).every(c=>c.is("element","th")))e++,n.push(l);else{s.push(l);const c=XR(l);(!t||c<t)&&(t=c)}}return{headingRows:e,headingColumns:t||0,rows:[...n,...s]}}function XR(i){let e=0,t=0;const n=Array.from(i.getChildren()).filter(s=>s.name==="th"||s.name==="td");for(;t<n.length&&n[t].name==="th";){const s=n[t],o=parseInt(s.getAttribute("colspan")||"1");e=e+o,t++}return e}/**
1343 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1344 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1345 */class z{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{const s=e.getChild(this._cellIndex);if(!s)return this._advanceToNextRow();const o=parseInt(s.getAttribute("colspan")||"1"),r=parseInt(s.getAttribute("rowspan")||"1");(o>1||r>1)&&this._recordSpans(s,r,o),this._shouldSkipSlot()||(t=this._formatOutValue(s)),this._nextCellAtColumn=this._column+o}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}
1345skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new eV(this,e,t,n)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,s=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||n||s}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){const s={cell:e,row:this._row,column:this._column};for(let o=this._row;o<this._row+t;o++)for(let r=this._column;r<this._column+n;r++)(o!=this._row||r!=this._column)&&this._markSpannedCell(o,r,s)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((n,s)=>n+parseInt(s.getAttribute("colspan")||"1"),0)}}class eV{constructor(e,t,n,s){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=s,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}/**
1346 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1347 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1348 */function Pd(i,e){return(t,{writer:n})=>{const s=t.getAttribute("headingRows")||0,o=n.createContainerElement("table",null,[]),r=n.createContainerElement("figure",{class:"table"},o);s>0&&n.insert(n.createPositionAt(o,"end"),n.createContainerElement("thead",null,n.createSlot(a=>a.is("element","tableRow")&&a.index<s))),s<i.getRows(t)&&n.insert(n.createPositionAt(o,"end"),n.createContainerElement("tbody",null,n.createSlot(a=>a.is("element","tableRow")&&a.index>=s)));for(const{positionOffset:a,filter:l}of e.additionalSlots)n.insert(n.createPositionAt(o,a),n.createSlot(l));return n.insert(n.createPositionAt(o,"after"),n.createSlot(a=>a.is("element","tableRow")?!1:!e.additionalSlots.some(({filter:l})=>l(a)))),e.asWidget?nV(r,n):r}}function tV(){return(i,{writer:e})=>i.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}function Rd(i={}){return(e,{writer:t})=>{const n=e.parent,s=n.parent,o=s.getChildIndex(n),r=new z(s,{row:o}),a=s.getAttribute("headingRows")||0,l=s.getAttribute("headingColumns")||0;let c=null;for(const u of r)if(u.cell==e){const h=u.row<a||u.column<l?"th":"td";c=i.asWidget?wg(t.createEditableElement(h),t):t.createContainerElement(h);break}return c}}function Vd(i={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!jg(e))return null;if(i.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const n=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,n),n}}}function jg(i){return i.parent.childCount==1&&!iV(i)}function nV(i,e){return e.setCustomProperty("table",!0,i),ms(i,e,{hasSelectionHandle:!0})}function iV(i){return!i.getAttributeKeys().next().done}/**
1349 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1350 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1351 */class sV extends R{refresh(){const e=this.editor.model,t=e.document.selection,n=e.sc
1351hema;this.isEnabled=oV(t,n)}execute(e={}){const t=this.editor,n=t.model,s=t.plugins.get("TableUtils"),o=t.config.get("table.defaultHeadings.rows"),r=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&o&&(e.headingRows=o),e.headingColumns===void 0&&r&&(e.headingColumns=r),n.change(a=>{const l=s.createTable(a,e);n.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}function oV(i,e){const t=i.getFirstPosition().parent,n=t===t.root?t:t.parent;return e.checkChild(n,"table")}/**
1352 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1353 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1354 */class Bd extends R{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,n=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=n}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),s=this.order==="above",o=n.getSelectionAffectedTableCells(t),r=n.getRowIndexes(o),a=s?r.first:r.last,l=o[0].findAncestor("table");n.insertRows(l,{at:s?a:a+1,copyStructureFromAbove:!s})}}/**
1355 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1356 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1357 */class Md extends R{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,n=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=n}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),s=this.order==="left",o=n.getSelectionAffectedTableCells(t),r=n.getColumnIndexes(o),a=s?r.first:r.last,l=o[0].findAncestor("table");n.insertColumns(l,{columns:1,at:s?a:a+1})}}/**
1358 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1359 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1360 */class Od extends R{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length===1}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}/**
1361 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1362 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1363 */function Gg(i,e,t){const{startRow:n,startColumn:s,endRow:o,endColumn:r}=e,a=t.createElement("table"),l=o-n+1;for(let u=0;u<l;u++)t.insertElement("tableRow",a,"end");const c=[...new z(i,{startRow:n,endRow:o,startColumn:s,endColumn:r,includeAllSlots:!0})];for(const{row:u,column:d,cell:h,isAnchor:f,cellAnchorRow:m,cellAnchorColumn:p}of c){const _=u-n,v=a.getChild(_);if(!f)(m<n||p<s)&&xn(t,t.createPositionAt(v,"end"));else{const T=t.cloneElement(h);t.append(T,v),Yg(T,u,d,o,r,t)}}return rV(a,i,n,s,t),a}function Kg(i,e,t=0){const n=[],s=new z(i,{startRow:t,endRow:e-1});for(const o of s){const{row:r,cellHeight:a}=o,l=r+a-1;r<e&&e<=l&&n.push(o)}return n}function Jg(i,e,t){const n=i.parent,s=n.parent,o=n.index,r=parseInt(i.getAttribute("rowspan")),a=e-o,l={},c=r-a;c>1&&(l.rowspan=c);const u=parseInt(i.getAttribute("colspan")||"1");u>1&&(l.colspan=u);const d=o,h=d+a,f=[...new z(s,{startRow:d,endRow:h,includeAllSlots:!0})];let m=null,p;for(const _ of f){const{row:v,column:T,cell:L}=_;L===i&&p===void 0&&(p=T),p!==void 0&&p===T&&v===h&&(m=xn(t,_.getPositionBefore(),l))}return oe("rowspan",a,i,t),m}function Zg(i,e){const t=[],n=new z(i);for(const s of n){const{column:o,cellWidth:r}=s,a=o+r-1;o<e&&e<=a&&t.push(s)}return t}function Qg(i,e,t,n){const s=parseInt(i.getAttribute("colspan")),o=t-e,r={},a=s-o;a>1&&(r.colspan=a);const l=parseInt(i.getAttribute("rowspan")||"1");l>1&&(r.rowspan=l);const c=xn(n,n.createPositionAfter(i),r);return oe("colspan",o,i,n),c}function Yg(i,e,t,n,s,o){const r=parseInt(i.getAttribute("colspan")||"1"),a=parseInt(i.getAttribute("rowspan")||"1");if(t+r-1>s){const u=s-t+1;oe("colspan",u,i,o,1)}if(e+a-1>n){const u=n-e+1;oe("rowspan",u,i,o,1)}}function rV(i,e,t,n,s){const o=parseInt(e.getAttribute("headingRows")||"0");if(o>0){const a=o-t;oe("headingRows",a,i,s,0)}const r=parseInt(e.getAttribute("headingColumns")||"0");if(r>0){const a=r-n;oe("headingColumns",a,i,s,0)}}function va(i,e){const t=e.getColumns(i),n=new Array(t).fill(0);for(const{column:o}of new z(i))n[o]++;const s=n.reduce((o,r,a)=>r?o:[...o,a],[]);if(s.length>0){const o=s[s.length-1];return e.removeColumns(i,{at:o}),!0}return!1}function ka(i,e){const t=[],n=e.getRows(i);for(let s=0;s<n;s++)i.getChild(s).isEmpty&&t.push(s);if(t.length>0){const s=t[t.length-1];return e.removeRows(i,{at:s}),!0}return!1}function vl(i,e){va(i,e)||ka(i,e)}function Xg(i,e){const t=Array.from(new z(i,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:o})=>o===1))return e.lastRow;const s=t[0].cellHeight-1;return e.lastRow+s}function ep(i,e){const t=Array.from(new z(i,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:o})=>o===1))return e.lastColumn;const s=t[0].cellWidth-1;return e.lastColumn+s}/**
1364 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1365 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1366 */class qs extends R{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,s=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],o=this.value,r=this.direction;e.change(a=>{const l=r=="right"||r=="down",c=l?s:o,u=l?o:s,d=u.parent;cV(u,c,a);const h=this.isHorizontal?"colspan":"rowspan",f=parseInt(s.getAttribute(h)||"1"),m=parseInt(o.getAttribute(h)||"1");a.setAttribute(h,f+m,c),a.setSelection(a.createRangeIn(c));
1366const p=this.editor.plugins.get("TableUtils"),_=d.findAncestor("table");vl(_,p)})}_getMergeableCell(){const t=this.editor.model.document,n=this.editor.plugins.get("TableUtils"),s=n.getTableCellsContainingSelection(t.selection)[0];if(!s)return;const o=this.isHorizontal?aV(s,this.direction,n):lV(s,this.direction,n);if(!o)return;const r=this.isHorizontal?"rowspan":"colspan",a=parseInt(s.getAttribute(r)||"1");if(parseInt(o.getAttribute(r)||"1")===a)return o}}function aV(i,e,t){const s=i.parent.parent,o=e=="right"?i.nextSibling:i.previousSibling,r=(s.getAttribute("headingColumns")||0)>0;if(!o)return;const a=e=="right"?i:o,l=e=="right"?o:i,{column:c}=t.getCellLocation(a),{column:u}=t.getCellLocation(l),d=parseInt(a.getAttribute("colspan")||"1"),h=_a(t,a),f=_a(t,l);return r&&h!=f?void 0:c+d===u?o:void 0}function lV(i,e,t){const n=i.parent,s=n.parent,o=s.getChildIndex(n);if(e=="down"&&o===t.getRows(s)-1||e=="up"&&o===0)return null;const r=parseInt(i.getAttribute("rowspan")||"1"),a=s.getAttribute("headingRows")||0,l=e=="down"&&o+r===a,c=e=="up"&&o===a;if(a&&(l||c))return null;const u=parseInt(i.getAttribute("rowspan")||"1"),d=e=="down"?o+u:o,h=[...new z(s,{endRow:d})],m=h.find(_=>_.cell===i).column,p=h.find(({row:_,cellHeight:v,column:T})=>T!==m?!1:e=="down"?_===d:d===_+v);return p&&p.cell?p.cell:null}function cV(i,e,t){Ld(i)||(Ld(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(i),t.createPositionAt(e,"end"))),t.remove(i)}function Ld(i){const e=i.getChild(0);return i.childCount==1&&e.is("element","paragraph")&&e.isEmpty}/**
1367 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1368 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1369 */class uV extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const s=n.findAncestor("table"),r=e.getRows(s)-1,a=e.getRowIndexes(t),l=a.first===0&&a.last===r;this.isEnabled=!l}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),s=t.getRowIndexes(n),o=n[0],r=o.findAncestor("table"),a=t.getCellLocation(o).column;e.change(l=>{const c=s.last-s.first+1;t.removeRows(r,{at:s.first,rows:c});const u=dV(r,s.first,a,t.getRows(r));l.setSelection(l.createPositionAt(u,0))})}}function dV(i,e,t,n){const s=i.getChild(Math.min(e,n-1));let o=s.getChild(0),r=0;for(const a of s.getChildren()){if(r>t)return o;o=a,r+=parseInt(a.getAttribute("colspan")||"1")}return o}/**
1370 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1371 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1372 */class hV extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const s=n.findAncestor("table"),o=e.getColumns(s),{first:r,last:a}=e.getColumnIndexes(t);this.isEnabled=a-r<o-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,n]=mV(this.editor.model.document.selection,e),s=t.parent.parent,o=[...new z(s)],r={first:o.find(l=>l.cell===t).column,last:o.find(l=>l.cell===n).column},a=fV(o,t,n,r);this.editor.model.change(l=>{const c=r.last-r.first+1;e.removeColumns(s,{at:r.first,columns:c}),l.setSelection(l.createPositionAt(a,0))})}}function fV(i,e,t,n){return parseInt(t.getAttribute("colspan")||"1")>1?t:e.previousSibling||t.nextSibling?t.nextSibling||e.previousSibling:n.first?i.reverse().find(({column:o})=>o<n.first).cell:i.reverse().find(({column:o})=>o>n.last).cell}function mV(i,e){const t=e.getSelectionAffectedTableCells(i),n=t[0],s=t.pop(),o=[n,s];return n.isBefore(s)?o:o.reverse()}/**
1373 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1374 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1375 */class gV extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),s=n.length>0;this.isEnabled=s,this.value=s&&n.every(o=>this._isInHeading(o,o.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,s=t.getSelectionAffectedTableCells(n.document.selection),o=s[0].findAnce
1375stor("table"),{first:r,last:a}=t.getRowIndexes(s),l=this.value?r:a+1,c=o.getAttribute("headingRows")||0;n.change(u=>{if(l){const d=l>c?c:0,h=Kg(o,l,d);for(const{cell:f}of h)Jg(f,l,u)}oe("headingRows",l,o,u,0)})}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||"0");return!!n&&e.parent.index<n}}/**
1376 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1377 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1378 */class pV extends R{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),s=n.length>0;this.isEnabled=s,this.value=s&&n.every(o=>_a(t,o))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,s=t.getSelectionAffectedTableCells(n.document.selection),o=s[0].findAncestor("table"),{first:r,last:a}=t.getColumnIndexes(s),l=this.value?r:a+1;n.change(c=>{if(l){const u=Zg(o,l);for(const{cell:d,column:h}of u)Qg(d,h,l,c)}oe("headingColumns",l,o,c,0)})}}/**
1379 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1380 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1381 */function bV(i){if(i.is("element","tableColumnGroup"))return i;const e=i.getChildren();return Array.from(e).find(t=>t.is("element","tableColumnGroup"))}function wV(i){const e=bV(i);return e?Array.from(e.getChildren()):[]}/**
1382 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1383 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1384 */class _e extends b{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,n=t.parent,s=n.getChildIndex(t),o=new z(n,{row:s});for(const{cell:r,row:a,column:l}of o)if(r===e)return{row:a,column:l};/* istanbul ignore next -- @preserve */}createTable(e,t){const n=e.createElement("table"),s=t.rows||2,o=t.columns||2;return Or(e,n,0,s,o),t.headingRows&&oe("headingRows",Math.min(t.headingRows,s),n,e,0),t.headingColumns&&oe("headingColumns",Math.min(t.headingColumns,o),n,e,0),n}insertRows(e,t={}){const n=this.editor.model,s=t.at||0,o=t.rows||1,r=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?s-1:s,l=this.getRows(e),c=this.getColumns(e);if(s>l)throw new g("tableutils-insertrows-insert-out-of-range",this,{options:t});n.change(u=>{const d=e.getAttribute("headingRows")||0;if(d>s&&oe("headingRows",d+o,e,u,0),!r&&(s===0||s===l)){Or(u,e,s,o,c);return}const h=r?Math.max(s,a):s,f=new z(e,{endRow:h}),m=new Array(c).fill(1);for(const{row:p,column:_,cellHeight:v,cellWidth:T,cell:L}of f){const U=p+v-1,K=p<s&&s<=U,x=p<=a&&a<=U;K?(u.setAttribute("rowspan",v+o,L),m[_]=-T):r&&x&&(m[_]=T)}for(let p=0;p<o;p++){const _=u.createElement("tableRow");u.insert(_,e,s);for(let v=0;v<m.length;v++){const T=m[v],L=u.createPositionAt(_,"end");T>0&&xn(u,L,T>1?{colspan:T}:void 0),v+=Math.abs(T)-1}}})}insertColumns(e,t={}){const n=this.editor.model,s=t.at||0,o=t.columns||1;n.change(r=>{const a=e.getAttribute("headingColumns");s<a&&r.setAttribute("headingColumns",a+o,e);const l=this.getColumns(e);if(s===0||l===s){for(const u of e.getChildren())u.is("element","tableRow")&&Wn(o,r,r.createPositionAt(u,s?"end":0));return}const c=new z(e,{column:s,includeAllSlots:!0});for(const u of c){const{row:d,cell:h,cellAnchorColumn:f,cellAnchorRow:m,cellWidth:p,cellHeight:_}=u;if(f<s){r.setAttribute("colspan",p+o,h);const v=m+_-1;for(let T=d;T<=v;T++)c.skipRow(T)}else Wn(o,r,u.getPositionBefore())}})}removeRows(e,t){const n=this.editor.model,s=t.rows||1,o=this.getRows(e),r=t.at,a=r+s-1;if(a>o-1)throw new g("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});n.change(l=>{const c={first:r,last:a},{cellsToMove:u,cellsToTrim:d}=vV(e,c);if(u.size){const h=a+1;kV(e,h,u,l)}for(let h=a;h>=r;h--)l.remove(e.getChild(h));for(const{rowspan:h,cell:f}of d)oe("rowspan",h,f,l);yV(e,c,l),va(e,this)||ka(e,this)})}removeColumns(e,t){const n=this.editor.model,s=t.at,o=t.columns||1,r=t.at+o-1;n.change(a=>
1384{_V(e,{first:s,last:r},a);const l=wV(e);for(let c=r;c>=s;c--){for(const{cell:u,column:d,cellWidth:h}of[...new z(e)])d<=c&&h>1&&d+h>c?oe("colspan",h-1,u,a):d===c&&a.remove(u);if(l[c]){const u=c===0?l[1]:l[c-1],d=parseFloat(l[c].getAttribute("columnWidth")),h=parseFloat(u.getAttribute("columnWidth"));a.remove(l[c]),a.setAttribute("columnWidth",d+h+"%",u)}}ka(e,this)||va(e,this)})}splitCellVertically(e,t=2){const n=this.editor.model,o=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");n.change(l=>{if(a>1){const{newCellsSpan:c,updatedSpan:u}=Fd(a,t);oe("colspan",u,e,l);const d={};c>1&&(d.colspan=c),r>1&&(d.rowspan=r);const h=a>t?t-1:a-1;Wn(h,l,l.createPositionAfter(e),d)}if(a<t){const c=t-a,u=[...new z(o)],{column:d}=u.find(({cell:p})=>p===e),h=u.filter(({cell:p,cellWidth:_,column:v})=>{const T=p!==e&&v===d,L=v<d&&v+_>d;return T||L});for(const{cell:p,cellWidth:_}of h)l.setAttribute("colspan",_+c,p);const f={};r>1&&(f.rowspan=r),Wn(c,l,l.createPositionAfter(e),f);const m=o.getAttribute("headingColumns")||0;m>d&&oe("headingColumns",m+c,o,l)}})}splitCellHorizontally(e,t=2){const n=this.editor.model,s=e.parent,o=s.parent,r=o.getChildIndex(s),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");n.change(c=>{if(a>1){const u=[...new z(o,{startRow:r,endRow:r+a-1,includeAllSlots:!0})],{newCellsSpan:d,updatedSpan:h}=Fd(a,t);oe("rowspan",h,e,c);const{column:f}=u.find(({cell:p})=>p===e),m={};d>1&&(m.rowspan=d),l>1&&(m.colspan=l);for(const p of u){const{column:_,row:v}=p,T=v>=r+h,L=_===f,U=(v+r+h)%d===0;T&&L&&U&&Wn(1,c,p.getPositionBefore(),m)}}if(a<t){const u=t-a,d=[...new z(o,{startRow:0,endRow:r})];for(const{cell:m,cellHeight:p,row:_}of d)if(m!==e&&_+p>r){const v=p+u;c.setAttribute("rowspan",v,m)}const h={};l>1&&(h.colspan=l),Or(c,o,r+1,u,1,h);const f=o.getAttribute("headingRows")||0;f>r&&oe("headingRows",f+u,o,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(n=>n.is("element","tableCell")).reduce((n,s)=>{const o=parseInt(s.getAttribute("colspan")||"1");return n+o},0)}getRows(e){return Array.from(e.getChildren()).reduce((t,n)=>n.is("element","tableRow")?t+1:t,0)}createTableWalker(e,t={}){return new z(e,t)}getSelectedTableCells(e){const t=[];for(const n of this.sortRanges(e.getRanges())){const s=n.getContainedElement();s&&s.is("element","tableCell")&&t.push(s)}return t}getTableCellsContainingSelection(e){const t=[];for(const n of e.getRanges()){const s=n.start.findAncestor("tableCell");s&&t.push(s)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(n=>n.parent.index);return this._getFirstLastIndexesObject(t)}
1384getColumnIndexes(e){const t=e[0].findAncestor("table"),s=[...new z(t)].filter(o=>e.includes(o.cell)).map(o=>o.column);return this._getFirstLastIndexesObject(s)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,n=new Set;let s=0;for(const r of e){const{row:a,column:l}=this.getCellLocation(r),c=parseInt(r.getAttribute("rowspan"))||1,u=parseInt(r.getAttribute("colspan"))||1;t.add(a),n.add(l),c>1&&t.add(a+c-1),u>1&&n.add(l+u-1),s+=c*u}return TV(t,n)==s}sortRanges(e){return Array.from(e).sort(CV)}_getFirstLastIndexesObject(e){const t=e.sort((o,r)=>o-r),n=t[0],s=t[t.length-1];return{first:n,last:s}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),n=this.getRowIndexes(e),s=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,s))return!1;const o=this.getColumnIndexes(e),r=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,r)}_areIndexesInSameSection({first:e,last:t},n){const s=e<n,o=t<n;return s===o}}function Or(i,e,t,n,s,o={}){for(let r=0;r<n;r++){const a=i.createElement("tableRow");i.insert(a,e,t),Wn(s,i,i.createPositionAt(a,"end"),o)}}function Wn(i,e,t,n={}){for(let s=0;s<i;s++)xn(e,t,n)}function Fd(i,e){if(i<e)return{newCellsSpan:1,updatedSpan:1};const t=Math.floor(i/e),n=i-t*e+t;return{newCellsSpan:t,updatedSpan:n}}function _V(i,e,t){const n=i.getAttribute("headingColumns")||0;if(n&&e.first<n){const s=Math.min(n-1,e.last)-e.first+1;t.setAttribute("headingColumns",n-s,i)}}function yV(i,{first:e,last:t},n){const s=i.getAttribute("headingRows")||0;if(e<s){const o=t<s?s-(t-e+1):e;oe("headingRows",o,i,n,0)}}function vV(i,{first:e,last:t}){const n=new Map,s=[];for(const{row:o,column:r,cellHeight:a,cell:l}of new z(i,{endRow:t})){const c=o+a-1;if(o>=e&&o<=t&&c>t){const h=t-o+1,f=a-h;n.set(r,{cell:l,rowspan:f})}if(o<e&&c>=e){let h;c>=t?h=t-e+1:h=c-e+1,s.push({cell:l,rowspan:a-h})}}return{cellsToMove:n,cellsToTrim:s}}function kV(i,e,t,n){const o=[...new z(i,{includeAllSlots:!0,row:e})],r=i.getChild(e);let a;for(const{column:l,cell:c,isAnchor:u}of o)if(t.has(l)){const{cell:d,rowspan:h}=t.get(l),f=a?n.createPositionAfter(a):n.createPositionAt(r,0);n.move(n.createRangeOn(d),f),oe("rowspan",h,d,n),a=d}else u&&(a=c)}function CV(i,e){const t=i.start,n=e.start;return t.isBefore(n)?-1:1}function TV(i,e){const t=Array.from(i.values()),n=Array.from(e.values()),s=Math.max(...t),o=Math.min(...t),r=Math.max(...n),a=Math.min(...n);return(s-o+1)*(r-a+1)}/**
1385 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1386 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1387 */class EV extends R{refresh(){const e=this.editor.plugins.get(_e),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(_e);e.change(n=>{const s=t.getSelectedTableCells(e.document.selection),o=s.shift(),{mergeWidth:r,mergeHeight:a}=xV(o,s,t);oe("colspan",r,o,n),oe("rowspan",a,o,n);for(const c of s)AV(c,o,n);const l=o.findAncestor("table");vl(l,t),n.setSelection(o,"in")})}}function AV(i,e,t){Nd(i)||(Nd(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(i),t.createPositionAt(e,"end"))),t.remove(i)}function Nd(i){const e=i.getChild(0);return i.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function xV(i,e,t){let n=0,s=0;for(const c of e){const{row:u,column:d}=t.getCellLocation(c);n=Dd(c,d,n,"colspan"),s=Dd(c,u,s,"rowspan")}const{row:o,column:r}=t.getCellLocation(i),a=n-r,l=s-o;return{mergeWidth:a,mergeHeight:l}}function Dd(i,e,t,n){const s=parseInt(i.getAttribute(n)||"1");return Math.max(t,e+s)}/**
1388 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1389 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1390 */class SV extends R{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),s=t.getRowIndexes(n),o=n[0].findAnce
1390stor("table"),r=[];for(let a=s.first;a<=s.last;a++)for(const l of o.getChild(a).getChildren())r.push(e.createRangeOn(l));e.change(a=>{a.setSelection(r)})}}/**
1391 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1392 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1393 */class IV extends R{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),s=n[0],o=n.pop(),r=s.findAncestor("table"),a=e.getCellLocation(s),l=e.getCellLocation(o),c=Math.min(a.column,l.column),u=Math.max(a.column,l.column),d=[];for(const h of new z(r,{startColumn:c,endColumn:u}))d.push(t.createRangeOn(h.cell));t.change(h=>{h.setSelection(d)})}}/**
1394 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1395 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1396 */function PV(i){i.document.registerPostFixer(e=>RV(e,i))}function RV(i,e){const t=e.document.differ.getChanges();let n=!1;const s=new Set;for(const o of t){let r=null;o.type=="insert"&&o.name=="table"&&(r=o.position.nodeAfter),(o.type=="insert"||o.type=="remove")&&(o.name=="tableRow"||o.name=="tableCell")&&(r=o.position.findAncestor("table")),LV(o)&&(r=o.range.start.findAncestor("table")),r&&!s.has(r)&&(n=VV(r,i)||n,n=BV(r,i)||n,s.add(r))}return n}function VV(i,e){let t=!1;const n=MV(i);if(n.length){t=!0;for(const s of n)oe("rowspan",s.rowspan,s.cell,e,1)}return t}function BV(i,e){let t=!1;const n=OV(i),s=[];for(const[l,c]of n.entries())!c&&i.getChild(l).is("element","tableRow")&&s.push(l);if(s.length){t=!0;for(const l of s.reverse())e.remove(i.getChild(l)),n.splice(l,1)}const o=n.filter((l,c)=>i.getChild(c).is("element","tableRow")),r=o[0];if(!o.every(l=>l===r)){const l=o.reduce((c,u)=>u>c?u:c,0);for(const[c,u]of o.entries()){const d=l-u;if(d){for(let h=0;h<d;h++)xn(e,e.createPositionAt(i.getChild(c),"end"));t=!0}}}return t}function MV(i){const e=parseInt(i.getAttribute("headingRows")||"0"),t=Array.from(i.getChildren()).reduce((s,o)=>o.is("element","tableRow")?s+1:s,0),n=[];for(const{row:s,cell:o,cellHeight:r}of new z(i)){if(r<2)continue;const l=s<e?e:t;if(s+r>l){const c=l-s;n.push({cell:o,rowspan:c})}}return n}function OV(i){const e=new Array(i.childCount).fill(0);for(const{rowIndex:t}of new z(i,{includeAllSlots:!0}))e[t]++;return e}function LV(i){if(i.type!=="attribute")return!1;const e=i.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}/**
1397 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1398 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1399 */function FV(i){i.document.registerPostFixer(e=>NV(e,i))}function NV(i,e){const t=e.document.differ.getChanges();let n=!1;for(const s of t)s.type=="insert"&&s.name=="table"&&(n=DV(s.position.nodeAfter,i)||n),s.type=="insert"&&s.name=="tableRow"&&(n=tp(s.position.nodeAfter,i)||n),s.type=="insert"&&s.name=="tableCell"&&(n=Ca(s.position.nodeAfter,i)||n),(s.type=="remove"||s.type=="insert")&&$V(s)&&(n=Ca(s.position.parent,i)||n);return n}function DV(i,e){let t=!1;for(const n of i.getChildren())n.is("element","tableRow")&&(t=tp(n,e)||t);return t}function tp(i,e){let t=!1;for(const n of i.getChildren())t=Ca(n,e)||t;return t}function Ca(i,e){if(i.childCount==0)return e.insertElement("paragraph",i),!0;const t=Array.from(i.getChildren()).filter(n=>n.is("$text"));for(const n of t)e.wrap(e.createRangeOn(n),"paragraph");return!!t.length}function $V(i){return i.position.parent.is("element","tableCell")?i.type=="insert"&&i.name=="$text"||i.type=="remove":!1}/**
1400 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1401 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1402 */function UV(i,e){const t=i.document.differ;for(const n of t.getChanges()){let s,o=!1;if(n.type=="attribute"){const c=n.range.start.nodeAfter;if(!c||!c.is("element","table")||n.attributeKey!="headingRows"&&n.attributeKey!="headingColumns")continue;s=c,o=n.attributeKey=="headingRows"}else(n.name=="tableRow"||n.name=="tableCell")&&(s=n.position.findAnce
1402stor("table"),o=n.name=="tableRow");if(!s)continue;const r=s.getAttribute("headingRows")||0,a=s.getAttribute("headingColumns")||0,l=new z(s);for(const c of l){const d=c.row<r||c.column<a?"th":"td",h=e.mapper.toViewElement(c.cell);h&&h.is("element")&&h.name!=d&&e.reconvertItem(o?c.cell.parent:c.cell)}}}/**
1403 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1404 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1405 */function HV(i,e){const t=i.document.differ,n=new Set;for(const s of t.getChanges()){const o=s.type=="attribute"?s.range.start.parent:s.position.parent;o.is("element","tableCell")&&n.add(o)}for(const s of n.values()){const o=Array.from(s.getChildren()).filter(r=>zV(r,e.mapper));for(const r of o)e.reconvertItem(r)}}function zV(i,e){if(!i.is("element","paragraph"))return!1;const t=e.toViewElement(i);return t?jg(i)!==t.is("element","span"):!1}/**
1406 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1407 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1408 */class rr extends b{static get pluginName(){return"TableEditing"}static get requires(){return[_e]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,n=t.schema,s=e.conversion,o=e.plugins.get(_e);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),s.for("upcast").add(KR()),s.for("upcast").add(JR()),s.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Pd(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),s.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Pd(o,{additionalSlots:this._additionalSlots})}),s.for("upcast").elementToElement({model:"tableRow",view:"tr"}),s.for("upcast").add(ZR()),s.for("downcast").elementToElement({model:"tableRow",view:tV()}),s.for("upcast").elementToElement({model:"tableCell",view:"td"}),s.for("upcast").elementToElement({model:"tableCell",view:"th"}),s.for("upcast").add(Id("td")),s.for("upcast").add(Id("th")),s.for("editingDowncast").elementToElement({model:"tableCell",view:Rd({asWidget:!0})}),s.for("dataDowncast").elementToElement({model:"tableCell",view:Rd()}),s.for("editingDowncast").elementToElement({model:"paragraph",view:Vd({asWidget:!0}),converterPriority:"high"}),s.for("dataDowncast").elementToElement({model:"paragraph",view:Vd(),converterPriority:"high"}),s.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),s.for("upcast").attributeToAttribute({model:{key:"colspan",value:$d("colspan")},view:"colspan"}),s.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),s.for("upcast").attributeToAttribute({model:{key:"rowspan",value:$d("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new sV(e)),e.commands.add("insertTableRowAbove",new Bd(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Bd(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Md(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Md(e,{order:"right"})),e.commands.add("removeTableRow",new uV(e)),e.commands.add("removeTableColumn",new hV(e)),e.commands.add("splitTableCellVertically",new Od(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Od(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new EV(e)),e.commands.add("mergeTableCellRight",new qs(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new qs(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new qs(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new qs(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new pV(e)),e.commands.add("setTableRowHeader",new gV(e)),e.commands.add("selectTableRow",
1408new SV(e)),e.commands.add("selectTableColumn",new IV(e)),PV(t),FV(t),this.listenTo(t.document,"change:data",()=>{UV(t,e.editing),HV(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function $d(i){return e=>{const t=parseInt(e.getAttribute(i));return Number.isNaN(t)||t<=0?null:t}}/**
1409 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1410 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1411 */class Ud extends C{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new de,this.focusTracker=new se,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(n,s)=>`${s} × ${n}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"[email protected]":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(n=>{n.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(n,s)=>{const{row:o,column:r}=s.target.dataset;this.items.get((parseInt(o,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(n,s,o)=>{if(!o)return;const{row:r,column:a}=o.dataset;this.set({rows:parseInt(r),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Nf({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((n,s)=>{const o=Math.floor(s/10),r=s%10,a=o<e&&r<t;n.set("isOn",a)})}_createGridButton(e,t,n,s){const o=new P(e);return o.set({label:s,class:"ck-insert-table-dropdown-grid-box"}),o.extendTemplate({attributes:{"data-row":t,"data-column":n}}),o}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const n=Math.floor(t/10),s=t%10,o=`${n+1} × ${s+1}`;e.push(this._createGridButton(this.locale,n+1,s+1,o))}return this.createCollection(e)}}const WV='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',qV='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',jV='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>';/**
1412 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1413 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1414 */class GV extends b{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,s=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",o=>{const r=e.commands.get("insertTable"),a=pe(o);a.bind("isEnabled").to(r),a.buttonView.set({icon:E.table,label:t("Insert table"),tooltip:!0});let l;return a.on("change:isOpen",()=>{l||(l=new Ud(o),a.panelView.children.add(l),l.delegate("execute").to(a),a.on("execute",()=>{e.execute("insertTable",{rows:l.rows,columns:l.columns}),e.editing.view.focus()}))}),a}),e.ui.componentFactory.add("menuBar:insertTable",o=>
1414{const r=e.commands.get("insertTable"),a=new Pe(o),l=new Ud(o);return l.delegate("execute").to(a),a.on("change:isOpen",(c,u,d)=>{d||l.reset()}),l.on("execute",()=>{e.execute("insertTable",{rows:l.rows,columns:l.columns}),e.editing.view.focus()}),a.buttonView.set({label:t("Table"),icon:E.table}),a.panelView.children.add(l),a.bind("isEnabled").to(r),a}),e.ui.componentFactory.add("tableColumn",o=>{const r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:s?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:s?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),WV,r,o)}),e.ui.componentFactory.add("tableRow",o=>{const r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),qV,r,o)}),e.ui.componentFactory.add("mergeTableCells",o=>{const r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:s?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:s?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),jV,r,o)})}_prepareDropdown(e,t,n,s){const o=this.editor,r=pe(s),a=this._fillDropdownWithListOptions(r,n);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(a,"isEnabled",(...l)=>l.some(c=>c)),this.listenTo(r,"execute",l=>{o.execute(l.source.commandName),l.source instanceof Yn||o.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,n,s){const o=this.editor,r=pe(s,ci),a="mergeTableCells",l=o.commands.get(a),c=this._fillDropdownWithListOptions(r,n);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([l,...c],"isEnabled",(...u)=>u.some(d=>d)),this.listenTo(r.buttonView,"execute",()=>{o.execute(a),o.editing.view.focus()}),this.listenTo(r,"execute",u=>{o.execute(u.source.commandName),o.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){const n=this.editor,s=[],o=new me;for(const r of t)KV(r,n,s,o);return kn(e,o),s}}function KV(i,e,t,n){if(i.type==="button"||i.type==="switchbutton"){const s=i.model=new ui(i.model),{commandName:o,bindIsOn:r}=i.model,a=e.commands.get(o);t.push(a),s.set({commandName:o}),s.bind("isEnabled").to(a),r&&s.bind("isOn").to(a,"value"),s.set({withText:!0})}n.add(i)}/**
1415 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1416 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1417 */class un extends b{static get pluginName(){return"TableSelection"}static get requires(){return[_e,_e]}init(){const e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,"deleteContent",(s,o)=>this._handleDeleteContent(s,o),{priority:"high"}),this.listenTo(n.document,"insertText",(s,o)=>this._handleInsertTextEvent(s,o),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(_e),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return n.length==0?null:n}getSelectionAsFragment(){const e=this.editor.plugins.get(_e),t=this.getSelectedTableCells();return t?this.editor.model.change(n=>{const s=n.createDocumentFragment(),{first:o,last:r}=e.getColumnIndexes(t),{first:a,last:l}
1417=e.getRowIndexes(t),c=t[0].findAncestor("table");let u=l,d=r;if(e.isSelectionRectangular(t)){const m={firstColumn:o,lastColumn:r,firstRow:a,lastRow:l};u=Xg(c,m),d=ep(c,m)}const f=Gg(c,{startRow:a,startColumn:o,endRow:u,endColumn:d},n);return n.insert(f,s,0),s}):null}setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change(s=>{s.setSelection(n.cells.map(o=>s.createRangeOn(o)),{backward:n.backward})})}getFocusCell(){const n=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return n&&n.is("element","tableCell")?n:null}getAnchorCell(){const e=this.editor.model.document.selection,n=ie(e.getRanges()).getContainedElement();return n&&n.is("element","tableCell")?n:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(s=>s.on("selection",(o,r,a)=>{const l=a.writer;n(l);const c=this.getSelectedTableCells();if(!c)return;for(const d of c){const h=a.mapper.toViewElement(d);l.addClass("ck-editor__editable_selected",h),t.add(h)}const u=a.mapper.toViewElement(c[c.length-1]);l.setSelection(u,0)},{priority:"lowest"}));function n(s){for(const o of t)s.removeClass("ck-editor__editable_selected",o);t.clear()}}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(n=>{const s=n.createPositionAt(t[0],0),o=e.model.schema.getNearestSelectionRange(s);n.setSelection(o)})}})}_handleDeleteContent(e,t){const n=this.editor.plugins.get(_e),s=t[0],o=t[1],r=this.editor.model,a=!o||o.direction=="backward",l=n.getSelectedTableCells(s);l.length&&(e.stop(),r.change(c=>{const u=l[a?l.length-1:0];r.change(h=>{for(const f of l)r.deleteContent(h.createSelection(f,"in"))});const d=r.schema.getNearestSelectionRange(c.createPositionAt(u,0));s.is("documentSelection")?c.setSelection(d):s.setTo(d)}))}_handleInsertTextEvent(e,t){const n=this.editor,s=this.getSelectedTableCells();if(!s)return;const o=n.editing.view,r=n.editing.mapper,a=s.map(l=>o.createRangeOn(r.toViewElement(l)));t.selection=o.createSelection(a)}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),s=n.getCellLocation(e),o=n.getCellLocation(t),r=Math.min(s.row,o.row),a=Math.max(s.row,o.row),l=Math.min(s.column,o.column),c=Math.max(s.column,o.column),u=new Array(a-r+1).fill(null).map(()=>[]),d={startRow:r,endRow:a,startColumn:l,endColumn:c};for(const{row:m,cell:p}of new z(e.findAncestor("table"),d))u[m-r].push(p);const h=o.row<s.row,f=o.column<s.column;return h&&u.reverse(),f&&u.forEach(m=>m.reverse()),{cells:u.flat(),backward:h||f}}}/**
1418 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1419 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1420 */class JV extends b{static get pluginName(){return"TableClipboard"}static get requires(){return[Ni,Je,un,_e]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(n,s)=>this._onCopyCut(n,s)),this.listenTo(t,"cut",(n,s)=>this._onCopyCut(n,s)),this.listenTo(e.model,"insertContent",(n,[s,o])=>this._onInsertContent(n,s,o),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const n=this.editor.editing.view,s=this.editor.plugins.get(un),o=this.editor.plugins.get(Ni);s.getSelectedTableCells()&&(e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name==="cut"},()=>{const r=o._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>s.getSelectionAsFragment());n.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(r),method:e.name})})))}_onInsertContent(e,t,n){if(n&&!n.is("documentSelection"))return;const s=this.editor.model,o=this.editor.plugins.get(_e),r=this.editor.plugins.get(Ni),a=this.getTableIfOnlyTableInContent(t,s);if(!a)return;const l=o.getSelectionAffectedTableCells(s.document.selection);if(!l.length){vl(a,o);return}e.stop(),t.is("documentFragment")?r._pasteMarkersIntoTransformedElement(t.markers,c=>this._replaceSelectedCells(a,l,c)):this.editor.model.change(c=>{this._replaceSelectedCells(a,l,c)})}
1420_replaceSelectedCells(e,t,n){const s=this.editor.plugins.get(_e),o={width:s.getColumns(e),height:s.getRows(e)},r=ZV(t,o,n,s),a=r.lastRow-r.firstRow+1,l=r.lastColumn-r.firstColumn+1,c={startRow:0,startColumn:0,endRow:Math.min(a,o.height)-1,endColumn:Math.min(l,o.width)-1};e=Gg(e,c,n);const u=t[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(e,o,u,r,n);if(this.editor.plugins.get("TableSelection").isEnabled){const h=s.sortRanges(d.map(f=>n.createRangeOn(f)));n.setSelection(h)}else n.setSelection(d[0],0);return u}_replaceSelectedCellsWithPasted(e,t,n,s,o){const{width:r,height:a}=t,l=YV(e,r,a),c=[...new z(n,{startRow:s.firstRow,endRow:s.lastRow,startColumn:s.firstColumn,endColumn:s.lastColumn,includeAllSlots:!0})],u=[];let d;for(const _ of c){const{row:v,column:T}=_;T===s.firstColumn&&(d=_.getPositionBefore());const L=v-s.firstRow,U=T-s.firstColumn,K=l[L%a][U%r],x=K?o.cloneElement(K):null,V=this._replaceTableSlotCell(_,x,d,o);V&&(Yg(V,v,T,s.lastRow,s.lastColumn,o),u.push(V),d=o.createPositionAfter(V))}const h=parseInt(n.getAttribute("headingRows")||"0"),f=parseInt(n.getAttribute("headingColumns")||"0"),m=s.firstRow<h&&h<=s.lastRow,p=s.firstColumn<f&&f<=s.lastColumn;if(m){const _={first:s.firstColumn,last:s.lastColumn},v=Ta(n,h,_,o,s.firstRow);u.push(...v)}if(p){const _={first:s.firstRow,last:s.lastRow},v=Ea(n,f,_,o);u.push(...v)}return u}_replaceTableSlotCell(e,t,n,s){const{cell:o,isAnchor:r}=e;return r&&s.remove(o),t?(s.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);const n=t.createRangeIn(e);for(const s of n.getItems())if(s.is("element","table")){const o=t.createRange(n.start,t.createPositionBefore(s));if(t.hasContent(o,{ignoreWhitespaces:!0}))return null;const r=t.createRange(t.createPositionAfter(s),n.end);return t.hasContent(r,{ignoreWhitespaces:!0})?null:s}return null}}function ZV(i,e,t,n){const s=i[0].findAncestor("table"),o=n.getColumnIndexes(i),r=n.getRowIndexes(i),a={firstColumn:o.first,lastColumn:o.last,firstRow:r.first,lastRow:r.last},l=i.length===1;return l&&(a.lastRow+=e.height-1,a.lastColumn+=e.width-1,QV(s,a.lastRow+1,a.lastColumn+1,n)),l||!n.isSelectionRectangular(i)?XV(s,a,t):(a.lastRow=Xg(s,a),a.lastColumn=ep(s,a)),a}function QV(i,e,t,n){const s=n.getColumns(i),o=n.getRows(i);t>s&&n.insertColumns(i,{at:s,columns:t-s}),e>o&&n.insertRows(i,{at:o,rows:e-o})}function YV(i,e,t){const n=new Array(t).fill(null).map(()=>new Array(e).fill(null));for(const{column:s,row:o,cell:r}of new z(i))n[o][s]=r;return n}function XV(i,e,t){const{firstRow:n,lastRow:s,firstColumn:o,lastColumn:r}=e,a={first:n,last:s},l={first:o,last:r};Ea(i,o,a,t),Ea(i,r+1,a,t),Ta(i,n,l,t),Ta(i,s+1,l,t,n)}function Ta(i,e,t,n,s=0){return e<1?void 0:Kg(i,e,s).filter(({column:a,cellWidth:l})=>np(a,l,t)).map(({cell:a})=>Jg(a,e,n))}function Ea(i,e,t,n){return e<1?void 0:Zg(i,e).filter(({row:r,cellHeight:a})=>np(r,a,t)).map(({cell:r,column:a})=>Qg(r,a,e,n))}function np(i,e,t){const n=i+e-1,{first:s,last:o}=t,r=i>=s&&i<=o,a=i<s&&n>=s;return r||a}/**
1421 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1422 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1423 */class eB extends b{static get pluginName(){return"TableKeyboard"}static get requires(){return[un,_e]}init(){const e=this.editor,n=e.editing.view.document,s=e.t;this.listenTo(n,"arrowKey",(...o)=>this._onArrowKey(...o),{context:"table"}),this.listenTo(n,"tab",(...o)=>this._handleTabOnSelectedTable(...o),{context:"figure"}),this.listenTo(n,"tab",(...o)=>this._handleTab(...o),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:s("Keystrokes that can be used in a table cell"),keystrokes:[{label:s("Move the selection to the next cell"),keystroke:"Tab"},{label:s("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:s("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:s("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const n=this.editor,o=n.model.document.selection.getSelectedElement();!o||!o.is("element","table")||(t.preventDefault(),t.stopPropagation(),e.stop(),n.model.change(r=>{r.setSelection(r.createRangeIn(o.getChild(0).getChild(0)))}))}_handleTab(e,t){const n=this.editor,s=this.editor.plugins.get(_e),o=this.editor.plugins.get("TableSelection"),r=n.model.document.selection,a=!t.shiftKey;let l=s.getTableCellsContainingSelection(r)[0];if(l||(l=o.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();const c=l.parent,u=c.parent,d=u.getChildIndex(c),h=c.getChildIndex(l),f=h===0;if(!a&&f&&d===0){n.model.change(v=>
1423{v.setSelection(v.createRangeOn(u))});return}const m=h===c.childCount-1,p=d===s.getRows(u)-1;if(a&&p&&m&&(n.execute("insertTableRowBelow"),d===s.getRows(u)-1)){n.model.change(v=>{v.setSelection(v.createRangeOn(u))});return}let _;if(a&&m)_=u.getChild(d+1).getChild(0);else if(!a&&f){const v=u.getChild(d-1);_=v.getChild(v.childCount-1)}else _=c.getChild(h+(a?1:-1));n.model.change(v=>{v.setSelection(v.createRangeIn(_))})}_onArrowKey(e,t){const n=this.editor,s=t.keyCode,o=Wo(s,n.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const n=this.editor.plugins.get(_e),s=this.editor.plugins.get("TableSelection"),o=this.editor.model,r=o.document.selection,a=["right","down"].includes(e),l=n.getSelectedTableCells(r);if(l.length){let u;return t?u=s.getFocusCell():u=a?l[l.length-1]:l[0],this._navigateFromCellInDirection(u,e,t),!0}const c=r.focus.findAncestor("tableCell");/* istanbul ignore if: paranoid check -- @preserve */if(!c)return!1;if(!r.isCollapsed)if(t){if(r.isBackward==a&&!r.containsEntireContent(c))return!1}else{const u=r.getSelectedElement();if(!u||!o.schema.isObject(u))return!1}return this._isSelectionAtCellEdge(r,c,a)?(this._navigateFromCellInDirection(c,e,t),!0):!1}_isSelectionAtCellEdge(e,t,n){const s=this.editor.model,o=this.editor.model.schema,r=n?e.getLastPosition():e.getFirstPosition();if(!o.getLimitElement(r).is("element","tableCell"))return s.createPositionAt(t,n?"end":0).isTouching(r);const a=s.createSelection(r);return s.modifySelection(a,{direction:n?"forward":"backward"}),r.isEqual(a.focus)}_navigateFromCellInDirection(e,t,n=!1){const s=this.editor.model,o=e.findAncestor("table"),r=[...new z(o,{includeAllSlots:!0})],{row:a,column:l}=r[r.length-1],c=r.find(({cell:T})=>T==e);let{row:u,column:d}=c;switch(t){case"left":d--;break;case"up":u--;break;case"right":d+=c.cellWidth;break;case"down":u+=c.cellHeight;break}const h=u<0||u>a,f=d<0&&u<=0,m=d>l&&u>=a;if(h||f||m){s.change(T=>{T.setSelection(T.createRangeOn(o))});return}d<0?(d=n?0:l,u--):d>l&&(d=n?l:0,u++);const p=r.find(T=>T.row==u&&T.column==d).cell,_=["right","down"].includes(t),v=this.editor.plugins.get("TableSelection");if(n&&v.isEnabled){const T=v.getAnchorCell()||e;v.setCellSelection(T,p)}else{const T=s.createPositionAt(p,_?0:"end");s.change(L=>{L.setSelection(T)})}}}/**
1424 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1425 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1426 */class tB extends Mt{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}/**
1427 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1428 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1429 */class nB extends b{static get pluginName(){return"TableMouse"}static get requires(){return[un,_e]}init(){this.editor.editing.view.addObserver(tB),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(_e);let n=!1;const s=e.plugins.get(un);this.listenTo(e.editing.view.document,"mousedown",(o,r)=>{const a=e.model.document.selection;if(!this.isEnabled||!s.isEnabled||!r.domEvent.shiftKey)return;const l=s.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;const c=this._getModelTableCellFromDomEvent(r);c&&Hd(l,c)&&(n=!0,s.setCellSelection(l,c),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1}),this.listenTo(e.editing.view.document,"selectionChange",o=>{n&&o.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,s=!1,o=!1;const r=e.plugins.get(un);this.listenTo(e.editing.view.document,"mousedown",(a,l)=>{!this.isEnabled||!r.isEnabled||l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l))}),this.listenTo(e.editing.view.document,"mousemove",(a,l)=>{if(!l.domEvent.buttons||!t)return;const c=this._getModelTableCellFromDomEvent(l);c&&Hd(t,c)&&(n=c,!s&&n!=t&&(s=!0)),s&&(o=!0,r.setCellSelection(t,n),l.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{s=!1,o=!1,t=null,n=null}),this.listenTo(e.editing.view.document,"selectionChange",a=>{o&&a.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAnce
1429stor("tableCell",{includeSelf:!0})}}function Hd(i,e){return i.parent.parent==e.parent.parent}/**
1430 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1431 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1432 */class iB extends b{static get requires(){return[rr,GV,un,nB,eB,JV,Cn]}static get pluginName(){return"Table"}}/**
1433 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1434 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1435 */function ip(i){const e=sp(i);return e||ar(i)}function sp(i){const e=i.getSelectedElement();return e&&op(e)?e:null}function ar(i){const e=i.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&op(t))return t;t=t.parent}return null}function op(i){return!!i.getCustomProperty("table")&&ce(i)}/**
1436 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1437 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1438 */class sB extends b{static get requires(){return[To]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,n=e.plugins.get(To),s=e.config.get("table.contentToolbar"),o=e.config.get("table.tableToolbar");s&&n.register("tableContent",{ariaLabel:t("Table toolbar"),items:s,getRelatedElement:ar}),o&&n.register("table",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:sp})}}/**
1439 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1440 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1441 */class oB extends C{constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new se,this._focusables=new ve,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new de,this._stillTyping=!1,this.focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(n,s,o)=>this._setInputValue(o))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,n=this.bindTemplate,s=this._createColorSelector(e),o=pe(e),r=new C;return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:n.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",n.if("value","ck-hidden",a=>a!="")]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(r),o.buttonView.label=t("Color picker"),o.buttonView.tooltip=!0,o.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",o.panelView.children.add(s),o.bind("isEnabled").to(this,"isReadOnly",a=>!a),o.on("change:isOpen",(a,l,c)=>{c&&(s.updateSelectedColors(),s.showColorGridsFragment())}),o}_createInputTextView(){const e=this.locale,t=new jm(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const n=t.element.value,s=this.options.colorDefinitions.find(o=>n===o.label);this._stillTyping=!0,this.value=s&&s.color||n}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,n=this.options.defaultColorValue||"",s=t(n?"Restore default":"Remove color"),o=new ml(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:s,colorPickerLabel:t("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig===!1?!1:{...this.options.colorPickerConfig,hideInput:!0}});o.appendUI(),o.on("execute",(a,l)=>{if(l.source==="colorPickerSaveButton"){this.dropdownView.isOpen=!1;return}this.value=l.value||n,this.fire("input"),l.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)});let r=this.value;return o.on("colorPicker:cancel",()=>{this.value=r,this.fire("input"),this.dropdownView.isOpen=!1}),o.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{r=this.value}),o.bind("selectedColor").to(this,"value"),o}_setInputValue(e){if(!this._stillTyping){const t=zd(e),n=this.options.colorDefinitions.find(s=>t===zd(s.color));
1441n?this.inputView.value=n.label:this.inputView.value=e||""}}}function zd(i){return i.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}/**
1442 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1443 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1444 */const kl=i=>i==="";function Cl(i){return{none:i("None"),solid:i("Solid"),dotted:i("Dotted"),dashed:i("Dashed"),double:i("Double"),groove:i("Groove"),ridge:i("Ridge"),inset:i("Inset"),outset:i("Outset")}}function rp(i){return i('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function ap(i){return i('The value is invalid. Try "10px" or "2em" or simply "2".')}function Ao(i){return i=i.trim().toLowerCase(),kl(i)||Rm(i)}function $i(i){return i=i.trim(),kl(i)||up(i)||Zo(i)||Vm(i)}function lp(i){return i=i.trim(),kl(i)||up(i)||Zo(i)}function cp(i,e){const t=new me,n=Cl(i.t);for(const s in n){const o={type:"button",model:new ui({_borderStyleValue:s,label:n[s],role:"menuitemradio",withText:!0})};s==="none"?o.model.bind("isOn").to(i,"borderStyle",r=>e==="none"?!r:r===s):o.model.bind("isOn").to(i,"borderStyle",r=>r===s),t.add(o)}return t}function Aa(i){const{view:e,icons:t,toolbar:n,labels:s,propertyName:o,nameToValue:r,defaultValue:a}=i;for(const l in s){const c=new P(e.locale);c.set({label:s[l],icon:t[l],tooltip:s[l]});const u=r?r(l):l;c.bind("isOn").to(e,o,d=>{let h=d;return d===""&&a&&(h=a),u===h}),c.on("execute",()=>{e[o]=u}),n.items.add(c)}}const xo=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function So(i){return(e,t,n)=>{const s=new oB(e.locale,{colorDefinitions:rB(i.colorConfig),columns:i.columns,defaultColorValue:i.defaultColorValue,colorPickerConfig:i.colorPickerConfig});return s.inputView.set({id:t,ariaDescribedById:n}),s.bind("isReadOnly").to(e,"isEnabled",o=>!o),s.bind("hasError").to(e,"errorText",o=>!!o),s.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused").to(s),s}}function up(i){const e=parseFloat(i);return!Number.isNaN(e)&&i===String(e)}function rB(i){return i.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))}/**
1445 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1446 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1447 */class Be extends C{constructor(e,t={}){super(e);const n=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach(s=>this.children.add(s)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}/**
1448 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1449 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1450 */const Wd={left:E.alignLeft,center:E.alignCenter,right:E.alignRight,justify:E.alignJustify,top:E.alignTop,middle:E.alignMiddle,bottom:E.alignBottom};class aB extends C{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:s,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:l}
1450=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:d,dimensionsLabel:h}=this._createDimensionFields(),{horizontalAlignmentToolbar:f,verticalAlignmentToolbar:m,alignmentLabel:p}=this._createAlignmentFields();this.focusTracker=new se,this.keystrokes=new de,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=s,this.borderColorInput=o,this.backgroundInput=l,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=d,this.horizontalAlignmentToolbar=f,this.verticalAlignmentToolbar=m;const{saveButtonView:_,cancelButtonView:v}=this._createActionButtons();this.saveButtonView=_,this.cancelButtonView=v,this._focusables=new ve,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Xo(e,{label:this.t("Cell properties")})),this.children.add(new Be(e,{labelView:r,children:[r,n,o,s],class:"ck-table-form__border-row"})),this.children.add(new Be(e,{labelView:a,children:[a,l],class:"ck-table-form__background-row"})),this.children.add(new Be(e,{children:[new Be(e,{labelView:h,children:[h,c,u,d],class:"ck-table-form__dimensions-row"}),new Be(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new Be(e,{labelView:p,children:[p,f,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new Be(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),wn({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{e.fieldView.focusCycler.on("forwardCycle",t=>{this._focusCycler.focusNext(),t.stop()}),e.fieldView.focusCycler.on("backwardCycle",t=>{this._focusCycler.focusPrevious(),t.stop()})}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,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()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=So({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),s=this.locale,o=this.t,r=o("Style"),a=new Ne(s);a.text=o("Border");const l=Cl(o),c=new he(s,Jm);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",h=>l[h||"none"]),c.fieldView.on("execute",h=>{this.borderStyle=h.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",h=>!h),kn(c.fieldView,cp(this,t.style),{role:"menu",ariaLabel:r});const u=new he(s,De);u.set({label:o("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",js),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});const d=new he(s,n);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",js),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(h,f,m,p)=>{js(m)||(this.borderColor="",this.borderWidth=""),js(p)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:u}}_createBackgroundFields(){const e=this.locale,t=this.t,n=new Ne(e);n.text=t("Background");const s=So({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new he(e,s);return o.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",()=>{this.backgroundColor=o.fieldView.value}),{backgroundRowLabel:n,backgroundInput:o}}_createDimensionFields(){const e=this.locale,t=this.t,n=new Ne(e);n.text=t("Dimensions");const s=new he(e,De);
1450s.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),s.fieldView.bind("value").to(this,"width"),s.fieldView.on("input",()=>{this.width=s.fieldView.element.value});const o=new C(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new he(e,De);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:n,widthInput:s,operatorLabel:o,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,n=new he(e,De);return n.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),n.fieldView.bind("value").to(this,"padding"),n.fieldView.on("input",()=>{this.padding=n.fieldView.element.value}),n}_createAlignmentFields(){const e=this.locale,t=this.t,n=new Ne(e);n.text=t("Table cell text alignment");const s=new Xn(e),o=e.contentLanguageDirection==="rtl";s.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),Aa({view:this,icons:Wd,toolbar:s,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:a=>{if(o){if(a==="left")return"right";if(a==="right")return"left"}return a},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new Xn(e);return r.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),Aa({view:this,icons:Wd,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:s,verticalAlignmentToolbar:r,alignmentLabel:n}}_createActionButtons(){const e=this.locale,t=this.t,n=new P(e),s=new P(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:t("Save"),icon:E.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(o,"errorText",(...r)=>r.every(a=>!a)),s.set({label:t("Cancel"),icon:E.cancel,class:"ck-button-cancel",withText:!0}),s.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:s}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,n=t("Align cell text to the left"),s=t("Align cell text to the center"),o=t("Align cell text to the right"),r=t("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:o,center:s,left:n,justify:r}:{left:n,center:s,right:o,justify:r}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function js(i){return i!=="none"}/**
1451 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1452 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1453 */const sn=ye.defaultPositions,xa=[sn.northArrowSouth,sn.northArrowSouthWest,sn.northArrowSouthEast,sn.southArrowNorth,sn.southArrowNorthWest,sn.southArrowNorthEast,sn.viewportStickyNorth];function dp(i,e){const t=i.plugins.get("ContextualBalloon"),n=i.editing.view.document.selection;let s;e==="cell"?ar(n)&&(s=fp(i)):ip(n)&&(s=hp(i)),s&&t.updatePosition(s)}function hp(i){const e=i.model.document.selection,t=ya(e),n=i.editing.mapper.toViewElement(t);return{target:i.editing.view.domConverter.mapViewToDom(n),positions:xa}}function fp(i){const e=i.editing.mapper,t=i.editing.view.domConverter,n=i.model.document.selection;if(n.rangeCount>1)return{target:()=>lB(n.getRanges(),i),positions:xa};const s=mp(n.getFirstPosition()),o=e.toViewElement(s);return{target:t.mapViewToDom(o),positions:xa}}function mp(i){return i.nodeAfter&&i.nodeAfter.is("element","tableCell")?i.nodeAfter:i.findAncestor("tableCell")}function lB(i,e){const t=e.editing.mapper,n=e.editing.view.domConverter,s=Array.from(i).map(o=>{const r=mp(o.start),a=t.toViewElement(r);return new O(n.mapViewToDom(a))});return O.getBoundingRect(s)}const cB='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>';/**
1454 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1455 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1456 */function Sn(i){if(!i||!Z(i))return i;const{top:e,right:t,bottom:n,left:s}=i;if(e==t&&t==n&&n==s)return e}function In(i,e){const t=parseFloat(i);return Number.isNaN(t)||String(t)!==String(i)?i:`${t}${e}`}function ws(i,e={}){const t={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...i};return e.includeAlignmentProperty&&!t.alignment&&(t.alignment="center"),e.includePaddingProperty&&!t.padding&&(t.padding=""),e.includeVerticalAlignmentProperty&&!t.verticalAlignment&&(t.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!t.horizontalAlignment&&(t.horizontalAlignment=e.isRightToLeftContent?"right":"left"),t}/**
1457 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1458 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1459 */const uB=500,qd={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroun
1459dColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class dB extends b{static get requires(){return[qt]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:xo,backgroundColors:xo})}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=ws(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._balloon=e.plugins.get(qt),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",n=>{const s=new P(n);s.set({label:t("Cell properties"),icon:cB,tooltip:!0}),this.listenTo(s,"execute",()=>this._showView());const o=Object.values(qd).map(r=>e.commands.get(r));return s.bind("isEnabled").toMany(o,"isEnabled",(...r)=>r.some(a=>a)),s})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableCellProperties"),n=es(t.borderColors),s=Xi(e.locale,n),o=es(t.backgroundColors),r=Xi(e.locale,o),a=t.colorPicker!==!1,l=new aB(e.locale,{borderColors:s,backgroundColors:r,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:a?t.colorPicker||{}:!1}),c=e.t;l.render(),this.listenTo(l,"submit",()=>{this._hideView()}),this.listenTo(l,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._und
1459oStepBatch),this._hideView()}),l.keystrokes.set("Esc",(h,f)=>{this._hideView(),f()}),ai({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const u=rp(c),d=ap(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableCellBorderColor",errorText:u,validator:Ao})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:lp})),l.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:l.paddingInput,commandName:"tableCellPadding",errorText:d,validator:$i})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableCellWidth",errorText:d,validator:$i})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableCellHeight",errorText:d,validator:$i})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableCellBackgroun
1459dColor",errorText:u,validator:Ao})),l.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),l.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),l}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(qd).map(([n,s])=>{const o=this._defaultTableCellProperties[n]||"";return[n,e.get(s).value||o]}).forEach(([n,s])=>{(n==="borderColor"||n==="borderWidth")&&t.value==="none"||this.view.set(n,s)}),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:fp(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor,t=e.editing.view.document;ar(t.selection)?this._isViewVisible&&dp(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,s)=>{this._isReady&&this.editor.execute(e,{value:s,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:n,validator:s,errorText:o}=e,r=gt(()=>{n.errorText=o},uB);return(a,l,c)=>{r.cancel(),this._isReady&&(s(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),n.errorText=null):r())}}}/**
1460 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1461 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1462 */class Ot extends R{constructor(e,t,n){super(e),this.attributeName=t,this._defaultValue=n}refresh(){const e=this.editor,n=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!n.length,this.value=this._getSingleValue(n)}execute(e={}){const{value:t,batch:n}=e,s=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(s.document.selection),a=this._getValueToSet(t);s.enqueueChange(n,l=>{a?r.forEach(c=>l.setAttribute(this.attributeName,a,c)):r.forEach(c=>l.removeAttribute(this.attributeName,c))})}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(s=>this._getAttribute(s)===t)?t:void 0}}/**
1463 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1464 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1465 */class hB extends Ot{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if(e=In(e,"px"),e!==this._defaultValue)return e}}/**
1466 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1467 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1468 */class fB extends b{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[rr]}init(){const e=this.editor,t=ws(e.config.get("table.tableCellProperties.defaultProperties"));ro(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new hB(e,t.width))}}/**
1469 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1470 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1471 */class mB extends Ot{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){const t=In(e,"px");if(t!==this._defaultValue)return t}}/**
1472 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1473 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1474 */class gB extends Ot{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=In(e,"px");if(t!==this._defaultValue)return t}}/**
1475 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1476 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1477 */class pB extends Ot{constructor(e,t){super(e,"tableCellBackgroun
1477dColor",t)}}/**
1478 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1479 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1480 */class bB extends Ot{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}/**
1481 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1482 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1483 */class wB extends Ot{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}/**
1484 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1485 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1486 */class _B extends Ot{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}/**
1487 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1488 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1489 */class yB extends Ot{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}/**
1490 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1491 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1492 */class vB extends Ot{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){const t=In(e,"px");if(t!==this._defaultValue)return t}}/**
1493 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1494 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1495 */const jd=/^(top|middle|bottom)$/,Gd=/^(left|center|right|justify)$/;class kB extends b{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[rr,fB]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const s=ws(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"});e.data.addStyleProcessorRules(Mm),CB(t,n,{color:s.borderColor,style:s.borderStyle,width:s.borderWidth}),e.commands.add("tableCellBorderStyle",new _B(e,s.borderStyle)),e.commands.add("tableCellBorderColor",new yB(e,s.borderColor)),e.commands.add("tableCellBorderWidth",new vB(e,s.borderWidth)),ro(t,n,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:s.height}),e.commands.add("tableCellHeight",new gB(e,s.height)),e.data.addStyleProcessorRules(nA),ro(t,n,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:s.padding}),e.commands.add("tableCellPadding",new mB(e,s.padding)),e.data.addStyleProcessorRules(ul),ro(t,n,{modelAttribute:"tableCellBackgroun
1495dColor",styleName:"background-color",defaultValue:s.backgroundColor}),e.commands.add("tableCellBackgroundColor",new pB(e,s.backgroundColor)),TB(t,n,s.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new wB(e,s.horizontalAlignment)),EB(t,n,s.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new bB(e,s.verticalAlignment))}}function CB(i,e,t){const n={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};i.extend("tableCell",{allowAttributes:Object.values(n)}),wa(e,"td",n,t),wa(e,"th",n,t),Di(e,{modelElement:"tableCell",modelAttribute:n.style,styleName:"border-style"}),Di(e,{modelElement:"tableCell",modelAttribute:n.color,styleName:"border-color"}),Di(e,{modelElement:"tableCell",modelAttribute:n.width,styleName:"border-width"})}function TB(i,e,t){i.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:n=>({key:"style",value:{"text-align":n}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":Gd}},model:{key:"tableCellHorizontalAlignment",value:n=>{const s=n.getStyle("text-align");return s===t?null:s}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Gd}},model:{key:"tableCellHorizontalAlignment",value:n=>{const s=n.getAttribute("align");return s===t?null:s}}})}function EB(i,e,t){i.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:n=>({key:"style",value:{"vertical-align":n}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":jd}},model:{key:"tableCellVerticalAlignment",value:n=>{const s=n.getStyle("vertical-align");return s===t?null:s}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:jd}},model:{key:"tableCellVerticalAlignment",value:n=>{const s=n.getAttribute("valign");return s===t?null:s}}})}/**
1496 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1497 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1498 */class AB extends b{static get pluginName(){return"TableCellProperties"}static get requires(){return[kB,dB]}}/**
1499 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1500 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1501 */class Pn extends R{constructor(e,t,n){super(e),this.attributeName=t,this._defaultValue=n}refresh(){const t=this.editor.model.document.selection,n=ya(t);this.isEnabled=!!n,this.value=this._getValue(n)}execute(e={}){const t=this.editor.model,n=t.document.selection,{value:s,batch:o}=e,r=ya(n),a=this._getValueToSet(s);t.enqueueChange(o,l=>{a?l.setAttribute(this.attributeName,a,r):l.removeAttribute(this.attributeName,r)})}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}}/**
1502 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1503 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1504 */class xB extends Pn{constructor(e,t){super(e,"tableBackgroundColor",t)}}/**
1505 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1506 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1507 */class SB extends Pn{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}/**
1508 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1509 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1510 */class IB extends Pn{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}/**
1511 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1512 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1513 */class PB extends Pn{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=Sn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){const t=In(e,"px");if(t!==this._defaultValue)return t}}/**
1514 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1515 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1516 */class RB extends Pn{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if(e=In(e,"px"),e!==this._defaultValue)return e}}/**
1517 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1518 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1519 */class VB extends Pn{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if(e=In(e,"px"),e!==this._defaultValue)return e}}/**
1520 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1521 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1522 */class BB extends Pn{constructor(e,t){super(e,"tableAlignment",t)}}/**
1523 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1524 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1525 */const MB=/^(left|center|right)$/,OB=/^(left|none|right)$/;class LB extends b{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[rr]}init(){const e=this.editor,t=e.model.schema,n=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const s=ws(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Mm),FB(t,n,{color:s.borderColor,style:s.borderStyle,width:s.borderWidth}),e.commands.add("tableBorderColor",new SB(e,s.borderColor)),e.commands.add("tableBorderStyle",new IB(e,s.borderStyle)),e.commands.add("tableBorderWidth",new PB(e,s.borderWidth)),NB(t,n,s.alignment),e.commands.add("tableAlignment",new BB(e,s.alignment)),Kd(t,n,{modelAttribute:"tableWidth",styleName:"width",defaultValue:s.width}),e.commands.add("tableWidth",new RB(e,s.width)),Kd(t,n,{modelAttribute:"tableHeight",styleName:"height",defaultValue:s.height}),e.commands.add("tableHeight",new VB(e,s.height)),e.data.addStyleProcessorRules(ul),DB(t,n,{modelAttribute:"tableBackgroun
1525dColor",styleName:"background-color",defaultValue:s.backgroundColor}),e.commands.add("tableBackgroundColor",new xB(e,s.backgroundColor))}}function FB(i,e,t){const n={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};i.extend("table",{allowAttributes:Object.values(n)}),wa(e,"table",n,t),so(e,{modelAttribute:n.color,styleName:"border-color"}),so(e,{modelAttribute:n.style,styleName:"border-style"}),so(e,{modelAttribute:n.width,styleName:"border-width"})}function NB(i,e,t){i.extend("table",{allowAttributes:["tableAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:n=>({key:"style",value:{float:n==="center"?"none":n}}),converterPriority:"high"}),e.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:OB}},model:{key:"tableAlignment",value:n=>{let s=n.getStyle("float");return s==="none"&&(s="center"),s===t?null:s}}}).attributeToAttribute({view:{attributes:{align:MB}},model:{name:"table",key:"tableAlignment",value:n=>{const s=n.getAttribute("align");return s===t?null:s}}})}function DB(i,e,t){const{modelAttribute:n}=t;i.extend("table",{allowAttributes:[n]}),yl(e,{viewElement:"table",...t}),so(e,t)}function Kd(i,e,t){const{modelAttribute:n}=t;i.extend("table",{allowAttributes:[n]}),yl(e,{viewElement:/^(table|figure)$/,shouldUpcast:s=>!(s.name=="table"&&s.parent.name=="figure"),...t}),Di(e,{modelElement:"table",...t})}/**
1526 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1527 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1528 */const $B={left:E.objectLeft,center:E.objectCenter,right:E.objectRight};class UB extends C{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:n,borderWidthInput:s,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:l}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:d,dimensionsLabel:h}=this._createDimensionFields(),{alignmentToolbar:f,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new se,this.keystrokes=new de,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=s,this.borderColorInput=o,this.backgroundInput=l,this.widthInput=c,this.heightInput=d,this.alignmentToolbar=f;const{saveButtonView:p,cancelButtonView:_}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=_,this._focusables=new ve,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Xo(e,{label:this.t("Table properties")})),this.children.add(new Be(e,{labelView:r,children:[r,n,o,s],class:"ck-table-form__border-row"})),this.children.add(new Be(e,{labelView:a,children:[a,l],class:"ck-table-form__background-row"})),this.children.add(new Be(e,{children:[new Be(e,{labelView:h,children:[h,c,u,d],class:"ck-table-form__dimensions-row"}),new Be(e,{labelView:m,children:[m,f],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new Be(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),wn({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{e.fieldView.focusCycler.on("forwardCycle",t=>{this._focusCycler.focusNext(),t.stop()}),e.fieldView.focusCycler.on("backwardCycle",t=>{this._focusCycler.focusPrevious(),t.stop()})}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,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()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=So({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),s=this.locale,o=this.t,r=o("Style"),a=new Ne(s);a.text=o("Border");const l=Cl(o),c=new he(s,Jm);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",h=>l[h||"none"]),c.fieldView.on("execute",h=>{this.borderStyle=h.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",h=>!h),kn(c.fieldView,cp(this,t.style),{role:"menu",ariaLabel:r});const u=new he(s,De);u.set({label:o("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",Gs),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});const d=new he(s,n);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",Gs),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(h,f,m,p)=>{Gs(m)||(this.borderColor="",this.borderWidth=""),Gs(p)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:a,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:u}}
1528_createBackgroundFields(){const e=this.locale,t=this.t,n=new Ne(e);n.text=t("Background");const s=So({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new he(e,s);return o.set({label:t("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",()=>{this.backgroundColor=o.fieldView.value}),{backgroundRowLabel:n,backgroundInput:o}}_createDimensionFields(){const e=this.locale,t=this.t,n=new Ne(e);n.text=t("Dimensions");const s=new he(e,De);s.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),s.fieldView.bind("value").to(this,"width"),s.fieldView.on("input",()=>{this.width=s.fieldView.element.value});const o=new C(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new he(e,De);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:n,widthInput:s,operatorLabel:o,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,n=new Ne(e);n.text=t("Alignment");const s=new Xn(e);return s.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Aa({view:this,icons:$B,toolbar:s,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:s}}_createActionButtons(){const e=this.locale,t=this.t,n=new P(e),s=new P(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:t("Save"),icon:E.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(o,"errorText",(...r)=>r.every(a=>!a)),s.set({label:t("Cancel"),icon:E.cancel,class:"ck-button-cancel",withText:!0}),s.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:s}}get _alignmentLabels(){const e=this.locale,t=this.t,n=t("Align table to the left"),s=t("Center table"),o=t("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:o,center:s,left:n}:{left:n,center:s,right:o}}}function Gs(i){return i!=="none"}const HB='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>';/**
1529 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1530 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1531 */const zB=500,Jd={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class WB extends b{static get requires(){return[qt]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),this.view=null,e.config.define("table.tableProperties",{borderColors:xo,backgroundColors:xo})}init(){const e=this.editor,t=e.t;this._defaultTableProperties=ws(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(qt),e.ui.componentFactory.add("tableProperties",n=>{const s=new P(n);s.set({label:t("Table properties"),icon:HB,tooltip:!0}),this.listenTo(s,"execute",()=>this._showView());const o=Object.values(Jd).map(r=>e.commands.get(r));return s.bind("isEnabled").toMany(o,"isEnabled",(...r)=>r.some(a=>a)),s})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),n=es(t.borderColors),s=Xi(e.locale,n),o=es(t.backgroundColors),r=Xi(e.locale,o),a=t.colorPicker!==!1,l=new UB(e.locale,{borderColors:s,backgroundColors:r,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:a?t.colorPicker||{}:!1}),c=e.t;l.render(),this.listenTo(l,"submit",()=>{this._hideView()}),this.listenTo(l,"cancel",()=>
1531{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),l.keystrokes.set("Esc",(h,f)=>{this._hideView(),f()}),ai({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const u=rp(c),d=ap(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableBorderColor",errorText:u,validator:Ao})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:lp})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableBackgroundColor",errorText:u,validator:Ao})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableWidth",errorText:d,validator:$i})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableHeight",errorText:d,validator:$i})),l.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),l}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(Jd).map(([n,s])=>{const o=n,r=this._defaultTableProperties[o]||"";return[o,e.get(s).value||r]}).forEach(([n,s])=>{(n==="borderColor"||n==="borderWidth")&&t.value==="none"||this.view.set(n,s)}),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:hp(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor,t=e.editing.view.document;ip(t.selection)?this._isViewVisible&&dp(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,s)=>{this._isReady&&this.editor.execute(e,{value:s,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:n,validator:s,errorText:o}=e,r=gt(()=>{n.errorText=o},zB);return(a,l,c)=>{r.cancel(),this._isReady&&(s(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),n.errorText=null):r())}}}/**
1532 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1533 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1534 */class qB extends b{static get pluginName(){return"TableProperties"}static get requires(){return[LB,WB]}}/**
1535 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1536 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1537 */function jB(i){return i.createContainerElement("span",{class:"image-inline"},i.createEmptyElement("img"))}function Zd(i){return i.createContainerElement("figure",{class:"image"},[i.createEmptyElement("img"),i.createSlot("children")])}function gp(i,e){const t=i.plugins.get("ImageUtils"),n=i.plugins.has("ImageInlineEditing")&&i.plugins.has("ImageBlockEditing");return o=>t.isInlineImageView(o)?n&&(o.getStyle("display")=="block"||o.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:s(o):null;function s(o){const r={name:!0};return o.hasAttribute("src")&&(r.attributes=["src"]),r}}function Tl(i,e){const t=ie(e.getSelectedBlocks());return!t||i.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function Io(i){return i&&i.endsWith("px")?parseInt(i):null}function Qd(i){const e=Io(i.getStyle("width")),t=Io(i.getStyle("height"));return!!(e&&t)}/**
1538 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1539 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1540 */const GB=/^(image|image-inline)$/;class Re extends b{constructor(){super(...arguments),this._domEmitter=new(Qe())}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={}
1540,t=null,n=null,s={}){const o=this.editor,r=o.model,a=r.document.selection,l=pp(o,t||a,n);e={...Object.fromEntries(a.getAttributes()),...e};for(const c in e)r.schema.checkAttribute(l,c)||delete e[c];return r.change(c=>{const{setImageSizes:u=!0}=s,d=c.createElement(l,e);return r.insertObject(d,t,null,{setSelection:"on",findOptimalPosition:!t&&l!="imageInline"?"auto":void 0}),d.parent?(u&&this.setImageNaturalSizeAttributes(d),d):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(n=>{const s=new A.window.Image;this._domEmitter.listenTo(s,"load",()=>{!e.getAttribute("width")&&!e.getAttribute("height")&&this.editor.model.enqueueChange(n.batch,o=>{o.setAttribute("width",s.naturalWidth,e),o.setAttribute("height",s.naturalHeight,e)}),this._domEmitter.stopListening(s,"load")}),s.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const n=e.getSelectedElement();if(n&&this.isImageWidget(n))return n;let s=t.parent;for(;s;){if(s.is("element")&&this.isImageWidget(s))return s;s=s.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:GB})}isImageAllowed(){const t=this.editor.model.document.selection;return KB(this.editor,t)&&JB(t)}toImageWidget(e,t,n){return t.setCustomProperty("image",!0,e),ms(e,t,{label:()=>{const r=this.findViewImgElement(e).getAttribute("alt");return r?`${r} ${n}`:n}})}isImageWidget(e){return!!e.getCustomProperty("image")&&ce(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:n}of t.createRangeIn(e))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function KB(i,e){if(pp(i,e,null)=="imageBlock"){const n=ZB(e,i.model);if(i.model.schema.checkChild(n,"imageBlock"))return!0}else if(i.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}function JB(i){return[...i.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function ZB(i,e){const n=ir(i,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}function pp(i,e,t){const n=i.model.schema,s=i.config.get("image.insert.type");return i.plugins.has("ImageBlockEditing")?i.plugins.has("ImageInlineEditing")?t||(s==="inline"?"imageInline":s!=="auto"?"imageBlock":e.is("selection")?Tl(n,e):n.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}/**
1541 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1542 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1543 */class QB extends R{refresh(){const n=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!n,this.isEnabled&&n.hasAttribute("alt")?this.value=n.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,n=t.plugins.get("ImageUtils"),s=t.model,o=n.getClosestSelectedImageElement(s.document.selection);s.change(r=>{r.setAttribute("alt",e.newValue,o)})}}/**
1544 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1545 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1546 */class YB extends b{static get requires(){return[Re]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new QB(this.editor))}}/**
1547 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1548 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1549 */class XB extends C{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new se,this.keystrokes=new de,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),E.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),E.cancel,"ck-button-cancel","cancel"),this._focusables=new ve,this._focusCycler=new ke({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),wn({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEac
1549h(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,n,s){const o=new P(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),s&&o.delegate("execute").to(this,s),o}_createLabeledInputView(){const e=this.locale.t,t=new he(this.locale,De);return t.label=e("Text alternative"),t}}/**
1550 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1551 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1552 */function e4(i){const e=i.plugins.get("ContextualBalloon");if(i.plugins.get("ImageUtils").getClosestSelectedImageWidget(i.editing.view.document.selection)){const n=bp(i);e.updatePosition(n)}}function bp(i){const e=i.editing.view,t=ye.defaultPositions,n=i.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(n.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}/**
1553 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1554 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1555 */class t4 extends b{static get requires(){return[qt]}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",n=>{const s=e.commands.get("imageTextAlternative"),o=new P(n);return o.set({label:t("Change image text alternative"),icon:E.textAlternative,tooltip:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>!!r),this.listenTo(o,"execute",()=>{this._showForm()}),o})}_createForm(){const e=this.editor,n=e.editing.view.document,s=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(qo(XB))(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",(o,r)=>{this._hideForm(!0),r()}),this.listenTo(e.ui,"update",()=>{s.getClosestSelectedImageWidget(n.selection)?this._isVisible&&e4(e):this._hideForm(!0)}),ai({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"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:bp(e)}),n.fieldView.value=n.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)}}/**
1556 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1557 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1558 */class wp extends b{static get requires(){return[YB,t4]}static get pluginName(){return"ImageTextAlternative"}}/**
1559 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1560 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1561 */function n4(i){const e=(t,n,s)=>{if(!s.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const o=i.findViewImgElement(n.viewItem);if(!o||!s.consumable.test(o,{name:!0}))return;s.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=s.convertItem(o,n.modelCursor),a=ie(r.modelRange.getItems());if(!a){s.consumable.revert(n.viewItem,{name:!0,classes:"image"});return}s.convertChildren(n.viewItem,a),s.updateConversionResult(a,n)};return t=>{t.on("element:figure",e)}}function i4(i){const e=["srcset","media","type","sizes"],t=(n,s,o)=>{const r=s.viewItem;if(!o.consumable.test(r,{name:!0}))return;const a=new Map;for(const u of r.getChildren())if(u.is("element","source")){const d={};for(const h of e)u.hasAttribute(h)&&o.consumable.test(u,{attributes:h})&&(d[h]=u.getAttribute(h));Object.keys(d).length&&a.set(u,d)}const l=i.findViewImgElement(r);if(!l)return;let c=s.modelCursor.parent;if(!c.is("element","imageBlock")){const u=o.convertItem(l,s.modelCursor);s.modelRange=u.modelRange,s.modelCursor=u.modelCursor,c=ie(u.modelRange.getItems())}o.consumable.consume(r,{name:!0});for(const[u,d]of a)o.consumable.consume(u,{attributes:Object.keys(d)});a.size&&o.writer.setAttribute("sources",Array.from(a.values()),c),o.convertChildren(r,c)};return n=>{n.on("element:picture",t)}}function _p(i,e){const t=(n,s,o)=>
1561{if(!o.consumable.consume(s.item,n.name))return;const r=o.writer,a=o.mapper.toViewElement(s.item),l=i.findViewImgElement(a);s.attributeNewValue===null?(r.removeAttribute("srcset",l),r.removeAttribute("sizes",l)):s.attributeNewValue&&(r.setAttribute("srcset",s.attributeNewValue,l),r.setAttribute("sizes","100vw",l))};return n=>{n.on(`attribute:srcset:${e}`,t)}}function s4(i){const e=(t,n,s)=>{if(!s.consumable.consume(n.item,t.name))return;const o=s.writer,r=s.mapper.toViewElement(n.item),a=i.findViewImgElement(r),l=n.attributeNewValue;if(l&&l.length){const c=o.createContainerElement("picture",null,l.map(h=>o.createEmptyElement("source",h))),u=[];let d=a.parent;for(;d&&d.is("attributeElement");){const h=d.parent;o.unwrap(o.createRangeOn(a),d),u.unshift(d),d=h}o.insert(o.createPositionBefore(a),c),o.move(o.createRangeOn(a),o.createPositionAt(c,"end"));for(const h of u)o.wrap(o.createRangeOn(c),h)}else if(a.parent.is("element","picture")){const c=a.parent;o.move(o.createRangeOn(a),o.createPositionBefore(c)),o.remove(c)}};return t=>{t.on("attribute:sources:imageBlock",e),t.on("attribute:sources:imageInline",e)}}function Po(i,e,t){const n=(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const a=r.writer,l=r.mapper.toViewElement(o.item),c=i.findViewImgElement(l);a.setAttribute(o.attributeKey,o.attributeNewValue||"",c)};return s=>{s.on(`attribute:${t}:${e}`,n)}}/**
1562 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1563 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1564 */class yp extends pt{observe(e){this.listenTo(e,"load",(t,n)=>{const s=n.target;this.checkShouldIgnoreEventFromTarget(s)||s.tagName=="IMG"&&this._fireEvents(n)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}/**
1565 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1566 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1567 */class o4 extends R{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&N("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&N("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=J(e.source),n=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());t.forEach((r,a)=>{const l=n.getSelectedElement();if(typeof r=="string"&&(r={src:r}),a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);s.insertImage({...r,...o},c)}else s.insertImage({...r,...o})})}}/**
1568 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1569 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1570 */class r4 extends R{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),n=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(n),this.value=this.isEnabled?n.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),n=this.editor.plugins.get("ImageUtils");this.editor.model.change(s=>{s.setAttribute("src",e.source,t),this.cleanupImage(s,t),n.setImageNaturalSizeAttributes(t)})}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}/**
1571 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1572 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1573 */class El extends b{static get requires(){return[Re]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(yp),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const n=new o4(e),s=new r4(e);e.commands.add("insertImage",n),e.commands.add("replaceImageSource",s),e.commands.add("imageInsert",n)}}/**
1574 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1575 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1576 */class vp extends b{static get requires(){return[Re]}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,n=t.plugins.get("ImageUtils"),s=e==="imageBlock"?"figure":"img";t.conversion.for("upcast").attributeToAttribute({view:{name:s,styles:{width:/.+/}},model:{key:"width",value:r=>Qd(r)?Io(r.getStyle("width")):null}}).attributeToAttribute({view:{name:s,key:"width"},model:"width"}).attributeToAttribute({view:{name:s,styles:{height:/.+/}},model:{key:"height",value:r=>Qd(r)?Io(r.getStyle("height")):null}}).attributeToAttribute({view:{name:s,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(r=>{o(r,"width","width",!0),o(r,"height","height",!0)}),t.conversion.for("dataDowncast").add(r=>{o(r,"width","width",!1),o(r,"height","height",!1)});function o(r,a,l,c){r.on(`attribute:${a}:${e}`,(u,d,h)=>{if(!h.consumable.consume(d.item,u.name))return;const f=h.writer,m=h.mapper.toViewElement(d.item),p=n.findViewImgElement(m);if(d.attributeNewValue!==null?f.setAttribute(l,d.attributeNewValue,p):f.removeAttribute(l,p),d.item.hasAttribute("sources"))return;const _=d.item.hasAttribute("resizedWidth");if(e==="imageInline"&&!_&&!c)return;const v=d.item.getAttribute("width"),T=d.item.getAttribute("height");v&&T&&f.setStyle("aspect-ratio",`${v}/${T}`,p)})}}}/**
1577 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1578 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1579 */class kp extends R{constructor(e,t){super(e),this._modelElementName=t}refresh(){const t=this.editor.plugins.get("ImageUtils"),n=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(n):this.isEnabled=t.isBlockImage(n)}execute(e={}){const t=this.editor,n=this.editor.model,s=t.plugins.get("ImageUtils"),o=s.getClosestSelectedImageElement(n.document.selection),r=Object.fromEntries(o.getAttributes());return!r.src&&!r.uploadId?null:n.change(a=>{const{setImageSizes:l=!0}=e,c=Array.from(n.markers).filter(h=>h.getRange().containsItem(o)),u=s.insertImage(r,n.createSelection(o,"on"),this._modelElementName,{setImageSizes:l});if(!u)return null;const d=a.createRangeOn(u);
1579for(const h of c){const f=h.getRange(),m=f.root.rootName!="$graveyard"?f.getJoined(d,!0):d;a.updateMarker(h,{range:m})}return{oldElement:o,newElement:u}})}}/**
1580 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1581 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1582 */class Cp extends b{static get requires(){return[Re]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,n=e.plugins.get("ImageUtils");t.for("editingDowncast").add(s=>{s.on("attribute:placeholder",(o,r,a)=>{if(!a.consumable.test(r.item,o.name)||!r.item.is("element","imageBlock")&&!r.item.is("element","imageInline"))return;a.consumable.consume(r.item,o.name);const l=a.writer,c=a.mapper.toViewElement(r.item),u=n.findViewImgElement(c);r.attributeNewValue?(l.addClass("image_placeholder",u),l.setStyle("background-image",`url(${r.attributeNewValue})`,u),l.setCustomProperty("editingPipeline:doNotReuseOnce",!0,u)):(l.removeClass("image_placeholder",u),l.removeStyle("background-image",u))})})}_setupLoadListener(){const e=this.editor,t=e.model,n=e.editing,s=n.view,o=e.plugins.get("ImageUtils");s.addObserver(yp),this.listenTo(s.document,"imageLoaded",(r,a)=>{const l=s.domConverter.mapDomToView(a.target);if(!l)return;const c=o.getImageWidgetFromImageView(l);if(!c)return;const u=n.mapper.toModelElement(c);!u||!u.hasAttribute("placeholder")||t.enqueueChange({isUndoable:!1},d=>{d.removeAttribute("placeholder",u)})})}}/**
1583 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1584 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1585 */class Tp extends b{static get requires(){return[El,vp,Re,Cp,Je]}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 kp(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,s=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>Zd(r)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>s.toImageWidget(Zd(r),r,t("image widget"))}),n.for("downcast").add(Po(s,"imageBlock","src")).add(Po(s,"imageBlock","alt")).add(_p(s,"imageBlock")),n.for("upcast").elementToElement({view:gp(e,"imageBlock"),model:(o,{writer:r})=>r.createElement("imageBlock",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)}).add(n4(s))}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isInlineImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(Tl(t.schema,u)==="imageBlock"){const d=new bt(n.document),h=l.map(f=>d.createElement("figure",{class:"image"},f));a.content=d.createDocumentFragment(h)}}),this.listenTo(o,"contentInsertion",(r,a)=>{a.method==="paste"&&t.change(l=>{const c=l.createRangeIn(a.content);for(const u of c.getItems())u.is("element","imageBlock")&&s.setImageNaturalSizeAttributes(u)})})}}/**
1586 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1587 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1588 */class a4 extends C{constructor(e,t=[]){super(e),this.focusTracker=new se,this.keystrokes=new de,this._focusables=new ve,this.children=this.createCollection(),this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const n of t)this.children.add(n),this._focusables.add(n),n instanceof Fm&&this._focusables.addMany(n.children);if(this._focusables.length>1)for(const n of this._focusables)l4(n)&&(n.focusCycler.on("forwardCycle",s=>{this._focusCycler.focusNext(),s.stop()}),n.focusCycler.on("backwardCycle",s=>{this._focusCycler.focusPrevious(),s.stop()}));this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),wn({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}function l4(i){return"focusCycler"in i}/**
1589 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1590 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1591 */class Ep extends b{static get pluginName(){return"ImageInsertUI"}static get requires(){return[Re]}constructor(e){super(e),this._integrations=new Map,e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=n.isImage(t.getSelectedElement())});const s=o=>this._createToolbarComponent(o);e.ui.componentFactory.add("insertImage",s),e.ui.componentFactory.add("imageInsert",s)}registerIntegration({name:e,observable:t,buttonViewCreator:n,formViewCreator:s,requiresForm:o}){this._integrations.has(e)&&N("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:n,formViewCreator:s,requiresForm:!!o})}_createToolbarComponent(e){const t=this.editor,n=e.t,s=this._prepareIntegrations();if(!s.length)return null;let o;const r=s[0];if(s.length==1){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const c=r.buttonViewCreator(!1);o=new ci(e,c),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",u=>n(u?"Replace image":"Insert image"))}const a=this.dropdownView=pe(e,o),l=s.map(({observable:c})=>typeof c=="function"?c():c);return a.bind("isEnabled").toMany(l,"isEnabled",(...c)=>c.some(u=>u)),a.once("change:isOpen",()=>{const c=s.map(({formViewCreator:d})=>d(s.length==1)),u=new a4(t.locale,c);a.panelView.children.add(u)}),a}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),n=[];if(!t.length)return N("image-insert-integrations-not-specified"),n;for(const s of t){if(!this._integrations.has(s)){["upload","assetManager","url"].includes(s)||N("image-insert-unknown-integration",{item:s});continue}n.push(this._integrations.get(s))}return n.length||N("image-insert-integrations-not-registered"),n}}/**
1592 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1593 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1594 */class c4 extends b{static get requires(){return[Tp,Cn,wp,Ep]}static get pluginName(){return"ImageBlock"}}/**
1595 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1596 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1597 */class u4 extends b{static get requires(){return[El,vp,Re,Cp,Je]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;
1597t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((n,s)=>{if(n.endsWith("caption")&&s.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new kp(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,s=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(o,{writer:r})=>r.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(o,{writer:r})=>s.toImageWidget(jB(r),r,t("image widget"))}),n.for("downcast").add(Po(s,"imageInline","src")).add(Po(s,"imageInline","alt")).add(_p(s,"imageInline")),n.for("upcast").elementToElement({view:gp(e,"imageInline"),model:(o,{writer:r})=>r.createElement("imageInline",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isBlockImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(Tl(t.schema,u)==="imageInline"){const d=new bt(n.document),h=l.map(f=>f.childCount===1?(Array.from(f.getAttributes()).forEach(m=>d.setAttribute(...m,s.findViewImgElement(f))),f.getChild(0)):f);a.content=d.createDocumentFragment(h)}}),this.listenTo(o,"contentInsertion",(r,a)=>{a.method==="paste"&&t.change(l=>{const c=l.createRangeIn(a.content);for(const u of c.getItems())u.is("element","imageInline")&&s.setImageNaturalSizeAttributes(u)})})}}/**
1598 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1599 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1600 */class d4 extends b{static get requires(){return[u4,Cn,wp,Ep]}static get pluginName(){return"ImageInline"}}/**
1601 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1602 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1603 */class h4 extends b{static get requires(){return[c4,d4]}static get pluginName(){return"Image"}}/**
1604 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1605 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1606 */class Ap extends b{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[Re]}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"),n=e.getFirstPosition().findAncestor("caption");return n&&t.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return e.name=="figcaption"&&t.isBlockImageView(e.parent)?{name:!0}:null}}/**
1607 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1608 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1609 */class f4 extends R{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),n=e.plugins.get("ImageUtils");if(!e.plugins.has(Tp)){this.isEnabled=!1,this.value=!1;return}const s=e.model.document.selection,o=s.getSelectedElement();if(!o){const r=t.getCaptionFromModelSelection(s);this.isEnabled=!!r,this.value=!!r;return}this.isEnabled=n.isImage(o),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(n=>{this.value?this._hideImageCaption(n):this._showImageCaption(n,t)})}_showImageCaption(e,t){const s=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing"),r=this.editor.plugins.get("ImageUtils");let a=s.getSelectedElement();const l=o._getSavedCaption(a);r.isInlineImage(a)&&(this.editor.execute("imageTypeBlock"),a=s.get
1609SelectedElement());const c=l||e.createElement("caption");e.append(c,a),t&&e.setSelection(c,"in")}_hideImageCaption(e){const t=this.editor,n=t.model.document.selection,s=t.plugins.get("ImageCaptionEditing"),o=t.plugins.get("ImageCaptionUtils");let r=n.getSelectedElement(),a;r?a=o.getCaptionFromImageModelElement(r):(a=o.getCaptionFromModelSelection(n),r=a.parent),s._saveCaption(r,a),e.setSelection(r,"on"),e.remove(a)}}/**
1610 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1611 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1612 */class m4 extends b{static get requires(){return[Re,Ap]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new f4(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,n=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:r=>s.matchImageCaptionViewElement(r),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(r,{writer:a})=>n.isBlockImage(r.parent)?a.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(r,{writer:a})=>{if(!n.isBlockImage(r.parent))return null;const l=a.createEditableElement("figcaption");a.setCustomProperty("imageCaption",!0,l),l.placeholder=o("Enter image caption"),Hf({view:t,element:l,keepOnFocus:!0});const c=r.parent.getAttribute("alt"),u=c?o("Caption for image: %0",[c]):o("Caption for the image");return wg(l,a,{label:u})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),s=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),r=a=>{if(!a.return)return;const{oldElement:l,newElement:c}=a.return;/* istanbul ignore if: paranoid check -- @preserve */if(!l)return;if(t.isBlockImage(l)){const d=n.getCaptionFromImageModelElement(l);if(d){this._saveCaption(c,d);return}}const u=this._getSavedCaption(l);u&&this._saveCaption(c,u)};s&&this.listenTo(s,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?H.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,n=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const o=t.document.differ.getChanges();for(const r of o){if(r.attributeKey!=="alt")continue;const a=r.range.start.nodeAfter;if(n.isBlockImage(a)){const l=s.getCaptionFromImageModelElement(a);if(!l)return;e.editing.reconvertItem(l)}}})}}/**
1613 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1614 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1615 */class g4 extends b{static get requires(){return[Ap]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,n=e.plugins.get("ImageCaptionUtils"),s=e.t;e.ui.componentFactory.add("toggleImageCaption",o=>{const r=e.commands.get("toggleImageCaption"),a=new P(o);return a.set({icon:E.caption,tooltip:!0,isToggleable:!0}),a.bind("isOn","isEnabled").to(r,"value","isEnabled"),a.bind("label").to(r,"value",l=>s(l?"Toggle caption off":"Toggle caption on")),this.listenTo(a,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const l=n.getCaptionFromModelSelection(e.model.document.selection);if(l){const c=e.editing.mapper.toViewElement(l);t.scrollToTheSelection(),t.change(u=>{u.addClass("image__caption_highlighted",c)})}e.editing.view.focus()}),a})}}/**
1616 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1617 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1618 */class p4 extends b{static get requires(){return[m4,g4]}static get pluginName(){return"ImageCaption"}}/**
1619 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1620 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1621 */function xp(i){const e=i.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function b4(i){return new Promise((e,t)=>
1621{const n=i.getAttribute("src");fetch(n).then(s=>s.blob()).then(s=>{const o=Sp(s,n),a=`image.${o.replace("image/","")}`,l=new File([s],a,{type:o});e(l)}).catch(s=>s&&s.name==="TypeError"?_4(n).then(e).catch(t):t(s))})}function w4(i,e){return!i.isInlineImageView(e)||!e.getAttribute("src")?!1:!!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!e.getAttribute("src").match(/^blob:/g)}function Sp(i,e){return i.type?i.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function _4(i){return y4(i).then(e=>{const t=Sp(e,i),s=`image.${t.replace("image/","")}`;return new File([e],s,{type:t})})}function y4(i){return new Promise((e,t)=>{const n=A.document.createElement("img");n.addEventListener("load",()=>{const s=A.document.createElement("canvas");s.width=n.width,s.height=n.height,s.getContext("2d").drawImage(n,0,0),s.toBlob(r=>r?e(r):t())}),n.addEventListener("error",()=>t()),n.src=i})}/**
1622 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1623 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1624 */class v4 extends b{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,n=()=>{const s=this._createButton(Lm);return s.set({label:t("Upload image from computer"),tooltip:!0}),s};if(e.ui.componentFactory.add("uploadImage",n),e.ui.componentFactory.add("imageUpload",n),e.ui.componentFactory.add("menuBar:uploadImage",()=>{const s=this._createButton(ig);return s.label=t("Image from computer"),s}),e.plugins.has("ImageInsertUI")){const s=e.plugins.get("ImageInsertUI");s.registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>{const o=e.ui.componentFactory.create("uploadImage");return o.bind("label").to(s,"isImageSelected",r=>t(r?"Replace image from computer":"Upload image from computer")),o},formViewCreator:()=>{const o=e.ui.componentFactory.create("uploadImage");return o.withText=!0,o.bind("label").to(s,"isImageSelected",r=>t(r?"Replace from computer":"Upload from computer")),o.on("execute",()=>{s.dropdownView.isOpen=!1}),o}})}}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get("uploadImage"),o=t.config.get("image.upload.types"),r=xp(o),a=new e(t.locale),l=n.t;return a.set({acceptedType:o.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:l("Upload image from computer"),icon:E.imageUpload}),a.bind("isEnabled").to(s),a.on("done",(c,u)=>{const d=Array.from(u).filter(h=>r.test(h.type));d.length&&(t.execute("uploadImage",{file:d}),t.editing.view.focus())}),a}}/**
1625 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1626 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1627 */class k4 extends W(){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((n,s)=>{t.onload=()=>{const o=t.result;this._data=o,n(o)},t.onerror=()=>{s("error")},t.onabort=()=>{s("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}/**
1628 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1629 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1630 */class dn extends b{constructor(){super(...arguments),this.loaders=new me,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[yo]}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 N("filerepository-no-upload-adapter"),null;const t=new Yd(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(n=>{this._loadersMap.set(n,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let n=0;for(const s of this.loaders)n+=s.uploaded;this.uploaded=n}),t.on("change:uploadTotal",()=>{let n=0;for(const s of this.loaders)s.uploadTotal&&(n+=s.uploadTotal);this.uploadTotal=n}),t}destroyLoader(e){const t=e instanceof Yd?e:this.getLoader(e);
1630t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((n,s)=>{n===t&&this._loadersMap.delete(s)})}_updatePendingAction(){const e=this.editor.plugins.get(yo);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,n=s=>`${t("Upload in progress")} ${parseInt(s)}%.`;this._pendingAction=e.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else e.remove(this._pendingAction),this._pendingAction=null}}class Yd extends W(){constructor(e,t){super(),this.id=$e(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new k4,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(n,s)=>s?n/s*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 g("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 g("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((n,s)=>{t.rejecter=s,t.isFulfilled=!1,e.then(o=>{t.isFulfilled=!0,n(o)}).catch(o=>{t.isFulfilled=!0,s(o)})}),t}}/**
1631 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1632 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1633 */class C4 extends b{static get requires(){return[dn]}static get pluginName(){return"Base64UploadAdapter"}init(){this.editor.plugins.get(dn).createUploadAdapter=e=>new T4(e)}}class T4{constructor(e){this.loader=e}upload(){return new Promise((e,t)=>{const n=this.reader=new window.FileReader;n.addEventListener("load",()=>{e({default:n.result})}),n.addEventListener("error",s=>{t(s)}),n.addEventListener("abort",()=>{t()}),this.loader.file.then(s=>{n.readAsDataURL(s)})})}abort(){this.reader.abort()}}/**
1634 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1635 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1636 */class E4 extends b{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.uploadStatusChange=(t,n,s)=>{const o=this.editor,r=n.item,a=r.getAttribute("uploadId");if(!s.consumable.consume(n.item,t.name))return;const l=o.plugins.get("ImageUtils"),c=o.plugins.get(dn),u=a?n.attributeNewValue:null,d=this.placeholder,h=o.editing.mapper.toViewElement(r),f=s.writer;if(u=="reading"){Xd(h,f),eh(l,d,h,f);return}if(u=="uploading"){const m=c.loaders.get(a);Xd(h,f),m?(th(h,f),x4(h,f,m,o.editing.view),V4(l,h,f,m)):eh(l,d,h,f);return}u=="complete"&&c.loaders.get(a)&&I4(h,f,o.editing.view),S4(h,f),th(h,f),A4(h,f)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function Xd(i,e){i.hasClass("ck-appear")||e.addClass("ck-appear",i)}function A4(i,e){e.removeClass("ck-appear",i)}function eh(i,e,t,n){t.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",t);const s=i.findViewImgElement(t);s.getAttribute("src")!==e&&n.setAttribute("src",e,s),Ip(t,"placeholder")||n.insert(n.createPositionAfter(s),R4(n))}function th(i,e){i.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",i),Pp(i,e,"placeholder")}function x4(i,e,t,n){const s=P4(e);e.insert(e.createPositionAt(i,"end"),s),t.on("change:uploadedPercent",(o,r,a)=>{n.change(l=>{l.setStyle("width",a+"%",s)})})}function S4(i,e){Pp(i,e,"progressBar")}function I4(i,e,t){const n=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(i,"end"),n),setTimeout(()=>{t.change(s=>s.remove(s.createRangeOn(n)))},3e3)}function P4(i){const e=i.createUIElement("div",{class:"ck-progress-bar"});return i.setCustomProperty("progressBar",!0,e),e}function R4(i){const e=i.createUIElement("div",{class:"ck-upload-placeholder-loader"});return i.setCustomProperty("placeholder",!0,e),e}function Ip(i,e){for(const t of i.getChildren())if(t.getCustomProperty(e))return t}function Pp(i,e,t){const n=Ip(i,t);n&&e.remove(e.createRangeOn(n))}function V4(i,e,t,n){if(n.data){const s=i.findViewImgElement(e);t.setAttribute("src",n.data,s)}}/**
1637 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1638 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1639 */class B4 extends R{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(n)}execute(e){const t=J(e.file),n=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());t.forEach((r,a)=>{const l=n.getSelectedElement();if(a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);this._uploadImage(r,o,c)}else this._uploadImage(r,o)})}_uploadImage(e,t,n){const s=this.editor,r=s.plugins.get(dn).createLoader(e),a=s.plugins.get("ImageUtils");r&&a.insertImage({...t,uploadId:r.id},n)}}/**
1640 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1641 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1642 */class M4 extends b{static get requires(){return[dn,Su,Je,Re]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,n=e.conversion,s=e.plugins.get(dn),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),a=xp(e.config.get("image.upload.types")),l=new B4(e);e.commands.add("uploadImage",l),e.commands.add("imageUpload",l),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(c,u)=>{if(O4(u.dataTransfer))return;const d=Array.from(u.dataTransfer.files).filter(h=>h?a.test(h.type):!1);d.length&&(c.stop(),e.model.change(h=>{u.targetRanges&&h.setSelection(u.targetRanges.map(f=>e.editing.mapper.toModelRange(f))),e.execute("uploadImage",{file:d})}))}),this.listenTo(r,"inputTransformation",(c,u)=>{const d=Array.from(e.editing.view.createRangeIn(u.content)).map(f=>f.item).filter(f=>w4(o,f)&&!f.getAttribute("uploadProcessed")).map(f=>({promise:b4(f),imageElement:f}));if(!d.length)return;const h=new bt(e.editing.view.document);for(const f of d){h.setAttribute("uploadProcessed",!0,f.imageElement);const m=s.createLoader(f.promise);m&&(h.setAttribute("src","",f.imageElement),h.setAttribute("uploadId",m.id,f.imageElement))}}),e.editing.view.document.on("dragover",(c,u)=>{u.preventDefault()}),t.on("change",()=>{const c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),u=new Set;for(const d of c)if(d.type=="insert"&&d.name!="$text"){const h=d.position.nodeAfter,f=d.position.root.rootName=="$graveyard";for(const m of L4(e,h)){const p=m.getAttribute("uploadId");if(!p)continue;const _=s.loaders.get(p);_&&(f?u.has(p)||_.abort():(u.add(p),this._uploadImageElements.set(p,m),_.status=="idle"&&this._readAndUpload(_)))}}}),this.on("uploadComplete",(c,{imageElement:u,data:d})=>{const h=d.urls?d.urls:d;this.editor.model.change(f=>{f.setAttribute("src",h.default,u),this._parseAndSetSrcsetAttributeOnImage(h,u,f),o.setImageNaturalSizeAttributes(u)})},{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,n=t.model,s=t.locale.t,o=t.plugins.get(dn),r=t.plugins.get(Su),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},u=>{u.setAttribute("uploadStatus","reading",l.get(e.id))}),e.read().then(()=>{const u=e.upload(),d=l.get(e.id);/* istanbul ignore next -- @preserve */if(B.isSafari){const h=t.editing.mapper.toViewElement(d),f=a.findViewImgElement(h);t.editing.view.once("render",()=>{if(!f.parent)return;const m=t.editing.view.domConverter.mapViewToDom(f.parent);if(!m)return;const p=m.style.display;m.style.display="none",m._ckHack=m.offsetHeight,m.style.display=p})}return t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Uploading image")),n.enqueueChange({isUndoable:!1},h=>{h.setAttribute("uploadStatus","uploading",d)}),u}).then(u=>{n.enqueueChange({isUndoable:!1},d=>{const h=l.get(e.id);d.setAttribute("uploadStatus","complete",h),t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Image upload complete")),this.fire("uploadComplete",{data:u,imageElement:h})}),c()}).catch(u=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Error during image upload")),e.status!=="error"&&e.status!=="aborted")throw u;e.status=="error"&&u&&r.showWarning(u,{title:s("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},d=>{d.remove(l.get(e.id))}),c()});function c(){n.enqueueChange({isUndoable:!1},u=>{const d=l.get(e.id);u.removeAttribute("uploadId",d),u.removeAttribute("uploadStatus",d),l.delete(e.id)}),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let s=0;const o=Object.keys(e).filter(r=>{const a=parseInt(r,10);if(!isNaN(a))return s=Math.max(s,a),!0}).map(r=>`${e[r]} ${r}w`).join(", ");
1642if(o!=""){const r={srcset:o};!t.hasAttribute("width")&&!t.hasAttribute("height")&&(r.width=s),n.setAttributes(r,t)}}}function O4(i){return Array.from(i.types).includes("text/html")&&i.getData("text/html")!==""}function L4(i,e){const t=i.plugins.get("ImageUtils");return Array.from(i.model.createRangeOn(e)).filter(n=>t.isImage(n.item)).map(n=>n.item)}/**
1643 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1644 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1645 */class F4 extends b{static get pluginName(){return"ImageUpload"}static get requires(){return[M4,v4,E4]}}/**
1646 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1647 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1648 */class N4 extends R{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(n=>{if(n.isDefault)for(const s of n.modelElements)this._defaultStyles[s]=n.name;return[n.name,n]}))}refresh(){const n=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!n,this.isEnabled?n.hasAttribute("imageStyle")?this.value=n.getAttribute("imageStyle"):this.value=this._defaultStyles[n.name]:this.value=!1}execute(e={}){const t=this.editor,n=t.model,s=t.plugins.get("ImageUtils");n.change(o=>{const r=e.value,{setImageSizes:a=!0}=e;let l=s.getClosestSelectedImageElement(n.document.selection);r&&this.shouldConvertImageType(r,l)&&(this.editor.execute(s.isBlockImage(l)?"imageTypeInline":"imageTypeBlock",{setImageSizes:a}),l=s.getClosestSelectedImageElement(n.document.selection)),!r||this._styles.get(r).isDefault?o.removeAttribute("imageStyle",l):o.setAttribute("imageStyle",r,l),a&&s.setImageNaturalSizeAttributes(l)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}/**
1649 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1650 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1651 */const{objectFullWidth:D4,objectInline:Rp,objectLeft:Vp,objectRight:Sa,objectCenter:Ia,objectBlockLeft:Bp,objectBlockRight:Mp}=E,ao={get inline(){return{name:"inline",title:"In line",icon:Rp,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Vp,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Bp,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Ia,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Sa,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Mp,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Ia,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Sa,modelElements:["imageBlock"],className:"image-style-side"}}},Op={full:D4,left:Bp,right:Mp,center:Ia,inlineLeft:Vp,inlineRight:Sa,inline:Rp},Lp=[{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 $4(i){return(i.configuredStyles.options||[]).map(n=>z4(n)).filter(n=>W4(n,i))}function U4(i,e){return i&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:i?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function H4(i){return i.has("ImageBlockEditing")&&i.has("ImageInlineEditing")?[...Lp]:[]}function z4(i){return typeof i=="string"?ao[i]?i={...ao[i]}:i={name:i}
1651:i=q4(ao[i.name],i),typeof i.icon=="string"&&(i.icon=Op[i.icon]||i.icon),i}function W4(i,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){const{modelElements:n,name:s}=i;if(!n||!n.length||!s)return Fp({style:i}),!1;{const o=[e?"imageBlock":null,t?"imageInline":null];if(!n.some(r=>o.includes(r)))return N("image-style-missing-dependency",{style:i,missingPlugins:n.map(r=>r==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function q4(i,e){const t={...e};for(const n in i)Object.prototype.hasOwnProperty.call(e,n)||(t[n]=i[n]);return t}function Fp(i){N("image-style-configuration-definition-invalid",i)}const Pa={normalizeStyles:$4,getDefaultStylesConfiguration:U4,getDefaultDropdownDefinitions:H4,warnInvalidStyle:Fp,DEFAULT_OPTIONS:ao,DEFAULT_ICONS:Op,DEFAULT_DROPDOWN_DEFINITIONS:Lp};/**
1652 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1653 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1654 */function j4(i){return(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const s=nh(t.attributeNewValue,i),o=nh(t.attributeOldValue,i),r=n.mapper.toViewElement(t.item),a=n.writer;o&&a.removeClass(o.className,r),s&&a.addClass(s.className,r)}}function G4(i){const e={imageInline:i.filter(t=>!t.isDefault&&t.modelElements.includes("imageInline")),imageBlock:i.filter(t=>!t.isDefault&&t.modelElements.includes("imageBlock"))};return(t,n,s)=>{if(!n.modelRange)return;const o=n.viewItem,r=ie(n.modelRange.getItems());if(r&&s.schema.checkAttribute(r,"imageStyle"))for(const a of e[r.name])s.consumable.consume(o,{classes:a.className})&&s.writer.setAttribute("imageStyle",a.name,r)}}function nh(i,e){for(const t of e)if(t.name===i)return t}/**
1655 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1656 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1657 */class Np extends b{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Re]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Pa,n=this.editor,s=n.plugins.has("ImageBlockEditing"),o=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",t(s,o)),this.normalizedStyles=e({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:s,isInlinePluginLoaded:o}),this._setupConversion(s,o),this._setupPostFixer(),n.commands.add("imageStyle",new N4(n,this.normalizedStyles))}_setupConversion(e,t){const n=this.editor,s=n.model.schema,o=j4(this.normalizedStyles),r=G4(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",o),n.data.downcastDispatcher.on("attribute:imageStyle",o),e&&(s.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),t&&(s.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,n=e.plugins.get(Re),s=new Map(this.normalizedStyles.map(o=>[o.name,o]));t.registerPostFixer(o=>{let r=!1;for(const a of t.differ.getChanges())if(a.type=="insert"||a.type=="attribute"&&a.attributeKey=="imageStyle"){let l=a.type=="insert"?a.position.nodeAfter:a.range.start.nodeAfter;if(l&&l.is("element","paragraph")&&l.childCount>0&&(l=l.getChild(0)),!n.isImage(l))continue;const c=l.getAttribute("imageStyle");if(!c)continue;const u=s.get(c);(!u||!u.modelElements.includes(l.name))&&(o.removeAttribute("imageStyle",l),r=!0)}return r})}}/**
1658 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1659 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1660 */class K4 extends b{static get requires(){return[Np]}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")||[],n=e.get("ImageStyleEditing"),s=ih(n.normalizedStyles,this.localizedDefaultStylesTitles);for(const r of s)this._createButton(r);const o=ih([...t.filter(Z),...Pa.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const r of o)this._createDropdown(r,s)}_createDropdown(e,t){const n=this.editor.ui.componentFactory;n.add(e.name,s=>{let o;const{defaultItem:r,items:a,title:l}=e,c=a.filter(f=>t.find(({name:m})=>sh(m)===f)).map(f=>{const m=n.create(f);return f===r&&(o=m),m});
1660a.length!==c.length&&Pa.warnInvalidStyle({dropdown:e});const u=pe(s,ci),d=u.buttonView,h=d.arrowView;return fs(u,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:oh(l,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:l}),d.bind("icon").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Dt);return m<0?o.icon:c[m].icon}),d.bind("label").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Dt);return oh(l,m<0?o.label:c[m].label)}),d.bind("isOn").toMany(c,"isOn",(...f)=>f.some(Dt)),d.bind("class").toMany(c,"isOn",(...f)=>f.some(Dt)?"ck-splitbutton_flatten":void 0),d.on("execute",()=>{c.some(({isOn:f})=>f)?u.isOpen=!u.isOpen:o.fire("execute")}),u.bind("isEnabled").toMany(c,"isEnabled",(...f)=>f.some(Dt)),this.listenTo(u,"execute",()=>{this.editor.editing.view.focus()}),u})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(sh(t),n=>{const s=this.editor.commands.get("imageStyle"),o=new P(n);return o.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>r===t),o.on("execute",this._executeCommand.bind(this,t)),o})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function ih(i,e){for(const t of i)e[t.title]&&(t.title=e[t.title]);return i}function sh(i){return`imageStyle:${i}`}function oh(i,e){return(i?i+": ":"")+e}/**
1661 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1662 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1663 */class J4 extends b{static get requires(){return[Np,K4]}static get pluginName(){return"ImageStyle"}}/**
1664 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1665 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1666 */class Z4 extends b{static get requires(){return[To,Re]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,n=e.plugins.get(To),s=e.plugins.get("ImageUtils");n.register("image",{ariaLabel:t("Image toolbar"),items:Q4(e.config.get("image.toolbar")||[]),getRelatedElement:o=>s.getClosestSelectedImageWidget(o)})}}function Q4(i){return i.map(e=>Z(e)?e.name:e)}/**
1667 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1668 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1669 */class Y4 extends b{static get requires(){return[El,Re]}static get pluginName(){return"PictureEditing"}afterInit(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){const e=this.editor,t=e.conversion,n=e.plugins.get("ImageUtils");t.for("upcast").add(i4(n)),t.for("downcast").add(s4(n))}_setupImageUploadEditingIntegration(){const e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;const t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",(n,{imageElement:s,data:o})=>{const r=o.sources;r&&e.model.change(a=>{a.setAttributes({sources:r},s)})})}}/**
1670 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1671 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1672 */function rh(i,e){const t=(n,s,o)=>{if(!o.consumable.consume(s.item,n.name))return;const r=s.attributeNewValue,a=o.writer,l=o.mapper.toViewElement(s.item),c=[...l.getChildren()].find(d=>d.getCustomProperty("media-content"));a.remove(c);const u=i.getMediaViewElement(a,r,e);a.insert(a.createPositionAt(l,0),u)};return n=>{n.on("attribute:url:media",t)}}/**
1673 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1674 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1675 */function X4(i,e,t){return e.setCustomProperty("media",!0,i),ms(i,e,{label:t})}function ah(i,e,t,n){return i.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(i,t,n),i.createSlot()])}function lh(i){const e=i.getSelectedElement();return e&&e.is("element","media")?e:null}function Dp(i,e,t,n){i.change(s=>{const o=s.createElement("media",{url:e});i.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:n?"auto":void 0})})}/**
1676 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1677 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1678 */class e7 extends R{refresh(){const e=this.editor.model,t=e.document.selection,n=lh(t);this.value=n?n.getAttribute("url"):void 0,this.isEnabled=n7(t)||t7(t,e)}execute(e){const t=this.editor.model,n=t.document.selection,s=lh(n);s?t.change(o=>{o.setAttribute("url",e,s)}):Dp(t,e,n,!0)}}function t7(i,e){let n=ir(i,e).start.parent;return n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent),e.schema.checkChild(n,"media")}function n7(i){const e=i.getSelectedElement();return!!e&&e.name==="media"}const i7='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.
1678637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>';/**
1679 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1680 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1681 */const s7="0 0 64 42";class o7{constructor(e,t){const n=t.providers,s=t.extraProviders||[],o=new Set(t.removeProviders),r=n.concat(s).filter(a=>{const l=a.name;return l?!o.has(l):(N("media-embed-no-provider-name",{provider:a}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,n){return this._getMedia(t).getViewElement(e,n)}_getMedia(e){if(!e)return new ch(this.locale);e=e.trim();for(const t of this.providerDefinitions){const n=t.html,s=J(t.url);for(const o of s){const r=this._getUrlMatches(e,o);if(r)return new ch(this.locale,e,r,n)}}return null}_getUrlMatches(e,t){let n=e.match(t);if(n)return n;let s=e.replace(/^https?:\/\//,"");return n=s.match(t),n||(s=s.replace(/^www\./,""),n=s.match(t),n)?n:null}}class ch{constructor(e,t,n,s){this.url=this._getValidUrl(t),this._locale=e,this._match=n,this._previewRenderer=s}getViewElement(e,t){const n={};let s;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),t.renderForEditingView&&(n.class="ck-media__wrapper");const o=this._getPreviewHtml(t);s=e.createRawElement("div",n,(r,a)=>{a.setContentOf(r,o)})}else this.url&&(n.url=this.url),s=e.createEmptyElement(t.elementName,n);return e.setCustomProperty("media-content",!0,s),s}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new lt,t=this._locale.t;return e.content=i7,e.viewBox=s7,new xe({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}}/**
1682 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1683 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1684 */class Ro extends b{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{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 n=t[1],s=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${n}${s?`?start=${s}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`}},{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=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{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 o7(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,n=e.t,s=e.conversion,o=e.config.get("mediaEmbed.previewsInData"),r=e.config.get("mediaEmbed.elementName"),a=this.registry;e.commands.add("mediaEmbed",new e7(e)),t.register("media",{inheritAllFrom
1684:"$blockObject",allowAttributes:["url"]}),s.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url");return ah(c,a,u,{elementName:r,renderMediaPreview:!!u&&o})}}),s.for("dataDowncast").add(rh(a,{elementName:r,renderMediaPreview:o})),s.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url"),d=ah(c,a,u,{elementName:r,renderForEditingView:!0});return X4(d,c,n("media widget"))}}),s.for("editingDowncast").add(rh(a,{elementName:r,renderForEditingView:!0})),s.for("upcast").elementToElement({view:l=>["oembed",r].includes(l.name)&&l.getAttribute("url")?{name:!0}:null,model:(l,{writer:c})=>{const u=l.getAttribute("url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(l,{writer:c})=>{const u=l.getAttribute("data-oembed-url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).add(l=>{const c=(u,d,h)=>{if(!h.consumable.consume(d.viewItem,{name:!0,classes:"media"}))return;const{modelRange:f,modelCursor:m}=h.convertChildren(d.viewItem,d.modelCursor);d.modelRange=f,d.modelCursor=m,ie(f.getItems())||h.consumable.revert(d.viewItem,{name:!0,classes:"media"})};l.on("element:figure",c)})}}/**
1685 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1686 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1687 */const r7=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class a7 extends b{static get requires(){return[Cg,Pt,Eg]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,n=e.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",()=>{const o=t.selection.getFirstRange(),r=we.fromPosition(o.start);r.stickiness="toPrevious";const a=we.fromPosition(o.end);a.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(r,a),r.detach(),a.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(A.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const n=this.editor,s=n.plugins.get(Ro).registry,o=new Fe(e,t),r=o.getWalker({ignoreElementEnd:!0});let a="";for(const c of r)c.item.is("$textProxy")&&(a+=c.item.data);if(a=a.trim(),!a.match(r7)){o.detach();return}if(!s.hasMedia(a)){o.detach();return}if(!n.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=we.fromPosition(e),this._timeoutId=A.window.setTimeout(()=>{n.model.change(c=>{this._timeoutId=null,c.remove(o),o.detach();let u=null;this._positionToInsert.root.rootName!=="$graveyard"&&(u=this._positionToInsert),Dp(n.model,a,u,!1),this._positionToInsert.detach(),this._positionToInsert=null}),n.plugins.get(Pt).requestUndoOnBackspace()},100)}}/**
1688 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1689 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1690 */class l7 extends C{constructor(e,t){super(t);const n=t.t;this.focusTracker=new se,this.keystrokes=new de,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),E.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),E.cancel,"ck-button-cancel","cancel"),this._focusables=new ve,this._focusCycler=new ke({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(),wn({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(n=>{this._focusables.add(n),this.focusTracker.add(n.element)}),this.keystrokes.listenTo(this.element);const t=n=>n.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();
1690for(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 he(this.locale,De),n=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,n.on("input",()=>{t.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()}),t}_createButton(e,t,n,s){const o=new P(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),s&&o.delegate("execute").to(this,s),o}}const c7='<svg viewBox="0 0 22 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-14.24 1h13.008v12H4.467l.029-12Zm-2.208 1h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003l-.029 1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h.974v1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Z"/><path d="M8.374 6.648a.399.399 0 0 1 .395-.4.402.402 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35V6.648Z"/></svg>';/**
1691 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1692 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1693 */class u7 extends b{static get requires(){return[Ro]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",n=>{const s=pe(n);return this._setUpDropdown(s,t),s})}_setUpDropdown(e,t){const n=this.editor,s=n.t,o=e.buttonView,r=n.plugins.get(Ro).registry;e.once("change:isOpen",()=>{const a=new(qo(l7))(d7(n.t,r),n.locale);e.panelView.children.add(a),o.on("open",()=>{a.disableCssTransitions(),a.url=t.value||"",a.urlInputView.fieldView.select(),a.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{a.isValid()&&(n.execute("mediaEmbed",a.url),n.editing.view.focus())}),e.on("change:isOpen",()=>a.resetFormStatus()),e.on("cancel",()=>{n.editing.view.focus()}),a.delegate("submit","cancel").to(e),a.urlInputView.fieldView.bind("value").to(t,"value"),a.urlInputView.on("change:errorText",()=>{n.ui.update()}),a.urlInputView.bind("isEnabled").to(t,"isEnabled")}),e.bind("isEnabled").to(t),o.set({label:s("Insert media"),icon:c7,tooltip:!0})}}function d7(i,e){return[t=>{if(!t.url.length)return i("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return i("This media URL is not supported.")}]}/**
1694 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1695 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1696 */class h7 extends b{static get requires(){return[Ro,u7,a7,Cn]}static get pluginName(){return"MediaEmbed"}}/**
1697 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1698 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1699 */function f7(i){const e=parseFloat(i);return i.endsWith("pt")?qn(e*96/72):i.endsWith("pc")?qn(e*12*96/72):i.endsWith("in")?qn(e*96):i.endsWith("cm")?qn(e*96/2.54):i.endsWith("mm")?qn(e/10*96/2.54):i}function uh(i){return i!==void 0&&i.endsWith("px")}function qn(i){return i.toFixed(2).replace(/\.?0+$/,"")+"px"}/**
1700 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1701 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1702 */function m7(i,e,t){if(!i.childCount)return;const n=new bt(i.document),s=p7(i,n);if(!s.length)return;const o={},r=[];
1702for(const a of s)if(a.indent!==void 0){b7(a)||(r.length=0);const l=`${a.id}:${a.indent}`,c=Math.min(a.indent-1,r.length);if(c<r.length&&r[c].id!==a.id&&(r.length=c),c<r.length-1)r.length=c+1;else{const d=w7(a,e);if(c>r.length-1||r[c].listElement.name!=d.type){c==0&&d.type=="ol"&&a.id!==void 0&&o[l]&&(d.startIndex=o[l]);const h=k7(d,n,t);if(uh(a.marginLeft)&&(c==0||uh(r[c-1].marginLeft))){let f=a.marginLeft;c>0&&(f=qn(parseFloat(f)-parseFloat(r[c-1].marginLeft))),n.setStyle("padding-left",f,h)}if(r.length==0){const f=a.element.parent,m=f.getChildIndex(a.element)+1;n.insertChild(m,h,f)}else{const f=r[c-1].listItemElements;n.appendChild(h,f[f.length-1])}r[c]={...a,listElement:h,listItemElements:[]},c==0&&a.id!==void 0&&(o[l]=d.startIndex||1)}}const u=a.element.name=="li"?a.element:n.createElement("li");n.appendChild(u,r[c].listElement),r[c].listItemElements.push(u),c==0&&a.id!==void 0&&o[l]++,a.element!=u&&n.appendChild(a.element,u),T7(a.element,n),n.removeStyle("text-indent",a.element),n.removeStyle("margin-left",a.element)}else{const l=r.find(c=>c.marginLeft==a.marginLeft);if(l){const c=l.listItemElements;n.appendChild(a.element,c[c.length-1]),n.removeStyle("margin-left",a.element)}else r.length=0}}function g7(i,e){for(const t of e.createRangeIn(i)){const n=t.item;if(n.is("element","li")){const s=n.getChild(0);s&&s.is("element","p")&&e.unwrapElement(s)}}}function p7(i,e){const t=e.createRangeIn(i),n=[],s=new Set;for(const o of t.getItems()){if(!o.is("element")||!o.name.match(/^(p|h\d+|li|div)$/))continue;let r=E7(o);if(r!==void 0&&parseFloat(r)==0&&!Array.from(o.getClassNames()).find(a=>a.startsWith("MsoList"))&&(r=void 0),o.hasStyle("mso-list")||r!==void 0&&s.has(r)){const a=C7(o);n.push({element:o,id:a.id,order:a.order,indent:a.indent,marginLeft:r}),r!==void 0&&s.add(r)}else s.clear()}return n}function b7(i){const e=i.element.previousSibling;return dh(e||i.element.parent)}function dh(i){return i.is("element","ol")||i.is("element","ul")}function w7(i,e){const t=new RegExp(`@list l${i.id}:level${i.indent}\\s*({[^}]*)`,"gi"),n=/mso-level-number-format:([^;]{0,100});/gi,s=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,o=new RegExp(`@list\\s+l${i.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),r=new RegExp(`@list l${i.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=o.exec(e),l=r.exec(e),c=a&&!l,u=t.exec(e);let d="decimal",h="ol",f=null;if(u&&u[1]){const m=n.exec(u[1]);if(m&&m[1]&&(d=m[1].trim(),h=d!=="bullet"&&d!=="image"?"ol":"ul"),d==="bullet"){const p=_7(i.element);p&&(d=p)}else{const p=s.exec(u[1]);p&&p[1]&&(f=parseInt(p[1]))}c&&(h="ol")}return{type:h,startIndex:f,style:v7(d),isLegalStyleList:c}}function _7(i){if(i.name=="li"&&i.parent.name=="ul"&&i.parent.hasAttribute("type"))return i.parent.getAttribute("type");const e=y7(i);if(!e)return null;const t=e._data;return t==="o"?"circle":t==="·"?"disc":t==="§"?"square":null}function y7(i){if(i.getChild(0).is("$text"))return null;for(const e of i.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);if(t)return t.is("$text")?t:t.getChild(0)}/* istanbul ignore next -- @preserve */return null}function v7(i){if(i.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(i){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return i;default:return null}}function k7(i,e,t){const n=e.createElement(i.type);return i.style&&e.setStyle("list-style-type",i.style,n),i.startIndex&&i.startIndex>1&&e.setAttribute("start",i.startIndex,n),i.isLegalStyleList&&t&&e.addClass("legal-list",n),n}function C7(i){const e=i.getStyle("mso-list");if(e===void 0)return{};const t=e.match(/(^|\s{1,100})l(\d+)/i),n=e.match(/\s{0,100}lfo(\d+)/i),s=e.match(/\s{0,100}level(\d+)/i);return t&&n&&s?{id:t[2],order:n[1],indent:parseInt(s[1])}:{indent:1}}function T7(i,e){const t=new Ke({name:"span",styles:{"mso-list":"Ignore"}}),n=e.createRangeIn(i);for(const s of n)s.type==="elementStart"&&t.match(s.item)&&e.remove(s.item)}function E7(i){const e=i.getStyle("margin-left");return e===void 0||e.endsWith("px")?e:f7(e)}/**
1703 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1704 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1705 */function A7(i,e){if(!i.childCount)return;const t=new bt(i.document),n=S7(i,t);I7(n,i,t),R7(n,i,t),P7(i,t);const s=V7(i,t);s.length&&M7(s,B7(e),t)}function x7(i){return btoa(i.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}function S7(i,e){const t=e.createRangeIn(i),n=new Ke({name:/v:(.+)/}),s=[];for(const o of t){if(o.type!="elementStart")continue;const r=o.item,a=r.previousSibling,l=a&&a.is("element")?a.name:null,c=["Chart"],u=n.match(r),d=r.getAttribute("o:gfxdata"),h=l==="v:shapetype",f=d&&c.some(m=>r.getAttribute("id").includes(m));u&&d&&!h&&!f&&s.push(o.item.getAttribute("id"))}return s}function I7(i,e,t){const n=t.createRangeIn(e),s=new Ke({name:"img"}),o=[];for(const r of n)if(r.item.is("element")&&s.match(r.item)){const a=r.item,l=a.getAttribute("v:shapes")?a.getAttribute("v:shapes").split(" "):[];l.length&&l.every(c=>i.indexOf(c)>-1)?o.push(a):a.getAttribute("src")||o.push(a)}for(const r of o)t.remove(r)}function P7(i,e){const t=e.createRangeIn(i),n=new Ke({name:/v:(.+)/}),s=[];for(const o of t)o.type=="elementStart"&&n.match(o.item)&&s.push(o.item);for(const o of s)e.remove(o)}function R7(i,e,t){const n=t.createRangeIn(e),s=[];for(const a of n)if(a.type=="elementStart"&&a.item.is("element","v:shape")){const l=a.item.getAttribute("id");if(i.includes(l))continue;o(a.item.parent.getChildren(),l)||s.push(a.item)}for(const a of s){const l={src:r(a)};a.hasAttribute("alt")&&(l.alt=a.getAttribute("alt"));const c=t.createElement("img",l);t.insertChild(a.index+1,c,a.parent)}function o(a,l){for(const c of a){/* istanbul ignore else -- @preserve */if(c.is("element")&&(c.name=="img"&&c.getAttribute("v:shapes")==l||o(c.getChildren(),l)))return!0}return!1}function r(a){for(const l of a.getChildren()){/* istanbul ignore else -- @preserve */if(l.is("element")&&l.getAttribute("src"))return l.getAttribute("src")}}}function V7(i,e){const t=e.createRangeIn(i),n=new Ke({name:"img"}),s=[];for(const o of t)o.item.is("element")&&n.match(o.item)&&o.item.getAttribute("src").startsWith("file://")&&s.push(o.item);return s}function B7(i){if(!i)return[];const e=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,t=new RegExp("(?:("+e.source+"))([\\da-fA-F\\s]+)\\}","g"),n=i.match(t),s=[];if(n)for(const o of n){let r=!1;o.includes("\\pngblip")?r="image/png":o.includes("\\jpegblip")&&(r="image/jpeg"),r&&s.push({hex:o.replace(e,"").replace(/[^\da-fA-F]/g,""),type:r})}return s}function M7(i,e,t){if(i.length===e.length)for(let n=0;n<i.length;n++){const s=`data:${e[n].type};base64,${x7(e[n].hex)}`;t.setAttribute("src",s,i[n])}}/**
1706 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1707 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1708 */function O7(i){const e=[],t=new bt(i.document);for(const{item:n}of t.createRangeIn(i))if(n.is("element")){for(const s of n.getClassNames())/\bmso/gi.exec(s)&&t.removeClass(s,n);for(const s of n.getStyleNames())/\bmso/gi.exec(s)&&t.removeStyle(s,n);(n.is("element","w:sdt")||n.is("element","w:sdtpr")&&n.isEmpty||n.is("element","o:p")&&n.isEmpty)&&e.push(n)}for(const n of e){const s=n.parent,o=s.getChildIndex(n);t.insertChild(o,n.getChildren(),s),t.remove(n)}}/**
1709 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1710 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1711 */const L7=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>
1711/i,F7=/xmlns:o="urn:schemas-microsoft-com/i;class N7{constructor(e,t=!1){this.document=e,this.hasMultiLevelListPlugin=t}isActive(e){return L7.test(e)||F7.test(e)}execute(e){const{body:t,stylesString:n}=e._parsedData;m7(t,n,this.hasMultiLevelListPlugin),A7(t,e.dataTransfer.getData("text/rtf")),O7(t),e.content=t}}/**
1712 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1713 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1714 */function D7(i,e){for(const t of i.getChildren())if(t.is("element","b")&&t.getStyle("font-weight")==="normal"){const n=i.getChildIndex(t);e.remove(t),e.insertChild(n,t.getChildren(),i)}}/**
1715 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1716 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1717 */function $7(i,e){const t=new Go(e.document.stylesProcessor),n=new Jo(t,{renderingMode:"data"}),s=n.blockElements,o=n.inlineObjectElements,r=[];for(const a of e.createRangeIn(i)){const l=a.item;if(l.is("element","br")){const c=hh(l,"forward",e,{blockElements:s,inlineObjectElements:o}),u=hh(l,"backward",e,{blockElements:s,inlineObjectElements:o}),d=fh(c,s);(fh(u,s)||d)&&r.push(l)}}for(const a of r)a.hasClass("Apple-interchange-newline")?e.remove(a):e.replace(a,e.createElement("p"))}function hh(i,e,t,{blockElements:n,inlineObjectElements:s}){let o=t.createPositionAt(i,e=="forward"?"after":"before");return o=o.getLastMatchingPosition(({item:r})=>r.is("element")&&!n.includes(r.name)&&!s.includes(r.name),{direction:e}),e=="forward"?o.nodeAfter:o.nodeBefore}function fh(i,e){return!!i&&i.is("element")&&e.includes(i.name)}/**
1718 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1719 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1720 */const U7=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class H7{constructor(e){this.document=e}isActive(e){return U7.test(e)}execute(e){const t=new bt(this.document),{body:n}=e._parsedData;D7(n,t),g7(n,t),$7(n,t),e.content=n}}/**
1721 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1722 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1723 */function z7(i,e){for(const t of i.getChildren())t.is("element","table")&&t.hasAttribute("xmlns")&&e.removeAttribute("xmlns",t)}/**
1724 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1725 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1726 */function W7(i,e){for(const t of i.getChildren())if(t.is("element","google-sheets-html-origin")){const n=i.getChildIndex(t);e.remove(t),e.insertChild(n,t.getChildren(),i)}}/**
1727 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1728 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1729 */function q7(i,e){for(const t of i.getChildren())t.is("element","table")&&t.getStyle("width")==="0px"&&e.removeStyle("width",t)}/**
1730 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1731 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1732 */function j7(i,e){for(const t of Array.from(i.getChildren()))t.is("element","style")&&e.remove(t)}/**
1733 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1734 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1735 */const G7=/<google-sheets-html-origin/i;class K7{constructor(e){this.document=e}isActive(e){return G7.test(e)}execute(e){const t=new bt(this.document),{body:n}=e._parsedData;W7(n,t),z7(n,t),q7(n,t),j7(n,t),e.content=n}}/**
1736 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1737 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1738 */function J7(i){return mh(mh(i)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/(<span\s+style=['"]letter-spacing:[^'"]+?['"]>)[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}function Z7(i){i.querySelectorAll("span[style*=spacerun]").forEach(e
1738=>{const t=e,n=t.innerText.length||0;t.innerText=Array(n+1).join("  ").substr(0,n)})}function mh(i){return i.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length===1?" ":Array(t.length+1).join("  ").substr(0,t.length))}/**
1739 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1740 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1741 */function Q7(i,e){const t=new DOMParser;i=i.replace(/<!--\[if gte vml 1]>/g,""),i=i.replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,"");const n=J7(e3(i)),s=t.parseFromString(n,"text/html");Z7(s);const o=s.body.innerHTML,r=Y7(s,e),a=X7(s);return{body:r,bodyString:o,styles:a.styles,stylesString:a.stylesString}}function Y7(i,e){const t=new Go(e),n=new Jo(t,{renderingMode:"data"}),s=i.createDocumentFragment(),o=i.body.childNodes;for(;o.length>0;)s.appendChild(o[0]);return n.domToView(s,{skipComments:!0})}function X7(i){const e=[],t=[],n=Array.from(i.getElementsByTagName("style"));for(const s of n)s.sheet&&s.sheet.cssRules&&s.sheet.cssRules.length&&(e.push(s.sheet),t.push(s.innerHTML));return{styles:e,stylesString:t.join(" ")}}function e3(i){const e="</body>",t="</html>",n=i.indexOf(e);if(n<0)return i;const s=i.indexOf(t,n+e.length);return i.substring(0,n+e.length)+(s>=0?i.substring(s):"")}/**
1742 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1743 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1744 */class t3 extends b{static get pluginName(){return"PasteFromOffice"}static get requires(){return[Je]}init(){const e=this.editor,t=e.plugins.get("ClipboardPipeline"),n=e.editing.view.document,s=[],o=this.editor.plugins.has("MultiLevelList");s.push(new N7(n,o)),s.push(new H7(n)),s.push(new K7(n)),t.on("inputTransformation",(r,a)=>{if(a._isTransformedWithPasteFromOffice||e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const c=a.dataTransfer.getData("text/html"),u=s.find(d=>d.isActive(c));u&&(a._parsedData||(a._parsedData=Q7(c,n.stylesProcessor)),u.execute(a),a._isTransformedWithPasteFromOffice=!0)},{priority:"high"})}}/**
1745 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1746 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1747 */function Lt(i,e,t,n){let s,o=null;typeof n=="function"?s=n:(o=i.commands.get(n),s=()=>{i.execute(n)}),i.model.document.on("change:data",(r,a)=>{if(o&&!o.isEnabled||!e.isEnabled)return;const l=ie(i.model.document.selection.getRanges());if(!l.isCollapsed||a.isUndo||!a.isLocal)return;const c=Array.from(i.model.document.differ.getChanges()),u=c[0];if(c.length!=1||u.type!=="insert"||u.name!="$text"||u.length!=1)return;const d=u.position.parent;if(d.is("element","codeBlock")||d.is("element","listItem")&&typeof n!="function"&&!["numberedList","bulletedList","todoList"].includes(n)||o&&o.value===!0)return;const h=d.getChild(0),f=i.model.createRangeOn(h);if(!f.containsRange(l)&&!l.end.isEqual(f.end))return;const m=t.exec(h.data.substr(0,l.end.offset));m&&i.model.enqueueChange(p=>{const _=p.createPositionAt(d,0),v=p.createPositionAt(d,m[0].length),T=new Fe(_,v);if(s({match:m})!==!1){p.remove(T);const U=i.model.document.selection.getFirstRange(),K=p.createRangeIn(d);d.isEmpty&&!K.isEqual(U)&&!K.containsRange(U,!0)&&p.remove(d)}T.detach(),i.model.enqueueChange(()=>{i.plugins.get("Delete").requestUndoOnBackspace()})})})}/**
1748 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1749 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1750 */function Nn(i,e,t,n){let s,o;t instanceof RegExp?s=t:o=t,o=o||(r=>{let a;const l=[],c=[];for(;(a=s.exec(r))!==null&&!(a&&a.length<4);){let{index:u,"1":d,"2":h,"3":f}=a;const m=d+h+f;u+=a[0].length-m.length;const p=[u,u+d.length],_=[u+d.length+h.length,u+d.length+h.length+f.length];l.push(p),l.push(_),c.push([u+d.length,u+d.length+h.length])}return{remove:l,format:c}}),i.model.document.on("change:data",(r,a)=>{if(a.isUndo||!a.isLocal||!e.isEnabled)return;const l=i.model,c=l.document.selection;if(!c.isCollapsed)return;const u=Array.from(l.document.differ.getChanges()),d=u[0];if(u.length!=1||d.type!=="insert"||d.name!="$text"||d.length!=1)return;const h=c.focus,f=h.parent,{text:m,range:p}=n3(l.createRange(l.createPositionAt(f,0),h),l),_=o(m),v=gh(p.start,_.format,l),T=gh(p.start,_.remove,l);v.length&&T.length&&l.enqueueChange(L=>{if(n(L,v)!==!1){for(const K of T.reverse())L.remove(K);l.enqueueChange(()=>{i.plugins.get("Delete").requestUndoOnBackspace()})}})})}function gh(i,e,t){return e.filter(n=>n[0]!==void 0&&n[1]!==void 0).map(n=>t.createRange(i.getShiftedBy(n[0]),i.getShiftedBy(n[1])))}function n3(i,e){let t=i.start;return{text:Array.from(i.getItems()).reduce((s,o)=>!(o.is("$text")||o.is("$textProxy"))||o.getAttribute("code")?(t=e.createPositionAfter(o
1750),""):s+o.data,""),range:e.createRange(t,i.end)}}/**
1751 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1752 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1753 */class i3 extends b{static get requires(){return[Pt]}static get pluginName(){return"Autoformat"}afterInit(){const e=this.editor,t=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Revert autoformatting action"),keystroke:"Backspace"}]})}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&Lt(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&Lt(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&Lt(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&Lt(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const t=Ks(this.editor,"bold");Nn(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),Nn(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(e.get("italic")){const t=Ks(this.editor,"italic");Nn(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),Nn(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(e.get("code")){const t=Ks(this.editor,"code");Nn(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(e.get("strikethrough")){const t=Ks(this.editor,"strikethrough");Nn(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(t=>t.match(/^heading[1-6]$/)).forEach(t=>{const n=t[7],s=new RegExp(`^(#{${n}})\\s$`);Lt(this.editor,this,s,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&Lt(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&Lt(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&Lt(this.editor,this,/^---$/,"horizontalLine")}}function Ks(i,e){return(t,n)=>{if(!i.commands.get(e).isEnabled)return!1;const o=i.model.schema.getValidRanges(n,e);for(const r of o)t.setAttribute(e,!0,r);t.removeSelectionAttribute(e)}}/**
1754 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1755 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1756 */function Vo(i){const e=i.t,t=i.config.get("codeBlock.languages");for(const n of t)n.label==="Plain text"&&(n.label=e("Plain text")),n.class===void 0&&(n.class=`language-${n.language}`);return t}function Bo(i,e,t){const n={};for(const s of i)if(e==="class"){const o=s[e].split(" ").shift();n[o]=s[t]}else n[s[e]]=s[t];return n}function Al(i){return i.data.match(/^(\s*)/)[0]}function s3(i,e){const t=i.createDocumentFragment(),n=e.split(`
1757`),s=n.reduce((o,r,a)=>(o.push(r),a<n.length-1&&o.push(i.createElement("br")),o),[]);return i.appendChild(s,t),t}function Ra(i){const e=i.document.selection,t=[];if(e.isCollapsed)return[e.anchor];const n=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:s}of n){if(!s.is("$textProxy"))continue;const{parent:o,startOffset:r}=s.textNode;if(!o.is("element","codeBlock"))continue;const a=Al(s.textNode),l=i.createPositionAt(o,r+a.length);t.push(l)}return t}function $p(i){const e=ie(i.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function ph(i,e){return e.is("rootElement")||i.isLimit(e)?!1:i.checkChild(e.parent,"codeBlock")}function bh(i,e,t,n){const s=Bo(e,"language","label"),o=t.getAttribute("language");if(o in s){const r=s[o];return i(n==="enter"?"Entering %0 code snippet":"Leaving %0 code snippet",r)}return i(n==="enter"?"Entering code snippet":"Leaving code snippet")}/**
1758 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1759 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1760 */class o3 extends R{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,n=t.model,s=n.document.selection,r=Vo(t)[0],a=Array.from(s.getSelectedBlocks()),l=e.forceValue==null?!this.value:e.forceValue,c=r3(e,this._lastLanguage,r.language);n.change(u=>{l?this._applyCodeBlock(u,a,c):this._removeCodeBlock(u,a)})}_getValue(){const e=this.editor.model.document.selection,t=ie(e.getSelectedBlocks());return!!(t&&t.is("element","codeBlock"))?t.getAttribute("language"):!1}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ie(e.getSelectedBlocks());return n?ph(t,n):!1}_applyCodeBlock(e,t,n){this._lastLanguage=n;const s=this.editor.model.schema,o=t.filter(r=>ph(s,r));for(const r of o)e.rename(r,"codeBlock"),e.setAttribute("language",n,r),s.removeDisallowedAttributes([r],e),Array.from(r.getChildren()).filter(a=>
1760!s.checkChild(r,a)).forEach(a=>e.remove(a));o.reverse().forEach((r,a)=>{const l=o[a+1];r.previousSibling===l&&(e.appendElement("softBreak",l),e.merge(e.createPositionBefore(r)))})}_removeCodeBlock(e,t){const n=t.filter(s=>s.is("element","codeBlock"));for(const s of n){const o=e.createRangeOn(s);for(const r of Array.from(o.getItems()).reverse())if(r.is("element","softBreak")&&r.parent.is("element","codeBlock")){const{position:a}=e.split(e.createPositionBefore(r)),l=a.nodeAfter;e.rename(l,"paragraph"),e.removeAttribute("language",l),e.remove(r)}e.rename(s,"paragraph"),e.removeAttribute("language",s)}}}function r3(i,e,t){return i.language?i.language:i.usePreviousLanguageChoice&&e?e:t}/**
1761 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1762 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1763 */class a3 extends R{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change(n=>{const s=Ra(t);for(const o of s){const r=n.createText(this._indentSequence);t.insertContent(r,o)}})}_checkEnabled(){return this._indentSequence?$p(this.editor.model.document.selection):!1}}/**
1764 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1765 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1766 */class l3 extends R{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change(()=>{const n=Ra(t);for(const s of n){const o=wh(t,s,this._indentSequence);o&&t.deleteContent(t.createSelection(o))}})}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return $p(e.document.selection)?Ra(e).some(t=>wh(e,t,this._indentSequence)):!1}}function wh(i,e,t){const n=c3(e);if(!n)return null;const s=Al(n),o=s.lastIndexOf(t);if(o+t.length!==s.length||o===-1)return null;const{parent:r,startOffset:a}=n;return i.createRange(i.createPositionAt(r,a+o),i.createPositionAt(r,a+o+t.length))}function c3(i){let e=i.parent.getChild(i.index);return(!e||e.is("element","softBreak"))&&(e=i.nodeBefore),!e||e.is("element","softBreak")?null:e}/**
1767 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1768 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1769 */function _h(i,e,t=!1){const n=Bo(e,"language","class"),s=Bo(e,"language","label");return(o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a;if(!u.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),h=c.toViewPosition(i.createPositionBefore(r.item)),f={};t&&(f["data-language"]=s[d],f.spellcheck="false");const m=n[d]?{class:n[d]}:void 0,p=l.createContainerElement("code",m),_=l.createContainerElement("pre",f,p);l.insert(h,_),c.bindElements(r.item,p)}}function u3(i){return(e,t,n)=>{if(t.item.parent.name!=="codeBlock")return;const{writer:s,mapper:o,consumable:r}=n;if(!r.consume(t.item,"insert"))return;const a=o.toViewPosition(i.createPositionBefore(t.item));s.insert(a,s.createText(`
1770`))}}function d3(i,e){const t=Bo(e,"class","language"),n=e[0].language;return(s,o,r)=>{const a=o.viewItem,l=a.parent;if(!l||!l.is("element","pre")||o.modelCursor.findAncestor("codeBlock"))return;const{consumable:c,writer:u}=r;if(!c.test(a,{name:!0}))return;const d=u.createElement("codeBlock"),h=[...a.getClassNames()];h.length||h.push("");for(const f of h){const m=t[f];if(m){u.setAttribute("language",m,d);break}}d.hasAttribute("language")||u.setAttribute("language",n,d),r.convertChildren(a,d),r.safeInsert(d,o.modelCursor)&&(c.consume(a,{name:!0}),r.updateConversionResult(d,o))}}function h3(){return(i,e,{consumable:t,writer:n})=>{let s=e.modelCursor;if(!t.test(e.viewItem)||!s.findAncestor("codeBlock"))return;t.consume(e.viewItem);const r=e.viewItem.data.split(`
1771`).map(l=>n.createText(l)),a=r[r.length-1];for(const l of r)if(n.insert(l,s),s=s.getShiftedBy(l.offsetSize),l!==a){const c=n.createElement("softBreak");n.insert(c,s),s=n.createPositionAfter(c)}e.modelRange=n.createRange(e.modelCursor,s),e.modelCursor=s}}function f3(){return(i,e,{consumable:t})=>{const n=e.viewItem;
1771if(n.findAncestor("pre"))return;const s=Array.from(n.getChildren()),o=s.find(r=>r.is("element","code"));if(o)for(const r of s)r===o||!r.is("$text")||t.consume(r,{name:!0})}}/**
1772 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1773 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1774 */const Up="paragraph";class m3 extends b{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[pg]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"	"})}init(){const e=this.editor,t=e.model.schema,n=e.model,s=e.editing.view,o=e.plugins.has("ListEditing")?e.plugins.get("ListEditing"):null,r=Vo(e);e.commands.add("codeBlock",new o3(e)),e.commands.add("indentCodeBlock",new a3(e)),e.commands.add("outdentCodeBlock",new l3(e)),this.listenTo(s.document,"tab",(a,l)=>{const c=l.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(c).isEnabled&&(e.execute(c),l.stopPropagation(),l.preventDefault(),a.stop())},{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck((a,l)=>{if(a.endsWith("codeBlock")&&o&&o.getListAttributeNames().includes(l))return!0;if(a.endsWith("codeBlock $text"))return!1}),e.model.schema.addChildCheck((a,l)=>{if(a.endsWith("codeBlock")&&l.isObject)return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",_h(n,r,!0)),e.data.downcastDispatcher.on("insert:codeBlock",_h(n,r)),e.data.downcastDispatcher.on("insert:softBreak",u3(n),{priority:"high"}),e.data.upcastDispatcher.on("element:code",d3(s,r)),e.data.upcastDispatcher.on("text",h3()),e.data.upcastDispatcher.on("element:pre",f3(),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",(a,l)=>{let c=n.createRange(n.document.selection.anchor);if(l.targetRanges&&(c=e.editing.mapper.toModelRange(l.targetRanges[0])),!c.start.parent.is("element","codeBlock"))return;const u=l.dataTransfer.getData("text/plain"),d=new bt(e.editing.view.document);l.content=s3(d,u)}),this.listenTo(n,"getSelectedContent",(a,[l])=>{const c=l.anchor;l.isCollapsed||!c.parent.is("element","codeBlock")||!c.hasSameParentAs(l.focus)||n.change(u=>{const d=a.return;if(c.parent.is("element")&&(d.childCount>1||l.containsEntireContent(c.parent))){const f=u.createElement("codeBlock",c.parent.getAttributes());u.append(d,f);const m=u.createDocumentFragment();u.append(f,m),a.return=m;return}const h=d.getChild(0);t.checkAttribute(h,"code")&&u.setAttribute("code",!0,h)})})}afterInit(){const e=this.editor,t=e.commands,n=t.get("indent"),s=t.get("outdent");n&&n.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),s&&s.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(o,r)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(!p3(e,r.isSoft)&&!b3(e,r.isSoft)&&g3(e),r.preventDefault(),o.stop())},{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){const{model:e,ui:t,t:n}=this.editor,s=Vo(this.editor);let o=null;e.document.selection.on("change:range",()=>{const r=e.document.selection.focus.parent;!t||o===r||!r.is("element")||(o&&o.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce(bh(n,s,o,"leave")),r.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce(bh(n,s,r,"enter")),o=r)})}}function g3(i){const t=i.model.document,n=t.selection.getLastPosition(),s=n.nodeBefore||n.textNode;let o;s&&s.is("$text")&&(o=Al(s)),i.model.change(r=>{i.execute("shiftEnter"),o&&r.insertText(o,t.selection.anchor)})}function p3(i,e){const n=i.model.document,s=i.editing.view,o=n.selection.getLastPosition(),r=o.nodeAfter;return e||!n.selection.isCollapsed||!o.isAtStart||!on(r)?!1:(i.model.change(a=>{i.execute("enter");const l=n.selection.anchor.parent.previousSibling;a.rename(l,Up),a.setSelection(l,"in"),i.model.schema.removeDisallowedAttributes([l],a),a.remove(r)}),s.scrollToTheSelection(),!0)}function b3(i,e){const t=i.model,n=t.document,s=i.editing.view,o=n.selection.getLastPosition(),r=o.nodeBefore;let a;if(e||!n.selection.isCollapsed||!o.isAtEnd||!r||!r.previousSibling)return!1;if(on(r)&&on(r.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling),t.createPositionAfter(r));else if(Lr(r)&&on(r.previousSibling)&&on(r.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling),t.createPositionAfter(r));else if(Lr(r)&&on(r.previousSibling)&&Lr(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&on(r.previousSibling.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling.previousSibling),t.createPositionAfter(r));else return!1;return i.model.change(l=>{l.remove(a),i.execute("enter");const c=n.selection.anchor.parent;l.rename(c,Up),i.model.schema.removeDisallowedAttributes([c],l)}),s.scrollToTheSelection(),!0}function Lr(i){return i&&i.is("$text")&&!i.data.match(/\S/)}function on(i){return i&&i.is("element","softBreak")}/**
1775 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1776 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1777 */class w3 extends b{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,n=e.ui.componentFactory,s=Vo(e),o=this._getLanguageListItemDefinitions(s),r=e.commands.get("codeBlock");n.add("codeBlock",a=>{const l=pe(a,ci),c=l.buttonView,u=t("Insert code block");return c.set({label:u,tooltip:!0,icon:E.codeBlock,isToggleable:!0}),c.bind("isOn").to(r,"value",d=>!!d),c.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),l.on("execute",d=>{e.execute("codeBlock",{language:d.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),l.class="ck-code-block-dropdown",l.bind("isEnabled").to(r),kn(l,o,{role:"menu",ariaLabel:u}),l}),n.add("menuBar:codeBlock",a=>{const l=new Pe(a);l.buttonView.set({label:t("Code block"),icon:E.codeBlock}),l.bind("isEnabled").to(r);const c=new jt(a);c.set({ariaLabel:t("Insert code block")});for(const u of o){const d=new It(a,l),h=new Q(a);h.bind(...Object.keys(u.model)).to(u.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",()=>{e.execute("codeBlock",{language:u.model._codeBlockLanguage,forceValue:r.value!=u.model._codeBlockLanguage}),e.editing.view.focus()}),d.children.add(h),c.items.add(d)}return l.panelView.children.add(c),l})}_getLanguageListItemDefinitions(e){const n=this.editor.commands.get("codeBlock"),s=new me;for(const o of e){const r={type:"button",model:new ui({_codeBlockLanguage:o.language,label:o.label,role:"menuitemradio",withText:!0})};r.model.bind("isOn").to(n,"value",a=>a===r.model._codeBlockLanguage),s.add(r)}return s}}/**
1778 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1779 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1780 */class _3 extends b{static get requires(){return[m3,w3]}static get pluginName(){return"CodeBlock"}}const y3='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>';/**
1781 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1782 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1783 */const Js="removeFormat";class v3 extends b{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor;e.ui.componentFactory.add(Js,()=>{const t=this._createButton(P);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add(`menuBar:${Js}`,()=>this._createButton(Q))}_createButton(e){const t=this.editor,n=t.locale,s=t.commands.get(Js),o=new e(t.locale),r=n.t;return o.set({label:r("Remove Format"),icon:y3}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute(Js),t.editing.view.focus()}),o}}/**
1784 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1785 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1786 */class k3 extends R{refresh(){const e=this.editor.model;this.isEnabled=!!ie(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(n=>{for(const s of this._getFormattingItems(e.document.selection,t))if(s.is("selection"))for(const o of this._getFormattingAttributes(s,t))n.removeSelectionAttribute(o);else{const o=n.createRangeOn(s);for(const r of this._getFormattingAttributes(s,t))n.removeAttribute(r,o)}})}*_getFormattingItems(e,t){const n=s=>!!ie(this._getFormattingAttributes(s,t));for(const s of e.getRanges())for(const o of s.getItems())!t.isBlock(o)&&n(o)&&(yield o);for(const s of e.getSelectedBlocks())n(s)&&(yield s);n(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[n]of e.getAttributes()){const s=t.getAttributeProperties(n);s&&s.isFormatting&&(yield n)}}}/**
1787 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1788 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1789 */class C3 extends b{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new k3(e))}}/**
1790 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1791 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1792 */class T3 extends b{static get requires(){return[C3,v3]}static get pluginName(){return"RemoveFormat"}}/**
1793 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1794 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1795 */function E3(i){const e=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],t=e.map(r=>r.name).join("|"),n=i.replace(new RegExp(`</?(${t})( .*?)?>`,"g"),`
1796$&
1797`).replace(/<br[^>]*>/g,`$&
1798`).split(`
1799`);let s=0,o=!1;return n.filter(r=>r.length).map(r=>(o=S3(r,o),A3(r,e)?Fr(r,s++):x3(r,e)?Fr(r,--s):o==="middle"||o==="last"?r:Fr(r,s))).join(`
1800`)}function A3(i,e){return e.some(t=>!(t.isVoid||!new RegExp(`<${t.name}( .*?)?>`).test(i)))}function x3(i,e){return e.some(t=>
1800new RegExp(`</${t.name}>`).test(i))}function Fr(i,e,t="    "){return`${t.repeat(Math.max(0,e))}${i}`}function S3(i,e){return new RegExp("<pre( .*?)?>").test(i)?"first":new RegExp("</pre>").test(i)?"last":e==="first"||e==="middle"?"middle":!1}const I3='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>';/**
1801 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1802 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1803 */const Zs="SourceEditingMode";class P3 extends b{static get pluginName(){return"SourceEditing"}static get requires(){return[yo]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new wf,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",()=>{const n=this._createButton(P);return n.set({label:t("Source"),icon:I3,tooltip:!0,class:"ck-source-editing-button"}),n}),e.ui.componentFactory.add("menuBar:sourceEditing",()=>{const n=this._createButton(Q);return n.set({label:t("Show source")}),n}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(n,s,o)=>{o?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(n,s,o)=>this._handleReadOnlyMode(!o)),this.listenTo(e,"change:isReadOnly",(n,s,o)=>this._handleReadOnlyMode(o))),e.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}updateEditorData(){const e=this.editor,t={};for(const[n,s]of this._replacedRoots){const o=this._dataFromRoots.get(n),r=s.dataset.value;o!==r&&(t[n]=r,this._dataFromRoots.set(n,r))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){const e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new g("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some(s=>e.plugins.has(s))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){const e=this.editor,t=e.editing.view,n=e.model;n.change(s=>{s.setSelection(null),s.removeSelectionAttribute(n.document.selection.getAttributeKeys())});for(const[s,o]of t.domRoots){const r=R3(e.data.get({rootName:s})),a=Ve(o.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),l=Ve(o.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[a]);a.value=r,a.setSelectionRange(0,0),a.addEventListener("input",()=>{l.dataset.value=a.value,e.ui.update()}),t.change(c=>{const u=t.document.getRoot(s);c.addClass("ck-hidden",u)}),e.ui.setEditableElement("sourceEditing:"+s,a),this._replacedRoots.set(s,l),this._elementReplacer.replace(o,l),this._dataFromRoots.set(s,r)}this._focusSourceEditing()}
1803_hideSourceEditing(){const t=this.editor.editing.view;this.updateEditorData(),t.change(n=>{for(const[s]of this._replacedRoots)n.removeClass("ck-hidden",t.document.getRoot(s))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),t.focus()}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),n=t.querySelector("textarea");e.editing.view.document.isFocused=!1,n.focus()}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(Zs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(Zs)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(Zs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(Zs)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){const t=this.editor.ui.view.editable;return t&&!t.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){const e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){const t=this.editor,n=new e(t.locale);return n.set({withText:!0}),n.bind("isOn").to(this,"isSourceEditingMode"),n.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(yo),"hasAny",(s,o,r)=>!(!s||o||r)),this.listenTo(n,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),n}}function R3(i){return V3(i)?E3(i):i}function V3(i){return i.startsWith("<")}/**
1804 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1805 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1806 */function Hp(i){if(i.is("$text")||i.is("$textProxy"))return i.data;const e=i;let t="",n=null;for(const s of e.getChildren()){const o=Hp(s);n&&n.is("element")&&(t+=`
1807`),t+=o,n=s}return t}/**
1808 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1809 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
1810 */class B3 extends b{constructor(e){super(e),this.set("characters",0),this.set("words",0),Object.defineProperties(this,{characters:{get(){return this.characters=this._getCharacters(this._getText())}},words:{get(){return this.words=this._getWords(this._getText())}}}),this.set("_wordsLabel",void 0),this.set("_charactersLabel",void 0),this._config=e.config.get("wordCount")||{},this._outputView=void 0,this._wordsMatchRegExp=B.features.isRegExpUnicodePropertySupported?new RegExp("([\\p{L}\\p{N}]+\\S?)+","gu"):/([a-zA-Z0-9À-ž]+\S?)+/gu}static get pluginName(){return"WordCount"}init(){this.editor.model.document.on("change:data",qi(this._refreshStats.bind(this),250)),typeof this._config.onUpdate=="function"&&this.on("update",(t,n)=>{this._config.onUpdate(n)}),Ht(this._config.container)&&this._config.container.appendChild(this.wordCountContainer)}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy()}get wordCountContainer(){const e=this.editor,t=e.t,n=e.config.get("wordCount.displayWords"),s=e.config.get("wordCount.displayCharacters"),o=xe.bind(this,this),r=[];return this._outputView||(this._outputView=new C,(n||n===void 0)&&(this.bind("_wordsLabel").to(this,"words",a=>t("Words: %0",a)),r.push({tag:"div",children:[{text:[o.to("_wordsLabel")]}],attributes:{class:"ck-word-count__words"}})),(s||s===void 0)&&(this.bind("_charactersLabel").to(this,"characters",a=>t("Characters: %0",a)),r.push({tag:"div",children:[{text:[o.to("_charactersLabel")]}],attributes:{class:"ck-word-count__characters"}})),this._outputView.setTemplate({tag:"div",attributes:{class:["ck","ck-word-count"]},children:r}),this._outputView.render()),this._outputView.element}_getText(){let e="";for(const t of this.editor.model.document.getRoots())e!==""&&(e+=`
1811`),e+=Hp(t);return e}_getCharacters(e){return e.replace(/\n/g,"").length}_getWords(e){return(e.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){const e=this._getText(),t=this.words=this._getWords(e),n=this.characters=this._getCharacters(e);this.fire("update",{words:t,characters:n})}}const M3=["sourceEditing","|","undo","redo","|","findAndReplace","selectAll","|","heading","|","fontFamily","fontSize","fontColor","fontBackgroun
1811dColor","|","bold","italic","underline","strikethrough","subscript","superscript","code","removeFormat","highlight","|","alignment","|","link","|","bulletedList","numberedList","todoList","outdent","indent","|","blockQuote","codeBlock","horizontalLine","pageBreak","|","imageUpload","insertTable","mediaEmbed"];class xl extends er{}xl.builtinPlugins=[_5,gs,A5,I5,N5,eI,H5,j5,Z5,M5,sI,LI,lP,_P,kP,TP,MP,dR,_R,VR,DR,GR,iB,sB,qB,AB,h4,p4,J4,Z4,F4,Y4,h7,t3,i3,_3,T3,mS,C4,P3,B3];xl.defaultConfig={toolbar:{items:M3,shouldNotGroupWhenFull:!1},image:{toolbar:["imageStyle:inline","imageStyle:block","imageStyle:side","|","toggleImageCaption","imageTextAlternative"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","|","tableProperties","tableCellProperties"]},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"}]}};const yh=`<h2>Sample document</h2>
1812<p>Replace this text with your own content. Use the toolbar for <strong>bold</strong>, <em>italic</em>, fonts, colors, alignment, lists, links, images, tables, media embeds, and source view.</p>
1813<ul>
1814<li>First list item</li>
1815<li>Second list item</li>
1816</ul>
1817<blockquote><p>Block quotes are supported too.</p></blockquote>
1818<p>&nbsp;</p>`;function Nr(i){const e=document.getElementById("ctCkToast"),t=document.getElementById("ctCkToastBody");vh(e,{bodyEl:t,message:i,delay:9e3})}function Qs(i){const e=document.getElementById("ctCkToastOk"),t=document.getElementById("ctCkToastOkBody");vh(e,{bodyEl:t,message:i,delay:4500})}function Ys(i){const e=i.ui.getEditableElement();e&&(e.style.minHeight="clamp(16rem, 42vh, 28rem)")}function X3(){const i=document.getElementById("ctCkEditorMount"),e=document.getElementById("ctCkDownload"),t=document.getElementById("ctCkFormat"),n=document.getElementById("ctCkCopy"),s=document.getElementById("ctCkClear"),o=document.getElementById("ctCkSample"),r=document.getElementById("ctCkWordCount");if(!i)return;let a=null;const l={initialData:yh,wordCount:r&&r instanceof HTMLElement?{container:r}:void 0,ckfinder:{uploadUrl:""}};xl.create(i,l).then(c=>{a=c,Ys(c)}).catch(c=>{Nr(`Editor failed to load: ${c}`)}),e==null||e.addEventListener("click",()=>{if(!a)return;const c=a.getData();Wp(new Blob([c],{type:"text/html;charset=utf-8"}),"ConversionTab.html")}),t==null||t.addEventListener("click",async()=>{if(a)try{const u=(await zp(async()=>{const{default:d}=await import("./index-B6EzSpTQ.js").then(h=>h.i);return{default:d}},__vite__mapDeps([0,1]))).default.html(a.getData(),{indent_size:2});a.setData(u),Ys(a),Qs("HTML formatted.")}catch(c){Nr(`Format failed: ${c}`)}}),n==null||n.addEventListener("click",async()=>{if(!a)return;const c=a.getData();try{await navigator.clipboard.writeText(c),Qs("HTML copied to clipboard.")}catch{Nr("Could not copy to clipboard (permission or browser support).")}}),s==null||s.addEventListener("click",()=>{a&&(a.setData("<p></p>"),Ys(a),Qs("Document cleared."))}),o==null||o.addEventListener("click",()=>{a&&(a.setData(yh),Ys(a),Qs("Sample content loaded."))})}export{X3 as initCKEditorPage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.