PageSourceSearch

https://login.brandcloud.pro/assets/js/ckeditor5-DQYMZArN.js

js brandcloud.pro collected 2026-10-02 18:06:19 UTC 874,841 bytes, 314 lines download raw bytes

1var df=Object.defineProperty;var hf=(n,i,e)=>i in n?df(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var u=(n,i,e)=>hf(n,typeof i!="symbol"?i+"":i,e);import{bk as yu,aV as ff,bl as mf,j as Ea,a1 as gf,bm as pf,B as wf,o as bf,l as _f,Y as yf,bn as Ta,h as tr,d as vf}from"./index-DasCZPt2.js";function kf(n){return Number.isSafeInteger(n)&&n>=0}function Cf(n){return n!=null&&typeof n!="function"&&kf(n.length)}function vu(n){return n}function gn(n){return n==="__proto__"}function ku(n){switch(typeof n){case"number":case"symbol":return!1;case"string":return n.includes(".")||n.includes("[")||n.includes("]")}}function Ao(n){var i;return typeof n=="string"||typeof n=="symbol"?n:Object.is((i=n==null?void 0:n.valueOf)==null?void 0:i.call(n),-0)?"-0":String(n)}function xo(n){const i=[],e=n.length;if(e===0)return i;let t=0,s="",r="",o=!1;for(n.charCodeAt(0)===46&&(i.push(""),t++);t<e;){const a=n[t];r?a==="\\"&&t+1<e?(t++,s+=n[t]):a===r?r="":s+=a:o?a==='"'||a==="'"?r=a:a==="]"?(o=!1,i.push(s),s=""):s+=a:a==="["?(o=!0,s&&(i.push(s),s="")):a==="."?s&&(i.push(s),s=""):s+=a,t++}return s&&i.push(s),i}function At(n,i,e){if(n==null)return e;switch(typeof i){case"string":{if(gn(i))return e;const t=n[i];return t===void 0?ku(i)?At(n,xo(i),e):e:t}case"number":case"symbol":{typeof i=="number"&&(i=Ao(i));const t=n[i];return t===void 0?e:t}default:{if(Array.isArray(i))return Ef(n,i,e);if(Object.is(i==null?void 0:i.valueOf(),-0)?i="-0":i=String(i),gn(i))return e;const t=n[i];return t===void 0?e:t}}}function Ef(n,i,e){if(i.length===0)return e;let t=n;for(let s=0;s<i.length;s++){if(t==null||gn(i[s]))return e;t=t[i[s]]}return t===void 0?e:t}function Tf(n){return function(i){return At(i,n)}}function Le(n){return n!==null&&(typeof n=="object"||typeof n=="function")}function Rn(n){return n==null||typeof n!="object"&&typeof n!="function"}function pn(n,i){return n===i||Number.isNaN(n)&&Number.isNaN(i)}function Pf(n,i,e){return typeof e!="function"?So(n,i):Wr(n,i,function t(s,r,o,a,l,c){const d=e(s,r,o,a,l,c);return d!==void 0?!!d:Wr(s,r,t,c)},new Map)}function Wr(n,i,e,t){if(i===n)return!0;switch(typeof i){case"object":return Af(n,i,e,t);case"function":return Object.keys(i).length>0?Wr(n,{...i},e,t):pn(n,i);default:return Le(n)?typeof i=="string"?i==="":!0:pn(n,i)}}function Af(n,i,e,t){if(i==null)return!0;if(Array.isArray(i))return Cu(n,i,e,t);if(i instanceof Map)return xf(n,i,e,t);if(i instanceof Set)return Sf(n,i,e,t);const s=Object.keys(i);if(n==null)return s.length===0;if(s.length===0)return!0;if(t&&t.has(i))return t.get(i)===n;t&&t.set(i,n);try{for(let r=0;r<s.length;r++){const o=s[r];if(!Rn(n)&&!(o in n)||i[o]===void 0&&n[o]!==void 0||i[o]===null&&n[o]!==null||!e(n[o],i[o],o,n,i,t))return!1}return!0}finally{t&&t.delete(i)}}function xf(n,i,e,t){if(i.size===0)return!0;if(!(n instanceof Map))return!1;for(const[s,r]of i.entries()){const o=n.get(s);if(e(o,r,s,n,i,t)===!1)return!1}return!0}function Cu(n,i,e,t){if(i.length===0)return!0;if(!Array.isArray(n))return!1;const s=new Set;for(let r=0;r<i.length;r++){const o=i[r];let a=!1;for(let l=0;l<n.length;l++){if(s.has(l))continue;const c=n[l];let d=!1;if(e(c,o,r,n,i,t)&&(d=!0),d){s.add(l),a=!0;break}}if(!a)return!1}return!0}function Sf(n,i,e,t){return i.size===0?!0:n instanceof Set?Cu([...n],[...i],e,t):!1}function So(n,i){return Pf(n,i,()=>{})}function ms(n){return Object.getOwnPropertySymbols(n).filter(i=>Object.prototype.propertyIsEnumerable.call(n,i))}function Pi(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}const Os="[object RegExp]",Ai="[object String]",Vn="[object Number]",Bn="[object Boolean]",xi="[object Arguments]",Ms="[object Symbol]",Rs="[object Date]",Vs="[object Map]",Bs="[object Set]",Io="[object Array]",If="[object Function]",Ls="[object ArrayBuffer]",nn="[object Object]",Of="[object Error]",Fs="[object DataView]",Oo="[object Uint8Array]",Mo="[object Uint8ClampedArray]",Ro="[object Uint16Array]",Vo="[object Uint32Array]",Mf="[object BigUint64Array]",Bo="[object Int8Array]",Lo="[object Int16Array]",Fo="[object Int32Array]",Rf="[object BigInt64Array
1]",No="[object Float32Array]",Do="[object Float64Array]";function zo(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Vf(n,i){return Wt(n,void 0,n,new Map,i)}function Wt(n,i,e,t=new Map,s=void 0){const r=s==null?void 0:s(n,i,e,t);if(r!=null)return r;if(Rn(n))return n;if(t.has(n))return t.get(n);if(Array.isArray(n)){const o=new Array(n.length);t.set(n,o);for(let a=0;a<n.length;a++)o[a]=Wt(n[a],a,e,t,s);return Object.hasOwn(n,"index")&&(o.index=n.index),Object.hasOwn(n,"input")&&(o.input=n.input),o}if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp){const o=new RegExp(n.source,n.flags);return o.lastIndex=n.lastIndex,o}if(n instanceof Map){const o=new Map;t.set(n,o);for(const[a,l]of n)o.set(a,Wt(l,a,e,t,s));return o}if(n instanceof Set){const o=new Set;t.set(n,o);for(const a of n)o.add(Wt(a,void 0,e,t,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(n))return n.subarray();if(zo(n)){const o=new(Object.getPrototypeOf(n)).constructor(n.length);t.set(n,o);for(let a=0;a<n.length;a++)o[a]=Wt(n[a],a,e,t,s);return o}if(n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer)return n.slice(0);if(n instanceof DataView){const o=new DataView(n.buffer.slice(0),n.byteOffset,n.byteLength);return t.set(n,o),zt(o,n,e,t,s),o}if(typeof File<"u"&&n instanceof File){const o=new File([n],n.name,{type:n.type});return t.set(n,o),zt(o,n,e,t,s),o}if(n instanceof Blob){const o=new Blob([n],{type:n.type});return t.set(n,o),zt(o,n,e,t,s),o}if(n instanceof Error){const o=new n.constructor;return t.set(n,o),o.message=n.message,o.name=n.name,o.stack=n.stack,o.cause=n.cause,zt(o,n,e,t,s),o}if(typeof n=="object"&&Bf(n)){const o=Object.create(Object.getPrototypeOf(n));return t.set(n,o),zt(o,n,e,t,s),o}return n}function zt(n,i,e=n,t,s){const r=[...Object.keys(i),...ms(i)];for(let o=0;o<r.length;o++){const a=r[o],l=Object.getOwnPropertyDescriptor(n,a);(l==null||l.writable)&&(n[a]=Wt(i[a],a,e,t,s))}}function Bf(n){switch(Pi(n)){case xi:case Io:case Ls:case Fs:case Bn:case Rs:case No:case Do:case Bo:case Lo:case Fo:case Vs:case Vn:case nn:case Os:case Bs:case Ai:case Ms:case Oo:case Mo:case Ro:case Vo:return!0;default:return!1}}function Lf(n){return Wt(n,void 0,n,new Map,void 0)}function Ff(n){return n=Lf(n),i=>So(i,n)}function Ns(n,i){return Vf(n,(e,t,s,r)=>{const o=i==null?void 0:i(e,t,s,r);if(o!=null)return o;if(typeof n=="object")switch(Object.prototype.toString.call(n)){case Vn:case Ai:case Bn:{const a=new n.constructor(n==null?void 0:n.valueOf());return zt(a,n),a}case xi:{const a={};return zt(a,n),a.length=n.length,a[Symbol.iterator]=n[Symbol.iterator],a}default:return}})}function _e(n){return Ns(n)}const Nf=/^(?:0|[1-9]\d*)$/;function Eu(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&n<i;case"symbol":return!1;case"string":return Nf.test(n)}}function $r(n){return n!==null&&typeof n=="object"&&Pi(n)==="[object Arguments]"}function Df(n,i){let e;if(Array.isArray(i)?e=i:typeof i=="string"&&ku(i)&&(n==null?void 0:n[i])==null?e=xo(i):e=[i],e.length===0)return!1;let t=n;for(let s=0;s<e.length;s++){const r=e[s];if((t==null||!Object.hasOwn(t,r))&&!((Array.isArray(t)||$r(t))&&Eu(r)&&r<t.length))return!1;t=t[r]}return!0}function zf(n,i){switch(typeof n){case"object":{Object.is(n==null?void 0:n.valueOf(),-0)&&(n="-0");break}case"number":{n=Ao(n);break}}return i=_e(i),function(e){const t=At(e,n);return t===void 0?Df(e,n):i===void 0?t===void 0:So(t,i)}}function Hf(n){if(n==null)return vu;switch(typeof n){case"function":return n;case"object":return Array.isArray(n)&&n.length===2?zf(n[0],n[1]):Ff(n);case"string":case"symbol":case"number":return Tf(n)}}function Ur(n){return typeof n=="object"&&n!==null}function Tu(n){return typeof n=="symbol"||n instanceof Symbol}function Wf(n){return Tu(n)?NaN:Number(n)}function $f(n){return n?(n=Wf(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}function Uf(n){const i=$f(n),e=i%1;return e?i-e:i}function Pa(n){return typeof n=="string"||n instanceof String}const qf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kf=/^\w*$/;function Gf(n,i){return Array.isArray(n)?!1:typeof n=="number"||typeof n=="boolean"||n==null||Tu(n)?!0:typeof n=="string"&&(Kf.test(n)||!qf.test(n))||i!=null&&Object.hasOwn(i,n)}function jf(n){return Array.isArray(n)}const Jf=(n,i,e)=>{const t=n[i];(!(Object.hasOwn(n,i)&&pn(t,e))||e===void 0&&!(i in n))&&(n[i]=e)};function Qf(n,i,e,t){if(n==null&&!Le(n))return n;const s=Gf(i,n)?[i]:Array.isArray(i)?i:typeof i=="string"?xo(i):[i];let r=n;for(let o=0;o<s.length&&r!=null;o++){const a=Ao(s[o]);if(gn(a))continue;let l;if(o===s.length-1)l=e(r[a]);else{const c=r[a],d=t==null?void 0:t(c,a,n);l=d!==void 0?d:Le(c)?c:Eu(s[o+1])?[]:{}}Jf(r,a,l),r=r[a]}return n}function Pu(n,i,e){return Qf(n,i,()=>e,()=>{})}function Yf(n,i,{signal:e,edges:t}={}){let s,r=null;const o=t!=null&&t.includes("leading"),a=t==null||t.includes("trailing"),l=()=>{r!==null&&(n.apply(s,r),s=void 0,r=null)},c=()=>{a&&l(),m()};let d=null;const h=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},i)},f=()=>{d!==null&&(clearTimeout(d),d=null)},m=()=>{f(),s=void 0,r=null},g=()=>{f(),l()},w=function(...v){if(e!=null&&e.aborted)return;s=this,r=v;const O=d==null;h(),o&&O&&l()};return w.schedule=h,w.cancel=m,w.flush=g,e==null||e.addEventListener("abort",m,{once:!0}),w}function pt(n,i=0,e={}){typeof e!="object"&&(e={});const{leading:t=!1,trailing:s=!0,maxWait:r}=e,o=Array(2);t&&(o[0]="leading"),s&&(o[1]="trailing");let a,l=null;const c=Yf(function(...f){a=n.apply(this,f),l=null},i,{edges:o}
1),d=function(...f){return r!=null&&(l===null&&(l=Date.now()),Date.now()-l>=r)?(a=n.apply(this,f),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,f),a)},h=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=h,d}function wn(n,i=0,e={}){typeof e!="object"&&(e={});const{leading:t=!0,trailing:s=!0}=e;return pt(n,i,{leading:t,trailing:s,maxWait:i})}function Ho(n){if(n==null)return"";if(typeof n=="string")return n;if(Array.isArray(n))return n.map(Ho).join(",");const i=String(n);return i==="0"&&Object.is(Number(n),-0)?"-0":i}function Aa(n){if(!n||typeof n!="object")return!1;const i=Object.getPrototypeOf(n);return i===null||i===Object.prototype||Object.getPrototypeOf(i)===null?Object.prototype.toString.call(n)==="[object Object]":!1}function Au(n,i,e){return Qi(n,i,void 0,void 0,void 0,void 0,e)}function Qi(n,i,e,t,s,r,o){const a=o(n,i,e,t,s,r);if(a!==void 0)return a;if(typeof n==typeof i)switch(typeof n){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return n===i;case"number":return n===i||Object.is(n,i);case"function":return n===i;case"object":return sn(n,i,r,o)}return sn(n,i,r,o)}function sn(n,i,e,t){if(Object.is(n,i))return!0;let s=Pi(n),r=Pi(i);if(s===xi&&(s=nn),r===xi&&(r=nn),s!==r)return!1;switch(s){case Ai:return n.toString()===i.toString();case Vn:{const l=n.valueOf(),c=i.valueOf();return pn(l,c)}case Bn:case Rs:case Ms:return Object.is(n.valueOf(),i.valueOf());case Os:return n.source===i.source&&n.flags===i.flags;case If:return n===i}e=e??new Map;const o=e.get(n),a=e.get(i);if(o!=null&&a!=null)return o===i;e.set(n,i),e.set(i,n);try{switch(s){case Vs:{if(n.size!==i.size)return!1;for(const[l,c]of n.entries())if(!i.has(l)||!Qi(c,i.get(l),l,n,i,e,t))return!1;return!0}case Bs:{if(n.size!==i.size)return!1;const l=Array.from(n.values()),c=Array.from(i.values());for(let d=0;d<l.length;d++){const h=l[d],f=c.findIndex(m=>Qi(h,m,void 0,n,i,e,t));if(f===-1)return!1;c.splice(f,1)}return!0}case Io:case Oo:case Mo:case Ro:case Vo:case Mf:case Bo:case Lo:case Fo:case Rf:case No:case Do:{if(typeof Buffer<"u"&&Buffer.isBuffer(n)!==Buffer.isBuffer(i)||n.length!==i.length)return!1;for(let l=0;l<n.length;l++)if(!Qi(n[l],i[l],l,n,i,e,t))return!1;return!0}case Ls:return n.byteLength!==i.byteLength?!1:sn(new Uint8Array(n),new Uint8Array(i),e,t);case Fs:return n.byteLength!==i.byteLength||n.byteOffset!==i.byteOffset?!1:sn(new Uint8Array(n),new Uint8Array(i),e,t);case Of:return n.name===i.name&&n.message===i.message;case nn:{if(!(sn(n.constructor,i.constructor,e,t)||Aa(n)&&Aa(i)))return!1;const c=[...Object.keys(n),...ms(n)],d=[...Object.keys(i),...ms(i)];if(c.length!==d.length)return!1;for(let h=0;h<c.length;h++){const f=c[h],m=n[f];if(!Object.hasOwn(i,f))return!1;const g=i[f];if(!Qi(m,g,f,n,i,e,t))return!1}return!0}default:return!1}}finally{e.delete(n),e.delete(i)}}function xu(){}function xa(n,i){return Au(n,i,xu)}function Xf(n){return typeof Buffer<"u"&&Buffer.isBuffer(n)}function Zf(n){const i=n==null?void 0:n.constructor,e=typeof i=="function"?i.prototype:Object.prototype;return n===e}function Wo(n){return zo(n)}function em(n,i){if(n=Uf(n),n<1||!Number.isSafeInteger(n))return[];const e=new Array(n);for(let t=0;t<n;t++)e[t]=typeof i=="function"?i(t):t;return e}function tm(n){if(n==null)return[];switch(typeof n){case"object":case"function":return Cf(n)?nm(n):Zf(n)?im(n):gs(n);default:return gs(Object(n))}}function gs(n){const i=[];for(const e in n)i.push(e);return i}function im(n){return gs(n).filter(e=>e!=="constructor")}function nm(n){const i=em(n.length,t=>`${t}`),e=new Set(i);return Xf(n)&&(e.add("offset"),e.add("parent")),Wo(n)&&(e.add("buffer"),e.add("byteLength"),e.add("byteOffset")),[...i,...gs(n).filter(t=>!e.has(t))]}function Su(n,...i){for(let e=0;e<i.length;e++)sm(n,i[e]);return n}function sm(n,i){const e=tm(i);for(let t=0;t<e.length;t++){const s=e[t];(!(s in n)||!pn(n[s],i[s]))&&(n[s]=i[s])}}function rm(n){if(Rn(n))return n;const i=Pi(n);if(!om(n))return{};if(jf(n)){const t=Array.from(n);return n.length>0&&typeof n[0]=="string"&&Object.hasOwn(n,"index")&&(t.index=n.index,t.input=n.input),t}if(Wo(n)){const t=n,s=t.constructor;return new s(t.buffer,t.byteOffset,t.length)}if(i===Ls)return new ArrayBuffer(n.byteLength);if(i===Fs){const t=n,s=t.buffer,r=t.byteOffset,o=t.byteLength,a=new ArrayBuffer(o),l=new Uint8Array(s,r,o);return new Uint8Array(a).set(l),new DataView(a)}if(i===Bn||i===Vn||i===Ai){const t=n.constructor,s=new t(n.valueOf());return i===Ai?lm(s,n):ir(s,n),s}if(i===Rs)return new Date(Number(n));if(i===Os){const t=n,s=new RegExp(t.source,t.flags);return s.lastIndex=t.lastIndex,s}if(i===Ms)return Object(Symbol.prototype.valueOf.call(n));if(i===Vs){const t=n,s=new Map;return t.forEach((r,o)=>{s.set(o,r)}),s}if(i===Bs){const t=n,s=new Set;return t.forEach(r=>{s.add(r)}),s}if(i===xi){const t=n,s={};return ir(s,t),s.length=t.length,s[Symbol.iterator]=t[Symbol.iterator],s}const e={};return cm(e,n),ir(e,n),am(e,n),e}function om(n){switch(Pi(n)){case xi:case Io:case Ls:case Fs:case Bn:case Rs:case No:case Do:case Bo:case Lo:case Fo:case Vs:case Vn:case nn:case Os:case Bs:case Ai:case Ms:case Oo:case Mo:case Ro:case Vo:return!0;default:return!1}}function ir(n,i){for(const e in i)Object.hasOwn(i,e)&&(n[e]=i[e])}function am(n,i){const e=Object.getOwnPropertySymbols(i);for(let t=0;t<e.length;t++){const s=e[t];Object.prototype.propertyIsEnumerable.call(i,s)&&(n[s]=i[s])}}function lm(n,i){const e=i.valueOf().length;for(const t in i)Object.hasOwn(i,t)&&(Number.isNaN(Number(t))||Number(t)>=e)&&(n[t]=i[t])}function cm(n,i){const e=Object.getPrototypeOf(i);e!==null&&typeof i.constructor=="function"&&Object.setPrototypeOf(n,e)}function it(n){var e;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;
1if(Object.prototype.toString.call(n)!=="[object Object]"){const t=n[Symbol.toStringTag];return t==null||!((e=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&e.writable)?!1:n.toString()===`[object ${t}]`}let i=n;for(;Object.getPrototypeOf(i)!==null;)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(n)===i}function um(n,i){const e={},t=Object.keys(n);for(let s=0;s<t.length;s++){const r=t[s],o=n[r];e[r]=i(o,r,n)}return e}function dm(n,i=vu){return n==null?{}:um(n,Hf(i))}function hm(n){if(Rn(n))return n;if(Array.isArray(n)||zo(n)||n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer)return n.slice(0);const i=Object.getPrototypeOf(n),e=i.constructor;if(n instanceof Date||n instanceof Map||n instanceof Set)return new e(n);if(n instanceof RegExp){const t=new e(n);return t.lastIndex=n.lastIndex,t}if(n instanceof DataView)return new e(n.buffer.slice(0));if(n instanceof Error){const t=new e(n.message);return t.stack=n.stack,t.name=n.name,t.cause=n.cause,t}if(typeof File<"u"&&n instanceof File)return new e([n],n.name,{type:n.type,lastModified:n.lastModified});if(typeof n=="object"){const t=Object.create(i);return Object.assign(t,n)}return n}function fm(n,...i){const e=i.slice(0,-1),t=i[i.length-1];let s=n;for(let r=0;r<e.length;r++){const o=e[r];s=os(s,o,t,new Map)}return s}function os(n,i,e,t){if(Rn(n)&&(n=Object(n)),i==null||typeof i!="object")return n;if(t.has(i))return hm(t.get(i));if(t.set(i,n),Array.isArray(i)){i=i.slice();for(let r=0;r<i.length;r++)i[r]=i[r]??void 0}const s=[...Object.keys(i),...ms(i)];for(let r=0;r<s.length;r++){const o=s[r];if(gn(o))continue;let a=i[o],l=n[o];if($r(a)&&(a={...a}),$r(l)&&(l={...l}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=_e(a)),Array.isArray(a))if(typeof l=="object"&&l!=null){const d=[],h=Reflect.ownKeys(l);for(let f=0;f<h.length;f++){const m=h[f];d[m]=l[m]}l=d}else l=[];const c=e(l,a,o,n,i,t);c!=null?n[o]=c:Array.isArray(a)||Ur(l)&&Ur(a)?n[o]=os(l,a,e,t):l==null&&it(a)?n[o]=os({},a,e,t):l==null&&Wo(a)?n[o]=_e(a):(l===void 0||a!==void 0)&&(n[o]=a)}return n}function $o(n,...i){return fm(n,...i,xu)}function ps(n){return typeof n=="function"}function xt(n){return Ur(n)&&n.nodeType===1&&!it(n)}function Sa(n,i){if(!Number.isInteger(n)||n<0)throw new Error("n must be a non-negative integer.");let e=0;return(...t)=>{if(++e>=n)return i(...t)}}function qr(n,i,e){return typeof e!="function"&&(e=()=>{}),Au(n,i,(...t)=>{const s=e(...t);if(s!==void 0)return!!s;if(n instanceof Map&&i instanceof Map||n instanceof Set&&i instanceof Set)return qr(Array.from(n),Array.from(i),Sa(2,e))})}function mm(n){return n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}function gm(n){return mm(Ho(n))}function pm(n){return n.substring(0,1).toUpperCase()+n.substring(1)}function wm(n){return pm(Ho(n))}/**
2 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4 *//**
5 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
6 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
7 */let C;try{C={window,document}}catch{/* istanbul ignore next -- @preserve */C={window:{},document:{}}}function bm(){try{return navigator.userAgent.toLowerCase()}catch{return""}}const Vt=bm(),P={isMac:Iu(Vt),isWindows:_m(Vt),isGecko:ym(Vt),isSafari:vm(Vt),isiOS:km(Vt),isAndroid:Cm(Vt),isBlink:Em(Vt),get isMediaForcedColors(){return Pm()},features:{isRegExpUnicodePropertySupported:Tm()}};function Iu(n){return n.indexOf("macintosh")>-1}function _m(n){return n.indexOf("windows")>-1}function ym(n){return!!n.match(/gecko\/\d+/)}function vm(n){return n.indexOf(" applewebkit/")>-1&&n.indexOf("chrome")===-1}function km(n){return!!n.match(/iphone|ipad/i)||Iu(n)&&navigator.maxTouchPoints>0}function Cm(n){return n.indexOf("android")>-1}function Em(n){return n.indexOf("chrome/")>-1&&n.indexOf("edge/")<0}function Tm(){let n=!1;try{n="ć".search(new RegExp("[\\p{L}]","u"))===0}catch{}return n}function Pm(){return C.window.matchMedia?C.window.matchMedia("(forced-colors: active)").matches:!1}/**
8 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
9 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
10 */function Ou(n,i,e,t){e=e||function(l,c){return l===c};const s=Array.isArray(n)?n:Array.prototype.slice.call(n),r=Array.isArray(i)?i:Array.prototype.slice.call(i),o=Am(s,r,e);return t?Sm(o,r.length):xm(r,o)}function Am(n,i,e){const t=Ia(n,i,e);if(t===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=Oa(n,t),r=Oa(i,t),o=Ia(s,r,e),a=n.length-o,l=i.length-o;return{firstIndex:t,lastIndexOld:a,lastIndexNew:l}}function Ia(n,i,e){for(let t=0;t<Math.max(n.length,i.length);t++)if(n[t]===void 0||i[t]===void 0||!e(n[t],i[t]))return t;return-1}function Oa(n,i){return n.slice(i).reverse()}function xm(n,i){const e=[],{firstIndex:t,lastIndexOld:s,lastIndexNew:r}=i;return r-t>0&&e.push({index:t,type:"insert",values:n.slice(t,r)}),s-t>0&&e.push({index:t+(r-t),type:"delete",howMany:s-t}),e}function Sm(n,i){const{firstIndex:e,lastIndexOld:t,lastIndexNew:s}=n;if(e===-1)return Array(i).fill("equal");let r=[];return e>0&&(r=r.concat(Array(e).fill("equal"))),s-e>
100&&(r=r.concat(Array(s-e).fill("insert"))),t-e>0&&(r=r.concat(Array(t-e).fill("delete"))),s<i&&(r=r.concat(Array(i-s).fill("equal"))),r}function ki(n,i,e){e=e||function(w,v){return w===v};const t=n.length,s=i.length;if(t>200||s>200||t+s>300)return ki.fastDiff(n,i,e,!0);let r,o;if(s<t){const w=n;n=i,i=w,r="delete",o="insert"}else r="insert",o="delete";const a=n.length,l=i.length,c=l-a,d={},h={};function f(w){const v=(h[w-1]!==void 0?h[w-1]:-1)+1,O=h[w+1]!==void 0?h[w+1]:-1,M=v>O?-1:1;d[w+M]&&(d[w]=d[w+M].slice(0)),d[w]||(d[w]=[]),d[w].push(v>O?r:o);let W=Math.max(v,O),ie=W-w;for(;ie<a&&W<l&&e(n[ie],i[W]);)ie++,W++,d[w].push("equal");return W}let m=0,g;do{for(g=-m;g<c;g++)h[g]=f(g);for(g=c+m;g>c;g--)h[g]=f(g);h[c]=f(c),m++}while(h[c]!==l);return d[c].slice(1)}ki.fastDiff=Ou;/**
11 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
12 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
13 */function Ma(){return function n(){n.called=!0}}class wt{constructor(i,e){u(this,"source");u(this,"name");u(this,"path");u(this,"stop");u(this,"off");u(this,"return");this.source=i,this.name=e,this.path=[],this.stop=Ma(),this.off=Ma()}}/**
14 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
15 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
16 */const ce=new Array(256).fill("").map((n,i)=>("0"+i.toString(16)).slice(-2));function me(){const[n,i,e,t]=crypto.getRandomValues(new Uint32Array(4));return"e"+ce[n>>0&255]+ce[n>>8&255]+ce[n>>16&255]+ce[n>>24&255]+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]}/**
17 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
18 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
19 */const Tt={get(n="normal"){return typeof n!="number"?this[n]||this.normal:n},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function Mu(n,i){const e=Tt.get(i.priority);let t=0,s=n.length;for(;t<s;){const r=t+s>>1;Tt.get(n[r].priority)<e?s=r:t=r+1}n.splice(t,0,i)}/**
20 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
21 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
22 */const Im="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";
22class p extends Error{constructor(e,t,s,r){super(Mm(e,s,r));u(this,"context");u(this,"data");this.name="CKEditorError",this.context=t,this.data=s,r&&(this.stack=r.stack)}is(e){return e==="CKEditorError"}static rethrowUnexpectedError(e,t){throw e.is&&e.is("CKEditorError")?e:new p("unexpected-error",t,void 0,e)}}function ZE(n,i){}function Om(n){return`
23Read more: ${Im}#error-${n}`}function Mm(n,i,e){const t=new WeakSet,r=i?` ${JSON.stringify(i,(l,c)=>{if(typeof c=="object"&&c!==null){if(t.has(c))return`[object ${c.constructor.name}]`;t.add(c)}return c})}`:"",o=Om(n),a=e?`
24Original error: ${e.name}: ${e.message}`:"";return n+r+o+a}const Rm="46.1.1",Vm=new Date(2025,8,15);/* istanbul ignore next -- @preserve */if(globalThis.CKEDITOR_VERSION)throw new p("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=Rm;const hi=Symbol("listeningTo"),Kr=Symbol("emitterId"),at=Symbol("delegations"),Bm=H(Object);function H(n){if(!n)return Bm;class i extends n{on(t,s,r){this.listenTo(this,t,s,r)}once(t,s,r){let o=!1;const a=(l,...c)=>{o||(o=!0,l.off(),s.call(this,l,...c))};this.listenTo(this,t,a,r)}off(t,s){this.stopListening(this,t,s)}listenTo(t,s,r,o={}){let a,l;this[hi]||(this[hi]={});const c=this[hi];nr(t)||Ru(t);const d=nr(t);(a=c[d])||(a=c[d]={emitter:t,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(r),zm(this,t,s,r,o)}stopListening(t,s,r){const o=this[hi];let a=t&&nr(t);const l=o&&a?o[a]:void 0,c=l&&s?l.callbacks[s]:void 0;if(!(!o||t&&!l||s&&!c))if(r)sr(this,t,s,r),c.indexOf(r)!==-1&&(c.length===1?delete l.callbacks[s]:sr(this,t,s,r));else if(c){for(;r=c.pop();)sr(this,t,s,r);delete l.callbacks[s]}else if(l){for(s in l.callbacks)this.stopListening(t,s);delete o[a]}else{for(a in o)this.stopListening(o[a].emitter);delete this[hi]}}fire(t,...s){try{const r=t instanceof wt?t:new wt(this,t),o=r.name;let a=Dm(this,o);if(r.path.push(this),a){a=a.slice();for(let c=0;c<a.length;c++){const d=a[c].callback;if(d.call(this,r,...s),r.off.called&&(delete r.off.called,this._removeEventListener(o,d)),r.stop.called)break}}const l=this[at];if(l){const c=l.get(o),d=l.get("*");c&&Ra(c,r,s),d&&Ra(d,r,s)}return r.return}catch(r){/* istanbul ignore next -- @preserve */p.rethrowUnexpectedError(r,this)}}delegate(...t){return{to:(s,r)=>{this[at]||(this[at]=new Map),t.forEach(o=>{const a=this[at].get(o);a?a.set(s,r):this[at].set(o,new Map([[s,r]]))})}}}stopDelegating(t,s){if(this[at])if(!t)this[at].clear();else if(!s)this[at].delete(t);else{const r=this[at].get(t);r&&r.delete(s)}}_addEventListener(t,s,r){Nm(this,t);const o=Gr(this,t),a=Tt.get(r.priority),l={callback:s,priority:a};for(const c of o)Mu(c,l)}_removeEventListener(t,s){const r=Gr(this,t);for(const o of r)for(let a=0;a<o.length;a++)o[a].callback==s&&(o.splice(a,1),a--)}}return i}function Lm(n,i){const e=n[hi];return e&&e[i]?e[i].emitter:null}function Ru(n,i){n[Kr]||(n[Kr]=i||me())}function nr(n){return n[Kr]}function Vu(n){return n._events||Object.defineProperty(n,"_events",{value:{}}),n._events}function Fm(){return{callbacks:[],childEvents:[]}}function Nm(n,i){const e=Vu(n);if(e[i])return;let t=i,s=null;const r=[];for(;t!==""&&!e[t];)e[t]=Fm(),r.push(e[t]),s&&e[t].childEvents.push(s),s=t,t=t.substr(0,t.lastIndexOf(":"));if(t!==""){for(const o of r)o.callbacks=e[t].callbacks.slice();e[t].childEvents.push(s)}}function Gr(n,i){const e=Vu(n)[i];if(!e)return[];let t=[e.callbacks];for(let s=0;s<e.childEvents.length;s++){const r=Gr(n,e.childEvents[s]);t=t.concat(r)}return t}function Dm(n,i){if(!n._events)return null;let e=i;do{const t=n._events[e];if(t&&t.callbacks&&t.callbacks.length)return t.callbacks;const s=e.lastIndexOf(":");e=s>-1?e.substring(0,s):""}while(e);return null}function Ra(n,i,e){for(let[t,s]of n){s?typeof s=="function"&&(s=s(i.name)):s=i.name;const r=new wt(i.source,s);r.path=[...i.path],t.fire(r,...e)}}function zm(n,i,e,t,s){i._addEventListener?i._addEventListener(e,t,s):n._addEventListener.call(i,e,t,s)}function sr(n,i,e,t){i._removeEventListener?i._removeEventListener(e,t):n._removeEventListener.call(i,e,t)}const rn=Symbol("observableProperties"),bn=Symbol("boundObservables"),on=Symbol("boundProperties"),Bt=Symbol("decoratedMethods"),Va=Symbol("decoratedOriginal"),Hm=q(H());function q(n){var e,t,s,r,o;
24if(!n)return Hm;class i extends(o=n,r=rn,s=Bt,t=on,e=bn,o){constructor(){super(...arguments);u(this,r);u(this,s);u(this,t);u(this,e)}set(c,d){if(Le(c)){Object.keys(c).forEach(f=>{this.set(f,c[f])},this);return}rr(this);const h=this[rn];if(c in this&&!h.has(c))throw new p("observable-set-cannot-override",this);Object.defineProperty(this,c,{enumerable:!0,configurable:!0,get(){return h.get(c)},set(f){const m=h.get(c);let g=this.fire(`set:${c}`,c,f,m);g===void 0&&(g=f),(m!==g||!h.has(c))&&(h.set(c,g),this.fire(`change:${c}`,c,g,m))}}),this[c]=d}bind(...c){if(!c.length||!Ba(c))throw new p("observable-bind-wrong-properties",this);if(new Set(c).size!==c.length)throw new p("observable-bind-duplicate-properties",this);rr(this);const d=this[on];c.forEach(f=>{if(d.has(f))throw new p("observable-bind-rebind",this)});const h=new Map;return c.forEach(f=>{const m={property:f,to:[]};d.set(f,m),h.set(f,m)}),{to:Wm,toMany:$m,_observable:this,_bindProperties:c,_to:[],_bindings:h}}unbind(...c){if(!this[rn])return;const d=this[on],h=this[bn];if(c.length){if(!Ba(c))throw new p("observable-unbind-wrong-properties",this);c.forEach(f=>{const m=d.get(f);m&&(m.to.forEach(([g,w])=>{const v=h.get(g),O=v[w];O.delete(m),O.size||delete v[w],Object.keys(v).length||(h.delete(g),this.stopListening(g,"change"))}),d.delete(f))})}else h.forEach((f,m)=>{this.stopListening(m,"change")}),h.clear(),d.clear()}decorate(c){rr(this);const d=this[c];if(!d)throw new p("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:c});this.on(c,(h,f)=>{h.return=d.apply(this,f)}),this[c]=function(...h){return this.fire(c,h)},this[c][Va]=d,this[Bt]||(this[Bt]=[]),this[Bt].push(c)}stopListening(c,d,h){if(!c&&this[Bt]){for(const f of this[Bt])this[f]=this[f][Va];delete this[Bt]}super.stopListening(c,d,h)}}return i}function rr(n){n[rn]||(Object.defineProperty(n,rn,{value:new Map}),Object.defineProperty(n,bn,{value:new Map}),Object.defineProperty(n,on,{value:new Map}))}function Wm(...n){const i=qm(...n),e=Array.from(this._bindings.keys()),t=e.length;if(!i.callback&&i.to.length>1)throw new p("observable-bind-to-no-callback",this);if(t>1&&i.callback)throw new p("observable-bind-to-extra-callback",this);i.to.forEach(s=>{if(s.properties.length&&s.properties.length!==t)throw new p("observable-bind-to-properties-length",this);s.properties.length||(s.properties=this._bindProperties)}),this._to=i.to,i.callback&&(this._bindings.get(e[0]).callback=i.callback),jm(this._observable,this._to),Gm(this),this._bindProperties.forEach(s=>{Bu(this._observable,s)})}function $m(n,i,e){if(this._bindings.size>1)throw new p("observable-bind-to-many-not-one-binding",this);this.to(...Um(n,i),e)}function Um(n,i){const e=n.map(t=>[t,i]);return Array.prototype.concat.apply([],e)}function Ba(n){return n.every(i=>typeof i=="string")}function qm(...n){if(!n.length)throw new p("observable-bind-to-parse-error",null);const i={to:[]};let e;return typeof n[n.length-1]=="function"&&(i.callback=n.pop()),n.forEach(t=>{if(typeof t=="string")e.properties.push(t);else if(typeof t=="object")e={observable:t,properties:[]},i.to.push(e);else throw new p("observable-bind-to-parse-error",null)}),i}function Km(n,i,e,t){const s=n[bn],r=s.get(e),o=r||{};o[t]||(o[t]=new Set),o[t].add(i),r||s.set(e,o)}function Gm(n){let i;
24n._bindings.forEach((e,t)=>{n._to.forEach(s=>{i=s.properties[e.callback?0:n._bindProperties.indexOf(t)],e.to.push([s.observable,i]),Km(n._observable,e,s.observable,i)})})}function Bu(n,i){const t=n[on].get(i);let s;t.callback?s=t.callback.apply(n,t.to.map(r=>r[0][r[1]])):(s=t.to[0],s=s[0][s[1]]),Object.prototype.hasOwnProperty.call(n,i)?n[i]=s:n.set(i,s)}function jm(n,i){i.forEach(e=>{const t=n[bn];let s;t.get(e.observable)||n.listenTo(e.observable,"change",(r,o)=>{s=t.get(e.observable)[o],s&&s.forEach(a=>{Bu(n,a.property)})})})}/**
25 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
26 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
27 */class eT{constructor(){u(this,"_replacedElements");this._replacedElements=[]}replace(i,e){this._replacedElements.push({element:i,newElement:e}),i.style.display="none",e&&i.parentNode.insertBefore(e,i.nextSibling)}restore(){this._replacedElements.forEach(({element:i,newElement:e})=>{i.style.display="",e&&e.remove()}),this._replacedElements=[]}}/**
28 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
29 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
30 */function jr(n){let i=0;for(const e of n)i++;return i}/**
31 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
32 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
33 */function ue(n,i){const e=Math.min(n.length,i.length);for(let t=0;t<e;t++)if(n[t]!=i[t])return t;return n.length==i.length?"same":n.length<i.length?"prefix":"extension"}/**
34 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
35 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
36 */function Te(n){return!!(n&&n[Symbol.iterator])}function Ue(n,i,e={},t=[]){const s=e&&e.xmlns,r=s?n.createElementNS(s,i):n.createElement(i);for(const o in e)r.setAttribute(o,e[o]);(Pa(t)||!Te(t))&&(t=[t]);for(let o of t)Pa(o)&&(o=n.createTextNode(o)),r.appendChild(o);return r}class Lu{constructor(i,e){u(this,"_config");this._config=Object.create(null),e&&this.define(La(e)),i&&this._setObjectToTarget(this._config,i)}set(i,e){this._setToTarget(this._config,i,e)}define(i,e){this._setToTarget(this._config,i,e,!0)}get(i){return this._getFromSource(this._config,i)}*names(){for(const i of Object.keys(this._config))yield i}_setToTarget(i,e,t,s=!1){if(it(e)){this._setObjectToTarget(i,e,s);return}const r=e.split(".");e=r.pop();for(const o of r)it(i[o])||(i[o]=Object.create(null)),i=i[o];if(it(t)){it(i[e])||(i[e]=Object.create(null)),i=i[e],this._setObjectToTarget(i,t,s);return}s&&typeof i[e]<"u"||(i[e]=t)}_getFromSource(i,e){const t=e.split(".");e=t.pop();for(const s of t){if(!it(i[s])){i=null;break}i=i[s]}return i?La(i[e]):void 0}_setObjectToTarget(i,e,t){Object.keys(e).forEach(s=>{this._setToTarget(i,s,e[s],t)})}}function La(n){return Ns(n,Jm)}function Jm(n){return xt(n)||typeof n=="function"?n:void 0}/**
37 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
38 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
39 */function St(n){if(n){if(n.defaultView)return n instanceof n.defaultView.Document;if(n.ownerDocument&&n.ownerDocument.defaultView)return n instanceof n.ownerDocument.defaultView.Node}return!1}/**
40 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
41 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
42 */function ws(n){const i=Object.prototype.toString.apply(n);return i=="[object Window]"||i=="[object global]"}const Qm=De(H());function De(n){if(!n)return Qm;class i extends n{listenTo(t,s,r,o={}){if(St(t)||ws(t)||t instanceof C.window.EventTarget){const a={capture:!!o.useCapture,passive:!!o.usePassive},l=this._getProxyEmitter(t,a)||new Ym(t,a);this.listenTo(l,s,r,o)}else super.listenTo(t,s,r,o)}stopListening(t,s,r){if(St(t)||ws(t)||t instanceof C.window.EventTarget){const o=this._getAllProxyEmitters(t);for(const a of o)this.stopListening(a,s,r)}else super.stopListening(t,s,r)}_getProxyEmitter(t,s){return Lm(this,Fu(t,s))}_getAllProxyEmitters(t){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(s=>this._getProxyEmitter(t,s)).filter(s=>!!s)}}return i}class Ym extends H(){constructor(e,t){super();u(this,"_domNode");u(this,"_options");u(this,"_domListeners");
42Ru(this,Fu(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,s){this.attach(e),H().prototype._addEventListener.call(this,e,t,s)}_removeEventListener(e,t){H().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=s=>{this.fire(e,s)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function Xm(n){return n["data-ck-expando"]||(n["data-ck-expando"]=me())}function Fu(n,i){let e=Xm(n);for(const t of Object.keys(i).sort())i[t]&&(e+="-"+t);return e}/**
43 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
44 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
45 */function Zm(n){const i=[];let e=n;for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)i.unshift(e),e=e.parentNode;return i}/**
46 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
47 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
48 */function eg(n){return n instanceof HTMLTextAreaElement?n.value:n.innerHTML}/**
49 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
50 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
51 */function Nu(n){const i=n.ownerDocument.defaultView.getComputedStyle(n);return{top:parseInt(i.borderTopWidth,10),right:parseInt(i.borderRightWidth,10),bottom:parseInt(i.borderBottomWidth,10),left:parseInt(i.borderLeftWidth,10)}}/**
52 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
53 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
54 */function Du(n){if(!n.target)return null;const i=n.target.ownerDocument,e=n.clientX,t=n.clientY;let s=null;return i.caretRangeFromPoint&&i.caretRangeFromPoint(e,t)?s=i.caretRangeFromPoint(e,t):n.rangeParent&&(s=i.createRange(),s.setStart(n.rangeParent,n.rangeOffset),s.collapse(!0)),s}function zu(n){return!n||!n.parentNode||n.offsetParent===C.document.body?null:n.offsetParent}/**
55 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
56 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
57 */function G(n){return Object.prototype.toString.call(n)=="[object Text]"}/**
58 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
59 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
60 */function Ds(n){return Object.prototype.toString.apply(n)=="[object Range]"}const Hu=["top","right","bottom","left","width","height"];class R{constructor(i){u(this,"top");u(this,"right");u(this,"bottom");u(this,"left");u(this,"width");u(this,"height");u(this,"_source");const e=Ds(i);if(Object.defineProperty(this,"_source",{value:i._source||i,writable:!0,enumerable:!1}),Jr(i)||e)if(e){const t=R.getDomRangeRects(i);Hn(this,R.getBoundingRect(t))}else Hn(this,i.getBoundingClientRect());else if(ws(i)){const{innerWidth:t,innerHeight:s}=i;Hn(this,{top:0,right:t,bottom:s,left:0,width:t,height:s})}else Hn(this,i)}clone(){return new R(this)}moveTo(i,e){return this.top=e,this.right=i+this.width,this.bottom=e+this.height,this.left=i,this}moveBy(i,e){return this.top+=e,this.right+=i,this.left+=i,this.bottom+=e,this}getIntersection(i){const e={top:Math.max(this.top,i.top),right:Math.min(this.right,i.right),bottom:Math.min(this.bottom,i.bottom),left:Math.max(this.left,i.left),width:0,height:0};if(e.width=e.right-e.left,e.height=e.bottom-e.top,e.width<0||e.height<0)return null;{const t=new R(e);return t._source=this._source,t}}getIntersectionArea(i){const e=this.getIntersection(i);return e?e.getArea():0}getArea(){return this.width*this.height}getVisible(){const i=this._source;let e=this.clone();if(Fa(i))return e;let t=i,s=i.parentNode||i.commonAncestorContainer,r;for(;s&&!Fa(s);){const o=tg(s)==="visible";t instanceof HTMLElement&&Na(t)==="absolute"&&(r=t);const a=Na(s);if(o||r&&(a==="relative"&&o||a!=="relative")){t=s,s=s.parentNode;continue}const l=new R(s),c=e.getIntersection(l);if(c)c.getArea()<e.getArea()&&(e=c);else return null;t=s,s=s.parentNode}return e}isEqual(i){for(const e of Hu)if(this[e]!==i[e])return!1;return!0}contains(i){const e=this.getIntersection(i);return!!(e&&e.isEqual(i))}toAbsoluteRect(){const{scrollX:i,scrollY:e}=C.window,t=this.clone().moveBy(i,e);if(Jr(t._source)){const s=zu(t._source);s&&ig(t,s)}return t}excludeScrollbarsAndBorders(){const i=this._source;let e,t,s;if(ws(i))e=i.innerWidth-i.document.documentElement.clientWidth,t=i.innerHeight-i.document.documentElement.clientHeight,s=i.getComputedStyle(i.document.documentElement).direction;else{const r=Nu(i);e=i.offsetWidth-i.clientWidth-r.left-r.right,t=i.offsetHeight-i.clientHeight-r.top-r.bottom,s=i.ownerDocument.defaultView.getComputedStyle(i).direction,this.left+=r.left,this.top+=r.top,this.right-=r.right,this.bottom-=r.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=e,s==="ltr"?this.right-=e:this.left+=e,this.height-=t,this.bottom-=t,this}static getDomRangeRects(i){const e=[],t=Array.from(i.getClientRects());if(t.length)for(const s of t)e.push(new R(s));else{let s=i.startContainer;G(s)&&(s=s.parentNode);const r=new R(s.getBoundingClientRect());r.right=r.left,r.width=0,e.push(r)}return e}
60static getBoundingRect(i){const e={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let t=0;for(const s of i)t++,e.left=Math.min(e.left,s.left),e.top=Math.min(e.top,s.top),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom);return t==0?null:(e.width=e.right-e.left,e.height=e.bottom-e.top,new R(e))}}function Hn(n,i){for(const e of Hu)n[e]=i[e]}function Fa(n){return Jr(n)?n===n.ownerDocument.body:!1}function Jr(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&typeof n.getBoundingClientRect=="function"}function Na(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).position:"static"}function tg(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).overflow:"visible"}function ig(n,i){const e=new R(i),t=Nu(i);let s=0,r=0;s-=e.left,r-=e.top,s+=i.scrollLeft,r+=i.scrollTop,s-=t.left,r-=t.top,n.moveBy(s,r)}const K=class K{constructor(i,e){u(this,"_element");u(this,"_callback");K._observerInstance||K._createObserver(),this._element=i,this._callback=e,K._addElementCallback(i,e),K._observerInstance.observe(i)}get element(){return this._element}destroy(){K._deleteElementCallback(this._element,this._callback)}static _addElementCallback(i,e){K._elementCallbacks||(K._elementCallbacks=new Map);let t=K._elementCallbacks.get(i);t||(t=new Set,K._elementCallbacks.set(i,t)),t.add(e)}static _deleteElementCallback(i,e){const t=K._getElementCallbacks(i);t&&(t.delete(e),t.size||(K._elementCallbacks.delete(i),K._observerInstance.unobserve(i))),K._elementCallbacks&&!K._elementCallbacks.size&&(K._observerInstance=null,K._elementCallbacks=null)}static _getElementCallbacks(i){return K._elementCallbacks?K._elementCallbacks.get(i):null}static _createObserver(){K._observerInstance=new C.window.ResizeObserver(i=>{for(const e of i){const t=K._getElementCallbacks(e.target);if(t)for(const s of t)s(e)}})}};u(K,"_observerInstance",null),u(K,"_elementCallbacks",null);let Si=K;/**
61 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
62 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
63 */function Da(n,i){n instanceof HTMLTextAreaElement&&(n.value=i),n.innerHTML=i}/**
64 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
65 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
66 */function Ri(n){return i=>i+n}/**
67 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
68 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
69 */function bi(n){let i=0;for(;n.previousSibling;)n=n.previousSibling,i++;return i}/**
70 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
71 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
72 */function Wu(n,i,e){n.insertBefore(e,n.childNodes[i]||null)}/**
73 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
74 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
75 */function an(n){return n&&n.nodeType===Node.COMMENT_NODE}function ng(n){try{C.document.createAttribute(n)}catch{return!1}return!0}function bt(n){return n?G(n)?bt(n.parentElement):n.getClientRects?!!n.getClientRects().length:!1:!1}function Uo({element:n,target:i,positions:e,limiter:t,fitInViewport:s,viewportOffsetConfig:r}){ps(i)&&(i=i()),ps(t)&&(t=t());const o=zu(n),a=sg(r),l=new R(n),c=za(i,a);let d;if(!c||!a.getIntersection(c))return null;const h={targetRect:c,elementRect:l,positionedElementAncestor:o,viewportRect:a};if(!t&&!s)d=new $u(e[0],h);else{if(t){const f=za(t,a);f&&(h.limiterRect=f)}d=rg(e,h)}return d}function za(n,i){const e=new R(n).getVisible();return e?e.getIntersection(i):null}function sg(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const i=new R(C.window);return i.top+=n.top,i.height-=n.top,i.bottom-=n.bottom,i.height-=n.bottom,i}function rg(n,i){const{elementRect:e}=i,t=e.getArea(),s=n.map(a=>new $u(a,i)).filter(a=>!!a.name);let r=0,o=null;for(const a of s){const{limiterIntersectionArea:l,viewportIntersectionArea:c}=a;if(l===t)return a;const d=c**2+l**2;d>r&&(r=d,o=a)}return o}class $u{constructor(i,e){u(this,"name");u(this,"config");u(this,"_positioningFunctionCoordinates");u(this,"_options");u(this,"_cachedRect");u(this,"_cachedAbsoluteRect");const t=i(e.targetRect,e.elementRect,e.viewportRect,e.limiterRect);if(!t)return;const{left:s,top:r,name:o,config:a}=t;this.name=o,this.config=a,this._positioningFunctionCoordinates={left:s,top:r},this._options=e}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const i=this._options.limiterRect;return i?i.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)}}/**
76 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
77 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
78 */function Ha(n){const i=n.parentNode;i&&i.removeChild(n)}
78function as(){const n=C.window.visualViewport;if(!n||!(P.isiOS||P.isSafari))return{left:0,top:0};const i=Math.max(Math.round(n.offsetLeft),0),e=Math.max(Math.round(n.offsetTop),0);return{left:i,top:e}}function og({target:n,viewportOffset:i=0,ancestorOffset:e=0,alignToTop:t,forceScroll:s}){const r=qo(n);let o=r,a=null;for(i=cg(i);o;){let l;o==r?l=Wa(n):l=Wa(a),lg({parent:l,getRect:()=>or(n,o),alignToTop:t,ancestorOffset:e,forceScroll:s});let c=or(n,o);const d=or(l,o);if(c.height>d.height){const h=c.getIntersection(d);h&&(c=h)}if(ag({window:o,rect:c,viewportOffset:i,alignToTop:t,forceScroll:s}),o.parent!=o){if(a=o.frameElement,o=o.parent,!a)return}else o=null}}function ag({window:n,rect:i,alignToTop:e,forceScroll:t,viewportOffset:s}){const r=i.clone().moveBy(0,s.bottom),o=i.clone().moveBy(0,-s.top),a=new R(n).excludeScrollbarsAndBorders(),l=[o,r],c=e&&t,d=l.every(w=>a.contains(w));let{scrollX:h,scrollY:f}=n;const m=h,g=f;c?f-=a.top-i.top+s.top:d||(qu(o,a)?f-=a.top-i.top+s.top:Uu(r,a)&&(e?f+=i.top-a.top-s.top:f+=i.bottom-a.bottom+s.bottom)),d||(Ku(i,a)?h-=a.left-i.left+s.left:Gu(i,a)&&(h+=i.right-a.right+s.right)),(h!=m||f!==g)&&n.scrollTo(h,f)}function lg({parent:n,getRect:i,alignToTop:e,forceScroll:t,ancestorOffset:s=0,limiterElement:r}){const o=qo(n),a=e&&t;let l,c,d;const h=r||o.document.body;for(;n!=h;)c=i(),l=new R(n).excludeScrollbarsAndBorders(),d=l.contains(c),a?n.scrollTop-=l.top-c.top+s:d||(qu(c,l)?n.scrollTop-=l.top-c.top+s:Uu(c,l)&&(e?n.scrollTop+=c.top-l.top-s:n.scrollTop+=c.bottom-l.bottom+s)),d||(Ku(c,l)?n.scrollLeft-=l.left-c.left+s:Gu(c,l)&&(n.scrollLeft+=c.right-l.right+s)),n=n.parentNode}function Uu(n,i){return n.bottom>i.bottom}function qu(n,i){return n.top<i.top}function Ku(n,i){return n.left<i.left}function Gu(n,i){return n.right>i.right}function qo(n){return Ds(n)?n.startContainer.ownerDocument.defaultView:n.ownerDocument.defaultView}function Wa(n){if(Ds(n)){let i=n.commonAncestorContainer;return G(i)&&(i=i.parentNode),i}else return n.parentNode}function or(n,i){const e=qo(n),t=new R(n);if(e===i)return t;{let s=e;for(;s!=i;){const r=s.frameElement,o=new R(r).excludeScrollbarsAndBorders();t.moveBy(o.left,o.top),s=s.parent}}return t}function cg(n){return typeof n=="number"?{top:n,bottom:n,left:n,right:n}:n}const ug={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},dg={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},$a={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},V=pg(),hg=Object.fromEntries(Object.entries(V).map(([n,i])=>{let e;return i in $a?e=$a[i]:e=n.charAt(0).toUpperCase()+n.slice(1),[i,e]}));function Kt(n){let i;if(typeof n=="string"){if(i=V[n.toLowerCase()],!i)throw new p("keyboard-unknown-key",null,{key:n})}else i=n.keyCode+(n.altKey?V.alt:0)+(n.ctrlKey?V.ctrl:0)+(n.shiftKey?V.shift:0)+(n.metaKey?V.cmd:0);return i}function zs(n){return typeof n=="string"&&(n=wg(n)),n.map(i=>typeof i=="string"?mg(i):i).reduce((i,e)=>e+i,0)}function bs(n,i){let e=zs(n);const t=P.isMac||P.isiOS;return Object.entries(t?ug:dg).reduce((o,[a,l])=>((e&V[a])!=0&&(e&=~V[a],o+=l),o),"")+(e?hg[e]:"")}function fg(n){return n==V.arrowright||n==V.arrowleft||n==V.arrowup||n==V.arrowdown}function Ko(n,i){const e=i==="ltr";switch(n){case V.arrowleft:return e?"left":"right";case V.arrowright:return e?"right":"left";case V.arrowup:return"up";case V.arrowdown:return"down"}}function mg(n){if(n.endsWith("!"))return Kt(n.slice(0,-1));const i=Kt(n);return(P.isMac||P.isiOS)&&i==V.ctrl?V.cmd:i}function gg(n,i){const e=Ko(n,i);return e==="down"||e==="right"}function pg(){const n={pageup:33,pagedown:34,end:35,home:36,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 i=65;i<=90;i++){const e=String.fromCharCode(i);n[e.toLowerCase()]=i}for(let i=48;i<=57;i++)n[i-48]=i;for(let i=112;i<=123;i++)n["f"+(i-111)]=i;return Object.assign(n,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),n}function wg(n){return n.split("+").map(i=>i.trim())}/**
79 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
80 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
81 */const bg=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig","ur","urd"];function Ua(n){return bg.includes(n)?"rtl":"ltr"}/**
82 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
83 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
84 */function Y(n){return Array.isArray(n)?n:[n]}/* istanbul ignore else -- @preserve */C.window.CKEDITOR_TRANSLATIONS||(C.window.CKEDITOR_TRANSLATIONS={});function _g(n,i,e=1,t){if(typeof e!="number")throw new p("translation-service-quantity-not-a-number",null,{quantity:e});const s=t||C.window.CKEDITOR_TRANSLATIONS,r=kg(s);r===1&&(n=Object.keys(s)[0]);const o=i.id||i.string;if(r===0||!vg(n,o,s))return e!==1?i.plural:i.string;const a=s[n].dictionary,l=s[n].getPluralForm||(h=>h===1?0:1),c=a[o];if(typeof c=="string")return c;const d=Number(l(e));return c[d]}function yg(n){return Array.isArray(n)?n.reduce((i,e)=>$o(i,e)):n}function vg(n,i,e){return!!e[n]&&!!e[n].dictionary[i]}function kg(n){return Object.keys(n).length}class Cg{constructor({uiLanguage:i="en",contentLanguage:e,translations:t}={}){u(this,"uiLanguage");u(this,"uiLanguageDirection");u(this,"contentLanguage");u(this,"contentLanguageDirection");u(this,"t");u(this,"translations");this.uiLanguage=i,this.contentLanguage=e||this.uiLanguage,this.uiLanguageDirection=Ua(this.uiLanguage),this.contentLanguageDirection=Ua(this.contentLanguage),this.translations=yg(t),this.t=(s,r)=>this._t(s,r)}_t(i,e=[]){e=Y(e),typeof i=="string"&&(i={string:i});const s=!!i.plural?e[0]:1,r=_g(this.uiLanguage,i,s,this.translations);return Eg(r,e)}}function Eg(n,i){return n.replace(/%(\d+)/g,(e,t)=>t<i.length?i[t]:e)}class Se extends H(){constructor(e={},t={}){super();u(this,"_items");u(this,"_itemMap");u(this,"_idProperty");u(this,"_bindToCollection");u(this,"_bindToExternalToInternalMap");u(this,"_bindToInternalToExternalMap");u(this,"_skippedIndexesFromExternal");const s=Te(e);
84if(s||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],s)for(const r of e)this._items.push(r),this._itemMap.set(this._getItemIdBeforeAdding(r),r)}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 p("collection-add-item-invalid-index",this);let s=0;for(const r of e){const o=this._getItemIdBeforeAdding(r),a=t+s;this._items.splice(a,0,r),this._itemMap.set(o,r),this.fire("add",r,a),s++}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 p("collection-get-invalid-arg",this);return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=this._idProperty,s=e[t];return s&&this._itemMap.has(s)}}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,s]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:s}),t}map(e,t){return this._items.map(e,t)}forEach(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 p("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(s=>new t(s))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(s=>s[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,s=(r,o,a)=>{const l=t._bindToCollection==this,c=t._bindToInternalToExternalMap.get(o);if(l&&c)this._bindToExternalToInternalMap.set(o,c),this._bindToInternalToExternalMap.set(c,o);else{const d=e(o);if(!d){this._skippedIndexesFromExternal.push(a);return}let h=a;for(const f of this._skippedIndexesFromExternal)a>f&&h--;for(const f of t._skippedIndexesFromExternal)h>=f&&h++;this._bindToExternalToInternalMap.set(o,d),this._bindToInternalToExternalMap.set(d,o),this.add(d,h);for(let f=0;f<t._skippedIndexesFromExternal.length;f++)h<=t._skippedIndexesFromExternal[f]&&t._skippedIndexesFromExternal[f]++}};for(const r of t)s(null,r,t.getIndex(r));this.listenTo(t,"add",s),this.listenTo(t,"remove",(r,o,a)=>{const l=this._bindToExternalToInternalMap.get(o);l&&this.remove(l),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((c,d)=>(a<d&&c.push(d-1),a>d&&c.push(d),c),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let s;if(t in e){if(s=e[t],typeof s!="string")throw new p("collection-add-invalid-id",this);if(this.get(s))throw new p("collection-add-item-already-exists",this)}else e[t]=s=me();return s}_remove(e){let t,s,r,o=!1;const a=this._idProperty;if(typeof e=="string"?(s=e,r=this._itemMap.get(s),o=!r,r&&(t=this._items.indexOf(r))):typeof e=="number"?(t=e,r=this._items[t],o=!r,r&&(s=r[a])):(r=e,s=r[a],t=this._items.indexOf(r),o=t==-1||!this._itemMap.get(s)),o)throw new p("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(s);const l=this._bindToInternalToExternalMap.get(r);return this._bindToInternalToExternalMap.delete(r),this._bindToExternalToInternalMap.delete(l),this.fire("remove",r,t),[r,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}/**
85 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
86 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
87 */function ye(n){const i=n.next();return i.done?null:i.value}class de extends De(q()){constructor(){super();u(this,"_elements",new Set);u(this,"_externalViews",new Set);u(this,"_blurTimeout",null);this.set("isFocused",!1),this.set("focusedElement",null)}get elements(){return Array.from(this._elements.values())}get externalViews(){return Array.from(this._externalViews.values())}add(e){if(Ka(e))this._addElement(e);else if(qa(e))this._addView(e);else{if(!e.element)throw new p("focustracker-add-view-missing-element",{focusTracker:this,view:e});this._addElement(e.element)}}remove(e){Ka(e)?this._removeElement(e):qa(e)?this._removeView(e):this._removeElement(e.element)}_addElement(e){if(this._elements.has(e))throw new p("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>{const t=this.externalViews.find(s=>Tg(e,s));t?this._focus(t.element):this._focus(e)},{useCapture:!0}),this.listenTo(e,"blur",()=>{this._blur()},{useCapture:!0}),this._elements.add(e)}_removeElement(e){this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e)),e===this.focusedElement&&this._blur()}_addView(e){e.element&&this._addElement(e.element),this.listenTo(e.focusTracker,"change:focusedElement",()=>{e.focusTracker.focusedElement?e.element&&this._focus(e.element):this._blur()}),this._externalViews.add(e)}_removeView(e){e.element&&this._removeElement(e.element),this.stopListening(e.focusTracker),this._externalViews.delete(e)}destroy(){this.stopListening(),this._elements.clear(),this._externalViews.clear(),this.isFocused=!1,this.focusedElement=null}_focus(e){this._clearBlurTimeout(),this.focusedElement=e,this.isFocused=!0}_blur(){this.elements.find(s=>s.contains(document.activeElement))||this.externalViews.find(s=>s.focusTracker.isFocused&&!s.focusTracker._blurTimeout)||(this._clearBlurTimeout(),this._blurTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0))}_clearBlurTimeout(){clearTimeout(this._blurTimeout),this._blurTimeout=null}}function qa(n){return"focusTracker"in n&&n.focusTracker instanceof de}function Ka(n){return xt(n)}function Tg(n,i){return Ga(n,i)?!0:!!i.focusTracker.externalViews.find(e=>Ga(n,e))}function Ga(n,i){return!!i.element&&i.element.contains(document.activeElement)&&n.c
87ontains(i.element)}class Ie{constructor(){u(this,"_listener");this._listener=new(De())}listenTo(i){this._listener.listenTo(i,"keydown",(e,t)=>{this._listener.fire("_keydown:"+Kt(t),t)})}set(i,e,t={}){const s=zs(i),r=t.priority;this._listener.listenTo(this._listener,"_keydown:"+s,(o,a)=>{t.filter&&!t.filter(a)||(e(a,()=>{a.preventDefault(),a.stopPropagation(),o.stop()}),o.return=!0)},{priority:r})}press(i){return!!this._listener.fire("_keydown:"+Kt(i),i)}stopListening(i){this._listener.stopListening(i)}destroy(){this.stopListening()}}/**
88 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
89 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
90 */function Pg(n){const i=new Map;for(const e in n)i.set(e,n[e]);return i}function je(n){return Te(n)?new Map(n):Pg(n)}/**
91 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
92 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
93 */function ja(n,i,e){const t=n.length,s=i.length;for(let r=t-1;r>=e;r--)n[r+s]=n[r];for(let r=0;r<s;r++)n[e+r]=i[r]}/**
94 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
95 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
96 */function Go(n,i){let e;function t(...s){t.cancel(),e=setTimeout(()=>n(...s),i)}return t.cancel=()=>{clearTimeout(e)},t}/**
97 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
98 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
99 */function jo(n){try{if(!n.startsWith("ey"))return null;const i=atob(n.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(i)}catch{return null}}/**
100 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
101 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
102 */function Ag(){const n=[];for(let i=0;i<256;i++){let e=i;for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e=e>>>1;n[i]=e}return n}function xg(n){const i=Array.isArray(n)?n:[n],e=Ag();let t=-1;const s=i.map(r=>Array.isArray(r)?r.join(""):String(r)).join("");for(let r=0;r<s.length;r++){const o=s.charCodeAt(r);t=t>>>8^e[(t^o)&255]}return t=(t^-1)>>>0,t.toString(16).padStart(8,"0")}/**
103 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
104 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
105 */function Sg(n){return!!n&&n.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n)}function Ig(n){return!!n&&n.length==1&&/[\ud800-\udbff]/.test(n)}function Og(n){return!!n&&n.length==1&&/[\udc00-\udfff]/.test(n)}function Jo(n,i){return Ig(n.charAt(i-1))&&Og(n.charAt(i))}function Qo(n,i){return Sg(n.charAt(i))}const Mg=Rg();function ju(n,i){const e=String(n).matchAll(Mg);return Array.from(e).some(t=>t.index<i&&i<t.index+t[0].length)}function Rg(){const n=[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")],i=new RegExp("\\p{Regional_Indicator}{2}","u").source,e="(?:"+n.map(s=>s.source).join("|")+")",t=`${i}|${e}(?:‍${e})*`;return new RegExp(t,"ug")}/**
106 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
107 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
108 */const Ni=new WeakMap;let Ja=!1;function Vg({view:n,element:i,text:e,isDirectHost:t=!0,keepOnFocus:s=!1}){const r=n.document;Ni.has(r)||(Ni.set(r,new Map),r.registerPostFixer(a=>ar(Ni.get(r),a)),r.on("change:isComposing",()=>{n.change(a=>ar(Ni.get(r),a))},{priority:"high"})),i.is("editableElement")&&i.on("change:placeholder",(a,l,c)=>o(c)),i.placeholder?o(i.placeholder):e&&o(e),e&&zg();function o(a){const l={text:a,isDirectHost:t,keepOnFocus:s,hostElement:t?i:null};Ni.get(r).set(i,l),n.change(c=>ar([[i,l]],c))}}function Bg(n,i){return i.hasClass("ck-placeholder")?!1:(n.addClass("ck-placeholder",i),!0)}function Lg(n,i){return i.hasClass("ck-placeholder")?(n.removeClass("ck-placeholder",i),!0):!1}function Fg(n,i){if(!n.isAttached()||Ng(n))return!1;const e=n.document,s=e.selection.anchor;return e.isComposing&&s&&s.parent===n?!1:i||!e.isFocused?!0:!!s&&s.parent!==n}function Ng(n){for(const i of n.getChildren())if(!i.is("uiElement"))return!0;return!1}function ar(n,i){const e=[];let t=!1;for(const[s,r]of n)r.isDirectHost&&(e.push(s),Qa(i,s,r)&&(t=!0));for(const[s,r]of n){if(r.isDirectHost)continue;const o=Dg(s);o&&(e.includes(o)||(r.hostElement=o,Qa(i,s,r)&&(t=!0)))}return t}function Qa(n,i,e){const{text:t,isDirectHost:s,hostElement:r}=e;let o=!1;return r.getAttribute("data-placeholder")!==t&&(n.setAttribute("data-placeholder",t,r),o=!0),(s||i.childCount==1)&&Fg(r,e.keepOnFocus)?Bg(n,r)&&(o=!0):Lg(n,r)&&(o=!0),o}function Dg(n){if(n.childCount){const i=n.getChild(0);if(i.is("element")&&!i.is("uiElement")&&!i.is("attributeElement"))return i}return null}function zg(){Ja||void 0,Ja=!0}/**
109 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
110 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
111 */class Jt{is(){throw new Error("is() method is abstract")}}class Qt extends H(Jt){constructor(e){super();u(this,"document");u(this,"parent");this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new p("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 s=e.includeSelf?this:this.parent;for(;s;)t[e.parentFirst?"push":"unshift"](s),s=s.parent;return t}getCommonAncestor(e,t={}){const s=this.getAncestors(t),r=e.getAncestors(t);let o=0;for(;s[o]==r[o]&&s[o];)o++;return o===0?null:s[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),s=e.getPath(),r=ue(t,s);switch(r){case"prefix":return!0;case"extension":return!1;default:return t[r]<s[r]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}
111_fireChange(e,t,s){this.fire(`change:${e}`,t,s),this.parent&&this.parent._fireChange(e,t,s)}toJSON(){const e={path:this.getPath(),type:"Node"};return this!==this.root&&this.root.is("rootElement")&&(e.root=this.root.toJSON()),e}}Qt.prototype.is=function(n){return n==="node"||n==="view:node"};class te extends Qt{constructor(e,t){super(e);u(this,"_textData");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 te?this===e||this.data===e.data:!1}toJSON(){const e=super.toJSON();return e.type="Text",e.data=this.data,e}_clone(){return new te(this.document,this.data)}}te.prototype.is=function(n){return n==="$text"||n==="view:$text"||n==="text"||n==="view:text"||n==="node"||n==="view:node"};class ut extends Jt{constructor(e,t,s){super();u(this,"textNode");u(this,"data");u(this,"offsetInText");if(this.textNode=e,t<0||t>e.data.length)throw new p("view-textproxy-wrong-offsetintext",this);if(s<0||t+s>e.data.length)throw new p("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+s),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 s=e.includeSelf?this.textNode:this.parent;for(;s!==null;)t[e.parentFirst?"push":"unshift"](s),s=s.parent;return t}}ut.prototype.is=function(n){return n==="$textProxy"||n==="view:$textProxy"||n==="textProxy"||n==="view:textProxy"};class _s{constructor(){u(this,"_consumables",new Map)}add(i,e){let t;if(i.is("$text")||i.is("documentFragment")){this._consumables.set(i,!0);return}this._consumables.has(i)?t=this._consumables.get(i):(t=new Hg(i),this._consumables.set(i,t)),t.add(e?Yi(e):i._getConsumables())}test(i,e){const t=this._consumables.get(i);return t===void 0?null:i.is("$text")||i.is("documentFragment")?t:t.test(Yi(e))}consume(i,e){if(i.is("$text")||i.is("documentFragment"))return this.test(i,e)?(this._consumables.set(i,!1),!0):!1;const t=this._consumables.get(i);return t===void 0?!1:t.consume(Yi(e))}revert(i,e){const t=this._consumables.get(i);t!==void 0&&(i.is("$text")||i.is("documentFragment")?this._consumables.set(i,!0):t.revert(Yi(e)))}static createFrom(i,e){if(e||(e=new _s),i.is("$text"))e.add(i);else if(i.is("element")||i.is("documentFragment")){e.add(i);for(const t of i.getChildren())_s.createFrom(t,e)}return e}}class Hg{constructor(i){u(this,"element");u(this,"_canConsumeName",null);u(this,"_attributes",new Map);this.element=i}add(i){i.name&&(this._canConsumeName=!0);for(const[e,t]of i.attributes)if(t){let s=this._attributes.get(e);(!s||typeof s=="boolean")&&(s=new Map,this._attributes.set(e,s)),s.set(t,!0)}else{if(e=="style"||e=="class")throw new p("viewconsumable-invalid-attribute",this);this._attributes.set(e,!0)}}test(i){if(i.name&&!this._canConsumeName)return this._canConsumeName;for(const[e,t]of i.attributes){const s=this._attributes.get(e);if(s===void 0)return null;if(s===!1)return!1;if(s!==!0){if(t){const r=s.get(t);if(r===void 0)return null;if(!r)return!1}else for(const r of s.values())if(!r)return!1}}return!0}consume(i){if(!this.test(i))return!1;i.name&&(this._canConsumeName=!1);for(const[e,t]of i.attributes){const s=this._attributes.get(e);if(typeof s=="boolean")for(const[r]of this.element._getConsumables(e,t).attributes)this._attributes.set(r,!1);else if(t)for(const[,r]of this.element._getConsumables(e,t).attributes)s.set(r,!1);else for(const r of s.keys())s.set(r,!1)}return!0}revert(i){i.name&&(this._canConsumeName=!0);for(const[e,t]of i.attributes){const s=this._attributes.get(e);if(s===!1){this._attributes.set(e,!0);continue}if(!(s===void 0||s===!0))if(t)s.get(t)===!1&&s.set(t,!0);else for(const r of s.keys())s.set(r,!0)}}}function Yi(n){const i=[];return"attributes"in n&&n.attributes&&lr(i,n.attributes),"classes"in n&&n.classes&&lr(i,n.classes,"class"),"styles"in n&&n.styles&&lr(i,n.styles,"style"),{name:n.name||!1,attributes:i}}function lr(n,i,e){if(typeof i=="string"){n.push(e?[e,i]:[i]);return}for(const t of i)Array.isArray(t)?n.push(t):n.push(e?[e,t]:[t])}class Pe{constructor(...i){u(this,"_patterns",[]);this.add(...i)}add(...i){for(let e of i)(typeof e=="string"||e instanceof RegExp)&&(e={name:e}),this._patterns.push(e)}match(...i){for(const e of i)for(const t of this._patterns){const s=this._isElementMatching(e,t);if(s)return{element:e,pattern:t,match:s}}return null}matchAll(...i){const e=[];for(const t of i)for(const s of this._patterns){const r=this._isElementMatching(t,s);r&&e.push({element:t,pattern:s,match:r})}return e.length>0?e:null}getElementName(){if(this._patterns.length!==1)return null;const i=this._patterns[0],e=i.name;return typeof i!="function"&&e&&!(e instanceof RegExp)?e:null}_isElementMatching(i,e){if(typeof e=="function"){const r=e(i);return!r||typeof r!="object"?r:Yi(r)}const t={};if(e.name&&(t.name=Wg(e.name,i.name),!t.name))return null;const s=[];return e.attributes&&!$g(e.attributes,i,s)||e.classes&&!Ug(e.classes,i,s)||e.styles&&
111!qg(e.styles,i,s)?null:(s.length&&(t.attributes=s),t)}}function ys(n,i){return n===!0||n===i||n instanceof RegExp&&!!String(i).match(n)}function Wg(n,i){return n instanceof RegExp?!!i.match(n):n===i}function Yo(n,i){if(Array.isArray(n))return n.map(t=>typeof t!="object"||t instanceof RegExp?i?[i,t,!0]:[t,!0]:((t.key===void 0||t.value===void 0)&&void 0,i?[i,t.key,t.value]:[t.key,t.value]));if(typeof n!="object"||n instanceof RegExp)return[i?[i,n,!0]:[n,!0]];const e=[];for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.push(i?[i,t,n[t]]:[t,n[t]]);return e}function $g(n,i,e){let t;return typeof n=="object"&&!(n instanceof RegExp)&&!Array.isArray(n)?(n.style!==void 0&&void 0,n.class!==void 0&&void 0):t=["class","style"],i._collectAttributesMatch(Yo(n),e,t)}function Ug(n,i,e){return i._collectAttributesMatch(Yo(n,"class"),e)}function qg(n,i,e){return i._collectAttributesMatch(Yo(n,"style"),e)}class ln{constructor(i){u(this,"_styles");u(this,"_cachedStyleNames",null);u(this,"_cachedExpandedStyleNames",null);u(this,"_styleProcessor");this._styles={},this._styleProcessor=i}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(i){this.clear();const e=Gg(i);for(const[t,s]of e)this._styleProcessor.toNormalizedForm(t,s,this._styles);return this}has(i){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(i,this._styles).find(([s])=>s===i);return Array.isArray(t)}set(i,e){if(this._cachedStyleNames=null,this._cachedExpandedStyleNames=null,Le(i))for(const[t,s]of Object.entries(i))this._styleProcessor.toNormalizedForm(t,s,this._styles);else this._styleProcessor.toNormalizedForm(i,e,this._styles)}remove(i){const e={};for(const t of Y(i)){const s=Qr(t),r=At(this._styles,s);if(r)ls(e,s,r);else{const o=this.getAsString(t);o!==void 0&&this._styleProcessor.toNormalizedForm(t,o,e)}}Object.keys(e).length&&(Ju(this._styles,e),this._cachedStyleNames=null,this._cachedExpandedStyleNames=null)}getNormalized(i){return this._styleProcessor.getNormalized(i,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(i=>i.join(":")).sort().join(";")+";"}getAsString(i){if(this.isEmpty)return;if(this._styles[i]&&!Le(this._styles[i]))return this._styles[i];const t=this._styleProcessor.getReducedForm(i,this._styles).find(([s])=>s===i);if(Array.isArray(t))return t[1]}getStyleNames(i=!1){return this.isEmpty?[]:i?(this._cachedExpandedStyleNames||(this._cachedExpandedStyleNames=this._styleProcessor.getStyleNames(this._styles)),this._cachedExpandedStyleNames):(this._cachedStyleNames||(this._cachedStyleNames=this.getStylesEntries().map(([e])=>e)),this._cachedStyleNames)}keys(){return this.getStyleNames()}clear(){this._styles={},this._cachedStyleNames=null,this._cachedExpandedStyleNames=null}isSimilar(i){if(this.size!==i.size)return!1;for(const e of this.getStyleNames())if(!i.has(e)||i.getAsString(e)!==this.getAsString(e))return!1;return!0}getStylesEntries(){const i=[],e=Object.keys(this._styles);for(const t of e)i.push(...this._styleProcessor.getReducedForm(t,this._styles));return i}_clone(){const i=new this.constructor(this._styleProcessor);return i.set(this.getNormalized()),i}_getTokensMatch(i,e){const t=[];
111for(const s of this.getStyleNames(!0))if(ys(i,s)){if(e===!0){t.push(s);continue}const r=this.getAsString(s);ys(e,r)&&t.push(s)}return t.length?t:void 0}_getConsumables(i){const e=[];if(i){e.push(i);for(const t of this._styleProcessor.getRelatedStyles(i))e.push(t)}else for(const t of this.getStyleNames()){for(const s of this._styleProcessor.getRelatedStyles(t))e.push(s);e.push(t)}return e}_canMergeFrom(i){for(const e of i.getStyleNames())if(this.has(e)&&this.getAsString(e)!==i.getAsString(e))return!1;return!0}_mergeFrom(i){for(const e of i.getStyleNames())this.has(e)||this.set(e,i.getAsString(e))}_isMatching(i){for(const e of i.getStyleNames())if(!this.has(e)||this.getAsString(e)!==i.getAsString(e))return!1;return!0}}class Kg{constructor(){u(this,"_normalizers");u(this,"_extractors");u(this,"_reducers");u(this,"_consumables");this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(i,e,t){if(Le(e)){ls(t,Qr(i),e);return}if(this._normalizers.has(i)){const s=this._normalizers.get(i),{path:r,value:o}=s(e);ls(t,r,o)}else ls(t,i,e)}getNormalized(i,e){if(!i)return $o({},e);if(e[i]!==void 0)return e[i];if(this._extractors.has(i)){const t=this._extractors.get(i);if(typeof t=="string")return At(e,t);const s=t(i,e);if(s)return s}return At(e,Qr(i))}getReducedForm(i,e){const t=this.getNormalized(i,e);return t===void 0?[]:this._reducers.has(i)?this._reducers.get(i)(t):[[i,t]]}getStyleNames(i){const e=new Set;for(const t of this._consumables.keys()){const s=this.getNormalized(t,i);s&&(typeof s!="object"||Object.keys(s).length)&&e.add(t)}for(const t of Object.keys(i))e.add(t);return Array.from(e)}getRelatedStyles(i){return this._consumables.get(i)||[]}setNormalizer(i,e){this._normalizers.set(i,e)}setExtractor(i,e){this._extractors.set(i,e)}setReducer(i,e){this._reducers.set(i,e)}setStyleRelation(i,e){this._mapStyleNames(i,e);for(const t of e)this._mapStyleNames(t,[i])}_mapStyleNames(i,e){this._consumables.has(i)||this._consumables.set(i,[]),this._consumables.get(i).push(...e)}}function Gg(n){let i=null,e=0,t=0,s=null;const r=new Map;if(n==="")return r;n.charAt(n.length-1)!=";"&&(n=n+";");for(let o=0;o<n.length;o++){const a=n.charAt(o);if(i===null)switch(a){case":":s||(s=n.substr(e,o-e),t=o+1);break;case'"':case"'":i=a;break;case";":{const l=n.substr(t,o-t);s&&r.set(s.trim(),l.trim()),s=null,e=o+1;break}}else a===i&&(i=null)}return r}function Qr(n){return n.replace("-",".")}function ls(n,i,e){let t=e;Le(e)&&(t=$o({},At(n,i),e)),Pu(n,i,t)}function Ju(n,i){for(const e of Object.keys(i))n[e]!==null&&!Array.isArray(n[e])&&typeof n[e]=="object"&&typeof i[e]=="object"?(Ju(n[e],i[e]),Object.keys(n[e]).length||delete n[e]):delete n[e]}class cr{constructor(){u(this,"_set",new Set)}get isEmpty(){return this._set.size==0}get size(){return this._set.size}has(i){return this._set.has(i)}keys(){return Array.from(this._set.keys())}setTo(i){this.clear();for(const e of i.split(/\s+/))e&&this._set.add(e);return this}set(i){for(const e of Y(i))e&&this._set.add(e)}remove(i){for(const e of Y(i))this._set.delete(e)}clear(){this._set.clear()}toString(){return Array.from(this._set).join(" ")}isSimilar(i){if(this.size!==i.size)return!1;for(const e of this.keys())if(!i.has(e))return!1;return!0}_clone(){const i=new this.constructor;return i._set=new Set(this._set),i}_getTokensMatch(i){const e=[];if(i===!0){for(const t of this._set.keys())e.push(t);return e}if(typeof i=="string"){for(const t of i.split(/\s+/))if(this._set.has(t))e.push(t);else return;return e}for(const t of this._set.keys())t.match(i)&&e.push(t);return e.length?e:void 0}_getConsumables(i){return i?[i]:this.keys()}_canMergeFrom(){return!0}_mergeFrom(i){for(const e of i._set.keys())this._set.has(e)||this._set.add(e)}_isMatching(i){for(const e of i._set.keys())if(!this._set.has(e))return!1;return!0}}class Je extends Qt{constructor(e,t,s,r){super(e);u(this,"name");u(this,"_unsafeAttributesToRender",[]);u(this,"_attrs");u(this,"_children");u(this,"_customProperties",new Map);this.name=t,this._attrs=this._parseAttributes(s),this._children=[],r&&this._insertChild(0,r)}get _classes(){return this._attrs.get("class")}get _styles(){return this._attrs.get("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&&(yield"class"),this._styles&&(yield"style");for(const e of this._attrs.keys())e!="class"&&e!="style"&&(yield e)}*getAttributes(){for(const[e,t]of this._attrs.entries())yield[e,String(t)]}getAttribute(e){return this._attrs.has(e)?String(this._attrs.get(e)):void 0}hasAttribute(e,t){return this._attrs.has(e)?t!==void 0?si(this.name,e)||Di(this.name,e)?this._attrs.get(e).has(t):this._attrs.get(e)===t:!0:!1}isSimilar(e){if(!(e instanceof Je))return!1;if(this===e)return!0;
111if(this.name!=e.name||this._attrs.size!==e._attrs.size)return!1;for(const[t,s]of this._attrs){const r=e._attrs.get(t);if(r===void 0)return!1;if(typeof s=="string"||typeof r=="string"){if(r!==s)return!1}else if(!s.isSimilar(r))return!1}return!0}hasClass(...e){for(const t of e)if(!this._classes||!this._classes.has(t))return!1;return!0}getClassNames(){const e=this._classes?this._classes.keys():[],t=e[Symbol.iterator]();return Object.assign(e,{next:t.next.bind(t)})}getStyle(e){return this._styles&&this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles&&this._styles.getNormalized(e)}getStyleNames(e){return this._styles?this._styles.getStyleNames(e):[]}hasStyle(...e){for(const t of e)if(!this._styles||!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Pe(...e);let s=this.parent;for(;s&&!s.is("documentFragment");){if(t.match(s))return s;s=s.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=this._classes?this._classes.keys().sort().join(","):"",t=this._styles&&String(this._styles),s=Array.from(this._attrs).filter(([r])=>r!="style"&&r!="class").map(r=>`${r[0]}="${r[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(s==""?"":` ${s}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}toJSON(){const e=super.toJSON();if(e.name=this.name,e.type="Element",this._attrs.size&&(e.attributes=Object.fromEntries(this.getAttributes())),this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=[];if(e)for(const r of this.getChildren())t.push(r._clone(e));const s=new this.constructor(this.document,this.name,this._attrs,t);return s._customProperties=new Map(this._customProperties),s.getFillerOffset=this.getFillerOffset,s._unsafeAttributesToRender=this._unsafeAttributesToRender,s}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this,{index:e});let s=0;const r=jg(this.document,t);for(const o of r)o.parent!==null&&o._remove(),o.parent=this,o.document=this.document,this._children.splice(e,0,o),e++,s++;return s}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let s=e;s<e+t;s++)this._children[s].parent=null;return this._children.splice(e,t)}_setAttribute(e,t,s=!0){if(this._fireChange("attributes",this),si(this.name,e)||Di(this.name,e)){let r=this._attrs.get(e);r||(r=si(this.name,e)?new ln(this.document.stylesProcessor):new cr,this._attrs.set(e,r)),s?r.setTo(String(t)):si(this.name,e)?Array.isArray(t)?r.set(t[0],t[1]):r.set(t):r.set(typeof t=="string"?t.split(/\s+/):t)}else this._attrs.set(e,String(t))}_removeAttribute(e,t){if(this._fireChange("attributes",this),t!==void 0&&(si(this.name,e)||Di(this.name,e))){const s=this._attrs.get(e);return s?(Di(this.name,e)&&typeof t=="string"&&(t=t.split(/\s+/)),s.remove(t),s.isEmpty?this._attrs.delete(e):!1):!1}return this._attrs.delete(e)}_addClass(e){this._setAttribute("class",e,!1)}_removeClass(e){this._removeAttribute("class",e)}_setStyle(e,t){typeof e!="string"?this._setAttribute("style",e,!1):this._setAttribute("style",[e,t],!1)}_removeStyle(e){this._removeAttribute("style",e)}_collectAttributesMatch(e,t,s){for(const[r,o,a]of e){let l=!1,c=!1;for(const[d,h]of this._attrs)if(!(s&&s.includes(d)||!ys(r,d)))if(l=!0,typeof h=="string"){if(ys(o,h))t.push([d]),c=!0;else if(!(r instanceof RegExp))return!1}else{const f=h._getTokensMatch(o,a||!0);if(f){c=!0;for(const m of f)t.push([d,m])}else if(!(r instanceof RegExp))return!1}if(!l||!c)return!1}return!0}_getConsumables(e,t){const s=[];if(e){const r=this._attrs.get(e);if(r!==void 0)if(typeof r=="string")s.push([e]);else for(const o of r._getConsumables(t))s.push([e,o])}else for(const[r,o]of this._attrs)if(typeof o=="string")s.push([r]);else for(const a of o._getConsumables())s.push([r,a]);return{name:!e,attributes:s}}_canMergeAttributesFrom(e){if(this.name!=e.name)return!1;for(const[t,s]of e._attrs){const r=this._attrs.get(t);if(r!==void 0){if(typeof r=="string"||typeof s=="string"){if(r!==s)return!1}else if(!r._canMergeFrom(s))return!1}}return!0}_mergeAttributesFrom(e){this._fireChange("attributes",this);for(const[t,s]of e._attrs){const r=this._attrs.get(t);r===void 0||typeof r=="string"||typeof s=="string"?this._setAttribute(t,s):r._mergeFrom(s)}}_canSubtractAttributesOf(e){if(this.name!=e.name)return!1;for(const[t,s]of e._attrs){const r=this._attrs.get(t);if(r===void 0)return!1;if(typeof r=="string"||typeof s=="string"){if(r!==s)return!1}else if(!r._isMatching(s))return!1}return!0}_subtractAttributesOf(e){this._fireChange("attributes",this);for(const[t,s]of e._attrs){const r=this._attrs.get(t);typeof r=="string"||typeof s=="string"?this._attrs.delete(t):(r.remove(s.keys()),r.isEmpty&&this._attrs.delete(t))}}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}_parseAttributes(e){const t=je(e);for(const[s,r]of t)if(r===null)t.delete(s);
111else if(si(this.name,s)){const o=r instanceof ln?r._clone():new ln(this.document.stylesProcessor).setTo(String(r));t.set(s,o)}else if(Di(this.name,s)){const o=r instanceof cr?r._clone():new cr().setTo(String(r));t.set(s,o)}else typeof r!="string"&&t.set(s,String(r));return t}}Je.prototype.is=function(n,i){return i?i===this.name&&(n==="element"||n==="view:element"):n==="element"||n==="view:element"||n==="node"||n==="view:node"};function jg(n,i){if(typeof i=="string")return[new te(n,i)];Te(i)||(i=[i]);const e=[];for(const t of i)typeof t=="string"?e.push(new te(n,t)):t instanceof ut?e.push(new te(n,t.data)):e.push(t);return e}function Di(n,i){return i=="class"||n=="a"&&i=="rel"}function si(n,i){return i=="style"}class _n extends Je{constructor(i,e,t,s){super(i,e,t,s),this.getFillerOffset=Jg}toJSON(){const i=super.toJSON();return i.type="ContainerElement",i}}_n.prototype.is=function(n,i){return i?i===this.name&&(n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function Jg(){const n=[...this.getChildren()],i=n[this.childCount-1];if(i&&i.is("element","br"))return this.childCount;for(const e of n)if(!e.is("uiElement"))return null;return this.childCount}class Hs extends q(_n){constructor(i,e,t,s){super(i,e,t,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(i),this.bind("isFocused").to(i,"isFocused",r=>r&&i.selection.editableElement==this),this.listenTo(i.selection,"change",()=>{this.isFocused=i.isFocused&&i.selection.editableElement==this})}destroy(){this.stopListening()}toJSON(){const i=super.toJSON();return i.type="EditableElement",i.isReadOnly=this.isReadOnly,i.isFocused=this.isFocused,i}}Hs.prototype.is=function(n,i){return i?i===this.name&&(n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};const Ya=Symbol("rootName");class Qu extends Hs{constructor(i,e){super(i,e),this.rootName="main"}get rootName(){return this.getCustomProperty(Ya)}set rootName(i){this._setCustomProperty(Ya,i)}toJSON(){return this.rootName}set _name(i){this.name=i}}Qu.prototype.is=function(n,i){return i?i===this.name&&(n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};class $t{constructor(i={}){u(this,"direction");u(this,"boundaries");u(this,"singleCharacters");u(this,"shallow");u(this,"ignoreElementEnd");u(this,"_position");u(this,"_boundaryStartParent");u(this,"_boundaryEndParent");if(!i.boundaries&&!i.startPosition)throw new p("view-tree-walker-no-start-position",null);if(i.direction&&i.direction!="forward"&&i.direction!="backward")throw new p("view-tree-walker-unknown-direction",i.startPosition,{direction:i.direction});this.boundaries=i.boundaries||null,i.startPosition?this._position=k._createAt(i.startPosition):this._position=k._createAt(i.boundaries[i.direction=="backward"?"end":"start"]),this.direction=i.direction||"forward",this.singleCharacters=!!i.singleCharacters,this.shallow=!!i.shallow,this.ignoreElementEnd=!!i.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(i){let e,t;do t=this.position,e=this.next();while(!e.done&&i(e.value));e.done||(this._position=t)}jumpTo(i){this._boundaryStartParent&&i.isBefore(this.boundaries.start)?i=this.boundaries.start:this._boundaryEndParent&&i.isAfter(this.boundaries.end)&&(i=this.boundaries.end),this._position=i.clone()}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let i=this.position.clone();const e=this.position,t=i.parent;if(t.parent===null&&i.offset===t.childCount)return{done:!0,value:void 0};if(t===this._boundaryEndParent&&i.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;
111if(t&&t.is("view:$text")){if(i.isAtEnd)return this._position=k._createAfter(t),this._next();s=t.data[i.offset]}else s=t.getChild(i.offset);if(typeof s=="string"){let r;this.singleCharacters?r=1:r=(t===this._boundaryEndParent?this.boundaries.end.offset:t.data.length)-i.offset;const o=new ut(t,i.offset,r);return i.offset+=r,this._position=i,this._formatReturnValue("text",o,e,i,r)}if(s&&s.is("view:element")){if(!this.shallow)i=new k(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(i))return{done:!0,value:void 0};i.offset++}return this._position=i,this._formatReturnValue("elementStart",s,e,i,1)}if(s&&s.is("view:$text")){if(this.singleCharacters)return i=new k(s,0),this._position=i,this._next();let r=s.data.length,o;return s==this._boundaryEndParent?(r=this.boundaries.end.offset,o=new ut(s,0,r),i=k._createAfter(o)):(o=new ut(s,0,s.data.length),i.offset++),this._position=i,this._formatReturnValue("text",o,e,i,r)}return i=k._createAfter(t),this._position=i,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",t,e,i)}_previous(){let i=this.position.clone();const e=this.position,t=i.parent;if(t.parent===null&&i.offset===0)return{done:!0,value:void 0};if(t==this._boundaryStartParent&&i.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(t.is("view:$text")){if(i.isAtStart)return this._position=k._createBefore(t),this._previous();s=t.data[i.offset-1]}else s=t.getChild(i.offset-1);if(typeof s=="string"){let r;if(this.singleCharacters)r=1;else{const a=t===this._boundaryStartParent?this.boundaries.start.offset:0;r=i.offset-a}i.offset-=r;const o=new ut(t,i.offset,r);return this._position=i,this._formatReturnValue("text",o,e,i,r)}if(s&&s.is("view:element"))return this.shallow?(i.offset--,this._position=i,this._formatReturnValue("elementStart",s,e,i,1)):(i=new k(s,s.childCount),this._position=i,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,e,i));if(s&&s.is("view:$text")){if(this.singleCharacters)return i=new k(s,s.data.length),this._position=i,this._previous();let r=s.data.length,o;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;o=new ut(s,a,s.data.length-a),r=o.data.length,i=k._createBefore(o)}else o=new ut(s,0,s.data.length),i.offset--;return this._position=i,this._formatReturnValue("text",o,e,i,r)}return i=k._createBefore(t),this._position=i,this._formatReturnValue("elementStart",t,e,i,1)}_formatReturnValue(i,e,t,s,r){return e.is("view:$textProxy")&&(e.offsetInText+e.data.length==e.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=k._createAfter(e.textNode),this._position=s):t=k._createAfter(e.textNode)),e.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=k._createBefore(e.textNode),this._position=s):t=k._createBefore(e.textNode))),{done:!1,value:{type:i,item:e,previousPosition:t,nextPosition:s,length:r}}}}class k extends Jt{constructor(e,t){super();u(this,"parent");u(this,"offset");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 Hs);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const t=k._createAt(this),s=t.offset+e;return t.offset=s<0?0:s,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const s=new $t(t);return s.skip(e),s.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),s=e.getAncestors();let r=0;for(;t[r]==s[r]&&t[r];)r++;return r===0?null:t[r-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():[],s=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),s.push(e.offset);const r=ue(t,s);switch(r){case"prefix":return"before";case"extension":return"after";default:return t[r]<s[r]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new $t(e)}clone(){return new k(this.parent,this.offset)}toJSON(){return{parent:this.parent.toJSON(),offset:this.offset}}static _createAt(e,t){if(e instanceof k)return new this(e.parent,e.offset);{const s=e;if(t=="end")t=s.is("$text")?s.data.length:s.childCount;else{if(t=="before")return this._createBefore(s);if(t=="after")return this._createAfter(s);if(t!==0&&!t)throw new p("view-createpositionat-offset-required",s)}return new k(s,t)}}static _createAfter(e){if(e.is("$textProxy"))return new k(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new p("view-position-after-root",e,{root:e});return new k(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new k(e.textNode,e.offsetInText);if(!e.parent)throw new p("view-position-before-root",e,{root:e});return new k(e.parent,e.index)}}k.prototype.is=function(n){return n==="position"||n==="view:position"};class I extends Jt{constructor(e,t=null){super();u(this,"start");u(this,"end");this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new $t({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(Wn,{direction:"backward"}),t=this.end.getLastMatchingPosition(Wn);return e.parent.is("$text")&&e.isAtStart&&(e=k._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=k._createAfter(t.parent)),new I(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(Wn);if(e.isAfter(this.end)||e.isEqual(this.end))return new I(e,e);let t=this.end.getLastMatchingPosition(Wn,{direction:"backward"});const s=e.nodeAfter,r=t.nodeBefore;return s&&s.is("$text")&&(e=new k(s,0)),r&&r.is("$text")&&(t=new k(r,r.data.length)),new I(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 s=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),r=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return s&&r}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new I(this.start,e.start)),this.containsPosition(e.end)&&t.pu
111sh(new I(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,s=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(s=e.end),new I(t,s)}return null}getWalker(e={}){return e.boundaries=this,new $t(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 I(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new $t(e);for(const s of t)yield s.item}*getPositions(e={}){e.boundaries=this;const t=new $t(e);yield t.position;for(const s of t)yield s.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static _createFromParentsAndOffsets(e,t,s,r){return new this(new k(e,t),new k(s,r))}static _createFromPositionAndShift(e,t){const s=e,r=e.getShiftedBy(t);return t>0?new this(s,r):new this(r,s)}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)}}I.prototype.is=function(n){return n==="range"||n==="view:range"};function Wn(n){return!!(n.item.is("attributeElement")||n.item.is("uiElement"))}class Ge extends H(Jt){constructor(...e){super();u(this,"_ranges");u(this,"_lastRangeBackward");u(this,"_isFake");u(this,"_fakeSelectionLabel");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 s=!1;for(const r of e._ranges)if(t.isEqual(r)){s=!0;break}if(!s)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=jr(this.getRanges()),s=jr(e.getRanges());if(t!=s)return!1;if(t==0)return!0;for(let r of this.getRanges()){r=r.getTrimmed();let o=!1;for(let a of e.getRanges())if(a=a.getTrimmed(),r.start.isEqual(a.start)&&r.end.isEqual(a.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,s,r]=e;if(typeof s=="object"&&(r=s,s=void 0),t===null)this._setRanges([]),this._setFakeOptions(r);else if(t instanceof Ge||t instanceof Xo)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof I)this._setRanges([t],r&&r.backward),this._setFakeOptions(r);
111else if(t instanceof k)this._setRanges([new I(t)]),this._setFakeOptions(r);else if(t instanceof Qt){const o=!!r&&!!r.backward;let a;if(s===void 0)throw new p("view-selection-setto-required-second-parameter",this);s=="in"?a=I._createIn(t):s=="on"?a=I._createOn(t):a=new I(k._createAt(t,s)),this._setRanges([a],o),this._setFakeOptions(r)}else if(Te(t))this._setRanges(t,r&&r.backward),this._setFakeOptions(r);else throw new p("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new p("view-selection-setfocus-no-ranges",this);const s=k._createAt(e,t);if(s.compareWith(this.focus)=="same")return;const r=this.anchor;this._ranges.pop(),s.compareWith(r)=="before"?this._addRange(new I(s,r),!0):this._addRange(new I(r,s)),this.fire("change")}toJSON(){const e={ranges:Array.from(this.getRanges()).map(t=>t.toJSON())};return this.isBackward&&(e.isBackward=!0),this.isFake&&(e.isFake=!0),e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const s of e)this._addRange(s);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof I))throw new p("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 p("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new I(e.start,e.end))}}Ge.prototype.is=function(n){return n==="selection"||n==="view:selection"};class Xo extends H(Jt){constructor(...e){super();u(this,"_selection");this._selection=new Ge,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)}toJSON(){return this._selection.toJSON()}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}}Xo.prototype.is=function(n){return n==="selection"||n=="documentSelection"||n=="view:selection"||n=="view:documentSelection"};class Yt extends wt{constructor(e,t,s){super(e,t);u(this,"startRange");u(this,"_eventPhase");u(this,"_currentTarget");this.startRange=s,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const ur=Symbol("bubbling contexts");function Qg(n){class i extends n{fire(t,...s){try{const r=t instanceof wt?t:new wt(this,t),o=dr(this);if(!o.size)return;if(zi(r,"capturing",this),ri(o,"$capture",r,...s))return r.return;const a=r.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,c=l?!!Yu(o,l):!1;let d=l||Yg(a);if(zi(r,"atTarget",d),!c){if(ri(o,"$text",r,...s))return r.return;zi(r,"bubbling",d)}for(;d;){if(d.is("rootElement")){if(ri(o,"$root",r,...s))return r.return}else if(d.is("element")&&ri(o,d.name,r,...s))return r.return;if(ri(o,d,r,...s))return r.return;d=d.parent,zi(r,"bubbling",d)}return zi(r,"bubbling",this),ri(o,"$document",r,...s),r.return}catch(r){/* istanbul ignore next -- @preserve */p.rethrowUnexpectedError(r,this)}}_addEventListener(t,s,r){const o=Y(r.context||"$document"),a=dr(this);for(const l of o){let c=a.get(l);c||(c=new(H()),a.set(l,c)),this.listenTo(c,t,s,r)}}_removeEventListener(t,s){const r=dr(this);for(const o of r.values())this.stopListening(o,t,s)}}return i}function zi(n,i,e){n instanceof Yt&&(n._eventPhase=i,n._currentTarget=e)}function ri(n,i,e,...t){const s=typeof i=="string"?n.get(i):Yu(n,i);return s?(s.fire(e,...t),e.stop.called):!1}function Yu(n,i){for(const[e,t]of n)if(typeof e=="function"&&e(i))return t;return null}function dr(n){return n[ur]||(n[ur]=new Map),n[ur]}function Yg(n){if(!n)return null;const i=n.start.parent,e=n.end.parent,t=i.getPath(),s=e.getPath();return t.length>s.length?i:e}class Ws extends Qg(q()){constructor(e){super();u(this,"selection");u(this,"roots");u(this,"stylesProcessor");u(this,"_postFixers",new Set);this.selection=new Xo,this.roots=new Se({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)}
111destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const s of this._postFixers)if(t=s(e),t)break;while(t)}}const Xa=10;class Ut extends Je{constructor(e,t,s,r){super(e,t,s,r);u(this,"_priority",Xa);u(this,"_id",null);u(this,"_clonesGroup",null);this.getFillerOffset=Xg}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new p("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}toJSON(){const e=super.toJSON();return e.type="AttributeElement",e}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}_canMergeAttributesFrom(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canMergeAttributesFrom(e)}_canSubtractAttributesOf(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canSubtractAttributesOf(e)}}u(Ut,"DEFAULT_PRIORITY",Xa);Ut.prototype.is=function(n,i){return i?i===this.name&&(n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"):n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function Xg(){if(hr(this))return null;let n=this.parent;for(;n&&n.is("attributeElement");){if(hr(n)>1)return null;n=n.parent}return!n||hr(n)>1?null:this.childCount}function hr(n){return Array.from(n.getChildren()).filter(i=>!i.is("uiElement")).length}class Zo extends Je{constructor(i,e,t,s){super(i,e,t,s),this.getFillerOffset=Zg}toJSON(){const i=super.toJSON();return i.type="EmptyElement",i}_insertChild(i,e){if(e&&(e instanceof Qt||Array.from(e).length>0))throw new p("view-emptyelement-cannot-add",[this,e]);return 0}}Zo.prototype.is=function(n,i){return i?i===this.name&&(n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"):n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function Zg(){return null}class $s extends Je{constructor(i,e,t,s){super(i,e,t,s),this.getFillerOffset=tp}_insertChild(i,e){if(e&&(e instanceof Qt||Array.from(e).length>0))throw new p("view-uielement-cannot-add",[this,e]);return 0}render(i,e){return this.toDomElement(i)}toDomElement(i){const e=i.createElement(this.name);for(const t of this.getAttributeKeys())e.setAttribute(t,this.getAttribute(t));return e}toJSON(){const i=super.toJSON();return i.type="UIElement",i}}$s.prototype.is=function(n,i){return i?i===this.name&&(n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"):n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function ep(n){n.document.on("arrowKey",(i,e)=>ip(i,e,n.domConverter),{priority:"low"})}function tp(){return null}function ip(n,i,e){if(i.keyCode==V.arrowright){const t=i.domTarget.ownerDocument.defaultView.getSelection(),s=t.rangeCount==1&&t.getRangeAt(0).collapsed;if(s||i.shiftKey){const r=t.focusNode,o=t.focusOffset,a=e.domPositionToView(r,o);if(a===null)return;let l=!1;const c=a.getLastMatchingPosition(d=>(d.item.is("uiElement")&&(l=!0),!!(d.item.is("uiElement")||d.item.is("attributeElement"))));if(l){const d=e.viewPositionToDom(c);s?t.collapse(d.parent,d.offset):t.extend(d.parent,d.offset)}}}}class ea extends Je{constructor(i,e,t,s){super(i,e,t,s),this.getFillerOffset=np}toJSON(){const i=super.toJSON();return i.type="RawElement",i}_insertChild(i,e){if(e&&(e instanceof Qt||Array.from(e).length>0))throw new p("view-rawelement-cannot-add",[this,e]);return 0}render(i,e){}}ea.prototype.is=function(n,i){return i?i===this.name&&(n==="rawElement"||n==="view:rawElement"||n==="element"||n==="view:element"):n==="rawElement"||n==="view:rawElement"||n===this.name||n==="view:"+this.name||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function np(){return null}class qt extends H(Jt){constructor(e,t){super();u(this,"document");u(this,"_children",[]);u(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()}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}_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,{index:e});let s=0;const r=sp(this.document,t);for(const o of r)o.parent!==null&&o._remove(),o.parent=this,this._children.splice(e,0,o),e++,s++;return s}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let s=e;s<e+t;s++)this._children[s].parent=null;return this._children.splice(e,t)}
111_fireChange(e,t,s){this.fire(`change:${e}`,t,s)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}qt.prototype.is=function(n){return n==="documentFragment"||n==="view:documentFragment"};function sp(n,i){return typeof i=="string"?[new te(n,i)]:(Te(i)||(i=[i]),Array.from(i).map(e=>typeof e=="string"?new te(n,e):e instanceof ut?new te(n,e.data):e))}class Xu{constructor(i){u(this,"document");u(this,"_cloneGroups",new Map);u(this,"_slotFactory",null);this.document=i}setSelection(...i){this.document.selection._setTo(...i)}setSelectionFocus(i,e){this.document.selection._setFocus(i,e)}createDocumentFragment(i){return new qt(this.document,i)}createText(i){return new te(this.document,i)}createAttributeElement(i,e,t={}){const s=new Ut(this.document,i,e);return typeof t.priority=="number"&&(s._priority=t.priority),t.id&&(s._id=t.id),t.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...t.renderUnsafeAttributes),s}createContainerElement(i,e,t={},s={}){let r;lp(t)?s=t:r=t;const o=new _n(this.document,i,e,r);return s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}createEditableElement(i,e,t={}){const s=new Hs(this.document,i,e);return t.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...t.renderUnsafeAttributes),s}createEmptyElement(i,e,t={}){const s=new Zo(this.document,i,e);return t.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...t.renderUnsafeAttributes),s}createUIElement(i,e,t){const s=new $s(this.document,i,e);return t&&(s.render=t),s}createRawElement(i,e,t,s={}){const r=new ea(this.document,i,e);return t&&(r.render=t),s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}setAttribute(i,e,t,s){s!==void 0?s._setAttribute(i,e,t):t._setAttribute(i,e)}removeAttribute(i,e,t){t!==void 0?t._removeAttribute(i,e):e._removeAttribute(i)}addClass(i,e){e._addClass(i)}removeClass(i,e){e._removeClass(i)}setStyle(i,e,t){it(i)&&t===void 0?e._setStyle(i):t._setStyle(i,e)}removeStyle(i,e){e._removeStyle(i)}setCustomProperty(i,e,t){t._setCustomProperty(i,e)}removeCustomProperty(i,e){return e._removeCustomProperty(i)}breakAttributes(i){return i instanceof k?this._breakAttributes(i):this._breakAttributesRange(i)}breakContainer(i){const e=i.parent;if(!e.is("containerElement"))throw new p("view-writer-break-non-container-element",this.document);if(!e.parent)throw new p("view-writer-break-root",this.document);if(i.isAtStart)return k._createBefore(e);if(!i.isAtEnd){const t=e._clone(!1);this.insert(k._createAfter(e),t);const s=new I(i,k._createAt(e,"end")),r=new k(t,0);this.move(s,r)}return k._createAfter(e)}mergeAttributes(i){const e=i.offset,t=i.parent;if(t.is("$text"))return i;if(t.is("attributeElement")&&t.childCount===0){const o=t.parent,a=t.index;return t._remove(),this._removeFromClonedElementsGroup(t),this.mergeAttributes(new k(o,a))}const s=t.getChild(e-1),r=t.getChild(e);if(!s||!r)return i;if(s.is("$text")&&r.is("$text"))return el(s,r);if(s.is("attributeElement")&&r.is("attributeElement")&&s.isSimilar(r)){const o=s.childCount;return s._appendChild(r.getChildren()),r._remove(),this._removeFromClonedElementsGroup(r),this.mergeAttributes(new k(s,o))}return i}mergeContainers(i){const e=i.nodeBefore,t=i.nodeAfter;if(!e||!t||!e.is("containerElement")||!t.is("containerElement"))throw new p("view-writer-merge-containers-invalid-position",this.document);const s=e.getChild(e.childCount-1),r=s instanceof te?k._createAt(s,"end"):k._createAt(e,"end");return this.move(I._createIn(t),k._createAt(e,"end")),this.remove(I._createOn(t)),r}insert(i,e){e=Te(e)?[...e]:[e],Zu(e,this.document);const t=e.reduce((o,a)=>{const l=o[o.length-1],c=!a.is("uiElement");return!l||l.breakAttributes!=c?o.push({breakAttributes:c,nodes:[a]}):l.nodes.push(a),o},[]);let s=null,r=i;for(const{nodes:o,breakAttributes:a}of t){const l=this._insertNodes(r,o,a);s||(s=l.start),r=l.end}return s?new I(s,r):new I(i)}remove(i){const e=i instanceof I?i:I._createOn(i);if(Hi(e,this.document),e.isCollapsed)return new qt(this.document);const{start:t,end:s}=this._breakAttributesRange(e,!0),r=t.parent,o=s.offset-t.offset,a=r._removeChildren(t.offset,o);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(t);return e.start=l,e.end=l.clone(),new qt(this.document,a)}clear(i,e){Hi(i,this.document);const t=i.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of t){const r=s.item;let o;if(r.is("element")&&e.isSimilar(r))o=I._createOn(r);else if(!s.nextPosition.isAfter(i.start)&&r.is("$textProxy")){const a=r.getAncestors().find(l=>l.is("element")&&e.isSimilar(l));a&&(o=I._createIn(a))}o&&(o.end.isAfter(i.end)&&(o.end=i.end),o.start.isBefore(i.start)&&(o.start=i.start),this.remove(o))}}move(i,e){let t;if(e.isAfter(i.end)){e=this._breakAttributes(e,!0);const s=e.parent,r=s.childCount;i=this._breakAttributesRange(i,!0),t=this.remove(i),e.offset+=s.childCount-r}else t=this.remove(i);return this.insert(e,t)}wrap(i,e){if(!(e instanceof Ut))throw new p("view-writer-wrap-invalid-attribute",this.document);if(Hi(i,this.document),i.isCollapsed){let t=i.start;t.parent.is("element")&&!rp(t.parent)&&(t=t.getLastMatchingPosition(r=>r.item.is("uiElement"))),t=this._wrapPosition(t,e);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(i.start)&&this.setSelection(t),new I(t)}else return this._wrapRange(i,e)}unwrap(i,e){if(!(e instanceof Ut))throw new p("view-writer-unwrap-invalid-attribute",this.document);if(Hi(i,this.document),i.isCollapsed)return i;const{start:t,end:s}=this._breakAttributesRange(i,!0),r=t.parent,o=this._unwrapChildren(r,t.offset,s.offset,e),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new I(a,l)}rename(i,e){const t=new _n(this.document,i,e.getAttributes());return this.insert(k._createAfter(e),t),this.move(I._createIn(e),k._createAt(t,0)),this.remove(I._createOn(e)),t}clearClonedElementsGroup(i){this._cloneGroups.delete(i)}createPositionAt(i,e){return k._createAt(i,e)}createPositionAfter(i){return k._createAfter(i)}createPositionBefore(i){return k._createBefore(i)}createRange(i,e){return new I(i,e)}createRangeOn(i){return I._createOn(i)}createRangeIn(i){return I._createIn(i)}createSelection(...i){return new Ge(...i)}createSlot(i="children"){if(!this._slotFactory)throw new p("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,i)}_registerSlotFactory(i){this._slotFactory=i}_clearSlotFactory(){this._slotFactory=null}
111_insertNodes(i,e,t){let s;if(t?s=Yr(i):s=i.parent.is("$text")?i.parent.parent:i.parent,!s)throw new p("view-writer-invalid-position-container",this.document);let r;t?r=this._breakAttributes(i,!0):r=i.parent.is("$text")?fr(i):i;const o=s._insertChild(r.offset,e);for(const d of e)this._addToClonedElementsGroup(d);const a=r.getShiftedBy(o),l=this.mergeAttributes(r);l.isEqual(r)||a.offset--;const c=this.mergeAttributes(a);return new I(l,c)}_wrapChildren(i,e,t,s){let r=e;const o=[];for(;r<t;){const l=i.getChild(r),c=l.is("$text"),d=l.is("attributeElement");if(d&&l._canMergeAttributesFrom(s))l._mergeAttributesFrom(s),o.push(new k(i,r));else if(c||!d||op(s,l)){const h=s._clone();l._remove(),h._appendChild(l),i._insertChild(r,h),this._addToClonedElementsGroup(h),o.push(new k(i,r))}else this._wrapChildren(l,0,l.childCount,s);r++}let a=0;for(const l of o){if(l.offset-=a,l.offset==e)continue;this.mergeAttributes(l).isEqual(l)||(a++,t--)}return I._createFromParentsAndOffsets(i,e,i,t)}_unwrapChildren(i,e,t,s){let r=e;const o=[];for(;r<t;){const l=i.getChild(r);if(!l.is("attributeElement")){r++;continue}if(l.isSimilar(s)){const c=l.getChildren(),d=l.childCount;l._remove(),i._insertChild(r,c),this._removeFromClonedElementsGroup(l),o.push(new k(i,r),new k(i,r+d)),r+=d,t+=d-1;continue}if(l._canSubtractAttributesOf(s)){l._subtractAttributesOf(s),o.push(new k(i,r),new k(i,r+1)),r++;continue}this._unwrapChildren(l,0,l.childCount,s),r++}let a=0;for(const l of o){if(l.offset-=a,l.offset==e||l.offset==t)continue;this.mergeAttributes(l).isEqual(l)||(a++,t--)}return I._createFromParentsAndOffsets(i,e,i,t)}_wrapRange(i,e){const{start:t,end:s}=this._breakAttributesRange(i,!0),r=t.parent,o=this._wrapChildren(r,t.offset,s.offset,e),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new I(a,l)}_wrapPosition(i,e){if(e.isSimilar(i.parent))return Za(i.clone());i.parent.is("$text")&&(i=fr(i));const t=this.createAttributeElement("_wrapPosition-fake-element");t._priority=Number.POSITIVE_INFINITY,t.isSimilar=()=>!1,i.parent._insertChild(i.offset,t);const s=new I(i,i.getShiftedBy(1));this.wrap(s,e);const r=new k(t.parent,t.index);t._remove();const o=r.nodeBefore,a=r.nodeAfter;return o&&o.is("view:$text")&&a&&a.is("view:$text")?el(o,a):Za(r)}_breakAttributesRange(i,e=!1){const t=i.start,s=i.end;if(Hi(i,this.document),i.isCollapsed){const l=this._breakAttributes(i.start,e);return new I(l,l)}const r=this._breakAttributes(s,e),o=r.parent.childCount,a=this._breakAttributes(t,e);return r.offset+=r.parent.childCount-o,new I(a,r)}_breakAttributes(i,e=!1){const t=i.offset,s=i.parent;if(i.parent.is("emptyElement"))throw new p("view-writer-cannot-break-empty-element",this.document);if(i.parent.is("uiElement"))throw new p("view-writer-cannot-break-ui-element",this.document);if(i.parent.is("rawElement"))throw new p("view-writer-cannot-break-raw-element",this.document);if(!e&&s.is("$text")&&Xr(s.parent)||Xr(s))return i.clone();if(s.is("$text"))return this._breakAttributes(fr(i),e);const r=s.childCount;if(t==r){const o=new k(s.parent,s.index+1);return this._breakAttributes(o,e)}else if(t===0){const o=new k(s.parent,s.index);return this._breakAttributes(o,e)}else{const o=s.index+1,a=s._clone();s.parent._insertChild(o,a),this._addToClonedElementsGroup(a);const l=s.childCount-t,c=s._removeChildren(t,l);a._appendChild(c);const d=new k(s.parent,o);return this._breakAttributes(d,e)}}_addToClonedElementsGroup(i){if(!i.root.is("rootElement"))return;if(i.is("element"))for(const s of i.getChildren())this._addToClonedElementsGroup(s);const e=i.id;if(!e)return;let t=this._cloneGroups.get(e);t||(t=new Set,this._cloneGroups.set(e,t)),t.add(i),i._clonesGroup=t}_removeFromClonedElementsGroup(i){if(i.is("element"))for(const s of i.getChildren())this._removeFromClonedElementsGroup(s);const e=i.id;if(!e)return;const t=this._cloneGroups.get(e);t&&t.delete(i)}}function rp(n){return Array.from(n.getChildren()).some(i=>!i.is("uiElement"))}function Yr(n){let i=n.parent;for(;!Xr(i);){if(!i)return;i=i.parent}return i}function op(n,i){return n.priority<i.priority?!0:n.priority>i.priority?!1:n.getIdentity()<i.getIdentity()}function Za(n){const i=n.nodeBefore;if(i&&i.is("$text"))return new k(i,i.data.length);const e=n.nodeAfter;return e&&e.is("$text")?new k(e,0):n}function fr(n){if(n.offset==n.parent.data.length)return new k(n.parent.parent,n.parent.index+1);if(n.offset===0)return new k(n.parent.parent,n.parent.index);const i=n.parent.data.slice(n.offset);return n.parent._data=n.parent.data.slice(0,n.offset),n.parent.parent._insertChild(n.parent.index+1,new te(n.root.document,i)),new k(n.parent.parent,n.parent.index+1)}function el(n,i){const e=n.data.length;return n._data+=i.data,i._remove(),new k(n,e)}const ap=[te,Ut,_n,Zo,ea,$s];function Zu(n,i){for(const e of n){if(!ap.some(t=>e instanceof t))throw new p("view-writer-insert-invalid-node-type",i);e.is("$text")||Zu(e.getChildren(),i)}}function Xr(n){return n&&(n.is("containerElement")||n.is("documentFragment"))}function Hi(n,i){const e=Yr(n.start),t=Yr(n.end);if(!e||!t||e!==t)throw new p("view-writer-invalid-range-container",i)}function lp(n){return it(n)}const ed=n=>n.createTextNode(" "),td=n=>{const i=n.createElement("span");return i.dataset.ckeFiller="true",i.innerText=" ",i},id=n=>{const i=n.createElement("br");return i.dataset.ckeFiller="true",i},Ce=7,yn="⁠".repeat(Ce);function he(n){return typeof n=="string"?n.substr(0,Ce)===yn:G(n)&&n.data.substr(0,Ce)===yn}function _i(n){return n.data.length==Ce&&he(n)}function tl(n){const i=typeof n=="string"?n:n.data;return he(n)?i.slice(Ce):i}function cp(n){n.document.on("arrowKey",up,{priority:"low"})}
111function up(n,i){if(i.keyCode==V.arrowleft){const e=i.domTarget.ownerDocument.defaultView.getSelection();if(e.rangeCount==1&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,s=e.getRangeAt(0).startOffset;he(t)&&s<=Ce&&e.collapse(t,0)}}}class dp extends q(){constructor(e,t){super();u(this,"domDocuments",new Set);u(this,"domConverter");u(this,"markedAttributes",new Set);u(this,"markedChildren",new Set);u(this,"markedTexts",new Set);u(this,"selection");u(this,"_inlineFiller",null);u(this,"_fakeSelectionContainer",null);this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),P.isBlink&&!P.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||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 p("view-renderer-unknown-type",this)}}render(){if(this.isComposing&&!P.isAndroid)return;let e=null;const t=P.isBlink&&!P.isAndroid?!this.isSelecting:!0;for(const s of this.markedChildren)this._updateChildrenMappings(s);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 s of this.markedAttributes)this._updateAttrs(s);for(const s of this.markedChildren)this._updateChildren(s,{inlineFillerPosition:e});for(const s of this.markedTexts)!this.markedChildren.has(s.parent)&&this.domConverter.mapViewToDom(s.parent)&&this._updateText(s,{inlineFillerPosition:e});if(t)if(e){const s=this.domConverter.viewPositionToDom(e),r=s.parent.ownerDocument;he(s.parent)?this._inlineFiller=s.parent:this._inlineFiller=il(r,s.parent,s.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 s=Array.from(t.childNodes),r=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),o=this._diffNodeLists(s,r),a=this._findUpdateActions(o,s,r,fp);if(a.indexOf("update")!==-1){const l={equal:0,insert:0,delete:0};for(const c of a)if(c==="update"){const d=l.equal+l.insert,h=l.equal+l.delete,f=e.getChild(d);f&&!f.is("uiElement")&&!f.is("rawElement")&&this._updateElementMappings(f,s[h]),Ha(r[d]),l.equal++}else l[c]++}}_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&&G(t.parent)&&he(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!he(e))throw new p("view-renderer-filler-was-lost",this);_i(e)?e.remove():e.data=e.data.substr(Ce),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,s=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!hp(t))return!1;const r=e.nodeBefore,o=e.nodeAfter;return!(r instanceof te||o instanceof te||s===t.getFillerOffset()&&(!r||!r.is("element","br"))||P.isAndroid&&(r||o))}_updateText(e,t){const s=this.domConverter.findCorrespondingDomText(e);let o=this.domConverter.viewToDom(e).data;const a=t.inlineFillerPosition;a&&a.parent==e.parent&&a.offset==e.index&&(o=yn+o),this._updateTextNode(s,o)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(t){for(const s of Array.from(t.attributes)){const r=s.name;e.hasAttribute(r)||this.domConverter.removeDomElementAttribute(t,r)}for(const s of e.getAttributeKeys())this.domConverter.setDomElementAttribute(t,s,e.getAttribute(s),e)}}_updateChildren(e,t){const s=this.domConverter.mapViewToDom(e);if(!s)return;if(P.isAndroid){let f=null;for(const m of Array.from(s.childNodes)){if(f&&G(f)&&G(m)){s.normalize();break}f=m}}const r=t.inlineFillerPosition,o=s.childNodes,a=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));r&&r.parent===e&&il(s.ownerDocument,a,r.offset);const l=this._diffNodeLists(o,a),c=this._findUpdateActions(l,o,a,mp);let d=0;const h=new Set;for(const f of c)f==="delete"?(h.add(o[d]),Ha(o[d])):(f==="equal"||f==="update")&&d++;d=0;for(const f of c)f==="insert"?(Wu(s,d,a[d]),d++):f==="update"?(this._updateTextNode(o[d],a[d].data),d++):f==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(a[d])),d++);for(const f of h)f.parentNode||this.domConverter.unbindDomElement(f)}_diffNodeLists(e,t){return e=wp(e,this._fakeSelectionContainer),ki(e,t,gp.bind(null,this.domConverter))}
111_findUpdateActions(e,t,s,r){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let o=[],a=[],l=[];const c={equal:0,insert:0,delete:0};for(const d of e)d==="insert"?l.push(s[c.equal+c.insert]):d==="delete"?a.push(t[c.equal+c.delete]):(o=o.concat(ki(a,l,r).map(h=>h==="equal"?"update":h)),o.push("equal"),a=[],l=[]),c[d]++;return o.concat(ki(a,l,r).map(d=>d==="equal"?"update":d))}_updateTextNode(e,t){const s=e.data;s!=t&&(P.isAndroid&&this.isComposing&&s.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){const s=Ou(e.data,t);for(const r of s)r.type==="insert"?e.insertData(r.index,r.values.join("")):e.deleteData(r.index,r.howMany)}_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(P.isBlink&&!P.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);if(!this.isFocused||!e){!this.selection.isFake&&this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected&&this._removeFakeSelection();return}this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&P.isAndroid||this._updateDomSelection(e)}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=bp(t));const s=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(s,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!s.parentElement||s.parentElement!=e)&&e.appendChild(s),s.textContent=this.selection.fakeSelectionLabel||" ";const r=t.getSelection(),o=t.createRange();r.removeAllRanges(),o.selectNodeContents(s),r.addRange(o)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const s=this.domConverter.viewPositionToDom(this.selection.anchor),r=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(s.parent,s.offset,r.parent,r.offset),P.isGecko&&pp(r,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,s=e.ownerDocument.getSelection();return!t||t.parentElement!==e||s.anchorNode!==t&&!t.contains(s.anchorNode)?!0:t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const s=e.activeElement,r=this.domConverter.mapDomToView(s);s&&r&&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 hp(n){if(n.getAttribute("contenteditable")=="false")return!1;const i=n.findAncestor(e=>e.hasAttribute("contenteditable"));return!i||i.getAttribute("contenteditable")=="true"}function il(n,i,e){const t=i instanceof Array?i:i.childNodes,s=t[e];if(G(s))return s.data=yn+s.data,s;{const r=n.createTextNode(yn);return Array.isArray(i)?t.splice(e,0,r):Wu(i,e,r),r}}function fp(n,i){return St(n)&&St(i)&&!G(n)&&!G(i)&&!an(n)&&!an(i)&&n.tagName.toLowerCase()===i.tagName.toLowerCase()}function mp(n,i){return St(n)&&St(i)&&G(n)&&G(i)}function gp(n,i,e){return i===e?!0:G(i)&&G(e)?i.data===e.data:!!(n.isBlockFiller(i)&&n.isBlockFiller(e))}function pp(n,i){let e=n.parent,t=n.offset;if(G(e)&&_i(e)&&(t=bi(e)+1,e=e.parentNode),e.nodeType!=Node.ELEMENT_NODE||t!=e.childNodes.length-1)return;const s=e.childNodes[t];s&&s.tagName=="BR"&&i.addRange(i.getRangeAt(0))}function wp(n,i){const e=Array.from(n);return e.length==0||!i||e[e.length-1]==i&&e.pop(),e}function bp(n){const i=n.createElement("div");
111return i.className="ck-fake-selection-container",Object.assign(i.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),i.textContent=" ",i}const _p=id(C.document),yp=ed(C.document),vp=td(C.document),$n="data-ck-unsafe-attribute-",nl="data-ck-unsafe-element";class Us{constructor(i,{blockFillerMode:e,renderingMode:t="editing"}={}){u(this,"document");u(this,"renderingMode");u(this,"blockFillerMode");u(this,"preElements");u(this,"blockElements");u(this,"inlineObjectElements");u(this,"unsafeElements");u(this,"_domDocument");u(this,"_domToViewMapping",new WeakMap);u(this,"_viewToDomMapping",new WeakMap);u(this,"_fakeSelectionMapping",new WeakMap);u(this,"_rawContentElementMatcher",new Pe);u(this,"_inlineObjectElementMatcher",new Pe);u(this,"_elementsWithTemporaryCustomProperties",new Set);this.document=i,this.renderingMode=t,this.blockFillerMode=e||(t==="editing"?"br":"nbsp"),this.preElements=["pre","textarea"],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"?C.document:C.document.implementation.createHTMLDocument("")}get domDocument(){return this._domDocument}bindFakeSelection(i,e){this._fakeSelectionMapping.set(i,new Ge(e))}fakeSelectionToView(i){return this._fakeSelectionMapping.get(i)}bindElements(i,e){this._domToViewMapping.set(i,e),this._viewToDomMapping.set(e,i)}unbindDomElement(i){const e=this._domToViewMapping.get(i);if(e){this._domToViewMapping.delete(i),this._viewToDomMapping.delete(e);for(const t of i.children)this.unbindDomElement(t)}}bindDocumentFragments(i,e){this._domToViewMapping.set(i,e),this._viewToDomMapping.set(e,i)}shouldRenderAttribute(i,e,t){return this.renderingMode==="data"?!0:(i=i.toLowerCase(),i.startsWith("on")||i==="srcdoc"&&e.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:t==="img"&&(i==="src"||i==="srcset")||t==="source"&&i==="srcset"?!0:!e.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(i,e){if(this.renderingMode==="data"){i.innerHTML=e;return}const t=new DOMParser().parseFromString(e,"text/html"),s=t.createDocumentFragment(),r=t.body.childNodes;for(;r.length>0;)s.appendChild(r[0]);const o=t.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=o.nextNode();)a.push(l);for(const c of a){for(const h of c.getAttributeNames())this.setDomElementAttribute(c,h,c.getAttribute(h));const d=c.tagName.toLowerCase();this._shouldRenameElement(d)&&(al(d),c.replaceWith(this._createReplacementDomElement(d,c)))}for(;i.firstChild;)i.firstChild.remove();i.append(s)}viewToDom(i,e={}){if(i.is("$text")){const t=this._processDataFromViewText(i);return this._domDocument.createTextNode(t)}else{const t=i;if(this.mapViewToDom(t))if(t.getCustomProperty("editingPipeline:doNotReuseOnce"))this._elementsWithTemporaryCustomProperties.add(t);else return this.mapViewToDom(t);let s;if(t.is("documentFragment"))s=this._domDocument.createDocumentFragment(),e.bind&&this.bindDocumentFragments(s,t);else{if(t.is("uiElement"))return t.name==="$comment"?s=this._domDocument.createComment(t.getCustomProperty("$rawContent")):s=t.render(this._domDocument,this),e.bind&&this.bindElements(s,t),s;this._shouldRenameElement(t.name)?(al(t.name),s=this._createReplacementDomElement(t.name)):t.hasAttribute("xmlns")?s=this._domDocument.createElementNS(t.getAttribute("xmlns"),t.name):s=this._domDocument.createElement(t.name),t.is("rawElement")&&t.render(s,this),e.bind&&this.bindElements(s,t);for(const r of t.getAttributeKeys())this.setDomElementAttribute(s,r,t.getAttribute(r),t)}if(e.withChildren!==!1)for(const r of this.viewChildrenToDom(t,e))s instanceof HTMLTemplateElement?s.content.appendChild(r):s.appendChild(r);return s}}setDomElementAttribute(i,e,t,s){const r=this.shouldRenderAttribute(e,t,i.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(e);
111if(r||void 0,!ng(e)){return}i.hasAttribute(e)&&!r?i.removeAttribute(e):i.hasAttribute($n+e)&&r&&i.removeAttribute($n+e),i.setAttribute(r?e:$n+e,t)}removeDomElementAttribute(i,e){e!=nl&&(i.removeAttribute(e),i.removeAttribute($n+e))}*viewChildrenToDom(i,e={}){const t=i.getFillerOffset&&i.getFillerOffset();let s=0;for(const r of i.getChildren()){t===s&&(yield this._getBlockFiller());const o=r.is("element")&&!!r.getCustomProperty("dataPipeline:transparentRendering")&&!ye(r.getAttributes());if(o&&this.renderingMode=="data")if(r.is("rawElement")){const a=this._domDocument.createElement(r.name);r.render(a,this),yield*[...a.childNodes]}else yield*this.viewChildrenToDom(r,e);else o&&void 0,yield this.viewToDom(r,e);s++}t===s&&(yield this._getBlockFiller())}viewRangeToDom(i){const e=this.viewPositionToDom(i.start),t=this.viewPositionToDom(i.end),s=this._domDocument.createRange();return s.setStart(e.parent,e.offset),s.setEnd(t.parent,t.offset),s}viewPositionToDom(i){const e=i.parent;if(e.is("$text")){const t=this.findCorrespondingDomText(e);if(!t)return null;let s=i.offset;return he(t)&&(s+=Ce),t.data&&s>t.data.length&&(s=t.data.length),{parent:t,offset:s}}else{let t,s,r;if(i.offset===0){if(t=this.mapViewToDom(e),!t)return null;r=t.childNodes[0]}else{const a=i.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;t=s.parentNode,r=s.nextSibling}if(G(r)&&he(r))return{parent:r,offset:Ce};const o=s?bi(s)+1:0;return{parent:t,offset:o}}}domToView(i,e={}){const t=[],s=this._domToView(i,e,t),r=s.next().value;return!r||(s.next(),this._processDomInlineNodes(null,t,e),this.blockFillerMode=="br"&&rl(r))||r.is("$text")&&r.data.length==0?null:r}*domChildrenToView(i,e={},t=[]){let s=[];i instanceof HTMLTemplateElement?s=[...i.content.childNodes]:s=[...i.childNodes];for(let r=0;r<s.length;r++){const o=s[r],a=this._domToView(o,e,t),l=a.next().value;l!==null&&(this._isBlockViewElement(l)&&this._processDomInlineNodes(i,t,e),this.blockFillerMode=="br"&&rl(l)||(yield l),a.next())}this._processDomInlineNodes(i,t,e)}domSelectionToView(i){if(Pp(i))return new Ge([]);if(i.rangeCount===1){let s=i.getRangeAt(0).startContainer;G(s)&&(s=s.parentNode);const r=this.fakeSelectionToView(s);if(r)return r}const e=this.isDomSelectionBackward(i),t=[];for(let s=0;s<i.rangeCount;s++){const r=i.getRangeAt(s),o=this.domRangeToView(r);o&&t.push(o)}return new Ge(t,{backward:e})}domRangeToView(i){const e=this.domPositionToView(i.startContainer,i.startOffset),t=this.domPositionToView(i.endContainer,i.endOffset);return e&&t?new I(e,t):null}domPositionToView(i,e=0){if(this.isBlockFiller(i))return this.domPositionToView(i.parentNode,bi(i));const t=this.mapDomToView(i);if(t&&(t.is("uiElement")||t.is("rawElement")))return k._createBefore(t);if(G(i)){if(_i(i))return this.domPositionToView(i.parentNode,bi(i));const s=this.findCorrespondingViewText(i);let r=e;return s?(he(i)&&(r-=Ce,r=r<0?0:r),new k(s,r)):null}else{if(e===0){const s=this.mapDomToView(i);if(s)return new k(s,0)}else{const s=i.childNodes[e-1];if(G(s)&&_i(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,bi(s));const r=G(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(r&&r.parent)return new k(r.parent,r.index+1)}return null}}mapDomToView(i){return this.getHostViewElement(i)||this._domToViewMapping.get(i)}findCorrespondingViewText(i){if(_i(i))return null;const e=this.getHostViewElement(i);if(e)return e;const t=i.previousSibling;if(t){if(!this.isElement(t))return null;const s=this.mapDomToView(t);if(s){const r=s.nextSibling;return r instanceof te?r:null}}else{const s=this.mapDomToView(i.parentNode);if(s){const r=s.getChild(0);return r instanceof te?r:null}}return null}mapViewToDom(i){return this._viewToDomMapping.get(i)}findCorrespondingDomText(i){const e=i.previousSibling;return e&&this.mapViewToDom(e)?this.mapViewToDom(e).nextSibling:!e&&i.parent&&this.mapViewToDom(i.parent)?this.mapViewToDom(i.parent).childNodes[0]:null}focus(i){const e=this.mapViewToDom(i);if(!e||e.ownerDocument.activeElement===e)return;const{scrollX:t,scrollY:s}=C.window,r=[];sl(e,o=>{const{scrollLeft:a,scrollTop:l}=o;r.push([a,l])}),e.focus({preventScroll:!0}),sl(e,o=>{const[a,l]=r.shift();o.scrollLeft=a,o.scrollTop=l}),C.window.scrollTo(t,s)}_clearDomSelection(){const i=this.mapViewToDom(this.document.selection.editableElement);if(!i)return;const e=i.ownerDocument.defaultView.getSelection(),t=this.domSelectionToView(e);t&&t.rangeCount>0&&e.removeAllRanges()}isElement(i){return i&&i.nodeType==Node.ELEMENT_NODE}isDocumentFragment(i){return i&&i.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(i){return this.blockFillerMode=="br"?i.isEqualNode(_p):ol(i,this.blockElements)?!0:i.isEqualNode(vp)||Cp(i,this.blockElements)}isDomSelectionBackward(i){if(i.isCollapsed)return!1;const e=this._domDocument.createRange();
111try{e.setStart(i.anchorNode,i.anchorOffset),e.setEnd(i.focusNode,i.focusOffset)}catch{return!1}const t=e.collapsed;return e.detach(),t}getHostViewElement(i){const e=Zm(i);for(e.pop();e.length;){const t=e.pop(),s=this._domToViewMapping.get(t);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(i){return this._isDomSelectionPositionCorrect(i.anchorNode,i.anchorOffset)&&this._isDomSelectionPositionCorrect(i.focusNode,i.focusOffset)}registerRawContentMatcher(i){this._rawContentElementMatcher.add(i)}registerInlineObjectMatcher(i){this._inlineObjectElementMatcher.add(i)}_clearTemporaryCustomProperties(){for(const i of this._elementsWithTemporaryCustomProperties)i._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return ed(this._domDocument);case"markedNbsp":return td(this._domDocument);case"br":return id(this._domDocument)}}_isDomSelectionPositionCorrect(i,e){if(G(i)&&he(i)&&e<Ce||this.isElement(i)&&he(i.childNodes[e]))return!1;const t=this.mapDomToView(i);return!(t&&(t.is("uiElement")||t.is("rawElement")))}*_domToView(i,e,t){if(this.blockFillerMode!="br"&&ol(i,this.blockElements))return null;const s=this.getHostViewElement(i);if(s)return s;if(an(i)&&e.skipComments)return null;if(G(i)){if(_i(i))return null;{const r=i.data;if(r==="")return null;const o=new te(this.document,r);return t.push(o),o}}else{let r=this.mapDomToView(i);if(r)return this._isInlineObjectElement(r)&&t.push(r),r;if(this.isDocumentFragment(i))r=new qt(this.document),e.bind&&this.bindDocumentFragments(i,r);else{r=this._createViewElement(i,e),e.bind&&this.bindElements(i,r);const a=i.attributes;if(a)for(let l=a.length,c=0;c<l;c++)r._setAttribute(a[c].name,a[c].value);if(this._isViewElementWithRawContent(r,e))return r._setCustomProperty("$rawContent",i.innerHTML),this._isBlockViewElement(r)||t.push(r),r;if(an(i))return r._setCustomProperty("$rawContent",i.data),r}yield r;const o=[];if(e.withChildren!==!1)for(const a of this.domChildrenToView(i,e,o))r._appendChild(a);if(this._isInlineObjectElement(r))t.push(r),this._processDomInlineNodes(null,o,e);else for(const a of o)t.push(a)}}_processDomInlineNodes(i,e,t){if(!e.length||i&&!this.isDocumentFragment(i)&&!this._isBlockDomElement(i))return;let s=!1;for(let r=0;r<e.length;r++){const o=e[r];if(!o.is("$text")){s=!1;continue}let a,l=!1;if(this._isPreFormatted(o))a=tl(o.data);else{a=o.data.replace(/[ \n\t\r]{1,}/g," "),l=/[^\S\u00A0]/.test(a.charAt(a.length-1));const c=r>0?e[r-1]:null,d=r+1<e.length?e[r+1]:null,h=!c||c.is("element")&&c.name=="br"||s,f=d?!1:!he(o.data);t.withChildren!==!1&&(h&&(a=a.replace(/^ /,"")),f&&(a=a.replace(/ $/,""))),a=tl(a),this.blockFillerMode!="br"&&o.parent&&(Tp(o.parent,a)?(a="",o.parent.parent&&(o.parent.parent._setCustomProperty("$hasBlockFiller",!0),o.parent._remove())):Ep(o.parent,a,this.blockElements)&&(a="",o.parent._setCustomProperty("$hasBlockFiller",!0))),a=a.replace(/ \u00A0/g,"  ");const m=d&&d.is("element")&&d.name!="br",g=d&&d.is("$text")&&d.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(a)||!d||m||g)&&(a=a.replace(/\u00A0$/," ")),(h||c&&c.is("element")&&c.name!="br")&&(a=a.replace(/^\u00A0/," "))}a.length==0&&o.parent?(o._remove(),e.splice(r,1),r--):(o._data=a,s=l)}e.length=0}_processDataFromViewText(i){let e=i.data;if(this._isPreFormatted(i))return e;if(e.charAt(0)==" "){const t=this._getTouchingInlineViewNode(i,!1);(t&&t.is("$textProxy")&&this._nodeEndsWithSpace(t)||!t)&&(e=" "+e.substr(1))}if(e.charAt(e.length-1)==" "){const t=this._getTouchingInlineViewNode(i,!0),s=t&&t.is("$textProxy")&&t.data.charAt(0)==" ";(e.charAt(e.length-2)==" "||!t||s)&&(e=e.substr(0,e.length-1)+" ")}return e.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(i){if(this._isPreFormatted(i))return!1;const e=this._processDataFromViewText(i);return e.charAt(e.length-1)==" "}_isPreFormatted(i){if(kp(i,this.preElements))return!0;for(const e of i.getAncestors({parentFirst:!0}))if(!(!e.is("element")||!e.hasStyle("white-space")||e.getStyle("white-space")==="inherit"))return["pre","pre-wrap","break-spaces"].includes(e.getStyle("white-space"));return!1}_getTouchingInlineViewNode(i,e){const t=new $t({startPosition:e?k._createAfter(i):k._createBefore(i),direction:e?"forward":"backward"});for(const{item:s}of t){if(s.is("$textProxy"))return s;if(s.is("element")&&s.getCustomProperty("dataPipeline:transparentRendering"))continue;if(s.is("element","br"))return null;if(this._isInlineObjectElement(s))return s;if(s.is("containerElement")||this._isBlockViewElement(s))return null}return null}_isBlockDomElement(i){return this.isElement(i)&&this.blockElements.includes(i.tagName.toLowerCase())}_isBlockViewElement(i){return i.is("element")&&this.blockElements.includes(i.name)}_isInlineObjectElement(i){return i.is("element")?i.name=="br"||this.inlineObjectElements.includes(i.name)||!!this._inlineObjectElementMatcher.match(i):!1}_createViewElement(i,e){if(an(i))return new $s(this.document,"$comment");const t=e.keepOriginalCase?i.tagName:i.tagName.toLowerCase();return new Je(this.document,t)}_isViewElementWithRawContent(i,e){return e.withChildren!==!1&&i.is("element")&&!!this._rawContentElementMatcher.match(i)}_shouldRenameElement(i){const e=i.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(e)}_createReplacementDomElement(i,e){const t=this._domDocument.createElement("span");if(t.setAttribute(nl,i),e){for(;e.firstChild;)t.appendChild(e.firstChild);for(const s of e.getAttributeNames())t.setAttribute(s,e.getAttribute(s))}return t}}function kp(n,i){return n.getAncestors().some(e=>e.is("element")&&i.includes(e.name))}function sl(n,i){let e=n;for(;e;)i(e),e=e.parentElement}function Cp(n,i){return n.isEqualNode(yp)&&nd(n,i)&&n.parentNode.childNodes.length===1}
111function nd(n,i){const e=n.parentNode;return!!e&&!!e.tagName&&i.includes(e.tagName.toLowerCase())}function Ep(n,i,e){return i==" "&&n&&n.is("element")&&n.childCount==1&&e.includes(n.name)}function Tp(n,i){return i==" "&&n&&n.is("element","span")&&n.childCount==1&&n.hasAttribute("data-cke-filler")}function rl(n){return n.is("element","br")&&n.hasAttribute("data-cke-filler")}function ol(n,i){return n.tagName==="BR"&&nd(n,i)&&n.parentNode.childNodes.length===1}function al(n){n==="script"&&void 0,n==="style"&&void 0}function Pp(n){if(!P.isGecko||!n.rangeCount)return!1;const i=n.getRangeAt(0).startContainer;try{Object.prototype.toString.call(i)}catch{return!0}return!1}class yt extends De(){constructor(e){super();u(this,"view");u(this,"document");u(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] *")}}class Gt{constructor(i,e,t){u(this,"view");u(this,"document");u(this,"domEvent");u(this,"domTarget");this.view=i,this.document=i.document,this.domEvent=e,this.domTarget=e.target,Su(this,t)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class ot extends yt{constructor(){super(...arguments);u(this,"useCapture",!1);u(this,"usePassive",!1)}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(s=>{this.listenTo(e,s,(r,o)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(o.target)&&this.onDomEvent(o)},{useCapture:this.useCapture,usePassive:this.usePassive})})}stopObserving(e){this.stopListening(e)}fire(e,t,s){this.isEnabled&&this.document.fire(e,new Gt(this.view,t,s))}}class Ap extends ot{constructor(){super(...arguments);u(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 Kt(this)}};this.fire(e.type,e,t)}}class xp extends yt{constructor(e){super(e);u(this,"_fireSelectionChangeDoneDebounced");this._fireSelectionChangeDoneDebounced=pt(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,s)=>{e.selection.isFake&&this.isEnabled&&s.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,s)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(s.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,s=new Ge(t.getRanges(),{backward:t.isBackward,fake:!1});(e==V.arrowleft||e==V.arrowup)&&s.setTo(s.getFirstPosition()),(e==V.arrowright||e==V.arrowdown)&&s.setTo(s.getLastPosition());const r={oldSelection:t,newSelection:s,domSelection:null};this.document.fire("selectionChange",r),this._fireSelectionChangeDoneDebounced(r)}}let sd=class extends yt{constructor(e){super(e);u(this,"domConverter");u(this,"_config");u(this,"_domElements");u(this,"_mutationObserver");this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,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,s=new Set,r=new Set;for(const a of e){const l=t.mapDomToView(a.target);l&&(l.is("uiElement")||l.is("rawElement")||a.type==="childList"&&!this._isBogusBrMutation(a)&&r.add(l))}for(const a of e){const l=t.mapDomToView(a.target);if(!(l&&(l.is("uiElement")||l.is("rawElement")))&&a.type==="characterData"){const c=t.findCorrespondingViewText(a.target);c&&!r.has(c.parent)?s.add(c):!c&&he(a.target)&&r.add(t.mapDomToView(a.target.parentNode))}}const o=[];for(const a of s)o.push({type:"text",node:a});for(const a of r){const l=t.mapViewToDom(a),c=Array.from(a.getChildren()),d=Array.from(t.domChildrenToView(l,{withChildren:!1}));qr(c,d,Sp)||o.push({type:"children",node:a})}o.length&&this.document.fire("mutations",{mutations:o})}_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")}};
111function Sp(n,i){if(!Array.isArray(n))return n===i?!0:n.is("$text")&&i.is("$text")?n.data===i.data:!1}class vs extends ot{constructor(e){super(e);u(this,"_renderTimeoutId",null);u(this,"_isFocusChanging",!1);u(this,"domEventType",["focus","blur"]);this.useCapture=!0;const t=this.document;t.on("focus",()=>this._handleFocus()),t.on("blur",(s,r)=>this._handleBlur(r)),t.on("beforeinput",()=>{t.isFocused||this._handleFocus()},{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this._renderTimeoutId=null,this.flush(),this.view.change(()=>{})},50)}_handleBlur(e){const t=this.document.selection.editableElement;(t===null||t===e.target)&&(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change(()=>{}))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class Ip extends yt{constructor(e){super(e);u(this,"mutationObserver");u(this,"focusObserver");u(this,"selection");u(this,"domConverter");u(this,"_documents",new WeakSet);u(this,"_fireSelectionChangeDoneDebounced");u(this,"_clearInfiniteLoopInterval");u(this,"_documentIsSelectingInactivityTimeoutDebounced");u(this,"_loopbackCounter",0);u(this,"_pendingSelectionChange",new Set);this.mutationObserver=e.getObserver(sd),this.focusObserver=e.getObserver(vs),this.selection=this.document.selection,this.domConverter=e.domConverter,this._fireSelectionChangeDoneDebounced=pt(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=pt(()=>this.document.isSelecting=!1,5e3),this.view.document.on("change:isFocused",(t,s,r)=>{if(r&&this._pendingSelectionChange.size){for(const o of Array.from(this._pendingSelectionChange))this._handleSelectionChange(o);this._pendingSelectionChange.clear()}})}observe(e){const t=e.ownerDocument,s=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},r=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",s,{priority:"highest"}),this.listenTo(e,"keydown",r,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",r,{priority:"highest",useCapture:!0}),!this._documents.has(t)&&(this.listenTo(t,"mouseup",r,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",()=>{this.document.isComposing&&!P.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced())}),this.listenTo(this.view.document,"compositionstart",()=>{this._handleSelectionChange(t)},{priority:"lowest"}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(t);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.view.document.isFocused&&!this.view.document.isReadOnly){this._pendingSelectionChange.add(e);return}if(this._pendingSelectionChange.delete(e),!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(t))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(!Op(s))this.view.forceRender();else if(this.selection.isSimilar(s))this.view.forceRender();else{const r={oldSelection:this.selection,newSelection:s,domSelection:t};this.document.fire("selectionChange",r),this._fireSelectionChangeDoneDebounced(r)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}function Op(n){return Array.from(n.getRanges()).flatMap(i=>[i.start.root,i.end.root]).every(i=>i&&i.is("rootElement"))}class Mp extends ot{constructor(e){super(e);u(this,"domEventType",["compositionstart","compositionupdate","compositionend"]);const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
112 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
113 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
114 */class rd{constructor(i,e={}){u(this,"_files");u(this,"_native");this._files=e.cacheFiles?ll(i):null,this._native=i}get files(){return this._files||(this._files=ll(this._native)),this._files}get types(){return this._native.types}getData(i){return this._native.getData(i)}setData(i,e){this._native.setData(i,e)}set effectAllowed(i){this._native.effectAllowed=i}get effectAllowed(){return this._native.effectAllowed}set dropEffect(i){this._native.dropEffect=i}get dropEffect(){return this._native.dropEffect}setDragImage(i,e,t){this._native.setDragImage(i,e,t)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function ll(n){const i=Array.from(n.files||[]),e=Array.from(n.items||[]);return i.length?i:e.filter(t=>t.kind==="file").map(t=>t.getAsFile())}class Rp extends ot{constructor(){super(...arguments);u(this,"domEventType","beforeinput")}onDomEvent(e){const t=e.getTargetRanges(),s=this.view,r=s.document;let o=null,a=null,l=[];if(e.dataTransfer&&(o=new rd(e.dataTransfer)),e.data!==null?a=e.data:o&&(a=o.getData("text/plain")),r.selection.isFake)l=Array.from(r.selection.getRanges()),e.preventDefault();else if(t.length)l=t.map(c=>{let d=s.domConverter.domPositionToView(c.startContainer,c.startOffset);const h=s.domConverter.domPositionToView(c.endContainer,c.endOffset);if(d&&he(c.startContainer)&&c.startOffset<Ce){e.preventDefault();let f=Ce-c.startOffset;d=d.getLastMatchingPosition(m=>!!(m.item.is("attributeElement")||m.item.is("uiElement")||m.item.is("$textProxy")&&f--),{direction:"backward",singleCharacters:!0})}if(Vp(c.endContainer,c.endOffset)&&e.preventDefault(),d)return s.createRange(d,h);if(h)return s.createRange(h)}).filter(c=>!!c);else if(P.isAndroid){const c=e.target.ownerDocument.defaultView.getSelection();l=Array.from(s.domConverter.domSelectionToView(c).getRanges())}if(P.isAndroid&&e.inputType=="insertCompositionText"&&a&&a.endsWith(`
115`)){this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[s.createRange(l[0].end)]});return}if(["insertText","insertReplacementText"].includes(e.inputType)&&a&&a.includes(`
116`)){const c=a.split(/\n{1,2}/g);let d=l;e.preventDefault();for(let h=0;h<c.length;h++){const f=c[h];f!=""&&(this.fire(e.type,e,{data:f,dataTransfer:o,targetRanges:d,inputType:e.inputType,isComposing:e.isComposing}),d=[r.selection.getFirstRange()]),h+1<c.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:d}),d=[r.selection.getFirstRange()])}return}this.fire(e.type,e,{data:a,dataTransfer:o,targetRanges:l,inputType:e.inputType,isComposing:e.isComposing})}}function Vp(n,i){for(;n.parentNode;
116){if(G(n)){if(i!=n.data.length)return!1}else if(i!=n.childNodes.length)return!1;if(i=bi(n)+1,n=n.parentNode,i<n.childNodes.length&&he(n.childNodes[i]))return!0}return!1}class Bp extends yt{constructor(i){super(i),this.document.on("keydown",(e,t)=>{if(this.isEnabled&&fg(t.keyCode)){const s=new Yt(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(s,t),s.stop.called&&e.stop()}})}observe(){}stopObserving(){}}class Lp extends yt{constructor(i){super(i);const e=this.document;e.on("keydown",(t,s)=>{if(!this.isEnabled||s.keyCode!=V.tab||s.ctrlKey)return;const r=new Yt(e,"tab",e.selection.getFirstRange());e.fire(r,s),r.stop.called&&t.stop()})}observe(){}stopObserving(){}}class Fp extends q(){constructor(e){super();u(this,"document");u(this,"domConverter");u(this,"domRoots",new Map);u(this,"_renderer");u(this,"_initialDomRootAttributes",new WeakMap);u(this,"_observers",new Map);u(this,"_writer");u(this,"_ongoingChange",!1);u(this,"_postFixersInProgress",!1);u(this,"_renderingDisabled",!1);u(this,"_hasChangedSinceTheLastRendering",!1);this.document=new Ws(e),this.domConverter=new Us(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new dp(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Xu(this.document),this.addObserver(sd),this.addObserver(vs),this.addObserver(Ip),this.addObserver(Ap),this.addObserver(xp),this.addObserver(Mp),this.addObserver(Bp),this.addObserver(Rp),this.addObserver(Lp),cp(this),ep(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}),P.isiOS&&this.listenTo(this.document,"blur",(t,s)=>{this.domConverter.mapDomToView(s.domEvent.relatedTarget)||this.domConverter._clearDomSelection()}),this.listenTo(this.document,"mutations",(t,{mutations:s})=>{s.forEach(r=>this._renderer.markToSync(r.type,r.node))},{priority:"low"}),this.listenTo(this.document,"mutations",()=>{this.forceRender()},{priority:"lowest"})}attachDomRoot(e,t="main"){const s=this.document.getRoot(t);s._name=e.tagName.toLowerCase();const r={};for(const{name:a,value:l}of Array.from(e.attributes))r[a]=l,a==="class"?this._writer.addClass(l.split(" "),s):s.hasAttribute(a)||this._writer.setAttribute(a,l,s);this._initialDomRootAttributes.set(e,r);const o=()=>{this._writer.setAttribute("contenteditable",(!s.isReadOnly).toString(),s),s.isReadOnly?this._writer.addClass("ck-read-only",s):this._writer.removeClass("ck-read-only",s)};o(),this.domRoots.set(t,e),this.domConverter.bindElements(e,s),this._renderer.markToSync("children",s),this._renderer.markToSync("attributes",s),this._renderer.domDocuments.add(e.ownerDocument),s.on("change:children",(a,l)=>this._renderer.markToSync("children",l)),s.on("change:attributes",(a,l)=>this._renderer.markToSync("attributes",l)),s.on("change:text",(a,l)=>this._renderer.markToSync("text",l)),s.on("change:isReadOnly",()=>this.change(o)),s.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const a of this._observers.values())a.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:r})=>t.removeAttribute(r));const s=this._initialDomRootAttributes.get(t);for(const r in s)t.setAttribute(r,s[r]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const r of this._observers.values())r.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[s,r]of this.domRoots)t.observe(r,s);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()}
116scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:s=20,ancestorOffset:r=20}={}){const o=this.document.selection.getFirstRange();if(!o)return;const a=_e({alignToTop:e,forceScroll:t,viewportOffset:s,ancestorOffset:r});typeof s=="number"&&(s={top:s,bottom:s,left:s,right:s});const l={target:this.domConverter.viewRangeToDom(o),viewportOffset:s,ancestorOffset:r,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",l,a),og(l)}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 p("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 */p.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(vs).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 I(e,t)}createRangeOn(e){return I._createOn(e)}createRangeIn(e){return I._createIn(e)}createSelection(...e){return new Ge(...e)}_disableRendering(e){this._renderingDisabled=e,e==!1&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}/**
117 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
118 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
119 */class Rt{is(){throw new Error("is() method is abstract")}}class Ke extends Rt{constructor(e,t,s){super();u(this,"textNode");u(this,"data");u(this,"offsetInText");if(this.textNode=e,t<0||t>e.offsetSize)throw new p("model-textproxy-wrong-offsetintext",this);if(s<0||t+s>e.offsetSize)throw new p("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+s),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 s=e.includeSelf?this:this.parent;for(;s;)t[e.parentFirst?"push":"unshift"](s),s=s.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()}}Ke.prototype.is=function(n){return n==="$textProxy"||n==="model:$textProxy"||n==="textProxy"||n==="model:textProxy"};class ht{constructor(i){u(this,"direction");u(this,"boundaries");u(this,"singleCharacters");u(this,"shallow");u(this,"ignoreElementEnd");u(this,"_position");u(this,"_boundaryStartParent");u(this,"_boundaryEndParent");u(this,"_visitedParent");if(!i||!i.boundaries&&!i.startPosition)throw new p("model-tree-walker-no-start-position",null);const e=i.direction||"forward";if(e!="forward"&&e!="backward")throw new p("model-tree-walker-unknown-direction",i,{direction:e});this.direction=e,this.boundaries=i.boundaries||null,i.startPosition?this._position=i.startPosition.clone():this._position=_._createAt(this.boundaries[this.direction=="backward"?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!i.singleCharacters,this.shallow=!!i.shallow,this.ignoreElementEnd=!!i.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(i){let e,t,s,r;do s=this.position,r=this._visitedParent,{done:e,value:t}=this.next();while(!e&&i(t));e||(this._position=s,this._visitedParent=r)}jumpTo(i){this._boundaryStartParent&&i.isBefore(this.boundaries.start)?i=this.boundaries.start:this._boundaryEndParent&&i.isAfter(this.boundaries.end)&&(i=this.boundaries.end),this._position=i.clone(),this._visitedParent=i.parent}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const i=this.position,e=this.position.clone(),t=this._visitedParent;if(t.parent===null&&e.offset===t.maxOffset)return{done:!0,value:void 0};if(t===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const s=cn(e,t),r=s||od(e,t,s);if(r&&r.is("model:element")){if(!this.shallow)e.path.push(0),this._visitedParent=r;else{if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}return this._position=e,Lt("elementStart",r,i,e,1)}if(r&&r.is("model:$text")){let o;if(this.singleCharacters)o=1;else{let c=r.endOffset;this._boundaryEndParent==t&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),o=c-e.offset}const a=e.offset-r.startOffset,l=new Ke(r,a,o);return e.offset+=o,this._position=e,Lt("text",l,i,e,o)}return e.path.pop(),e.offset++,this._position=e,this._visitedParent=t.parent,this.ignoreElementEnd?this._next():Lt("elementEnd",t,i,e)}_previous(){const i=this.position,e=this.position.clone(),t=this._visitedParent;if(t.parent===null&&e.offset===0)return{done:!0,value:void 0};if(t==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const s=e.parent,r=cn(e,s),o=r||ad(e,s,r);if(o&&o.is("model:element"))return e.offset--,this.shallow?(this._position=e,Lt("elementStart",o,i,e,1)):(e.path.push(o.maxOffset),this._position=e,this._visitedParent=o,this.ignoreElementEnd?this._previous():Lt("elementEnd",o,i,e));if(o&&o.is("model:$text")){let a;if(this.singleCharacters)a=1;else{let d=o.startOffset;this._boundaryStartParent==t&&this.boundaries.start.offset>d&&(d=this.boundaries.start.offset),a=e.offset-d}const l=e.offset-o.startOffset,c=new Ke(o,l-a,a);return e.offset-=a,this._position=e,Lt("text",c,i,e,a)}return e.path.pop(),this._position=e,this._visitedParent=t.parent,Lt("elementStart",t,i,e,1)}}function Lt(n,i,e,t,s){return{done:!1,value:{type:n,item:i,previousPosition:e,nextPosition:t,length:s}}}class _ extends Rt{constructor(e,t,s="toNone"){super();u(this,"root");u(this,"path");u(this,"stickiness");if(!e.is("element")&&!e.is("documentFragment"))throw new p("model-position-root-invalid",e);if(!Array.isArray(t)||t.length===0)throw new p("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=s}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.getChildAtOffset(this.path[t]),!e)throw new p("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new p("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return cn(this,this.parent)}get nodeAfter(){const e=this.parent;return od(this,e,cn(this,e))}get nodeBefore(){const e=this.parent;return ad(this,e,cn(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}isValid(){if(this.offset<0)return!1;let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)return!1;return this.offset<=e.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=ue(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"}}
119getLastMatchingPosition(e,t={}){t.startPosition=this;const s=new ht(t);return s.skip(e),s.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=ue(this.path,e.path),s=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,s)}getCommonAncestor(e){const t=this.getAncestors(),s=e.getAncestors();let r=0;for(;t[r]==s[r]&&t[r];)r++;return r===0?null:t[r-1]}getShiftedBy(e){const t=this.clone(),s=t.offset+e;return t.offset=s<0?0:s,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 s=0;s<t;s++){const r=this.path[s]-e.path[s];if(r<-1||r>1)return!1;if(r===1)return cl(e,this,s);if(r===-1)return cl(this,e,s)}return this.path.length===e.path.length?!0:this.path.length>e.path.length?Zr(this.path,t):Zr(e.path,t)}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),s=e.getParentPath();return ue(t,s)=="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=_._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,s=t.containsPosition(this)||t.start.isEqual(this);let r;return s?(r=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(r=r._getTransformedByDeletion(e.deletionPosition,1))):this.isEqual(e.deletionPosition)?r=_._createAt(e.deletionPosition):r=this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),r}_getTransformedByDeletion(e,t){const s=_._createAt(this);if(this.root!=e.root)return s;if(ue(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;s.offset-=t}}else if(ue(e.getParentPath(),this.getParentPath())=="prefix"){const r=e.path.length-1;if(e.offset<=this.path[r]){if(e.offset+t>this.path[r])return null;s.path[r]-=t}}return s}_getTransformedByInsertion(e,t){const s=_._createAt(this);if(this.root!=e.root)return s;if(ue(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(s.offset+=t);else if(ue(e.getParentPath(),this.getParentPath())=="prefix"){const r=e.path.length-1;e.offset<=this.path[r]&&(s.path[r]+=t)}return s}_getTransformedByMove(e,t,s){if(t=t._getTransformedByDeletion(e,s),e.isEqual(t))return _._createAt(this);const r=this._getTransformedByDeletion(e,s);return r===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(s).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):r._getTransformedByInsertion(t,s)}_getCombined(e,t){const s=e.path.length-1,r=_._createAt(t);return r.stickiness=this.stickiness,r.offset=r.offset+this.path[s]-e.offset,r.path=[...r.path,...this.path.slice(s+1)],r}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,s="toNone"){if(e.is("model:position"))return new _(e.root,e.path,e.stickiness);{const r=e;if(t=="end")t=r.maxOffset;
119else{if(t=="before")return this._createBefore(r,s);if(t=="after")return this._createAfter(r,s);if(t!==0&&!t)throw new p("model-createpositionat-offset-required",[this,e])}if(!r.is("element")&&!r.is("documentFragment"))throw new p("model-position-parent-incorrect",[this,e]);const o=r.getPath();return o.push(t),new this(r.root,o,s)}}static _createAfter(e,t){if(!e.parent)throw new p("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 p("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const s=new _(t.graveyard,e.path);return s.stickiness=e.stickiness,s}if(!t.getRoot(e.root))throw new p("model-position-fromjson-no-root",t,{rootName:e.root});return new _(t.getRoot(e.root),e.path,e.stickiness)}}_.prototype.is=function(n){return n==="position"||n==="model:position"};function cn(n,i){const e=i.getChildAtOffset(n.offset);return e&&e.is("$text")&&e.startOffset<n.offset?e:null}function od(n,i,e){return e!==null?null:i.getChildAtOffset(n.offset)}function ad(n,i,e){return e!==null?null:i.getChild(i.offsetToIndex(n.offset)-1)}function cl(n,i,e){return!(e+1===n.path.length||!Zr(i.path,e+1)||!Np(n,e+1))}function Zr(n,i){for(;i<n.length;){if(n[i]!==0)return!1;i++}return!0}function Np(n,i){let e=n.parent,t=n.path.length-1,s=0;for(;t>=i;){if(n.path[t]+s!==e.maxOffset)return!1;s=1,t--,e=e.parent}return!0}class b extends Rt{constructor(e,t){super();u(this,"start");u(this,"end");this.start=_._createAt(e),this.end=t?_._createAt(t):_._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new ht({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return ue(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 s=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),r=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return s&&r}containsItem(e){const t=_._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 b(this.start,e.start)),this.containsPosition(e.end)&&t.push(new b(e.end,this.end))):t.push(new b(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,s=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(s=e.end),new b(t,s)}return null}getJoined(e,t=!1){let s=this.isIntersecting(e);if(s||(this.start.isBefore(e.start)?s=t?this.end.isTouching(e.start):this.end.isEqual(e.start):s=t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!s)return null;let r=this.start,o=this.end;return e.start.isBefore(r)&&(r=e.start),e.end.isAfter(o)&&(o=e.end),new b(r,o)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,s=_._createAt(this.start);let r=s.parent;for(;s.path.length>t+1;){const o=r.maxOffset-s.offset;o!==0&&e.push(new b(s,s.getShiftedBy(o))),s.path=s.path.slice(0,-1),s.offset++,r=r.parent}for(;s.path.length<=this.end.path.length;){const o=this.end.path[s.path.length-1],a=o-s.offset;a!==0&&e.push(new b(s,s.getShiftedBy(a))),s.offset=o,s.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new ht(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ht(e);for(const s of t)yield s.item}*getPositions(e={}){e.boundaries=this;const t=new ht(e);yield t.position;for(const s of t)yield s.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 b(this.start,this.end)]}getTransformedByOperations(e){const t=[new b(this.start,this.end)];for(const s of e)for(let r=0;r<t.length;r++){const o=t[r].getTransformedByOperation(s);t.splice(r,1,...o),r+=o.length-1}for(let s=0;s<t.length;s++){const r=t[s];for(let o=s+1;o<t.length;o++){const a=t[o];(r.containsRange(a)||a.containsRange(r)||r.isEqual(a))&&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 s=e.sourcePosition,r=e.howMany,o=e.targetPosition;return this._getTransformedByMove(s,o,r,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let s=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(s=this.end.getShiftedBy(1)),t.root!=s.root&&(s=this.end.getShiftedBy(-1)),new b(t,s)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new b(this.start);let t=this.start._getTransformedByMergeOperation(e),s=this.end._getTransformedByMergeOperation(e);return t.root!=s.root&&(s=this.end.getShiftedBy(-1)),t.isAfter(s)?(e.sourcePosition.isBefore(e.targetPosition)?(t=_._createAt(s),t.offset=0):(e.deletionPosition.isEqual(t)||(s=e.deletionPosition),t=e.targetPosition),new b(t,s)):new b(t,s)}_getTransformedByInsertion(e,t,s=!1){if(s&&this.containsPosition(e))return[new b(this.start,e),new b(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const r=new b(this.start,this.end);return r.start=r.start._getTransformedByInsertion(e,t),r.end=r.end._getTransformedByInsertion(e,t),[r]}}_getTransformedByMove(e,t,s,r=!1){if(this.isCollapsed){const f=this.start._getTransformedByMove(e,t,s);return[new b(f)]}const o=b._createFromPositionAndShift(e,s),a=t._getTransformedByDeletion(e,s);if(this.containsPosition(t)&&!r&&(o.containsPosition(this.start)||o.containsPosition(this.end))){const f=this.start._getTransformedByMove(e,t,s),m=this.end._getTransformedByMove(e,t,s);return[new b(f,m)]}let l;const c=this.getDifference(o);let d=null;const h=this.getIntersection(o);if(c.length==1?d=new b(c[0].start._getTransformedByDeletion(e,s),c[0].end._getTransformedByDeletion(e,s)):c.length==2&&(d=new b(this.start,this.end._getTransformedByDeletion(e,s))),d?l=d._getTransformedByInsertion(a,s,h!==null||r):l=[],h){const f=new b(h.start._getCombined(o.start,a),h.end._getCombined(o.start,a));l.length==2?l.splice(1,0,f):l.push(f)}return l}_getTransformedByDeletion(e,t){let s=this.start._getTransformedByDeletion(e,t),r=this.end._getTransformedByDeletion(e,t);return s==null&&r==null?null:(s==null&&(s=e),r==null&&(r=e),new b(s,r))}static _createFromPositionAndShift(e,t){const s=e,r=e.getShiftedBy(t);return t>0?new this(s,r):new this(r,s)}static _createIn(e){return new this(_._createAt(e,0),_._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(_._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new p("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((o,a)=>o.start.isAfter(a.start)?1:-1);const s=e.indexOf(t),r=new this(t.start,t.end);for(let o=s-1;o>=0&&e[o].end.isEqual(r.start);o--)r.start=_._createAt(e[o].start);for(let o=s+1;o<e.length&&e[o].start.isEqual(r.end);o++)r.end=_._createAt(e[o].end);return r}static fromJSON(e,t){return new this(_.fromJSON(e.start,t),_.fromJSON(e.end,t))}}b.prototype.is=function(n){return n==="range"||n==="model:range"};class ld extends H(){constructor(){super();u(this,"_modelToViewMapping",new WeakMap);u(this,"_viewToModelMapping",new WeakMap);u(this,"_viewToModelLengthCallbacks",new Map);u(this,"_markerNameToElements",new Map);u(this,"_elementToMarkerNames",new Map);u(this,"_deferredBindingRemovals",new Map);u(this,"_unboundMarkerNames",new Set);u(this,"_cache",new Dp);this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const s=this._modelToViewMapping.get(t.modelPosition.parent);if(!s)throw new p("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(s,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const s=this.findMappedViewAncestor(t.viewPosition),r=this._viewToModelMapping.get(s),o=this._toModelOff
119set(t.viewPosition.parent,t.viewPosition.offset,s);t.modelPosition=_._createAt(r,o)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const s=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const r of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(r);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e)&&this._cache.stopTracking(e),this._modelToViewMapping.get(s)==e&&this._modelToViewMapping.delete(s))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)&&this._cache.stopTracking(t)}bindElementToMarker(e,t){const s=this._markerNameToElements.get(t)||new Set;s.add(e);const r=this._elementToMarkerNames.get(e)||new Set;r.add(t),this._markerNameToElements.set(t,s),this._elementToMarkerNames.set(e,r)}unbindElementFromMarkerName(e,t){const s=this._markerNameToElements.get(t);s&&(s.delete(e),s.size==0&&this._markerNameToElements.delete(t));const r=this._elementToMarkerNames.get(e);r&&(r.delete(t),r.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 b(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new I(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 s={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",s),s.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const s=new Set;for(const r of t)if(r.is("attributeElement"))for(const o of r.getElementsWithSameId())s.add(o);else s.add(r);return s}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,s){if(s!=e){const o=this._toModelOffset(e.parent,e.index,s),a=this._toModelOffset(e,t,e);return o+a}if(e.is("$text"))return t;let r=0;for(let o=0;o<t;o++)r+=this.getModelLength(e.getChild(o));return r}getModelLength(e){const t=[e];let s=0;for(;t.length>0;){const r=t.pop(),o=r.name&&this._viewToModelLengthCallbacks.size>0&&this._viewToModelLengthCallbacks.get(r.name);if(o)s+=o(r);else if(this._viewToModelMapping.has(r))s+=1;else if(r.is("$text"))s+=r.data.length;else{if(r.is("uiElement"))continue;for(const a of r.getChildren())t.push(a)}}return s}findPositionIn(e,t){if(t===0)return this._moveViewPositionToTextNode(new k(e,0));if(this._viewToModelLengthCallbacks.size==0&&this._viewToModelMapping.has(e)){const r=this._cache.getClosest(e,t);return this._findPositionStartingFrom(r.viewPosition,r.modelOffset,t,e,!0)}else return this._findPositionStartingFrom(new k(e,0),0,t,e,!1)}_findPositionStartingFrom(e,t,s,r,o){let a=e.parent,l=e.offset;if(a.is("$text"))return new k(a,s-t);let c,d=t,h=0;for(;d<s;){if(c=a.getChild(l),!c){if(a==r)throw new p("mapping-model-offset-not-found",this,{modelOffset:s,viewContainer:r});l=a.parent.getChildIndex(a)+1,a=a.parent,o&&this._cache.save(a,l,r,d);continue}o?h=this._getModelLengthAndCache(c,r,d):h=this.getModelLength(c),d+=h,l++}let f=new k(a,l);if(o)for(;f.isAtEnd&&f.parent!==r&&f.parent.parent;){const m=f.parent.parent,g=m.getChildIndex(f.parent)+1;this._cache.save(m,g,r,d),f=new k(m,g)}return d==s?this._moveViewPositionToTextNode(f):this._findPositionStartingFrom(new k(c,0),d-h,s,r,o)}
119_getModelLengthAndCache(e,t,s){let r=0;if(this._viewToModelMapping.has(e))r=1;else if(e.is("$text"))r=e.data.length;else if(!e.is("uiElement"))for(const o of e.getChildren())r+=this._getModelLengthAndCache(o,t,s+r);return this._cache.save(e.parent,e.index+1,t,s+r),r}_moveViewPositionToTextNode(e){const t=e.nodeBefore,s=e.nodeAfter;return t&&t.is("view:$text")?new k(t,t.data.length):s&&s.is("view:$text")?new k(s,0):e}}class Dp extends H(){constructor(){super(...arguments);u(this,"_cachedMapping",new WeakMap);u(this,"_nodeToCacheListIndex",new WeakMap);u(this,"_invalidateOnChildrenChangeCallback",(e,t,s)=>{this._clearCacheInsideParent(t,s.index)});u(this,"_invalidateOnTextChangeCallback",(e,t)=>{this._clearCacheAfter(t)})}save(e,t,s,r){const o=this._cachedMapping.get(s),a=o.cacheMap.get(r);if(a){const h=e.getChild(t-1),f=a.viewPosition.nodeBefore?this._nodeToCacheListIndex.get(a.viewPosition.nodeBefore):0;this._nodeToCacheListIndex.set(h,f);return}const c={viewPosition:new k(e,t),modelOffset:r};o.maxModelOffset=r>o.maxModelOffset?r:o.maxModelOffset,o.cacheMap.set(r,c);let d=o.cacheList.length-1;for(;d>=0&&o.cacheList[d].modelOffset>r;)d--;if(o.cacheList.splice(d+1,0,c),t>0){const h=e.getChild(t-1);this._nodeToCacheListIndex.set(h,d+1)}}getClosest(e,t){const s=this._cachedMapping.get(e);let r;if(s)if(t>s.maxModelOffset)r=s.cacheList[s.cacheList.length-1];else{const o=s.cacheMap.get(t);o?r=o:r=this._findInCacheList(s.cacheList,t)}else r=this.startTracking(e);return{modelOffset:r.modelOffset,viewPosition:r.viewPosition.clone()}}startTracking(e){const s={viewPosition:new k(e,0),modelOffset:0},r={maxModelOffset:0,cacheList:[s],cacheMap:new Map([[0,s]])};return this._cachedMapping.set(e,r),e.on("change:children",this._invalidateOnChildrenChangeCallback),e.on("change:text",this._invalidateOnTextChangeCallback),s}stopTracking(e){e.off("change:children",this._invalidateOnChildrenChangeCallback),e.off("change:text",this._invalidateOnTextChangeCallback),this._cachedMapping.delete(e)}_clearCacheInsideParent(e,t){if(t==0)this._cachedMapping.has(e)?this._clearCacheAll(e):this._clearCacheInsideParent(e.parent,e.index);else{const s=e.getChild(t-1);this._clearCacheAfter(s)}}_clearCacheAll(e){const t=this._cachedMapping.get(e);t.maxModelOffset>0&&(t.maxModelOffset=0,t.cacheList.length=1,t.cacheMap.clear(),t.cacheMap.set(0,t.cacheList[0]))}_clearCacheAfter(e){const t=this._nodeToCacheListIndex.get(e);if(t===void 0){const r=e.parent;this._cachedMapping.has(r)||this._clearCacheInsideParent(r.parent,r.index);return}let s=e.parent;for(;!this._cachedMapping.has(s);)s=s.parent;this._clearCacheFromCacheIndex(s,t)}_clearCacheFromCacheIndex(e,t){t===0&&(t=1);const s=this._cachedMapping.get(e),r=s.cacheList[t-1];if(!r)return;s.maxModelOffset=r.modelOffset;const o=s.cacheList.splice(t);for(const a of o){s.cacheMap.delete(a.modelOffset);const l=a.viewPosition.nodeBefore;this._nodeToCacheListIndex.delete(l)}}_findInCacheList(e,t){let s=0,r=e.length-1,o=r-s>>1,a=e[o];for(;s<r;)a.modelOffset<t?s=o+1:r=o-1,o=s+(r-s>>1),a=e[o];return a.modelOffset<=t?a:e[o-1]}}class zp{constructor(){u(this,"_consumable",new Map);u(this,"_textProxyRegistry",new Map)}add(i,e){e=Un(e),i instanceof Ke&&(i=this._getSymbolForTextProxy(i)),this._consumable.has(i)||this._consumable.set(i,new Map),this._consumable.get(i).set(e,!0)}consume(i,e){return e=Un(e),i instanceof Ke&&(i=this._getSymbolForTextProxy(i)),this.test(i,e)?(this._consumable.get(i).set(e,!1),!0):!1}test(i,e){e=Un(e),i instanceof Ke&&(i=this._getSymbolForTextProxy(i));const t=this._consumable.get(i);if(t===void 0)return null;const s=t.get(e);return s===void 0?null:s}revert(i,e){e=Un(e),i instanceof Ke&&(i=this._getSymbolForTextProxy(i));const t=this.test(i,e);return t===!1?(this._consumable.get(i).set(e,!0),!0):t===!0?!1:null}verifyAllConsumed(i){const e=[];for(const[t,s]of this._consumable)for(const[r,o]of s){const a=r.split(":")[0];o&&i==a&&e.push({event:r,item:t.name||t.description})}if(e.length)throw new p("conversion-model-consumable-not-consumed",null,{items:e})}_getSymbolForTextProxy(i){let e=null;const t=this._textProxyRegistry.get(i.startOffset);if(t){const s=t.get(i.endOffset);s&&(e=s.get(i.parent))}return e||(e=this._addSymbolForTextProxy(i)),e}_addSymbolForTextProxy(i){const e=i.startOffset,t=i.endOffset,s=i.parent,r=Symbol("$textProxy:"+i.data);let o,a;return o=this._textProxyRegistry.get(e),o||(o=new Map,this._textProxyRegistry.set(e,o)),a=o.get(t),a||(a=new Map,o.set(t,a)),a.set(s,r),r}}function Un(n){const i=n.split(":");return i[0]=="insert"?i[0]:i[0]=="addMarker"||i[0]=="removeMarker"?n:i.length>
1191?i[0]+":"+i[1]:i[0]}class cd extends H(){constructor(e){super();u(this,"_conversionApi");u(this,"_firedEventsMap");this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,s){const r=this._createConversionApi(s,e.getRefreshedItems());for(const a of e.getMarkersToRemove())this._convertMarkerRemove(a.name,a.range,r);const o=this._reduceChanges(e.getChanges());for(const a of o)a.type==="insert"?this._convertInsert(b._createFromPositionAndShift(a.position,a.length),r):a.type==="reinsert"?this._convertReinsert(b._createFromPositionAndShift(a.position,a.length),r):a.type==="remove"?this._convertRemove(a.position,a.length,a.name,r):this._convertAttribute(a.range,a.attributeKey,a.attributeOldValue,a.attributeNewValue,r);r.mapper.flushDeferredBindings();for(const a of r.mapper.flushUnboundMarkerNames()){const l=t.get(a).getRange();this._convertMarkerRemove(a,l,r),this._convertMarkerAdd(a,l,r)}for(const a of e.getMarkersToAdd())this._convertMarkerAdd(a.name,a.range,r);r.consumable.verifyAllConsumed("insert")}convert(e,t,s,r={}){const o=this._createConversionApi(s,void 0,r);this._convertInsert(e,o);for(const[a,l]of t)this._convertMarkerAdd(a,l,o);o.consumable.verifyAllConsumed("insert")}convertSelection(e,t,s){const r=this._createConversionApi(s);this.fire("cleanSelection",{selection:e},r);const o=e.getFirstPosition().root;if(!r.mapper.toViewElement(o))return;const a=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(r.consumable,e,a),this.fire("selection",{selection:e},r),!!e.isCollapsed){for(const l of a)if(r.consumable.test(e,"addMarker:"+l.name)){const c=l.getRange();if(!Hp(e.getFirstPosition(),l,r.mapper))continue;const d={item:e,markerName:l.name,markerRange:c};this.fire(`addMarker:${l.name}`,d,r)}for(const l of e.getAttributeKeys())if(r.consumable.test(e,"attribute:"+l)){const c={item:e,range:e.getFirstRange(),attributeKey:l,attributeOldValue:null,attributeNewValue:e.getAttribute(l)};this.fire(`attribute:${l}:$text`,c,r)}}}_convertInsert(e,t,s={}){s.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const r of e.getWalker({shallow:!0}))this._testAndFire("insert",ul(r),t)}_convertRemove(e,t,s,r){this.fire(`remove:${s}`,{position:e,length:t},r)}_convertAttribute(e,t,s,r,o){this._addConsumablesForRange(o.consumable,e,`attribute:${t}`);for(const a of e){const l={item:a.item,range:b._createFromPositionAndShift(a.previousPosition,a.length),attributeKey:t,attributeOldValue:s,attributeNewValue:r};this._testAndFire(`attribute:${t}`,l,o)}}_convertReinsert(e,t){const s=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,s);for(const r of s.map(ul))this._testAndFire("insert",{...r,reconversion:!0},t)}_convertMarkerAdd(e,t,s){if(t.root.rootName=="$graveyard")return;const r=`addMarker:${e}`;if(s.consumable.add(t,r),this.fire(r,{markerName:e,markerRange:t},s),!!s.consumable.consume(t,r)){this._addConsumablesForRange(s.consumable,t,r);for(const o of t.getItems()){if(!s.consumable.test(o,r))continue;const a={item:o,range:b._createOn(o),markerName:e,markerRange:t};this.fire(r,a,s)}}}_convertMarkerRemove(e,t,s){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},s)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const s of t){const r=s.item;if(e.test(r,"insert")===null){e.add(r,"insert");for(const o of r.getAttributeKeys())e.add(r,"attribute:"+o)}}return e}_addConsumablesForRange(e,t,s){for(const r of t.getItems())e.add(r,s);return e}_addConsumablesForSelection(e,t,s){e.add(t,"selection");for(const r of s)e.add(t,"addMarker:"+r.name);for(const r of t.getAttributeKeys())e.add(t,"attribute:"+r);return e}_testAndFire(e,t,s){const r=Wp(e,t),o=t.item.is("$textProxy")?s.consumable._getSymbolForTextProxy(t.item):t.item,a=this._firedEventsMap.get(s),l=a.get(o);if(!l)a.set(o,new Set([r]));else if(!l.has(r))l.add(r);else return;this.fire(r,t,s)}_testAndFireAddAttributes(e,t){const s={item:e,range:b._createOn(e)};for(const r of s.item.getAttributeKeys())s.attributeKey=r,s.attributeOldValue=null,s.attributeNewValue=s.item.getAttribute(r),this._testAndFire(`attribute:${r}`,s,t)}_createConversionApi(e,t=new Set,s={}){const r={...this._conversionApi,consumable:new zp,writer:e,options:s,convertItem:o=>this._convertInsert(b._createOn(o),r),convertChildren:o=>this._convertInsert(b._createIn(o),r,{doNotAddConsumables:!0}),convertAttributes:o=>this._testAndFireAddAttributes(o,r),canReuseView:o=>!t.has(r.mapper.toModelElement(o))};return this._firedEventsMap.set(r,new Map),r}}function Hp(n,i,e){const t=i.getRange(),s=Array.from(n.getAncestors());return s.shift(),s.reverse(),!s.some(o=>{if(t.containsItem(o))return!!e.toViewElement(o).getCustomProperty("addHighlight")})}function Wp(n,i){const e=i.item.is("element")?i.item.name:"$text";return`${n}:${e}`}function ul(n){return{item:n.item,range:b._createFromPositionAndShift(n.previousPosition,n.length)}}class Xt extends Rt{constructor(e){super();u(this,"parent",null);u(this,"_attrs");u(this,"_index",null);u(this,"_startOffset",null);this._attrs=je(e)}get document(){return null}get index(){return this._index}get startOffset(){return this._startOffset}get offsetSize(){return 1}get endOffset(){return this.startOffset===null?null:this.startOffset+this.offsetSize}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 s=e.includeSelf?this:this.parent;for(;s;)t[e.parentFirst?"push":"unshift"](s),s=s.parent;return t}getCommonAncestor(e,t={}){const s=this.getAncestors(t),r=e.getAncestors(t);let o=0;for(;s[o]==r[o]&&s[o];)o++;return o===0?null:s[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),s=e.getPath(),r=ue(t,s);switch(r){case"prefix":return!0;case"extension":return!1;default:return t[r]<s[r]}}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,s)=>(t[s[0]]=s[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=je(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}Xt.prototype.is=function(n){return n==="node"||n==="model:node"};class ke extends H(Rt){constructor(...e){super();u(this,"_lastRangeBackward",!1);u(this,"_attrs",new Map);u(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}
119get 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 s=!1;for(const r of e._ranges)if(t.isEqual(r)){s=!0;break}if(!s)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new b(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 b(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 b(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,s,r]=e;if(typeof s=="object"&&(r=s,s=void 0),t===null)this._setRanges([]);else if(t instanceof ke)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof b)this._setRanges([t],!!r&&!!r.backward);else if(t instanceof _)this._setRanges([new b(t)]);else if(t instanceof Xt){const o=!!r&&!!r.backward;let a;if(s=="in")a=b._createIn(t);else if(s=="on")a=b._createOn(t);else if(s!==void 0)a=new b(_._createAt(t,s));else throw new p("model-selection-setto-required-second-parameter",[this,t]);this._setRanges([a],o)}else if(Te(t))this._setRanges(t,r&&!!r.backward);else throw new p("model-selection-setto-not-selectable",[this,t])}_setRanges(e,t=!1){const s=Array.from(e),r=s.some(o=>{if(!(o instanceof b))throw new p("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(a=>!a.isEqual(o))});s.length===this._ranges.length&&!r||(this._replaceAllRanges(s),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new p("model-selection-setfocus-no-ranges",[this,e]);const s=_._createAt(e,t);if(s.compareWith(this.focus)=="same")return;const r=this.anchor;this._ranges.length&&this._popRange(),s.compareWith(r)=="before"?(this._pushRange(new b(s,r)),this._lastRangeBackward=!0):(this._pushRange(new b(r,s)),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 s=dl(t.start,e);Up(s,t)&&(yield s);const r=t.getWalker();for(const a of r){const l=a.item;a.type=="elementEnd"&&$p(l,e,t)?yield l:a.type=="elementStart"&&l.is("model:element")&&l.root.document.model.schema.isBlock(l)&&r.jumpTo(_._createAt(l,"end"))}const o=dl(t.end,e);qp(o,t)&&(yield o)}}containsEntireContent(e=this.anchor.root){const t=_._createAt(e,0),s=_._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&s.isTouching(this.getLastPosition())}toJSON(){const e={ranges:Array.from(this.getRanges()).map(s=>s.toJSON())},t=Object.fromEntries(this.getAttributes());return Object.keys(t).length&&(e.attributes=t),this.isBackward&&(e.isBackward=!0),e}_pushRange(e){this._checkRange(e),this._ranges.push(new b(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new p("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}
119_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}ke.prototype.is=function(n){return n==="selection"||n==="model:selection"};function ud(n,i){return i.has(n)?!1:(i.add(n),n.root.document.model.schema.isBlock(n)&&!!n.parent)}function $p(n,i,e){return ud(n,i)&&ta(n,e)}function dl(n,i){const t=n.parent.root.document.model.schema,s=n.parent.getAncestors({parentFirst:!0,includeSelf:!0});let r=!1;const o=s.find(a=>r?!1:(r=t.isLimit(a),!r&&ud(a,i)));return s.forEach(a=>i.add(a)),o}function ta(n,i){const e=Kp(n);return e?!i.containsRange(b._createOn(e),!0):!0}function Up(n,i){return n?i.isCollapsed||n.isEmpty?!0:i.start.isTouching(_._createAt(n,n.maxOffset))?!1:ta(n,i):!1}function qp(n,i){return n?i.isCollapsed||n.isEmpty?!0:i.end.isTouching(_._createAt(n,0))?!1:ta(n,i):!1}function Kp(n){const i=n.root.document.model.schema;let e=n.parent;for(;e;){if(i.isBlock(e))return e;e=e.parent}}class Be extends H(b){constructor(i,e){super(i,e),Gp.call(this)}detach(){this.stopListening()}toRange(){return new b(this.start,this.end)}static fromRange(i){return new Be(i.start,i.end)}}Be.prototype.is=function(n){return n==="liveRange"||n==="model:liveRange"||n=="range"||n==="model:range"};function Gp(){this.listenTo(this.root.document.model,"applyOperation",(n,i)=>{const e=i[0];e.isDocumentOperation&&jp.call(this,e)},{priority:"low"})}function jp(n){const i=this.getTransformedByOperation(n),e=b._createFromRanges(i),t=!e.isEqual(this),s=Jp(this,n);let r=null;if(t){e.root.rootName=="$graveyard"&&(n.type=="remove"?r=n.sourcePosition:r=n.deletionPosition);const o=this.toRange();this.start=e.start,this.end=e.end,this.fire("change:range",o,{deletionPosition:r})}else s&&this.fire("change:content",this.toRange(),{deletionPosition:r})}function Jp(n,i){switch(i.type){case"insert":return n.containsPosition(i.position);case"move":case"remove":case"reinsert":case"merge":return n.containsPosition(i.sourcePosition)||n.start.isEqual(i.sourcePosition)||n.containsPosition(i.targetPosition);case"split":return n.containsPosition(i.splitPosition)||n.containsPosition(i.insertionPosition)}return!1}class U extends Xt{constructor(e,t){super(t);u(this,"_data");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 U(this.data,this.getAttributes())}static fromJSON(e){return new U(e.data,e.attributes)}}U.prototype.is=function(n){return n==="$text"||n==="model:$text"||n==="text"||n==="model:text"||n==="node"||n==="model:node"};const vn="selection:";class Qe extends H(Rt){constructor(e){super();u(this,"_selection");this._selection=new Qp(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)}toJSON(){return this._selection.toJSON()}_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 vn+e}static _isStoreAttributeKey(e){return e.startsWith(vn)}}Qe.prototype.is=function(n){return n==="selection"||n=="model:selection"||n=="documentSelection"||n=="model:documentSelection"};class Qp extends ke{constructor(e){super();u(this,"markers",new Se({idProperty:"name"}));u(this,"_model");u(this,"_document");u(this,"_attributePriority",new Map);u(this,"_selectionRestorePosition",null);u(this,"_hasChangedRange",!1);u(this,"_overriddenGravityRegister",new Set);u(this,"_observedMarkers",new Set);this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,s)=>{const r=s[0];!r.isDocumentOperation||r.type=="marker"||r.type=="rename"||r.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",()=>
119{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,s,r,o)=>{this._updateMarker(s,o)}),this.listenTo(this._document,"change",(t,s)=>{Yp(this._model,s)})}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 s=[e];this.fire("change:attribute",{attributeKeys:s,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=me();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new p("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)}toJSON(){const e=super.toJSON();return this.markers.length&&(e.markers=this.markers.map(t=>t.toJSON())),e}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new p("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Be.fromRange(e);return t.on("change:range",(s,r,o)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const a=this._ranges.indexOf(t);this._ranges.splice(a,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const r of this._model.markers){const o=r.name.split(":",1)[0];if(!this._observedMarkers.has(o))continue;const a=r.getRange();for(const l of this.getRanges())a.containsRange(l,!l.isCollapsed)&&e.push(r)}const s=Array.from(this.markers);for(const r of e)this.markers.has(r)||(this.markers.add(r),t=!0);for(const r of Array.from(this.markers))e.includes(r)||(this.markers.remove(r),t=!0);t&&this.fire("change:marker",{oldMarkers:s,directChange:!1})}_updateMarker(e,t){const s=e.name.split(":",1)[0];if(!this._observedMarkers.has(s))return;let r=!1;const o=Array.from(this.markers),a=this.markers.has(e);if(!t)a&&(this.markers.remove(e),r=!0);else{let l=!1;for(const c of this.getRanges())if(t.containsRange(c,!c.isCollapsed)){l=!0;break}l&&!a?(this.markers.add(e),r=!0):!l&&a&&(this.markers.remove(e),r=!0)}r&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=je(this._getSurroundingAttributes()),s=je(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[o,a]of this._attributePriority)a=="low"&&(this._attrs.delete(o),this._attributePriority.delete(o));this._setAttributesTo(t);const r=[];for(const[o,a]of this.getAttributes())(!s.has(o)||s.get(o)!==a)&&r.push(o);for(const[o]of s)this.hasAttribute(o)||r.push(o);r.length>0&&this.fire("change:attribute",{attributeKeys:r,directChange:!1})}_setAttribute(e,t,s=!0){const r=s?"normal":"low";return r=="low"&&this._attributePriority.get(e)=="normal"||super.getAttribute(e)===t?!1:(this._attrs.set(e,t),this._attributePriority.set(e,r),!0)}
119_removeAttribute(e,t=!0){const s=t?"normal":"low";return s=="low"&&this._attributePriority.get(e)=="normal"||(this._attributePriority.set(e,s),!super.hasAttribute(e))?!1:(this._attrs.delete(e),!0)}_setAttributesTo(e){const t=new Set;for(const[s,r]of this.getAttributes())e.get(s)!==r&&this._removeAttribute(s,!1);for(const[s,r]of e)this._setAttribute(s,r,!1)&&t.add(s);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(vn)&&(yield[t.substr(vn.length),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if(e.root.rootName=="$graveyard")return null;let s=null;if(this.isCollapsed){const r=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(s=Wi(r,t)),s||(s=Wi(o,t)),!this.isGravityOverridden&&!s){let a=r;for(;a&&!s;)a=a.previousSibling,s=Wi(a,t)}if(!s){let a=o;for(;a&&!s;)a=a.nextSibling,s=Wi(a,t)}s||(s=this.getStoredAttributes())}else{const r=this.getFirstRange();for(const o of r){if(o.item.is("element")&&t.isObject(o.item)){s=Wi(o.item,t);break}if(o.type=="text"){s=o.item.getAttributes();break}}}return s}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Wi(n,i){if(!n)return null;if(n instanceof Ke||n instanceof U)return n.getAttributes();if(!i.isInline(n))return null;if(!i.isObject(n))return[];const e=[];for(const[t,s]of n.getAttributes())i.checkAttribute("$text",t)&&i.getAttributeProperties(t).copyFromObject!==!1&&e.push([t,s]);return e}function Yp(n,i){const e=n.document.differ;for(const t of e.getChanges()){if(t.type!="insert")continue;const s=t.position.parent;t.length===s.maxOffset&&n.enqueueChange(i,o=>{const a=Array.from(s.getAttributeKeys()).filter(l=>l.startsWith(vn));for(const l of a)o.removeAttribute(l,s)})}}class un{constructor(i){u(this,"_nodes",[]);u(this,"_offsetToNode",[]);i&&this._insertNodes(0,i)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._offsetToNode.length}getNode(i){return this._nodes[i]||null}getNodeAtOffset(i){return this._offsetToNode[i]||null}getNodeIndex(i){return i.index}getNodeStartOffset(i){return i.startOffset}indexToOffset(i){if(i==this._nodes.length)return this.maxOffset;const e=this._nodes[i];if(!e)throw new p("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(e)}offsetToIndex(i){if(i==this._offsetToNode.length)return this._nodes.length;const e=this._offsetToNode[i];if(!e)throw new p("model-nodelist-offset-out-of-bounds",this,{offset:i,nodeList:this});return this.getNodeIndex(e)}_insertNodes(i,e){const t=[];for(const r of e){if(!(r instanceof Xt))throw new p("model-nodelist-insertnodes-not-node",this);t.push(r)}let s=this.indexToOffset(i);ja(this._nodes,t,i),ja(this._offsetToNode,Xp(t),s);for(let r=i;r<this._nodes.length;r++)this._nodes[r]._index=r,this._nodes[r]._startOffset=s,s+=this._nodes[r].offsetSize}_removeNodes(i,e=1){if(e==0)return[];let t=this.indexToOffset(i);const s=this._nodes.splice(i,e),r=s[s.length-1],o=r.startOffset+r.offsetSize-t;this._offsetToNode.splice(t,o);for(const a of s)a._index=null,a._startOffset=null;for(let a=i;a<this._nodes.length;a++)this._nodes[a]._index=a,this._nodes[a]._startOffset=t,t+=this._nodes[a].offsetSize;return s}_removeNodesArray(i){if(i.length==0)return;for(const t of i)t._index=null,t._startOffset=null;this._nodes=this._nodes.filter(t=>t.index!==null),this._offsetToNode=this._offsetToNode.filter(t=>t.index!==null);let e=0;for(let t=0;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=e,e+=this._nodes[t].offsetSize}toJSON(){return this._nodes.map(i=>i.toJSON())}}function Xp(n){const i=[];let e=0;for(const t of n)for(let s=0;s<t.offsetSize;s++)i[e++]=t;return i}class $ extends Xt{constructor(e,t,s){super(t);u(this,"name");u(this,"_children",new un);this.name=e,s&&this._insertChild(0,s)}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)}getChildAtOffset(e){return this._children.getNodeAtOffset(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 s of e)t=t.getChildAtOffset(s);return t}findAncestor(e,t={}){let s=t.includeSelf?this:this.parent;for(;s;){if(s.name===e)return s;s=s.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?ew(this._children):void 0;return new $(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const s=Zp(t);for(const r of s)r.parent!==null&&r._remove(),r.parent=this;this._children._insertNodes(e,s)}_removeChildren(e,t=1){const s=this._children._removeNodes(e,t);for(const r of s)r.parent=null;return s}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const t of e)t.parent=null}static fromJSON(e){let t;if(e.children){t=[];for(const s of e.children)s.name?t.push($.fromJSON(s)):t.push(U.fromJSON(s))}return new $(e.name,e.attributes,t)}}$.prototype.is=function(n,i){return i?i===this.name&&(n==="element"||n==="model:element"):n==="element"||n==="model:element"||n==="node"||n==="model:node"};function Zp(n){if(typeof n=="string")return[new U(n)];Te(n)||(n=[n]);const i=[];for(const e of n)typeof e=="string"?i.push(new U(e)):e instanceof Ke?i.push(new U(e.data,e.getAttributes())):i.push(e);return i}function ew(n){const i=[];for(const e of n)i.push(e._clone(!0));return i}/**
120 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
121 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
122 */class dd{constructor(i){u(this,"_dispatchers");this._dispatchers=i}add(i){for(const e of this._dispatchers)i(e);return this}}class tw extends dd{elementToElement(i){return this.add(_w(i))}
122elementToStructure(i){return this.add(yw(i))}attributeToElement(i){return this.add(vw(i))}attributeToAttribute(i){return this.add(kw(i))}markerToElement(i){return this.add(Cw(i))}markerToHighlight(i){return this.add(Tw(i))}markerToData(i){return this.add(Ew(i))}}function hd(){return(n,i,e)=>{if(!e.consumable.consume(i.item,n.name))return;const t=e.writer,s=e.mapper.toViewPosition(i.range.start),r=t.createText(i.item.data);t.insert(s,r)}}function fd(){return(n,i,e)=>{e.convertAttributes(i.item),!i.reconversion&&i.item.is("element")&&!i.item.isEmpty&&e.convertChildren(i.item)}}function iw(){return(n,i,e)=>{const t=e.mapper.toViewPosition(i.position),s=i.position.getShiftedBy(i.length),r=e.mapper.toViewPosition(s,{isPhantom:!0}),o=e.writer.createRange(t,r),a=e.writer.remove(o.getTrimmed());for(const l of e.writer.createRangeIn(a).getItems())e.mapper.unbindViewElement(l,{defer:!0})}}function md(n,i){const e=n.createAttributeElement("span",i.attributes);return i.classes&&e._addClass(i.classes),typeof i.priority=="number"&&(e._priority=i.priority),e._id=i.id,e}function nw(){return(n,i,e)=>{const t=i.selection;if(t.isCollapsed||!e.consumable.consume(t,"selection"))return;const s=[];for(const r of t.getRanges())s.push(e.mapper.toViewRange(r));e.writer.setSelection(s,{backward:t.isBackward})}}function sw(){return(n,i,e)=>{const t=i.selection;if(!t.isCollapsed||!e.consumable.consume(t,"selection"))return;const s=e.writer,r=t.getFirstPosition(),o=e.mapper.toViewPosition(r),a=s.breakAttributes(o);s.setSelection(a)}}function rw(){return(n,i,e)=>{const t=e.writer,s=t.document.selection;for(const r of s.getRanges())r.isCollapsed&&r.end.parent.isAttached()&&e.writer.mergeAttributes(r.start);t.setSelection(null)}}function ow(n){return(i,e,t)=>{if(!t.consumable.test(e.item,i.name))return;const s=n(e.attributeOldValue,t,e),r=n(e.attributeNewValue,t,e);if(!s&&!r)return;t.consumable.consume(e.item,i.name);const o=t.writer,a=o.document.selection;if(e.item instanceof ke||e.item instanceof Qe)o.wrap(a.getFirstRange(),r);else{let l=t.mapper.toViewRange(e.range);e.attributeOldValue!==null&&s&&(l=o.unwrap(l,s)),e.attributeNewValue!==null&&r&&o.wrap(l,r)}}}function aw(n,i=Mw){return(e,t,s)=>{if(!i(t.item,s.consumable,{preflight:!0}))return;const r=n(t.item,s,t);if(!r)return;i(t.item,s.consumable);const o=s.mapper.toViewPosition(t.range.start);s.mapper.bindElements(t.item,r),s.writer.insert(o,r),s.convertAttributes(t.item),_d(r,t.item.getChildren(),s,{reconversion:t.reconversion})}}function lw(n,i){return(e,t,s)=>{if(!i(t.item,s.consumable,{preflight:!0}))return;const r=new Map;s.writer._registerSlotFactory(xw(t.item,r,s));const o=n(t.item,s,t);if(s.writer._clearSlotFactory(),!o)return;Sw(t.item,r,s),i(t.item,s.consumable);const a=s.mapper.toViewPosition(t.range.start);s.mapper.bindElements(t.item,o),s.writer.insert(a,o),s.convertAttributes(t.item),Iw(o,r,s,{reconversion:t.reconversion})}}function cw(n){return(i,e,t)=>{e.isOpening=!0;const s=n(e,t);e.isOpening=!1;const r=n(e,t);if(!s||!r)return;const o=e.markerRange;if(o.isCollapsed&&!t.consumable.consume(o,i.name))return;for(const c of o)if(!t.consumable.consume(c.item,i.name))return;const a=t.mapper,l=t.writer;l.insert(a.toViewPosition(o.start),s),t.mapper.bindElementToMarker(s,e.markerName),o.isCollapsed||(l.insert(a.toViewPosition(o.end),r),t.mapper.bindElementToMarker(r,e.markerName)),i.stop()}}function uw(){return(n,i,e)=>{const t=e.mapper.markerNameToElements(i.markerName);if(t){for(const s of t)e.mapper.unbindElementFromMarkerName(s,i.markerName),e.writer.clear(e.writer.createRangeOn(s),s);e.writer.clearClonedElementsGroup(i.markerName),n.stop()}}}function dw(n){return(i,e,t)=>{const s=n(e.markerName,t);if(!s)return;const r=e.markerRange;t.consumable.consume(r,i.name)&&(hl(r,!1,t,e,s),hl(r,!0,t,e,s),i.stop())}}function hl(n,i,e,t,s){const r=i?n.start:n.end,o=r.nodeAfter&&r.nodeAfter.is("element")?r.nodeAfter:null,a=r.nodeBefore&&r.nodeBefore.is("element")?r.nodeBefore:null;if(o||a){let c,d;i&&o||!i&&!a?(c=o,d=!0):(c=a,d=!1);const h=e.mapper.toViewElement(c);if(h){hw(h,i,d,e,t,s);return}}const l=e.mapper.toViewPosition(r);fw(l,i,e,t,s)}function hw(n,i,e,t,s,r){const o=`data-${r.group}-${i?"start":"end"}-${e?"before":"after"}`,a=n.hasAttribute(o)?n.getAttribute(o).split(","):[];a.unshift(r.name),t.writer.setAttribute(o,a.join(","),n),t.mapper.bindElementToMarker(n,s.markerName)}function fw(n,i,e,t,s){const r=`${s.group}-${i?"start":"end"}`,o=s.name?{name:s.name}:null,a=e.writer.createUIElement(r,o);e.writer.insert(n,a),e.mapper.bindElementToMarker(a,t.markerName)}function mw(n){return(i,e,t)=>{const s=n(e.markerName,t);if(!s)return;const r=t.mapper.markerNameToElements(e.markerName);if(!r)return;for(const a of r)t.mapper.unbindElementFromMarkerName(a,e.markerName),a.is("containerElement")?(o(`data-${s.group}-start-before`,a),o(`data-${s.group}-start-after`,a),o(`data-${s.group}-end-before`,a),o(`data-${s.group}-end-after`,a)):t.writer.clear(t.writer.createRangeOn(a),a);t.writer.clearClonedElementsGroup(e.markerName),i.stop();function o(a,l){if(l.hasAttribute(a)){const c=new Set(l.getAttribute(a).split(","));c.delete(s.name),c.size==0?t.writer.removeAttribute(a,l):t.writer.setAttribute(a,Array.from(c).join(","),l)}}}}function gw(n){return(i,e,t)=>{if(!t.consumable.test(e.item,i.name))return;const s=n(e.attributeOldValue,t,e),r=n(e.attributeNewValue,t,e);if(!s&&!r)return;t.consumable.consume(e.item,i.name);const o=t.mapper.toViewElement(e.item),a=t.writer;if(!o)throw new p("conversion-attribute-to-attribute-on-text",t.dispatcher,e);if(e.attributeOldValue!==null&&s){let l=s.value;s.key=="style"&&(typeof s.value=="string"?l=new ln(a.document.stylesProcessor).setTo(s.value).getStylesEntries().map(([c])=>c):l=Object.keys(s.value)),a.removeAttribute(s.key,l,o)}if(e.attributeNewValue!==null&&r){let l=r.value;r.key=="style"&&typeof r.value=="string"&&(l=Object.fromEntries(new ln(a.document.stylesProcessor).setTo(r.value).getStylesEntries())),a.setAttribute(r.key,l,!1,o)}}}function pw(n){return(i,e,t)=>{if(!e.item||!(e.item instanceof ke||e.item instanceof Qe)&&!e.item.is("$textProxy"))return;const s=ia(n,e,t);if(!s||!t.consumable.consume(e.item,i.name))return;const r=t.writer,o=md(r,s),a=r.document.selection;if(e.item instanceof ke||e.item instanceof Qe)r.wrap(a.getFirstRange(),o);else{const l=t.mapper.toViewRange(e.range),c=r.wrap(l,o);for(const d of c.getItems())if(d.is("attributeElement")&&d.isSimilar(o)){t.mapper.bindElementToMarker(d,e.markerName);break}}}}function ww(n){return(i,e,t)=>{if(!e.item||!(e.item instanceof $))return;const s=ia(n,e,t);if(!s||!t.consumable.test(e.item,i.name))return;const r=t.mapper.toViewElement(e.item);if(r&&r.getCustomProperty("addHighlight")){t.consumable.consume(e.item,i.name);for(const a of b._createIn(e.item))t.consumable.consume(a.item,i.name);r.getCustomProperty("addHighlight")(r,s,t.writer),t.mapper.bindElementToMarker(r,e.markerName)}}}function bw(n){return(i,e,t)=>{if(e.markerRange.isCollapsed)return;const s=ia(n,e,t);if(!s)return;
122const r=md(t.writer,s),o=t.mapper.markerNameToElements(e.markerName);if(o){for(const a of o)t.mapper.unbindElementFromMarkerName(a,e.markerName),a.is("attributeElement")?t.writer.unwrap(t.writer.createRangeOn(a),r):a.getCustomProperty("removeHighlight")(a,s.id,t.writer);t.writer.clearClonedElementsGroup(e.markerName),i.stop()}}}function _w(n){const i=gd(n.model),e=kn(n.view,"container");return i.attributes.length&&(i.children=!0),t=>{t.on(`insert:${i.name}`,aw(e,bd(i)),{priority:n.converterPriority||"normal"}),(i.children||i.attributes.length)&&t.on("reduceChanges",wd(i),{priority:"low"})}}function yw(n){const i=gd(n.model),e=kn(n.view,"container");return i.children=!0,t=>{if(t._conversionApi.schema.checkChild(i.name,"$text"))throw new p("conversion-element-to-structure-disallowed-text",t,{elementName:i.name});t.on(`insert:${i.name}`,lw(e,bd(i)),{priority:n.converterPriority||"normal"}),t.on("reduceChanges",wd(i),{priority:"low"})}}function vw(n){n=_e(n);let i=n.model;typeof i=="string"&&(i={key:i});let e=`attribute:${i.key}`;if(i.name&&(e+=":"+i.name),i.values)for(const s of i.values)n.view[s]=kn(n.view[s],"attribute");else n.view=kn(n.view,"attribute");const t=pd(n);return s=>{s.on(e,ow(t),{priority:n.converterPriority||"normal"})}}function kw(n){n=_e(n);let i=n.model;typeof i=="string"&&(i={key:i});let e=`attribute:${i.key}`;if(i.name&&(e+=":"+i.name),i.values)for(const s of i.values)n.view[s]=fl(n.view[s]);else n.view=fl(n.view);const t=pd(n);return s=>{s.on(e,gw(t),{priority:n.converterPriority||"normal"})}}function Cw(n){const i=kn(n.view,"ui");return e=>{e.on(`addMarker:${n.model}`,cw(i),{priority:n.converterPriority||"normal"}),e.on(`removeMarker:${n.model}`,uw(),{priority:n.converterPriority||"normal"})}}function Ew(n){n=_e(n);const i=n.model;let e=n.view;return e||(e=t=>({group:i,name:t.substr(n.model.length+1)})),t=>{t.on(`addMarker:${i}`,dw(e),{priority:n.converterPriority||"normal"}),t.on(`removeMarker:${i}`,mw(e),{priority:n.converterPriority||"normal"})}}function Tw(n){return i=>{i.on(`addMarker:${n.model}`,pw(n.view),{priority:n.converterPriority||"normal"}),i.on(`addMarker:${n.model}`,ww(n.view),{priority:n.converterPriority||"normal"}),i.on(`removeMarker:${n.model}`,bw(n.view),{priority:n.converterPriority||"normal"})}}function gd(n){return typeof n=="string"&&(n={name:n}),{name:n.name,attributes:n.attributes?Y(n.attributes):[],children:!!n.children}}function kn(n,i){return typeof n=="function"?n:(e,t)=>Pw(n,t,i)}function Pw(n,i,e){typeof n=="string"&&(n={name:n});let t;const s=i.writer,r=Object.assign({},n.attributes);if(e=="container")t=s.createContainerElement(n.name,r);else if(e=="attribute"){const o={priority:n.priority||Ut.DEFAULT_PRIORITY};t=s.createAttributeElement(n.name,r,o)}else t=s.createUIElement(n.name,r);if(n.styles){const o=Object.keys(n.styles);for(const a of o)s.setStyle(a,n.styles[a],t)}if(n.classes){const o=n.classes;if(typeof o=="string")s.addClass(o,t);else for(const a of o)s.addClass(a,t)}return t}function pd(n){return n.model.values?(i,e,t)=>{const s=n.view[i];return s?s(i,e,t):null}:n.view}function fl(n){return typeof n=="string"?i=>({key:n,value:i}):typeof n=="object"?n.value?()=>n:i=>({key:n.key,value:i}):n}function ia(n,i,e){const t=typeof n=="function"?n(i,e):n;return t?(t.priority||(t.priority=10),t.id||(t.id=i.markerName),t):null}function Aw(n){return(i,e)=>{if(!i.is("element",n.name))return!1;if(e.type=="attribute"){if(n.attributes.includes(e.attributeKey))return!0}else{/* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */if(n.children)return!0}return!1}}function wd(n){const i=Aw(n);return(e,t)=>{const s=[];t.reconvertedElements||(t.reconvertedElements=new Set);for(const r of t.changes){const o=r.type=="attribute"?r.range.start.nodeAfter:r.position.parent;if(!o||!i(o,r)){s.push(r);continue}if(!t.reconvertedElements.has(o)){t.reconvertedElements.add(o);const a=_._createBefore(o);let l=s.length;for(let c=s.length-1;c>=0;c--){const d=s[c],f=(d.type=="attribute"?d.range.start:d.position).compareWith(a);if(f=="before"||d.type=="remove"&&f=="same")break;l=c}s.splice(l,0,{type:"remove",name:o.name,position:a,length:1},{type:"reinsert",name:o.name,position:a,length:1})}}t.changes=s}}function bd(n){return(i,e,t={})=>{const s=["insert"];for(const r of n.attributes)i.hasAttribute(r)&&s.push(`attribute:${r}`);return s.every(r=>
122e.test(i,r))?(t.preflight||s.forEach(r=>e.consume(i,r)),!0):!1}}function xw(n,i,e){return(t,s)=>{const r=t.createContainerElement("$slot");let o=null;if(s==="children")o=Array.from(n.getChildren());else if(typeof s=="function")o=Array.from(n.getChildren()).filter(a=>s(a));else throw new p("conversion-slot-mode-unknown",e.dispatcher,{modeOrFilter:s});return i.set(r,o),r}}function Sw(n,i,e){const t=Array.from(i.values()).flat(),s=new Set(t);if(s.size!=t.length)throw new p("conversion-slot-filter-overlap",e.dispatcher,{element:n});if(s.size!=n.childCount)throw new p("conversion-slot-filter-incomplete",e.dispatcher,{element:n})}function Iw(n,i,e,t){e.mapper.on("modelToViewPosition",o,{priority:"highest"});let s=null,r=null;for([s,r]of i)_d(n,r,e,t),e.writer.move(e.writer.createRangeIn(s),e.writer.createPositionBefore(s)),e.writer.remove(s);e.mapper.off("modelToViewPosition",o);function o(a,l){const c=l.modelPosition.nodeAfter,d=r.indexOf(c);d<0||(l.viewPosition=l.mapper.findPositionIn(s,d))}}function _d(n,i,e,t){for(const s of i)Ow(n.root,s,e,t)||e.convertItem(s)}function Ow(n,i,e,t){const{writer:s,mapper:r}=e;if(!t.reconversion)return!1;const o=r.toViewElement(i);return!o||o.root==n||!e.canReuseView(o)?!1:(s.move(s.createRangeOn(o),r.toViewPosition(_._createBefore(i))),!0)}function Mw(n,i,{preflight:e}={}){return e?i.test(n,"insert"):i.consume(n,"insert")}/**
123 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
124 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
125 */function yd(n){const{schema:i,document:e}=n.model;for(const t of e.getRoots())if(t.isEmpty&&!i.checkChild(t,"$text")&&i.checkChild(t,"paragraph"))return n.insertElement("paragraph",t),!0;return!1}function vd(n,i,e){const t=e.createContext(n);return!(!e.checkChild(t,"paragraph")||!e.checkChild(t.push("paragraph"),i))}function kd(n,i){const e=i.createElement("paragraph");return i.insert(e,n),i.createPositionAt(e,0)}class Rw extends dd{elementToElement(i){return this.add(Cd(i))}elementToAttribute(i){return this.add(Lw(i))}attributeToAttribute(i){return this.add(Fw(i))}elementToMarker(i){return this.add(Nw(i))}dataToMarker(i){return this.add(Dw(i))}}function ml(){return(n,i,e)=>{if(!i.modelRange&&e.consumable.consume(i.viewItem,{name:!0})){const{modelRange:t,modelCursor:s}=e.convertChildren(i.viewItem,i.modelCursor);i.modelRange=t,i.modelCursor=s}}}function Vw(){return(n,i,{schema:e,consumable:t,writer:s})=>{let r=i.modelCursor;if(!t.test(i.viewItem))return;if(!e.checkChild(r,"$text")){if(!vd(r,"$text",e)||i.viewItem.data.trim().length==0)return;r=kd(r,s)}t.consume(i.viewItem);const o=s.createText(i.viewItem.data);s.insert(o,r),i.modelRange=s.createRange(r,r.getShiftedBy(o.offsetSize)),i.modelCursor=i.modelRange.end}}function Bw(n,i){return(e,t)=>{const s=t.newSelection,r=[];for(const a of s.getRanges())r.push(i.toModelRange(a));const o=n.createSelection(r,{backward:s.isBackward});o.isEqual(n.document.selection)||n.change(a=>{a.setSelection(o)})}}function Cd(n){n=_e(n);const i=eo(n),e=na(n.view),t=e?`element:${e}`:"element";return s=>{s.on(t,i,{priority:n.converterPriority||"normal"})}}function Lw(n){n=_e(n),Ed(n);const i=Td(n,!1),e=na(n.view),t=e?`element:${e}`:"element";return s=>{s.on(t,i,{priority:n.converterPriority||"low"})}}function Fw(n){n=_e(n);let i=null;(typeof n.view=="string"||n.view.key)&&(i=Ww(n)),Ed(n,i);const e=Td(n,!0);return t=>{t.on("element",e,{priority:n.converterPriority||"low"})}}function Nw(n){const i=qw(n.model);return Cd({...n,model:i})}function Dw(n){n=_e(n),n.model||(n.model=s=>s?n.view+":"+s:n.view);const i={view:n.view,model:n.model},e=eo(gl(i,"start")),t=eo(gl(i,"end"));return s=>{s.on(`element:${n.view}-start`,e,{priority:n.converterPriority||"normal"}),s.on(`element:${n.view}-end`,t,{priority:n.converterPriority||"normal"});const r=Tt.low,o=Tt.highest,a=Tt.get(n.converterPriority)/o;s.on("element",zw(i),{priority:r+a})}}function zw(n){return(i,e,t)=>{const s=`data-${n.view}`;if(!t.consumable.test(e.viewItem,{attributes:s+"-end-after"})&&!t.consumable.test(e.viewItem,{attributes:s+"-start-after"})&&!t.consumable.test(e.viewItem,{attributes:s+"-end-before"})&&!t.consumable.test(e.viewItem,{attributes:s+"-start-before"}))return;e.modelRange||Object.assign(e,t.convertChildren(e.viewItem,e.modelCursor)),t.consumable.consume(e.viewItem,{attributes:s+"-end-after"})&&r(e.modelRange.end,e.viewItem.getAttribute(s+"-end-after").split(",")),t.consumable.consume(e.viewItem,{attributes:s+"-start-after"})&&r(e.modelRange.end,e.viewItem.getAttribute(s+"-start-after").split(",")),t.consumable.consume(e.viewItem,{attributes:s+"-end-before"})&&r(e.modelRange.start,e.viewItem.getAttribute(s+"-end-before").split(",")),t.consumable.consume(e.viewItem,{attributes:s+"-start-before"})&&r(e.modelRange.start,e.viewItem.getAttribute(s+"-start-before").split(","));function r(o,a){for(const l of a){const c=n.model(l,t),d=t.writer.createElement("$marker",{"data-name":c});t.writer.insert(d,o),e.modelCursor.isEqual(o)?e.modelCursor=e.modelCursor.getShiftedBy(1):e.modelCursor=e.modelCursor._getTransformedByInsertion(o,1),e.modelRange=e.modelRange._getTransformedByInsertion(o,1)[0]}}}}function na(n){return typeof n=="string"?n:typeof n=="object"&&typeof n.name=="string"?n.name:null}function eo(n){const i=new Pe(n.view);return(e,t,s)=>{const r=i.match(t.viewItem);if(!r)return;const o=r.match;if(o.name=!0,!s.consumable.test(t.viewItem,o))return;const a=Hw(n.model,t.viewItem,s);a&&s.safeInsert(a,t.modelCursor)&&(s.consumable.consume(t.viewItem,o),s.convertChildren(t.viewItem,a),s.updateConversionResult(a,t))}}function Hw(n,i,e){return n instanceof Function?n(i,e):e.writer.createElement(n)}function Ww(n){typeof n.view=="string"&&(n.view={key:n.view});const i=n.view.key,e=typeof n.view.value>"u"?/[\s\S]*/:n.view.value;let t;return i=="class"||i=="style"?t={[i=="class"?"classes":"styles"]:e}:t={attributes:{[i]:e}},n.view.name&&(t.name=n.view.name),n.view=t,i}function Ed(n,i=null){const e=i===null?!0:r=>r.getAttribute(i),t=typeof n.model!="object"?n.model:n.model.key,s=typeof n.model!="object"||typeof n.model.value>"u"?e:n.model.value;n.model={key:t,value:s}}function Td(n,i){const e=new Pe(n.view);return(t,s,r)=>{if(!s.modelRange&&i)return;const o=e.match(s.viewItem);if(!o||($w(n.view,s.viewItem)?o.match.name=!0:delete o.match.name,!r.consumable.test(s.viewItem,o.match)))return;const a=n.model.key,l=typeof n.model.value=="function"?n.model.value(s.viewItem,r,s):n.model.value;if(l==null)return;s.modelRange||Object.assign(s,r.convertChildren(s.viewItem,s.modelCursor)),Uw(s.modelRange,{key:a,value:l},i,r)&&(r.consumable.test(s.viewItem,{name:!0})&&(o.match.name=!0),r.consumable.consume(s.viewItem,o.match))}}function $w(n,i){const e=typeof n=="function"?n(i):n;return typeof e=="object"&&!na(e)?!1:!e.classes&&!e.attributes&&!e.styles}function Uw(n,i,e,t){let s=!1;for(const r of Array.from(n.getItems({shallow:e})))t.schema.checkAttribute(r,i.key)&&(s=!0,!r.hasAttribute(i.key)&&t.writer.setAttribute(i.key,i.value,r));return s}function qw(n){return(i,e)=>{const t=typeof n=="string"?n:n(i,e);return e.writer.createElement("$marker",{"data-name":t})}}function gl(n,i){const e=(t,s)=>{const r=t.getAttribute("name"),o=n.model(r,s);return s.writer.createElement("$marker",{"data-name":o})};return{view:`${n.view}-${i}`,model:e}}class Kw extends q(){constructor(e,t){super();u(this,"model");u(this,"view");u(this,"mapper");u(this,"downcastDispatcher");this.model=e,this.view=new Fp(t),this.mapper=new ld,this.downcastDispatcher=new cd({mapper:this.mapper,schema:e.schema});const s=this.model.document,r=s.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(s,"change",()=>{this.view.change(a=>{this.downcastDispatcher.convertChanges(s.differ,o,a),this.downcastDispatcher.convertSelection(r,o,a)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",Bw(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",hd(),{priority:"lowest"}),this.downcastDispatcher.on("insert",fd(),{priority:"lowest"}),this.downcastDispatcher.on("remove",iw(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",rw()),this.downcastDispatcher.on("selection",nw(),{priority:"low"}),this.downcastDispatcher.on("selection",sw(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(a=>{if(a.rootName=="$graveyard")return null;const l=new Qu(this.view.document,a.name);return l.rootName=a.rootName,this.mapper.bindElements(a,l),l})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,s=this.model.markers.get(t);if(!s)throw new p("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(s)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}class Gw extends q(){constructor(){super();u(this,"_sourceDefinitions",{});u(this,"_attributeProperties",Object.create(null));u(this,"_customChildChecks",new Map);u(this,"_customAttributeChecks",new Map);u(this,"_genericCheckSymbol",Symbol("$generic"));u(this,"_compiledDefinitions");this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new Pt(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Pt(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new p("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 p("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(e,t):!1}checkAttribute(e,t){const s=this.getDefinition(e.last);if(!s)return!1;const r=this._evaluateAttributeChecks(e,t);return r!==void 0?r:s.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof _){const s=e.nodeBefore,r=e.nodeAfter;if(!(s instanceof $))throw new p("schema-check-merge-no-element-before",this);if(!(r instanceof $))throw new p("schema-check-merge-no-element-after",this);return this.checkMerge(s,r)}if(this.isLimit(e)||this.isLimit(t))return!1;for(const s of t.getChildren())if(!this.checkChild(e,s))return!1;return!0}addChildCheck(e,t){const s=t!==void 0?t:this._genericCheckSymbol,r=this._customChildChecks.get(s)||[];r.push(e),this._customChildChecks.set(s,r)}addAttributeCheck(e,t){const s=t!==void 0?t:this._genericCheckSymbol,r=this._customAttributeChecks.get(s)||[];r.push(e),this._customAttributeChecks.set(s,r)}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||Object.create(null)}getLimitElement(e){let t;for(e instanceof _?t=e.parent:t=(e instanceof b?[e]:Array.from(e.getRanges())).reduce((r,o)=>{const a=o.getCommonAncestor();return r?r.getCommonAncestor(a,{includeSelf:!0}):a},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const r=[...e.getFirstPosition().getAncestors(),new U("",e.getAttributes())];return this.checkAttribute(r,t)}else{const s=e.getRanges();for(const r of s)for(const o of r)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=cb(e);for(const s of e)yield*this._getValidRangesForRange(s,t)}getNearestSelectionRange(e,t="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new b(e);let s,r;const o=e.getAncestors().reverse().find(a=>this.isLimit(a))||e.root;
125(t=="both"||t=="backward")&&(s=new ht({boundaries:b._createIn(o),startPosition:e,direction:"backward"})),(t=="both"||t=="forward")&&(r=new ht({boundaries:b._createIn(o),startPosition:e}));for(const a of lb(s,r)){const l=a.walker==s?"elementEnd":"elementStart",c=a.value;if(c.type==l&&this.isObject(c.item))return b._createOn(c.item);if(this.checkChild(c.nextPosition,"$text"))return new b(c.nextPosition)}return null}findAllowedParent(e,t){let s=e.parent;for(;s;){if(this.checkChild(s,t))return s;if(this.isLimit(s))return null;s=s.parent}return null}setAllowedAttributes(e,t,s){const r=s.model;for(const[o,a]of Object.entries(t))r.schema.checkAttribute(e,o)&&s.setAttribute(o,a,e)}removeDisallowedAttributes(e,t){for(const s of e)if(s.is("$text"))pl(this,s,t);else{const o=b._createIn(s).getPositions();for(const a of o){const l=a.nodeBefore||a.parent;pl(this,l,t)}}}getAttributesWithProperty(e,t,s){const r={};for(const[o,a]of e.getAttributes()){const l=this.getAttributeProperties(o);l[t]!==void 0&&(s===void 0||s===l[t])&&(r[o]=a)}return r}createContext(e){return new Pt(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,s=Object.keys(t);for(const o of s)e[o]=jw(t[o],o);const r=Object.values(e);for(const o of r)Jw(e,o),Qw(e,o),Yw(e,o),Xw(e,o);for(const o of r)Zw(e,o);for(const o of r)eb(e,o);for(const o of r)tb(e,o);for(const o of r)nb(e,o);for(const o of r)sb(e,o);this._compiledDefinitions=ib(e)}_checkContextMatch(e,t){const s=e.last;let r=this._evaluateChildChecks(e,t);if(r=r!==void 0?r:t.allowIn.includes(s.name),!r)return!1;const o=this.getDefinition(s),a=e.trimLast();return o?a.length==0?!0:this._checkContextMatch(a,o):!1}_evaluateChildChecks(e,t){const s=this._customChildChecks.get(this._genericCheckSymbol)||[],r=this._customChildChecks.get(t.name)||[];for(const o of[...s,...r]){const a=o(e,t);if(a!==void 0)return a}}_evaluateAttributeChecks(e,t){const s=this._customAttributeChecks.get(this._genericCheckSymbol)||[],r=this._customAttributeChecks.get(t)||[];for(const o of[...s,...r]){const a=o(e,t);if(a!==void 0)return a}}*_getValidRangesForRange(e,t){let s=e.start,r=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(b._createIn(o),t)),this.checkAttribute(o,t)||(s.isEqual(r)||(yield new b(s,r)),s=_._createAfter(o)),r=_._createAfter(o);s.isEqual(r)||(yield new b(s,r))}findOptimalInsertionRange(e,t){const s=e.getSelectedElement();if(s&&this.isObject(s)&&!this.isInline(s))return t=="before"||t=="after"?new b(_._createAt(s,t)):b._createOn(s);const r=ye(e.getSelectedBlocks());if(!r)return new b(e.focus);if(r.isEmpty)return new b(_._createAt(r,0));const o=_._createAfter(r);return e.focus.isTouching(o)?new b(o):new b(_._createBefore(r))}}class Pt{constructor(i){u(this,"_items");if(i instanceof Pt)return i;let e;typeof i=="string"?e=[i]:Array.isArray(i)?e=i:e=i.getAncestors({includeSelf:!0}),this._items=e.map(ab)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(i){const e=new Pt([i]);return e._items=[...this._items,...e._items],e}trimLast(){const i=new Pt([]);return i._items=this._items.slice(0,-1),i}getItem(i){return this._items[i]}*getNames(){yield*this._items.map(i=>i.name)}endsWith(i){return Array.from(this.getNames()).join(" ").endsWith(i)}startsWith(i){return Array.from(this.getNames()).join(" ").startsWith(i)}}function jw(n,i){const e={name:i,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return rb(n,e),Xe(n,e,"allowIn"),Xe(n,e,"allowChildren"),Xe(n,e,"disallowIn"),Xe(n,e,"disallowChildren"),Xe(n,e,"allowContentOf"),Xe(n,e,"allowWhere"),Xe(n,e,"allowAttributes"),Xe(n,e,"disallowAttributes"),Xe(n,e,"allowAttributesOf"),Xe(n,e,"inheritTypesFrom"),ob(n,e),e}function Jw(n,i){for(const e of i.allowIn){const t=n[e];t?t.allowChildren.add(i.name):i.allowIn.delete(e)}}function Qw(n,i){for(const e of i.allowChildren){const t=n[e];t?t.allowIn.add(i.name):i.allowChildren.delete(e)}}function Yw(n,i){for(const e of i.disallowIn){const t=n[e];t?t.disallowChildren.add(i.name):i.disallowIn.delete(e)}}function Xw(n,i){for(const e of i.disallowChildren){const t=n[e];t?t.disallowIn.add(i.name):i.disallowChildren.delete(e)}}function Zw(n,i){for(const e of i.disallowChildren)i.allowChildren.delete(e);for(const e of i.disallowIn)i.allowIn.delete(e);for(const e of i.disallowAttributes)i.allowAttributes.delete(e)}function eb(n,i){for(const e of i.allowContentOf){const t=n[e];
125t&&(t.disallowChildren.forEach(s=>{i.allowChildren.has(s)||(i.disallowChildren.add(s),n[s].disallowIn.add(i.name))}),t.allowChildren.forEach(s=>{i.disallowChildren.has(s)||(i.allowChildren.add(s),n[s].allowIn.add(i.name))}))}}function tb(n,i){for(const e of i.allowWhere){const t=n[e];t&&(t.disallowIn.forEach(s=>{i.allowIn.has(s)||(i.disallowIn.add(s),n[s].disallowChildren.add(i.name))}),t.allowIn.forEach(s=>{i.disallowIn.has(s)||(i.allowIn.add(s),n[s].allowChildren.add(i.name))}))}}function ib(n){const i={};for(const e of Object.values(n))i[e.name]={name:e.name,isBlock:!!e.isBlock,isContent:!!e.isContent,isInline:!!e.isInline,isLimit:!!e.isLimit,isObject:!!e.isObject,isSelectable:!!e.isSelectable,allowIn:Array.from(e.allowIn).filter(t=>!!n[t]),allowChildren:Array.from(e.allowChildren).filter(t=>!!n[t]),allowAttributes:Array.from(e.allowAttributes)};return i}function nb(n,i){for(const e of i.allowAttributesOf){const t=n[e];if(!t)return;t.allowAttributes.forEach(s=>{i.disallowAttributes.has(s)||i.allowAttributes.add(s)})}}function sb(n,i){for(const e of i.inheritTypesFrom){const t=n[e];if(t){const s=Object.keys(t).filter(r=>r.startsWith("is"));for(const r of s)r in i||(i[r]=t[r])}}}function rb(n,i){for(const e of n){const t=Object.keys(e).filter(s=>s.startsWith("is"));for(const s of t)i[s]=!!e[s]}}function Xe(n,i,e){for(const t of n){let s=t[e];typeof s=="string"&&(s=[s]),Array.isArray(s)&&s.forEach(r=>i[e].add(r))}}function ob(n,i){for(const e of n){const t=e.inheritAllFrom;t&&(i.allowContentOf.add(t),i.allowWhere.add(t),i.allowAttributesOf.add(t),i.inheritTypesFrom.add(t))}}function ab(n){return typeof n=="string"||n.is("documentFragment")?{name:typeof n=="string"?n:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:n.is("element")?n.name:"$text",*getAttributeKeys(){yield*n.getAttributeKeys()},getAttribute(i){return n.getAttribute(i)}}}function*lb(n,i){let e=!1;for(;!e;){if(e=!0,n){const t=n.next();t.done||(e=!1,yield{walker:n,value:t.value})}if(i){const t=i.next();t.done||(e=!1,yield{walker:i,value:t.value})}}}function*cb(n){for(const i of n)yield*i.getMinimalFlatRanges()}function pl(n,i,e){for(const t of i.getAttributeKeys())n.checkAttribute(i,t)||e.removeAttribute(t,i)}class ub extends H(){constructor(e){super();u(this,"conversionApi");u(this,"_splitParts",new Map);u(this,"_cursorParents",new Map);u(this,"_modelCursor",null);u(this,"_emptyElementsToKeep",new Set);this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(t,s)=>this._convertItem(t,s),convertChildren:(t,s)=>this._convertChildren(t,s),safeInsert:(t,s)=>this._safeInsert(t,s),updateConversionResult:(t,s)=>this._updateConversionResult(t,s),splitToAllowedParent:(t,s)=>this._splitToAllowedParent(t,s),getSplitParts:t=>this._getSplitParts(t),keepEmptyElement:t=>this._keepEmptyElement(t)}}convert(e,t,s=["$root"]){this.fire("viewCleanup",e),this._modelCursor=hb(s,t),this.conversionApi.writer=t,this.conversionApi.consumable=_s.createFrom(e),this.conversionApi.store={};const{modelRange:r}=this._convertItem(e,this._modelCursor),o=t.createDocumentFragment();if(r){this._removeEmptyElements();const a=this._modelCursor.parent,l=a._removeChildren(0,a.childCount);o._insertChild(0,l),o.markers=db(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 s={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,s,this.conversionApi):e.is("$text")?this.fire("text",s,this.conversionApi):this.fire("documentFragment",s,this.conversionApi),s.modelRange&&!(s.modelRange instanceof b))throw new p("view-conversion-dispatcher-incorrect-result",this);return{modelRange:s.modelRange,modelCursor:s.modelCursor}}_convertChildren(e,t){let s=t.is("position")?t:_._createAt(t,0);const r=new b(s);for(const o of Array.from(e.getChildren())){const a=this._convertItem(o,s);a.modelRange instanceof b&&(r.end=a.modelRange.end,s=a.modelCursor)}return{modelRange:r,modelCursor:s}}_safeInsert(e,t){const s=this._splitToAllowedParent(e,t);return s?(this.conversionApi.writer.insert(e,s.position),!0):!1}_updateConversionResult(e,t){const s=this._getSplitParts(e),r=this.conversionApi.writer;t.modelRange||(t.modelRange=r.createRange(r.createPositionBefore(e),r.createPositionAfter(s[s.length-1])));const o=this._cursorParents.get(e);o?t.modelCursor=r.createPositionAt(o,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){const{schema:s,writer:r}=this.conversionApi;let o=s.findAllowedParent(t,e);if(o){if(o===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return vd(t,e,s)?{position:kd(t,r)}:null;const a=this.conversionApi.writer.split(t,o),l=[];for(const d of a.range.getWalker())if(d.type=="elementEnd")l.push(d.item);else{const h=l.pop(),f=d.item;this._registerSplitPair(h,f)}const c=a.range.end.parent;return this._cursorParents.set(e,c),{position:a.position,cursorParent:c}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const s=this._splitParts.get(e);this._splitParts.set(t,s),s.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(){const e=new Map;
125for(const t of this._splitParts.keys())if(t.isEmpty&&!this._emptyElementsToKeep.has(t)){const s=e.get(t.parent)||[];s.push(t),this._splitParts.delete(t),e.set(t.parent,s)}for(const[t,s]of e)t._removeChildrenArray(s);e.size&&this._removeEmptyElements()}}function db(n,i){const e=new Set,t=new Map,s=b._createIn(n).getItems();for(const r of s)r.is("element","$marker")&&e.add(r);for(const r of e){const o=r.getAttribute("data-name"),a=i.createPositionBefore(r);t.has(o)?t.get(o).end=a.clone():t.set(o,new b(a.clone())),i.remove(r)}return t}function hb(n,i){let e;for(const t of new Pt(n)){const s={};for(const o of t.getAttributeKeys())s[o]=t.getAttribute(o);const r=i.createElement(t.name,s);e&&i.insert(r,e),e=_._createAt(r,0)}return e}class fb{getHtml(i){const t=C.document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(i),t.innerHTML}}class mb{constructor(i){u(this,"domParser");u(this,"domConverter");u(this,"htmlWriter");u(this,"skipComments",!0);this.domParser=new DOMParser,this.domConverter=new Us(i,{renderingMode:"data"}),this.htmlWriter=new fb}toData(i){const e=this.domConverter.viewToDom(i);return this.htmlWriter.getHtml(e)}toView(i){const e=this._toDom(i);return this.domConverter.domToView(e,{skipComments:this.skipComments})}registerRawContentMatcher(i){this.domConverter.registerRawContentMatcher(i)}useFillerType(i){this.domConverter.blockFillerMode=i=="marked"?"markedNbsp":"nbsp"}_toDom(i){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(i.trim().slice(0,1e4))||(i=`<body>${i}</body>`);const e=this.domParser.parseFromString(i,"text/html"),t=e.createDocumentFragment(),s=e.body.childNodes;for(;s.length>0;)t.appendChild(s[0]);return t}}class gb extends H(){constructor(e,t){super();u(this,"model");u(this,"mapper");u(this,"downcastDispatcher");u(this,"upcastDispatcher");u(this,"viewDocument");u(this,"stylesProcessor");u(this,"htmlProcessor");u(this,"processor");u(this,"_viewWriter");this.model=e,this.mapper=new ld,this.downcastDispatcher=new cd({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",hd(),{priority:"lowest"}),this.downcastDispatcher.on("insert",fd(),{priority:"lowest"}),this.upcastDispatcher=new ub({schema:e.schema}),this.viewDocument=new Ws(t),this.stylesProcessor=t,this.htmlProcessor=new mb(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Xu(this.viewDocument),this.upcastDispatcher.on("text",Vw(),{priority:"lowest"}),this.upcastDispatcher.on("element",ml(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",ml(),{priority:"lowest"}),q().prototype.decorate.call(this,"init"),q().prototype.decorate.call(this,"set"),q().prototype.decorate.call(this,"get"),q().prototype.decorate.call(this,"toView"),q().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},yd)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:s="empty"}=e;if(!this._checkIfRootsExists([t]))throw new p("datacontroller-get-non-existent-root",this);const r=this.model.document.getRoot(t);return r.isAttached()||void 0,s==="empty"&&!this.model.hasContent(r,{ignoreWhitespaces:!0})?"":this.stringify(r,e)}stringify(e,t={}){const s=this.toView(e,t);return this.processor.toData(s)}toView(e,t={}){const s=this.viewDocument,r=this._viewWriter;this.mapper.clearBindings();const o=b._createIn(e),a=new qt(s);this.mapper.bindElements(e,a);const l=e.is("documentFragment")?e.markers:pb(e);return this.downcastDispatcher.convert(o,l,r,t),a}init(e){if(this.model.document.version)throw new p("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new p("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},s=>{for(const r of Object.keys(t)){const o=this.model.document.getRoot(r);s.insert(this.parse(t[r],o),o,0)}}),Promise.resolve()}set(e,t={}){let s={};if(typeof e=="string"?s.main=e:s=e,!this._checkIfRootsExists(Object.keys(s)))throw new p("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},r=>{r.setSelection(null),r.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(s)){const a=this.model.document.getRoot(o);r.remove(r.createRangeIn(a)),r.insert(this.parse(s[o],a),a,0)}})}parse(e,t="$root"){const s=this.processor.toView(e);return this.toModel(s,t)}toModel(e,t="$root"){return this.model.change(s=>this.upcastDispatcher.convert(e,s,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 pb(n){const i=[],e=n.root.document;if(!e)return new Map;const t=b._createIn(n);for(const s of e.model.markers){const r=s.getRange(),o=r.isCollapsed,a=r.start.isEqual(t.start)||r.end.isEqual(t.end
125);if(o&&a)i.push([s.name,r]);else{const l=t.getIntersection(r);l&&i.push([s.name,l])}}return i.sort(([s,r],[o,a])=>{if(r.end.compareWith(a.start)!=="after")return 1;if(r.start.compareWith(a.end)!=="before")return-1;switch(r.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(r.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return o.localeCompare(s)}}}),new Map(i)}class wb{constructor(i,e){u(this,"_helpers",new Map);u(this,"_downcast");u(this,"_upcast");this._downcast=Y(i),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Y(e),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(i,e){const t=this._downcast.includes(e);if(!this._upcast.includes(e)&&!t)throw new p("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:i,dispatchers:[e],isDowncast:t})}for(i){if(!this._helpers.has(i))throw new p("conversion-for-unknown-group",this);return this._helpers.get(i)}elementToElement(i){this.for("downcast").elementToElement(i);for(const{model:e,view:t}of mr(i))this.for("upcast").elementToElement({model:e,view:t,converterPriority:i.converterPriority})}attributeToElement(i){this.for("downcast").attributeToElement(i);for(const{model:e,view:t}of mr(i))this.for("upcast").elementToAttribute({view:t,model:e,converterPriority:i.converterPriority})}attributeToAttribute(i){this.for("downcast").attributeToAttribute(i);for(const{model:e,view:t}of mr(i))this.for("upcast").attributeToAttribute({view:t,model:e})}_createConversionHelpers({name:i,dispatchers:e,isDowncast:t}){if(this._helpers.has(i))throw new p("conversion-group-exists",this);const s=t?new tw(e):new Rw(e);this._helpers.set(i,s)}}function*mr(n){if(n.model.values)for(const i of n.model.values){const e={key:n.model.key,value:i},t=n.view[i],s=n.upcastAlso?n.upcastAlso[i]:void 0;yield*wl(e,t,s)}else yield*wl(n.model,n.view,n.upcastAlso)}function*wl(n,i,e){if(yield{model:n,view:i},e)for(const t of Y(e))yield{model:n,view:t}}/**
126 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
127 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
128 */class Ae{constructor(i){u(this,"baseVersion");u(this,"isDocumentOperation");u(this,"batch");this.baseVersion=i,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const i=Object.assign({},this);return i.__className=this.constructor.className,delete i.batch,delete i.isDocumentOperation,i}static get className(){return"Operation"}static fromJSON(i,e){return new this(i.baseVersion)}}function sa(n,i){const e=Ad(i),t=e.reduce((o,a)=>o+a.offsetSize,0),s=n.parent;Tn(n);const r=n.index;return s._insertChild(r,e),En(s,r+e.length),En(s,r),new b(n,n.getShiftedBy(t))}function Pd(n){if(!n.isFlat)throw new p("operation-utils-remove-range-not-flat",this);const i=n.start.parent;Tn(n.start),Tn(n.end);const e=i._removeChildren(n.start.index,n.end.index-n.start.index);return En(i,n.start.index),e}function Cn(n,i){if(!n.isFlat)throw new p("operation-utils-move-range-not-flat",this);const e=Pd(n);return i=i._getTransformedByDeletion(n.start,n.end.offset-n.start.offset),sa(i,e)}function bb(n,i,e){Tn(n.start),Tn(n.end);for(const t of n.getItems({shallow:!0})){const s=t.is("$textProxy")?t.textNode:t;e!==null?s._setAttribute(i,e):s._removeAttribute(i),En(s.parent,s.index)}En(n.end.parent,n.end.index)}function Ad(n){const i=[];function e(t){if(typeof t=="string")i.push(new U(t));else if(t instanceof Ke)i.push(new U(t.data,t.getAttributes()));else if(t instanceof Xt)i.push(t);else if(Te(t))for(const s of t)e(s)}e(n);for(let t=1;t<i.length;t++){const s=i[t],r=i[t-1];s instanceof U&&r instanceof U&&xd(s,r)&&(i.splice(t-1,2,new U(r.data+s.data,r.getAttributes())),t--)}return i}function En(n,i){const e=n.getChild(i-1),t=n.getChild(i);if(e&&t&&e.is("$text")&&t.is("$text")&&xd(e,t)){const s=new U(e.data+t.data,e.getAttributes());n._removeChildren(i-1,2),n._insertChild(i-1,s)}}function Tn(n){const i=n.textNode,e=n.parent;if(i){const t=n.offset-i.startOffset,s=i.index;e._removeChildren(s,1);
128const r=new U(i.data.substr(0,t),i.getAttributes()),o=new U(i.data.substr(t),i.getAttributes());e._insertChild(s,[r,o])}}function xd(n,i){const e=n.getAttributes(),t=i.getAttributes();for(const s of e){if(s[1]!==i.getAttribute(s[0]))return!1;t.next()}return t.next().done}class N extends Ae{constructor(e,t,s,r){super(r);u(this,"sourcePosition");u(this,"howMany");u(this,"targetPosition");this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=s.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName==this.sourcePosition.root.rootName?"move":this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[b._createFromPositionAndShift(this.sourcePosition,this.howMany),b._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new N(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 N(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,s=this.sourcePosition.offset,r=this.targetPosition.offset;if(s+this.howMany>e.maxOffset)throw new p("move-operation-nodes-do-not-exist",this);if(e===t&&s<r&&r<s+this.howMany)throw new p("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&ue(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const o=this.sourcePosition.path.length-1;if(this.targetPosition.path[o]>=s&&this.targetPosition.path[o]<s+this.howMany)throw new p("move-operation-node-into-itself",this)}}_execute(){Cn(b._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 s=_.fromJSON(e.sourcePosition,t),r=_.fromJSON(e.targetPosition,t);return new this(s,e.howMany,r,e.baseVersion)}}class ae extends Ae{constructor(e,t,s){super(s);u(this,"position");u(this,"nodes");u(this,"shouldReceiveAttributes");this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new un(Ad(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new un([...this.nodes].map(s=>s._clone(!0))),t=new ae(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new _(e,[0]);return new N(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new p("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new un([...e].map(t=>t._clone(!0))),sa(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 s=[];for(const o of e.nodes)o.name?s.push($.fromJSON(o)):s.push(U.fromJSON(o));const r=new ae(_.fromJSON(e.position,t),s,e.baseVersion);return r.shouldReceiveAttributes=e.shouldReceiveAttributes,r}}class z extends Ae{constructor(e,t,s,r,o){super(o);u(this,"splitPosition");u(this,"howMany");u(this,"insertionPosition");u(this,"graveyardPosition");this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=s,this.graveyardPosition=r?r.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 _(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new b(this.splitPosition,e)}get affectedSelectable(){const e=[b._createFromPositionAndShift(this.splitPosition,0),b._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(b._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new z(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new _(e,[0]);return new Q(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 p("split-operation-position-invalid",this);if(e.parent){if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new p("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new p("split-operation-graveyard-position-invalid",this)}else throw new p("split-operation-split-in-root",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Cn(b._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const s=e._clone();sa(this.insertionPosition,s)}const t=new b(_._createAt(e,this.splitPosition.offset),_._createAt(e,e.maxOffset));Cn(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 _(e.root,t,"toPrevious")}static fromJSON(e,t){const s=_.fromJSON(e.splitPosition,t),r=_.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?_.fromJSON(e.graveyardPosition,t):null;return new this(s,e.howMany,r,o,e.baseVersion)}}class Q extends Ae{constructor(e,t,s,r,o){super(o);u(this,"sourcePosition");u(this,"howMany");u(this,"targetPosition");u(this,"graveyardPosition");this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=s.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=r.clone()}get type(){return"merge"}get deletionPosition(){return new _(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new b(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[b._createOn(e),b._createFromPositionAndShift(this.targetPosition,0),b._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new Q(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),s=new _(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new z(e,this.howMany,s,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 p("merge-operation-how-many-invalid",this)}else throw new p("merge-operation-target-position-invalid",this);else throw new p("merge-operation-source-position-invalid",this)}_execute(){const e=this.sourcePosition.parent,t=b._createIn(e);Cn(t,this.targetPosition),Cn(b._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 s=_.fromJSON(e.sourcePosition,t),r=_.fromJSON(e.targetPosition,t),o=_.fromJSON(e.graveyardPosition,t);return new this(s,e.howMany,r,o,e.baseVersion)}}class fe extends Ae{constructor(e,t,s,r,o,a){super(a);u(this,"name");u(this,"oldRange");u(this,"newRange");u(this,"affectsData");u(this,"_markers");this.name=e,this.oldRange=t?t.clone():null,this.newRange=s?s.clone():null,this.affectsData=o,this._markers=r}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 fe(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new fe(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 fe(e.name,e.oldRange?b.fromJSON(e.oldRange,t):null,e.newRange?b.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class X extends Ae{constructor(e,t,s,r,o){super(o);u(this,"range");u(this,"key");u(this,"oldValue");u(this,"newValue");this.range=e.clone(),this.key=t,this.oldValue=s===void 0?null:s,this.newValue=r===void 0?null:r}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new X(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new X(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 p("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!xa(e.getAttribute(this.key),this.oldValue))throw new p("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 p("attribute-operation-attribute-exists",this,{node:e,ke
128y:this.key})}}_execute(){xa(this.oldValue,this.newValue)||bb(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new X(b.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class se extends Ae{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new se(this.baseVersion)}getReversed(){return new se(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class be extends Ae{constructor(e,t,s,r){super(r);u(this,"position");u(this,"oldName");u(this,"newName");this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=s}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new be(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new be(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(e instanceof $){if(e.name!==this.oldName)throw new p("rename-operation-wrong-name",this)}else throw new p("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 be(_.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class ft extends Ae{constructor(e,t,s,r,o){super(o);u(this,"root");u(this,"key");u(this,"oldValue");u(this,"newValue");this.root=e,this.key=t,this.oldValue=s===void 0?null:s,this.newValue=r===void 0?null:r}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new ft(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new ft(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new p("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 p("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 p("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 p("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new ft(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class nt extends Ae{constructor(e,t,s,r,o){super(o);u(this,"rootName");u(this,"elementName");u(this,"isAdd");u(this,"_document");if(this.rootName=e,this.elementName=t,this.isAdd=s,this._document=r,!this._document.getRoot(this.rootName)){const a=this._document.createRoot(this.elementName,this.rootName);a._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new nt(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new nt(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 nt(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const ze={};ze[X.className]=X;ze[ae.className]=ae;ze[fe.className]=fe;ze[N.className]=N;ze[se.className]=se;ze[Ae.className]=Ae;ze[be.className]=be;ze[ft.className]=ft;ze[nt.className]=nt;ze[z.className]=z;ze[Q.className]=Q;class _b{static fromJSON(i,e){return ze[i.__className].fromJSON(i,e)}}const to=new Map;function F(n,i,e){let t=to.get(n);t||(t=new Map,to.set(n,t)),t.set(i,e)}function yb(n,i){const e=to.get(n);return e&&e.has(i)?e.get(i):vb}function vb(n){return[n]}function bl(n,i,e={}){const t=yb(n.constructor,i.constructor);try{return n=n.clone(),t(n,i,e)}catch(s){throw s}}function kb(n,i,e){n=n.slice(),i=i.slice();const t=new Cb(e.document,e.useRelations,e.forceWeakRemove);t.setOriginalOperations(n),t.setOriginalOperations(i);const s=t.originalOperations;if(n.length==0||i.length==0)return{operationsA:n,operationsB:i,originalOperations:s};const r=new WeakMap;for(const l of n)r.set(l,0);const o={nextBaseVersionA:n[n.length-1].baseVersion+1,nextBaseVersionB:i[i.length-1].baseVersion+1,originalOperationsACount:n.length,originalOperationsBCount:i.length};let a=0;for(;a<n.length;){const l=n[a],c=r.get(l);if(c==i.length){a++;continue}const d=i[c],h=bl(l,d,t.getContext(l,d,!0)),f=bl(d,l,t.getContext(d,l,!1));t.updateRelation(l,d),t.setOriginalOperations(h,l),t.setOriginalOperations(f,d);for(const m of h)r.set(m,c+f.length);n.splice(a,1,...h),i.splice(c,1,...f)}return yl(n),yl(i),_l(n,o.nextBaseVersionB),_l(i,o.nextBaseVersionA),{operationsA:n,operationsB:i,originalOperations:s}}class Cb{constructor(i,e,t=!1){u(this,"originalOperations");u(this,"_history");u(this,"_useRelations");u(this,"_forceWeakRemove");u(this,"_relations");this.originalOperations=new Map,this._history=i.history,this._useRelations=e,this._forceWeakRemove=!!t,this._relations=new Map}setOriginalOperations(i,e=null){const t=e?this.originalOperations.get(e):null;for(const s of i)this.originalOperations.set(s,t||s)}updateRelation(i,e){if(i instanceof N)e instanceof Q?i.targetPosition.isEqual(e.sourcePosition)||e.movedRange.containsPosition(i.targetPosition)?this._setRelation(i,e,"insertAtSource"):i.targetPosition.isEqual(e.deletionPosition)?this._setRelation(i,e,"insertBetween"):i.targetPosition.isAfter(e.sourcePosition)?this._setRelation(i,e,"moveTargetAfter"):i.howMany>1&&i.sourcePosition.isEqual(e.deletionPosition)?this._setRelation(i,e,"firstToMoveMerged"):i.howMany>1&&i.sourcePosition.getShiftedBy(i.howMany-1).isEqual(e.deletionPosition)&&this._setRelation(i,e,"lastToMoveMerged"):e instanceof N&&(i.targetPosition.isEqual(e.sourcePosition)||i.targetPosition.isBefore(e.sourcePosition)?this._setRelation(i,e,"insertBefore"):this._setRelation(i,e,"insertAfter"));else if(i instanceof z){if(e instanceof Q)i.splitPosition.isBefore(e.sourcePosition)&&this._setRelation(i,e,"
128splitBefore");else if(e instanceof N)if(i.splitPosition.isEqual(e.sourcePosition)||i.splitPosition.isBefore(e.sourcePosition))this._setRelation(i,e,"splitBefore");else{const t=b._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.splitPosition.hasSameParentAs(e.sourcePosition)&&t.containsPosition(i.splitPosition)){const s=t.end.offset-i.splitPosition.offset,r=i.splitPosition.offset-t.start.offset;this._setRelation(i,e,{howMany:s,offset:r})}}}else if(i instanceof Q)e instanceof Q?(i.targetPosition.isEqual(e.sourcePosition)||this._setRelation(i,e,"mergeTargetNotMoved"),i.sourcePosition.isEqual(e.targetPosition)&&this._setRelation(i,e,"mergeSourceNotMoved"),i.sourcePosition.isEqual(e.sourcePosition)&&this._setRelation(i,e,"mergeSameElement")):e instanceof z?i.sourcePosition.isEqual(e.splitPosition)&&this._setRelation(i,e,"splitAtSource"):e instanceof N&&e.howMany>0&&(i.sourcePosition.isEqual(e.sourcePosition.getShiftedBy(e.howMany))&&this._setRelation(i,e,"mergeSourceAffected"),i.targetPosition.isEqual(e.sourcePosition)&&this._setRelation(i,e,"mergeTargetWasBefore"));else if(i instanceof fe){const t=i.newRange;if(!t)return;if(e instanceof Q){const s=t.start.isEqual(e.targetPosition),r=t.start.isEqual(e.deletionPosition),o=t.end.isEqual(e.deletionPosition),a=t.end.isEqual(e.sourcePosition);(s||r||o||a)&&this._setRelation(i,e,{wasInLeftElement:s,wasStartBeforeMergedElement:r,wasEndBeforeMergedElement:o,wasInRightElement:a})}}}getContext(i,e,t){return{aIsStrong:t,aWasUndone:this._wasUndone(i),bWasUndone:this._wasUndone(e),abRelation:this._useRelations?this._getRelation(i,e):null,baRelation:this._useRelations?this._getRelation(e,i):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(i){const e=this.originalOperations.get(i);return e.wasUndone||this._history.isUndoneOperation(e)}_getRelation(i,e){const t=this.originalOperations.get(e),s=this._history.getUndoneOperation(t);if(!s)return null;const r=this.originalOperations.get(i),o=this._relations.get(r);return o&&o.get(s)||null}_setRelation(i,e,t){const s=this.originalOperations.get(i),r=this.originalOperations.get(e);let o=this._relations.get(s);o||(o=new Map,this._relations.set(s,o)),o.set(r,t)}}function _l(n,i){for(const e of n)e.baseVersion=i++}function yl(n){const i=new Map;for(let e=0;e<n.length;e++){const t=n[e];t instanceof fe&&(t.baseVersion!==-1?i.set(t.name,{op:t,ranges:t.newRange?[t.newRange]:[]}):(t.newRange&&i.get(t.name).ranges.push(t.newRange),n.splice(e,1),e--))}for(const{op:e,ranges:t}of i.values())t.length?e.newRange=b._createFromRanges(t):e.newRange=null}F(X,X,(n,i,e)=>{if(n.key===i.key&&n.range.start.hasSameParentAs(i.range.start)){const t=n.range.getDifference(i.range).map(r=>new X(r,n.key,n.oldValue,n.newValue,0)),s=n.range.getIntersection(i.range);return s&&e.aIsStrong&&t.push(new X(s,i.key,i.newValue,n.newValue,0)),t.length==0?[new se(0)]:t}else return[n]});F(X,ae,(n,i)=>{if(n.range.start.hasSameParentAs(i.position)&&n.range.containsPosition(i.position)){const t=n.range._getTransformedByInsertion(i.position,i.howMany,!i.shouldReceiveAttributes).map(s=>new X(s,n.key,n.oldValue,n.newValue,n.baseVersion));if(i.shouldReceiveAttributes){const s=Sd(i,n.key,n.oldValue);s&&t.unshift(s)}return t}return n.range=n.range._getTransformedByInsertion(i.position,i.howMany,!1)[0],[n]});function Sd(n,i,e){const s=n.nodes.getNode(0).getAttribute(i);if(s==e)return null;const r=new b(n.position,n.position.getShiftedBy(n.howMany));return new X(r,i,s,e,0)}F(X,Q,(n,i)=>{const e=[];n.range.start.hasSameParentAs(i.deletionPosition)&&(n.range.containsPosition(i.deletionPosition)||n.range.start.isEqual(i.deletionPosition))&&e.push(b._createFromPositionAndShift(i.graveyardPosition,1));const t=n.range._getTransformedByMergeOperation(i);return t.isCollapsed||e.push(t),e.map(s=>new X(s,n.key,n.oldValue,n.newValue,n.baseVersion))});F(X,N,(n,i)=>Eb(n.range,i).map(t=>new X(t,n.key,n.oldValue,n.newValue,n.baseVersion)));function Eb(n,i){const e=b._createFromPositionAndShift(i.sourcePosition,i.howMany);let t=null,s=[];e.containsRange(n,!0)?t=n:n.start.hasSameParentAs(e.start)?(s=n.getDifference(e),t=n.getIntersection(e)):s=[n];const r=[];for(let o of s){o=o._getTransformedByDeletion(i.sourcePosition,i.howMany);const a=i.getMovedRangeStart(),l=o.start.hasSameParentAs(a),c=o._getTransformedByInsertion(a,i.howMany,l);r.push(...c)}return t&&r.push(t._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany,!1)[0]),r}F(X,z,(n,i)=>{if(n.range.end.isEqual(i.insertionPosition))return i.graveyardPosition||n.range.end.offset++,[n];if(n.range.start.hasSameParentAs(i.splitPosition)&&n.range.containsPosition(i.splitPosition)){const e=n.clone();return e.range=new b(i.moveTargetPosition.clone(),n.range.end._getCombined(i.splitPosition,i.moveTargetPosition)),n.range.end=i.splitPosition.clone(),n.range.end.stickiness="toPrevious",[n,e]}return n.range=n.range._getTransformedBySplitOperation(i),[n]});F(ae,X,(n,i)=>{const e=[n];if(n.shouldReceiveAttributes&&n.position.hasSameParentAs(i.range.start)&&i.range.containsPosition(n.position)){const t=Sd(n,i.key,i.newValue);t&&e.push(t)}return e});F(ae,ae,(n,i,e)=>n.position.isEqual(i.position)&&e.aIsStrong?[n]:(n.position=n.position._getTransformedByInsertOperation(i),[n]));F(ae,N,(n,i)=>(n.position=n.position._getTransformedByMoveOperation(i),[n]));F(ae,z,(n,i)=>(n.position=n.position._getTransformedBySplitOperation(i),[n]));F(ae,Q,(n,i)=>(n.position=n.position._getTransformedByMergeOperation(i),[n]));F(fe,ae,(n,i)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByInsertOperation(i)[0]),n.newRange&&(n.newRange=n.newRange._getTransformedByInsertOperation(i)[0]),[n]));F(fe,fe,(n,i,e)=>{if(n.name==i.name)if(e.aIsStrong)n.oldRange=i.newRange?i.newRange.clone():null;else return[new se(0)];return[n]});F(fe,Q,(n,i)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByMergeOperation(i)),n.newRange&&(n.newRange=n.newRange._getTransformedByMergeOperation(i)),[n]));F(fe,N,(n,i)=>{const e=[n];if(n.oldRange&&(n.oldRange=b._createFromRanges(n.oldRange._getTransformedByMoveOperation(i))
128),n.newRange){const t=n.newRange._getTransformedByMoveOperation(i);n.newRange=t[0];for(let s=1;s<t.length;s++){const r=n.clone();r.oldRange=null,r.newRange=t[s],r.baseVersion=-1,e.push(r)}}return e});F(fe,z,(n,i,e)=>{if(n.oldRange&&(n.oldRange=n.oldRange._getTransformedBySplitOperation(i)),n.newRange){if(e.abRelation){const t=n.newRange._getTransformedBySplitOperation(i);return n.newRange.start.isEqual(i.splitPosition)?e.abRelation.wasStartBeforeMergedElement?n.newRange.start=_._createAt(i.insertionPosition):e.abRelation.wasInLeftElement?n.newRange.start=_._createAt(n.newRange.start):n.newRange.start=_._createAt(i.moveTargetPosition):n.newRange.start=t.start,n.newRange.end.isEqual(i.splitPosition)?n.newRange.end.isEqual(i.splitPosition)&&e.abRelation.wasEndBeforeMergedElement?n.newRange.end=_._createAt(i.insertionPosition):e.abRelation.wasInRightElement?n.newRange.end=_._createAt(i.moveTargetPosition):n.newRange.end=_._createAt(n.newRange.end):n.newRange.end=t.end,[n]}n.newRange=n.newRange._getTransformedBySplitOperation(i)}return[n]});F(Q,ae,(n,i)=>(n.sourcePosition.hasSameParentAs(i.position)&&(n.howMany+=i.howMany),n.sourcePosition=n.sourcePosition._getTransformedByInsertOperation(i),n.targetPosition=n.targetPosition._getTransformedByInsertOperation(i),[n]));F(Q,Q,(n,i,e)=>{if(n.sourcePosition.isEqual(i.sourcePosition)&&n.targetPosition.isEqual(i.targetPosition))if(e.bWasUndone){const t=i.graveyardPosition.path.slice();return t.push(0),n.sourcePosition=new _(i.graveyardPosition.root,t),n.howMany=0,[n]}else return[new se(0)];if(n.sourcePosition.isEqual(i.sourcePosition)&&!n.targetPosition.isEqual(i.targetPosition)&&!e.bWasUndone&&e.abRelation!="splitAtSource"){const t=n.targetPosition.root.rootName=="$graveyard",s=i.targetPosition.root.rootName=="$graveyard";if(s&&!t||!(t&&!s)&&e.aIsStrong){const l=i.targetPosition._getTransformedByMergeOperation(i),c=n.targetPosition._getTransformedByMergeOperation(i);return[new N(l,n.howMany,c,0)]}else return[new se(0)]}return n.sourcePosition.hasSameParentAs(i.targetPosition)&&(n.howMany+=i.howMany),n.sourcePosition=n.sourcePosition._getTransformedByMergeOperation(i),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(i),(!n.graveyardPosition.isEqual(i.graveyardPosition)||!e.aIsStrong)&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(i)),[n]});F(Q,N,(n,i,e)=>{const t=b._createFromPositionAndShift(i.sourcePosition,i.howMany);return i.type=="remove"&&!e.bWasUndone&&n.deletionPosition.hasSameParentAs(i.sourcePosition)&&t.containsPosition(n.sourcePosition)?[new se(0)]:(i.sourcePosition.getShiftedBy(i.howMany).isEqual(n.sourcePosition)?n.sourcePosition.stickiness="toNone":i.targetPosition.isEqual(n.sourcePosition)&&e.abRelation=="mergeSourceAffected"?n.sourcePosition.stickiness="toNext":i.sourcePosition.isEqual(n.targetPosition)?(n.targetPosition.stickiness="toNone",n.howMany-=i.howMany):i.targetPosition.isEqual(n.targetPosition)&&e.abRelation=="mergeTargetWasBefore"?(n.targetPosition.stickiness="toPrevious",n.howMany+=i.howMany):(n.sourcePosition.hasSameParentAs(i.targetPosition)&&(n.howMany+=i.howMany),n.sourcePosition.hasSameParentAs(i.sourcePosition)&&(n.howMany-=i.howMany)),n.sourcePosition=n.sourcePosition._getTransformedByMoveOperation(i),n.targetPosition=n.targetPosition._getTransformedByMoveOperation(i),n.sourcePosition.stickiness="toPrevious",n.targetPosition.stickiness="toNext",n.graveyardPosition.isEqual(i.targetPosition)||(n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(i)),[n])});F(Q,z,(n,i,e)=>{if(i.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByDeletion(i.graveyardPosition,1),n.deletionPosition.isEqual(i.graveyardPosition)&&(n.howMany=i.howMany)),n.targetPosition.isEqual(i.splitPosition)&&(i.graveyardPosition&&n.deletionPosition.isEqual(i.graveyardPosition)||e.abRelation=="mergeTargetNotMoved"))return n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(i),[n];if(n.sourcePosition.isEqual(i.splitPosition)){if(e.abRelation=="mergeSourceNotMoved")return n.howMany=0,n.targetPosition=n.targetPosition._getTransformedBySplitOperation(i),[n];if(e.abRelation=="mergeSameElement"||n.sourcePosition.offset>0)return n.sourcePosition=i.moveTargetPosition.clone(),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(i),[n]}return n.sourcePosition.hasSameParentAs(i.splitPosition)&&(n.howMany=i.splitPosition.offset),n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(i),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(i),[n]});F(N,ae,(n,i)=>{const t=b._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByInsertOperation(i,!1)[0];return n.sourcePosition=t.start,n.howMany=t.end.offset-t.start.offset,n.targetPosition.isEqual(i.position)||(n.targetPosition=n.targetPosition._getTransformedByInsertOperation(i)),[n]});F(N,N,(n,i,e)=>{const t=b._createFromPositionAndShift(n.sourcePosition,n.howMany),s=b._createFromPositionAndShift(i.sourcePosition,i.howMany);let r=e.aIsStrong,o=!e.aIsStrong;e.abRelation=="insertBefore"||e.baRelation=="insertAfter"?o=!0:(e.abRelation=="insertAfter"||e.baRelation=="insertBefore")&&(o=!1);let a;if(n.targetPosition.isEqual(i.targetPosition)&&o?a=n.targetPosition._getTransformedByDeletion(i.sourcePosition,i.howMany):a=n.targetPosition._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany),vl(n,i)&&vl(i,n))return[i.getReversed()];if(t.containsPosition(i.targetPosition)&&t.containsRange(s,!0))return t.start=t.start._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany),t.end=t.end._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany),yi([t],a);if(s.containsPosition(n.targetPosition)&&s.containsRange(t,!0))return t.start=t.start._getCombined(i.sourcePosition,i.getMovedRangeStart()),t.end=t.end._getCombined(i.sourcePosition,i.getMovedRangeStart()),yi([t],a);const d=ue(n.sourcePosition.getParentPath(),i.sourcePosition.getParentPath());if(d=="prefix"||d=="extension")return t.start=t.start._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany),t.end=t.end._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany),yi([t],a);n.type=="remove"&&i.type!="remove"&&!e.aWasUndone&&!e.forceWeakRemove?r=!0:n.type!="remove"&&i.type=="remove"&&!e.bWasUndone&&!e.forceWeakRemove&&(r=!1);const h=[],f=t.getDifference(s);
128for(const g of f){g.start=g.start._getTransformedByDeletion(i.sourcePosition,i.howMany),g.end=g.end._getTransformedByDeletion(i.sourcePosition,i.howMany);const w=ue(g.start.getParentPath(),i.getMovedRangeStart().getParentPath())=="same",v=g._getTransformedByInsertion(i.getMovedRangeStart(),i.howMany,w);h.push(...v)}const m=t.getIntersection(s);return m!==null&&r&&(m.start=m.start._getCombined(i.sourcePosition,i.getMovedRangeStart()),m.end=m.end._getCombined(i.sourcePosition,i.getMovedRangeStart()),h.length===0?h.push(m):h.length==1?s.start.isBefore(t.start)||s.start.isEqual(t.start)?h.unshift(m):h.push(m):h.splice(1,0,m)),h.length===0?[new se(n.baseVersion)]:yi(h,a)});F(N,z,(n,i,e)=>{let t=n.targetPosition.clone();if((!n.targetPosition.isEqual(i.insertionPosition)||!i.graveyardPosition||e.abRelation=="moveTargetAfter")&&(t=n.targetPosition._getTransformedBySplitOperation(i)),n.sourcePosition.isEqual(i.insertionPosition)&&e.abRelation=="firstToMoveMerged")return n.howMany++,n.targetPosition=t,[n];const s=b._createFromPositionAndShift(n.sourcePosition,n.howMany);if(s.end.isEqual(i.insertionPosition))return(!i.graveyardPosition||e.abRelation=="lastToMoveMerged")&&n.howMany++,n.targetPosition=t,[n];if(s.start.hasSameParentAs(i.splitPosition)&&s.containsPosition(i.splitPosition)){let a=new b(i.splitPosition,s.end);a=a._getTransformedBySplitOperation(i);const l=[new b(s.start,i.splitPosition),a];return yi(l,t)}n.targetPosition.isEqual(i.splitPosition)&&e.abRelation=="insertAtSource"&&(t=i.moveTargetPosition),n.targetPosition.isEqual(i.insertionPosition)&&e.abRelation=="insertBetween"&&(t=n.targetPosition);const o=[s._getTransformedBySplitOperation(i)];if(i.graveyardPosition){const a=s.start.isEqual(i.graveyardPosition)||s.containsPosition(i.graveyardPosition);n.howMany>1&&a&&!e.aWasUndone&&o.push(b._createFromPositionAndShift(i.insertionPosition,1))}return yi(o,t)});F(N,Q,(n,i,e)=>{const t=b._createFromPositionAndShift(n.sourcePosition,n.howMany);if(i.deletionPosition.hasSameParentAs(n.sourcePosition)&&t.containsPosition(i.sourcePosition)){if(n.type=="remove"&&!e.forceWeakRemove){if(!e.aWasUndone){const o=[];let a=i.graveyardPosition.clone(),l=i.targetPosition._getTransformedByMergeOperation(i);const c=n.targetPosition.getTransformedByOperation(i);n.howMany>1&&(o.push(new N(n.sourcePosition,n.howMany-1,c,0)),a=a._getTransformedByMove(n.sourcePosition,c,n.howMany-1),l=l._getTransformedByMove(n.sourcePosition,c,n.howMany-1));const d=i.deletionPosition._getCombined(n.sourcePosition,c),h=new N(a,1,d,0),f=h.getMovedRangeStart().path.slice();f.push(0);const m=new _(h.targetPosition.root,f);l=l._getTransformedByMove(a,d,1);const g=new N(l,i.howMany,m,0);return o.push(h),o.push(g),o}}else if(n.howMany==1)return e.bWasUndone?(n.sourcePosition=i.graveyardPosition.clone(),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(i),[n]):[new se(0)]}const r=b._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByMergeOperation(i);return n.sourcePosition=r.start,n.howMany=r.end.offset-r.start.offset,n.targetPosition=n.targetPosition._getTransformedByMergeOperation(i),[n]});F(be,ae,(n,i)=>(n.position=n.position._getTransformedByInsertOperation(i),[n]));F(be,Q,(n,i)=>n.position.isEqual(i.deletionPosition)?(n.position=i.graveyardPosition.clone(),n.position.stickiness="toNext",[n]):(n.position=n.position._getTransformedByMergeOperation(i),[n]));F(be,N,(n,i)=>(n.position=n.position._getTransformedByMoveOperation(i),[n]));F(be,be,(n,i,e)=>{if(n.position.isEqual(i.position))if(e.aIsStrong)n.oldName=i.newName;else return[new se(0)];return[n]});F(be,z,(n,i)=>{const e=n.position.path,t=i.splitPosition.getParentPath();if(ue(e,t)=="same"&&!i.graveyardPosition){const s=new be(n.position.getShiftedBy(1),n.oldName,n.newName,0);return[n,s]}return n.position=n.position._getTransformedBySplitOperation(i),[n]});F(ft,ft,(n,i,e)=>{if(n.root===i.root&&n.key===i.key){if(!e.aIsStrong||n.newValue===i.newValue)return[new se(0)];n.oldValue=i.newValue}return[n]});F(nt,nt,(n,i)=>n.rootName===i.rootName&&n.isAdd===i.isAdd?[new se(0)]:[n]);F(z,ae,(n,i)=>(n.splitPosition.hasSameParentAs(i.position)&&n.splitPosition.offset<i.position.offset&&(n.howMany+=i.howMany),n.splitPosition=n.splitPosition._getTransformedByInsertOperation(i),n.insertionPosition=n.insertionPosition._getTransformedByInsertOperation(i),[n]));F(z,Q,(n,i,e)=>{if(!n.graveyardPosition&&!e.bWasUndone&&n.splitPosition.hasSameParentAs(i.sourcePosition)){const t=i.graveyardPosition.path.slice();t.push(0);const s=new _(i.graveyardPosition.root,t),r=z.getInsertionPosition(new _(i.graveyardPosition.root,t)),o=new z(s,0,r,null,0);return n.splitPosition=n.splitPosition._getTransformedByMergeOperation(i),n.insertionPosition=z.getInsertionPosition(n.splitPosition),n.graveyardPosition=o.insertionPosition.clone(),n.graveyardPosition.stickiness="toNext",[o,n]}return n.splitPosition.hasSameParentAs(i.deletionPosition)&&!n.splitPosition.isAfter(i.deletionPosition)&&n.howMany--,n.splitPosition.hasSameParentAs(i.targetPosition)&&(n.howMany+=i.howMany),n.splitPosition=n.splitPosition._getTransformedByMergeOperation(i),n.insertionPosition=z.getInsertionPosition(n.splitPosition),n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(i)),[n]});F(z,N,(n,i,e)=>{const t=b._createFromPositionAndShift(i.sourcePosition,i.howMany);if(n.graveyardPosition){const r=t.start.isEqual(n.graveyardPosition)||t.containsPosition(n.graveyardPosition);if(!e.bWasUndone&&r){const o=n.splitPosition._getTransformedByMoveOperation(i),a=n.graveyardPosition._getTransformedByMoveOperation(i),l=a.path.slice();l.push(0);const c=new _(a.root,l);return[new N(o,n.howMany,c,0)]}n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(i)}const s=n.splitPosition.isEqual(i.targetPosition);if(s&&(e.baRelation=="insertAtSource"||e.abRelation=="splitBefore"))return n.howMany+=i.howMany,n.splitPosition=n.splitPosition._getTransformedByDeletion(i.sourcePosition,i.howMany),n.insertionPosition=z.getInsertionPosition(n.splitPosition),[n];if(s&&e.abRelation&&e.abRelation.howMany){const{howMany:r,offset:o}=e.abRelation;return n.howMany+=r,n.splitPosition=n.splitPosition.getShiftedBy(o),[n]}if(n.splitPosition.hasSameParentAs(i.sourcePosition)&&t.containsPosition(n.splitPosition)){const r=i.howMany-(n.splitPosition.offset-i.sourcePosition.offset);return n.howMany-=r,n.splitPosition.hasSameParentAs(i.targetPosition)&&n.splitPosition.offset<i.targetPosition.offset&&(n.howMany+=i.howMany),n.splitPosition=i.sourcePosition.clone(),n.insertionPosition=z.getInsertionPosition(n.splitPosition),[n]}return i.sourcePosition.isEqual(i.targetPosition)||(n.splitPosition.hasSameParentAs(i.sourcePosition)&&n.splitPosition.offset<=i.sourcePosition.offset&&(n.howMany-=i.howMany),n.splitPosition.hasSameParentAs(i.targetPosition)&&n.splitPosition.offset<i.targetPosition.offset&&(n.howMany+=i.howMany)),n.splitPosition.stickiness="toNone",n.splitPosition=n.splitPosition._getTransformedByMoveOperation(i),n.splitPosition.stickiness="toNext",n.graveyardPosition?n.insertionPosition=n.insertionPosition._getTransformedByMoveOperation(i):n.insertionPosition=z.getInsertionPosition(n.splitPosition),[n]});F(z,z,(n,i,e)=>
128{if(n.splitPosition.isEqual(i.splitPosition)){if(!n.graveyardPosition&&!i.graveyardPosition)return[new se(0)];if(n.graveyardPosition&&i.graveyardPosition&&n.graveyardPosition.isEqual(i.graveyardPosition))return[new se(0)];if(e.abRelation=="splitBefore")return n.howMany=0,n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(i),[n]}if(n.graveyardPosition&&i.graveyardPosition&&n.graveyardPosition.isEqual(i.graveyardPosition)){const t=n.splitPosition.root.rootName=="$graveyard",s=i.splitPosition.root.rootName=="$graveyard";if(s&&!t||!(t&&!s)&&e.aIsStrong){const l=[];return i.howMany&&l.push(new N(i.moveTargetPosition,i.howMany,i.splitPosition,0)),n.howMany&&l.push(new N(n.splitPosition,n.howMany,n.moveTargetPosition,0)),l}else return[new se(0)]}if(n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(i)),n.splitPosition.isEqual(i.insertionPosition)&&e.abRelation=="splitBefore")return n.howMany++,[n];if(i.splitPosition.isEqual(n.insertionPosition)&&e.baRelation=="splitBefore"){const t=i.insertionPosition.path.slice();t.push(0);const s=new _(i.insertionPosition.root,t),r=new N(n.insertionPosition,1,s,0);return[n,r]}return n.splitPosition.hasSameParentAs(i.splitPosition)&&n.splitPosition.offset<i.splitPosition.offset&&(n.howMany-=i.howMany),n.splitPosition=n.splitPosition._getTransformedBySplitOperation(i),n.insertionPosition=z.getInsertionPosition(n.splitPosition),[n]});function vl(n,i){return n.targetPosition._getTransformedByDeletion(i.sourcePosition,i.howMany)===null}function yi(n,i){const e=[];for(let t=0;t<n.length;t++){const s=n[t],r=new N(s.start,s.end.offset-s.start.offset,i,0);e.push(r);for(let o=t+1;o<n.length;o++)n[o]=n[o]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];i=i._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return e}class oe extends H(_){constructor(i,e,t="toNone"){if(super(i,e,t),!this.root.is("rootElement"))throw new p("model-liveposition-root-not-rootelement",i);Tb.call(this)}detach(){this.stopListening()}toPosition(){return new _(this.root,this.path.slice(),this.stickiness)}static fromPosition(i,e){return new this(i.root,i.path.slice(),e||i.stickiness)}}oe.prototype.is=function(n){return n==="livePosition"||n==="model:livePosition"||n=="position"||n==="model:position"};function Tb(){this.listenTo(this.root.document.model,"applyOperation",(n,i)=>{const e=i[0];e.isDocumentOperation&&Pb.call(this,e)},{priority:"low"})}function Pb(n){const i=this.getTransformedByOperation(n);if(!this.isEqual(i)){const e=this.toPosition();this.path=i.path,this.root=i.root,this.fire("change",e)}}class oi{constructor(i={}){u(this,"operations");u(this,"isUndoable");u(this,"isLocal");u(this,"isUndo");u(this,"isTyping");typeof i=="string"&&(i=i==="transparent"?{isUndoable:!1}:{},void 0);const{isUndoable:e=!0,isLocal:t=!0,isUndo:s=!1,isTyping:r=!1}=i;this.operations=[],this.isUndoable=e,this.isLocal=t,this.isUndo=s,this.isTyping=r}get baseVersion(){for(const i of this.operations)if(i.baseVersion!==null)return i.baseVersion;return null}addOperation(i){return i.isDocumentOperation&&(i.batch=this,this.operations.push(i)),i}}const mn=class mn{constructor(i){u(this,"_markerCollection");u(this,"_changesInElement",new Map);u(this,"_elementsSnapshots",new Map);u(this,"_elementChildrenSnapshots",new Map);u(this,"_elementState",new Map);u(this,"_changedMarkers",new Map);u(this,"_changedRoots",new Map);u(this,"_changeCount",0);u(this,"_cachedChanges",null);u(this,"_cachedChangesWithGraveyard",null);u(this,"_refreshedItems",new Set);this._markerCollection=i}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(i){const e=i;switch(e.type){case"insert":{if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break}case"addAttribute":case"removeAttribute":case"changeAttribute":{for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break}case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),s=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),s||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);const r=b._createFromPositionAndShift(e.sourcePosition,e.howMany);for(const o of r.getItems({shallow:!0}
128))this._setElementState(o,"move");break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=b._createFromPositionAndShift(e.position,1);for(const s of this._markerCollection.getMarkersIntersectingRange(t)){const r=s.getData();this.bufferMarkerChange(s.name,r,r)}this._setElementState(e.position.nodeAfter,"rename");break}case"split":{const t=e.splitPosition.parent;if(!this._isInInsertedElement(t)){this._markRemove(t,e.splitPosition.offset,e.howMany);const s=b._createFromPositionAndShift(e.splitPosition,e.howMany);for(const r of s.getItems({shallow:!0}))this._setElementState(r,"move")}this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&(this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1),this._setElementState(e.graveyardPosition.nodeAfter,"move"));break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const s=e.graveyardPosition.parent;this._markInsert(s,e.graveyardPosition.offset,1),this._setElementState(t,"move");const r=e.targetPosition.parent;if(!this._isInInsertedElement(r)){this._markInsert(r,e.targetPosition.offset,t.maxOffset);const o=b._createFromPositionAndShift(e.sourcePosition,e.howMany);for(const a of o.getItems({shallow:!0}))this._setElementState(a,"move")}break}case"detachRoot":case"addRoot":{const t=e.affectedSelectable;if(!t._isLoaded||t.isAttached()==e.isAdd)return;this._bufferRootStateChange(e.rootName,e.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!e.root._isLoaded)return;const t=e.root.rootName;this._bufferRootAttributeChange(t,e.key,e.oldValue,e.newValue);break}}this._cachedChanges=null}bufferMarkerChange(i,e,t){e.range&&e.range.root.is("rootElement")&&!e.range.root._isLoaded&&(e.range=null),t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null);let s=this._changedMarkers.get(i);s?s.newMarkerData=t:(s={newMarkerData:t,oldMarkerData:e},this._changedMarkers.set(i,s)),s.oldMarkerData.range==null&&t.range==null&&this._changedMarkers.delete(i)}getMarkersToRemove(){const i=[];for(const[e,t]of this._changedMarkers)t.oldMarkerData.range!=null&&i.push({name:e,range:t.oldMarkerData.range});return i}getMarkersToAdd(){const i=[];for(const[e,t]of this._changedMarkers)t.newMarkerData.range!=null&&i.push({name:e,range:t.newMarkerData.range});return i}getChangedMarkers(){return Array.from(this._changedMarkers).map(([i,e])=>({name:i,data:{oldRange:e.oldMarkerData.range,newRange:e.newMarkerData.range}}))}hasDataChanges(){if(this.getChanges().length||this._changedRoots.size>0)return!0;for(const{newMarkerData:i,oldMarkerData:e}of this._changedMarkers.values()){if(i.affectsData!==e.affectsData)return!0;if(i.affectsData){const t=i.range&&!e.range,s=!i.range&&e.range,r=i.range&&e.range&&!i.range.isEqual(e.range);if(t||s||r)return!0}}return!1}getChanges(i={}){if(this._cachedChanges)return i.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let e=[];for(const t of this._changesInElement.keys()){const s=this._changesInElement.get(t).sort((d,h)=>d.offset===h.offset?d.type!=h.type?d.type=="remove"?-1:1:0:d.offset<h.offset?-1:1),r=this._elementChildrenSnapshots.get(t),o=Cl(t.getChildren()),a=Ab(r.length,s);let l=0,c=0;for(const d of a)if(d==="i"){const h=this._getDiffActionForNode(o[l].node,"insert"),f=this._elementsSnapshots.get(o[l].node),m=this._getInsertDiff(t,l,h,o[l],f);e.push(m),l++}else if(d==="r"){const h=this._getDiffActionForNode(r[c].node,"remove"),f=this._getRemoveDiff(t,l,h,r[c]);e.push(f),c++}else if(d==="a"){const h=r[c].attributes,f=o[l].attributes;let m;if(o[l].name=="$text")m=new b(_._createAt(t,l),_._createAt(t,l+1));else{const w=t.offsetToIndex(l);m=new b(_._createAt(t,l),_._createAt(t.getChild(w),0))}const g=this._getAttributesDiff(m,h,f);e.push(...g),l++,c++}else l++,c++}e.sort((t,s)=>t.position.root!=s.position.root?t.position.root.rootName<s.position.root.rootName?-1:1:t.position.isEqual(s.position)?t.changeCount-s.changeCount:t.position.isBefore(s.position)?-1:1);for(let t=1,s=0;t<e.length;t++){const r=e[s],o=e[t],a=r.type=="remove"&&o.type=="remove"&&r.name=="$text"&&o.name=="$text"&&r.position.isEqual(o.position),l=r.type=="insert"&&o.type=="insert"&&r.name=="$text"&&o.name=="$text"&&r.position.parent==o.position.parent&&r.position.offset+r.length==o.position.offset,c=r.type=="attribute"&&o.type=="attribute"&&r.position.parent==o.position.parent&&r.range.isFlat&&o.range.isFlat&&r.position.offset+r.length==o.position.offset&&r.attributeKey==o.attributeKey&&r.attributeOldValue==o.attributeOldValue&&r.attributeNewValue==o.attributeNewValue;a||l||c?(r.length++,c&&(r.range.end=r.range.end.getShiftedBy(1)),e[t]=null):s=t}e=e.filter(t=>t);for(const t of e)delete t.changeCount,t.type=="attribute"&&(delete t.position,delete t.length);return this._changeCount=0,this._cachedChangesWithGraveyard=e,this._cachedChanges=e.filter(xb),i.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}
128getChangedRoots(){return Array.from(this._changedRoots.values()).map(i=>{const e={...i};return e.state!==void 0&&delete e.attributes,e})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementChildrenSnapshots.clear(),this._elementsSnapshots.clear(),this._elementState.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems.clear(),this._cachedChanges=null}_refreshItem(i){if(this._isInInsertedElement(i.parent))return;this._markRemove(i.parent,i.startOffset,i.offsetSize),this._markInsert(i.parent,i.startOffset,i.offsetSize),this._refreshedItems.add(i),this._setElementState(i,"refresh");const e=b._createOn(i);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const s=t.getData();this.bufferMarkerChange(t.name,s,s)}this._cachedChanges=null}_bufferRootLoad(i){if(i.isAttached()){this._bufferRootStateChange(i.rootName,!0),this._markInsert(i,0,i.maxOffset);for(const e of i.getAttributeKeys())this._bufferRootAttributeChange(i.rootName,e,null,i.getAttribute(e));for(const e of this._markerCollection)if(e.getRange().root==i){const t=e.getData();this.bufferMarkerChange(e.name,{...t,range:null},t)}}}_bufferRootStateChange(i,e){if(!this._changedRoots.has(i)){this._changedRoots.set(i,{name:i,state:e?"attached":"detached"});return}const t=this._changedRoots.get(i);t.state!==void 0?(delete t.state,t.attributes===void 0&&this._changedRoots.delete(i)):t.state=e?"attached":"detached"}_bufferRootAttributeChange(i,e,t,s){const r=this._changedRoots.get(i)||{name:i},o=r.attributes||{};if(o[e]){const a=o[e];s===a.oldValue?delete o[e]:a.newValue=s}else o[e]={oldValue:t,newValue:s};Object.entries(o).length===0?(delete r.attributes,r.state===void 0&&this._changedRoots.delete(i)):(r.attributes=o,this._changedRoots.set(i,r))}_markInsert(i,e,t){if(i.root.is("rootElement")&&!i.root._isLoaded)return;const s={type:"insert",offset:e,howMany:t,count:this._changeCount++};this._markChange(i,s)}_markRemove(i,e,t){if(i.root.is("rootElement")&&!i.root._isLoaded)return;const s={type:"remove",offset:e,howMany:t,count:this._changeCount++};this._markChange(i,s),this._removeAllNestedChanges(i,e,t)}_markAttribute(i){if(i.root.is("rootElement")&&!i.root._isLoaded)return;const e={type:"attribute",offset:i.startOffset,howMany:i.offsetSize,count:this._changeCount++};this._markChange(i.parent,e)}_markChange(i,e){this._makeSnapshots(i);const t=this._getChangesForElement(i);this._handleChange(e,t),t.push(e);for(let s=0;s<t.length;s++)t[s].howMany<1&&(t.splice(s,1),s--)}_setElementState(i,e){if(!i.is("element"))return;const t=mn._statesPriority.indexOf(this._elementState.get(i));mn._statesPriority.indexOf(e)>t&&this._elementState.set(i,e)}_getDiffActionForNode(i,e){if(!i.is("element")||!this._elementsSnapshots.has(i))return e;const t=this._elementState.get(i);return!t||t=="move"?e:t}_getChangesForElement(i){let e;return this._changesInElement.has(i)?e=this._changesInElement.get(i):(e=[],this._changesInElement.set(i,e)),e}_makeSnapshots(i){if(this._elementChildrenSnapshots.has(i))return;const e=Cl(i.getChildren());this._elementChildrenSnapshots.set(i,e);for(const t of e)this._elementsSnapshots.set(t.node,t)}_handleChange(i,e){i.nodesToHandle=i.howMany;for(const t of e){const s=i.offset+i.howMany,r=t.offset+t.howMany;if(i.type=="insert"&&(t.type=="insert"&&(i.offset<=t.offset?t.offset+=i.howMany:i.offset<r&&(t.howMany+=i.nodesToHandle,i.nodesToHandle=0)),t.type=="remove"&&i.offset<t.offset&&(t.offset+=i.howMany),t.type=="attribute")){if(i.offset<=t.offset)t.offset+=i.howMany;else if(i.offset<r){const o=t.howMany;t.howMany=i.offset-t.offset,e.unshift({type:"attribute",offset:s,howMany:o-t.howMany,count:this._changeCount++})}}if(i.type=="remove"){if(t.type=="insert"){if(s<=t.offset)t.offset-=i.howMany;else if(s<=r)if(i.offset<t.offset){const o=s-t.offset;t.offset=i.offset,t.howMany-=o,i.nodesToHandle-=o}else t.howMany-=i.nodesToHandle,i.nodesToHandle=0;else if(i.offset<=t.offset)i.nodesToHandle-=t.howMany,t.howMany=0;else if(i.offset<r){const o=r-i.offset;t.howMany-=o,i.nodesToHandle-=o}}if(t.type=="remove"&&(s<=t.offset?t.offset-=i.howMany:i.offset<t.offset&&(i.nodesToHandle+=t.howMany,t.howMany=0)),t.type=="attribute"){if(s<=t.offset)t.offset-=i.howMany;else if(i.offset<t.offset){const o=s-t.offset;t.offset=i.offset,t.howMany-=o}else if(i.offset<r)if(s<=r){const o=t.howMany;t.howMany=i.offset-t.offset;const a=o-t.howMany-i.nodesToHandle;e.unshift({type:"attribute",offset:i.offset,howMany:a,count:this._changeCount++})}else t.howMany-=r-i.offset}}if(i.type=="attribute"){if(t.type=="insert")if(i.offset<t.offset&&s>t.offset){if(s>r){const o={type:"attribute",offset:r,howMany:s-r,count:this._changeCount++};this._handleChange(o,e),e.push(o)}i.nodesToHandle=t.offset-i.offset,i.howMany=i.nodesToHandle}else i.offset>=t.offset&&i.offset<r&&(s>r?(i.nodesToHandle=s-r,i.offset=r):i.nodesToHandle=0);if(t.type=="remove"&&i.offset<t.offset&&s>t.offset){const o={type:"attribute",offset:t.offset,howMany:s-t.offset,count:this._changeCount++};this._handleChange(o,e),e.push(o),i.nodesToHandle=t.offset-i.offset,i.howMany=i.nodesToHandle}t.type=="attribute"&&(i.offset>=t.offset&&s<=r?(i.nodesToHandle=0,i.howMany=0,i.offset=0):i.offset<=t.offset&&s>=r&&(t.howMany=0))}}i.howMany=i.nodesToHandle,delete i.nodesToHandle}_getInsertDiff(i,e,t,s,r){const o={type:"insert",position:_._createAt(i,e),name:s.name,attributes:new Map(s.attributes),length:1,changeCount:this._changeCount++,action:t};return t!="insert"&&r&&(o.before={name:r.name,attributes:new Map(r.attributes)}),o}_getRemoveDiff(i,e,t,s){return{type:"remove",action:t,position:_._createAt(i,e),name:s.name,attributes:new Map(s.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(i,e,t){const s=[];t=new Map(t);for(const[r,o]of e){const a=t.has(r)?t.get(r):null;a!==o&&s.push({type:"attribute",position:i.start,range:i.clone(),length:1,attributeKey:r,attributeOldValue:o,attributeNewValue:a,changeCount:this._changeCount++}),t.delete(r)}for(const[r,o]of t)s.push({type:"attribute",position:i.start,range:i.clone(),length:1,attributeKey:r,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return s}_isInInsertedElement(i){const e=i.parent;if(!e)return!1;const t=this._changesInElement.get(e),s=i.startOffset;if(t){for(const r of t)if(r.type=="insert"&&s>=r.offset&&s<r.offset+r.howMany)return!0}return this._isInInsertedElement(e)}_removeAllNestedChanges(i,e,t){const s=new b(_._createAt(i,e),_._createAt(i,e+t));for(const r of s.getItems({shallow:!0}))r.is("element")&&(this._changesInElement.delete(r),this._removeAllNestedChanges(r,0,r.maxOffset))}};u(mn,"_statesPriority",[void 0,"refresh","rename","move"]);let io=mn;function kl(n){return{node:n,name:n.is("$text")?"$text":n.name,attributes:new Map(n.getAttributes())}}function Cl(n){const i=[];for(const e of n)if(e.is("$text"))for(let t=0;t<e.data.length;++t)i.push(kl(e));else i.push(kl(e));return i}function Ab(n,i){const e=[];let t=0,s=0;for(const r of i){if(r.offset>t){for(let o=0;o<r.offset-t;
128o++)e.push("e");s+=r.offset-t}if(r.type=="insert"){for(let o=0;o<r.howMany;o++)e.push("i");t=r.offset+r.howMany}else if(r.type=="remove"){for(let o=0;o<r.howMany;o++)e.push("r");t=r.offset,s+=r.howMany}else{if(r.howMany>1500)for(let o=0;o<r.howMany;o++)e.push("a");else e.push(..."a".repeat(r.howMany).split(""));t=r.offset+r.howMany,s+=r.howMany}}if(s<n)for(let r=0;r<n-s-t;r++)e.push("e");return e}function xb(n){const i="position"in n&&n.position.root.rootName=="$graveyard",e="range"in n&&n.range.root.rootName=="$graveyard";return!i&&!e}class Sb{constructor(){u(this,"_operations",[]);u(this,"_undoPairs",new Map);u(this,"_undoneOperations",new Set);u(this,"_baseVersionToOperationIndex",new Map);u(this,"_version",0);u(this,"_gaps",new Map)}get version(){return this._version}set version(i){this._operations.length&&i>this._version+1&&this._gaps.set(this._version,i),this._version=i}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(i){if(i.baseVersion!==this.version)throw new p("model-document-history-addoperation-incorrect-version",this,{operation:i,historyVersion:this.version});this._operations.push(i),this._version++,this._baseVersionToOperationIndex.set(i.baseVersion,this._operations.length-1)}getOperations(i,e=this.version){if(!this._operations.length)return[];const t=this._operations[0];i===void 0&&(i=t.baseVersion);let s=e-1;for(const[a,l]of this._gaps)i>a&&i<l&&(i=l),s>a&&s<l&&(s=a-1);if(s<t.baseVersion||i>this.lastOperation.baseVersion)return[];let r=this._baseVersionToOperationIndex.get(i);r===void 0&&(r=0);let o=this._baseVersionToOperationIndex.get(s);return o===void 0&&(o=this._operations.length-1),this._operations.slice(r,o+1)}getOperation(i){const e=this._baseVersionToOperationIndex.get(i);if(e!==void 0)return this._operations[e]}setOperationAsUndone(i,e){this._undoPairs.set(e,i),this._undoneOperations.add(i)}isUndoingOperation(i){return this._undoPairs.has(i)}isUndoneOperation(i){return this._undoneOperations.has(i)}getUndoneOperation(i){return this._undoPairs.get(i)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class ks extends ${constructor(e,t,s="main"){super(t);u(this,"rootName");u(this,"_document");u(this,"_isAttached",!0);u(this,"_isLoaded",!0);this._document=e,this.rootName=s}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}ks.prototype.is=function(n,i){return i?i===this.name&&(n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"):n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"||n==="node"||n==="model:node"};const El="$graveyard";class Ib extends H(){constructor(e){super();u(this,"model");u(this,"history");u(this,"selection");u(this,"roots");u(this,"differ");u(this,"isReadOnly");u(this,"_postFixers");u(this,"_hasSelectionChangedFromTheLastChangeBlock");this.model=e,this.history=new Sb,this.selection=new Qe(this),this.roots=new Se({idProperty:"rootName"}),this.differ=new io(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",El),this.listenTo(e,"applyOperation",(t,s)=>{const r=s[0];r.isDocumentOperation&&this.differ.bufferOperation(r)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,s)=>{const r=s[0];r.isDocumentOperation&&this.history.addOperation(r)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,s,r,o,a)=>{const l={...s.getData(),range:o};this.differ.bufferMarkerChange(s.name,a,l),r===null&&s.on("change",(c,d)=>{const h=s.getData();this.differ.bufferMarkerChange(s.name,{...h,range:d},h)})}),this.registerPostFixer(t=>{let s=!1;for(const r of this.roots)!r.isAttached()&&!r.isEmpty&&(t.remove(t.createRangeIn(r)),s=!0);for(const r of this.model.markers)r.getRange().root.isAttached()||(t.removeMarker(r),s=!0);return s})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(El)}
128createRoot(e="$root",t="main"){if(this.roots.get(t))throw new p("model-document-createroot-name-exists",this,{name:t});const s=new ks(this,e,t);return this.roots.add(s),s}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=rm(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,s=t.schema,r=t.createPositionFromPath(e,[0]);return s.getNearestSelectionRange(r)||t.createRange(r)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&Tl(e.start)&&Tl(e.end)}_callPostFixers(e){let t=!1;do for(const s of this._postFixers)if(this.selection.refresh(),t=s(e),t)break;while(t)}}function Tl(n){const i=n.textNode;if(i){const e=i.data,t=n.offset-i.startOffset;return!Jo(e,t)&&!Qo(e,t)}return!0}class Ob extends H(){constructor(){super(...arguments);u(this,"_markers",new Map)}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof fi?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,s=!1,r=!1){const o=e instanceof fi?e.name:e;if(o.includes(","))throw new p("markercollection-incorrect-marker-name",this);const a=this._markers.get(o);if(a){const d=a.getData(),h=a.getRange();let f=!1;return h.isEqual(t)||(a._attachLiveRange(Be.fromRange(t)),f=!0),s!=a.managedUsingOperations&&(a._managedUsingOperations=s,f=!0),typeof r=="boolean"&&r!=a.affectsData&&(a._affectsData=r,f=!0),f&&this.fire(`update:${o}`,a,h,t,d),a}const l=Be.fromRange(t),c=new fi(o,l,s,r);return this._markers.set(o,c),this.fire(`update:${o}`,c,null,t,{...c.getData(),range:null}),c}_remove(e){const t=e instanceof fi?e.name:e,s=this._markers.get(t);return s?(this._markers.delete(t),this.fire(`update:${t}`,s,s.getRange(),null,s.getData()),this._destroyMarker(s),!0):!1}_refresh(e){const t=e instanceof fi?e.name:e,s=this._markers.get(t);if(!s)throw new p("markercollection-refresh-marker-not-exists",this);const r=s.getRange();this.fire(`update:${t}`,s,r,r,s.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 fi extends H(Rt){constructor(e,t,s,r){super();u(this,"name");u(this,"_managedUsingOperations");u(this,"_affectsData");u(this,"_liveRange");this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=s,this._affectsData=r}get managedUsingOperations(){if(!this._liveRange)throw new p("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new p("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new p("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new p("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new p("marker-destroyed",this);return this._liveRange.toRange()}toJSON(){var e;return{name:this.name,range:(e=this._liveRange)==null?void 0:e.toJSON(),usingOperations:this._managedUsingOperations,affectsData:this._affectsData}}_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}}fi.prototype.is=function(n){return n==="marker"||n==="model:marker"};class Mb extends Ae{constructor(e,t){super(null);u(this,"sourcePosition");u(this,"howMany");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 p("detach-operation-on-document-node",this)}_execute(){Pd(b._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class et extends Rt{constructor(e){super();u(this,"markers",new Map);u(this,"_children",new un);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)}getChildAtOffset(e){return this._children.getNodeAtOffset(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 s of e)t=t.getChildAtOffset(s);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 s of e)s.name?t.push($.fromJSON(s)):t.push(U.fromJSON(s));return new et(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const s=Rb(t);for(const r of s)r.parent!==null&&r._remove(),r.parent=this;this._children._insertNodes(e,s)}_removeChildren(e,t=1){const s=this._children._removeNodes(e,t);for(const r of s)r.parent=null;return s}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const t of e)t.parent=null}}et.prototype.is=function(n){return n==="documentFragment"||n==="model:documentFragment"};function Rb(n){return typeof n=="string"?[new U(n)]:(Te(n)||(n=[n]),Array.from(n).map(i=>typeof i=="string"?new U(i):i instanceof Ke?new U(i.data,i.getAttributes()):i))}class Vb{constructor(i,e){u(this,"model");u(this,"batch");this.model=i,this.batch=e}createText(i,e){return new U(i,e)}createElement(i,e){return new $(i,e)}createDocumentFragment(){return new et}cloneElement(i,e=!0){return i._clone(e)}insert(i,e,t=0){if(this._assertWriterUsedCorrectly(),i instanceof U&&i.data=="")return;const s=_._createAt(e,t);if(i.parent)if(xl(i.root,s.root)){this.move(b._createOn(i),s);return}
128else{if(i.root.document)throw new p("model-writer-insert-forbidden-move",this);this.remove(i)}const r=s.root.document?s.root.document.version:null,o=i instanceof et?i._removeChildren(0,i.childCount):i,a=new ae(s,o,r);if(i instanceof U&&(a.shouldReceiveAttributes=!0),this.batch.addOperation(a),this.model.applyOperation(a),i instanceof et)for(const[l,c]of i.markers){const d=_._createAt(c.root,0),f={range:new b(c.start._getCombined(d,s),c.end._getCombined(d,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(l)?this.updateMarker(l,f):this.addMarker(l,f)}}insertText(i,e,t,s){e instanceof et||e instanceof $||e instanceof _?this.insert(this.createText(i),e,t):this.insert(this.createText(i,e),t,s)}insertElement(i,e,t,s){e instanceof et||e instanceof $||e instanceof _?this.insert(this.createElement(i),e,t):this.insert(this.createElement(i,e),t,s)}append(i,e){this.insert(i,e,"end")}appendText(i,e,t){e instanceof et||e instanceof $?this.insert(this.createText(i),e,"end"):this.insert(this.createText(i,e),t,"end")}appendElement(i,e,t){e instanceof et||e instanceof $?this.insert(this.createElement(i),e,"end"):this.insert(this.createElement(i,e),t,"end")}setAttribute(i,e,t){if(this._assertWriterUsedCorrectly(),t instanceof b){const s=t.getMinimalFlatRanges();for(const r of s)Pl(this,i,e,r)}else Al(this,i,e,t)}setAttributes(i,e){for(const[t,s]of je(i))this.setAttribute(t,s,e)}removeAttribute(i,e){if(this._assertWriterUsedCorrectly(),e instanceof b){const t=e.getMinimalFlatRanges();for(const s of t)Pl(this,i,null,s)}else Al(this,i,null,e)}clearAttributes(i){this._assertWriterUsedCorrectly();const e=t=>{for(const s of t.getAttributeKeys())this.removeAttribute(s,t)};if(!(i instanceof b))e(i);else for(const t of i.getItems())e(t)}move(i,e,t){if(this._assertWriterUsedCorrectly(),!(i instanceof b))throw new p("writer-move-invalid-range",this);if(!i.isFlat)throw new p("writer-move-range-not-flat",this);const s=_._createAt(e,t);if(s.isEqual(i.start))return;if(this._addOperationForAffectedMarkers("move",i),!xl(i.root,s.root))throw new p("writer-move-different-document",this);const r=i.root.document?i.root.document.version:null,o=new N(i.start,i.end.offset-i.start.offset,s,r);this.batch.addOperation(o),this.model.applyOperation(o)}remove(i){this._assertWriterUsedCorrectly();const t=(i instanceof b?i:b._createOn(i)).getMinimalFlatRanges().reverse();for(const s of t)this._addOperationForAffectedMarkers("move",s),Bb(s.start,s.end.offset-s.start.offset,this.batch,this.model)}merge(i){this._assertWriterUsedCorrectly();const e=i.nodeBefore,t=i.nodeAfter;if(this._addOperationForAffectedMarkers("merge",i),!(e instanceof $))throw new p("writer-merge-no-element-before",this);if(!(t instanceof $))throw new p("writer-merge-no-element-after",this);i.root.document?this._merge(i):this._mergeDetached(i)}createPositionFromPath(i,e,t){return this.model.createPositionFromPath(i,e,t)}createPositionAt(i,e){return this.model.createPositionAt(i,e)}createPositionAfter(i){return this.model.createPositionAfter(i)}createPositionBefore(i){return this.model.createPositionBefore(i)}createRange(i,e){return this.model.createRange(i,e)}createRangeIn(i){return this.model.createRangeIn(i)}createRangeOn(i){return this.model.createRangeOn(i)}createSelection(...i){return this.model.createSelection(...i)}_mergeDetached(i){const e=i.nodeBefore,t=i.nodeAfter;this.move(b._createIn(t),_._createAt(e,"end")),this.remove(t)}_merge(i){const e=_._createAt(i.nodeBefore,"end"),t=_._createAt(i.nodeAfter,0),s=i.root.document.graveyard,r=new _(s,[0]),o=i.root.document.version,a=new Q(t,i.nodeAfter.maxOffset,e,r,o);this.batch.addOperation(a),this.model.applyOperation(a)}rename(i,e){if(this._assertWriterUsedCorrectly(),!(i instanceof $))throw new p("writer-rename-not-element-instance",this);const t=i.root.document?i.root.document.version:null,s=new be(_._createBefore(i),i.name,e,t);this.batch.addOperation(s),this.model.applyOperation(s)}split(i,e){this._assertWriterUsedCorrectly();let t=i.parent;if(!t.parent)throw new p("writer-split-element-no-parent",this);if(e||(e=t.parent),!i.parent.getAncestors({includeSelf:!0}).includes(e))throw new p("writer-split-invalid-limit-element",this);let s,r;do{const o=t.root.document?t.root.document.version:null,a=t.maxOffset-i.offset,l=z.getInsertionPosition(i),c=new z(i,a,l,null,o);this.batch.addOperation(c),this.model.applyOperation(c),!s&&!r&&(s=t,r=i.parent.nextSibling),i=this.createPositionAfter(i.parent),t=i.parent}while(t!==e);return{position:i,range:new b(_._createAt(s,"end"),_._createAt(r,0))}}wrap(i,e){if(this._assertWriterUsedCorrectly(),!i.isFlat)throw new p("writer-wrap-range-not-flat",this);const t=e instanceof $?e:new $(e);if(t.childCount>0)throw new p("writer-wrap-element-not-empty",this);if(t.parent!==null)throw new p("writer-wrap-element-attached",this);this.insert(t,i.start);const s=new b(i.start.getShiftedBy(1),i.end.getShiftedBy(1));this.move(s,_._createAt(t,0))}unwrap(i){if(this._assertWriterUsedCorrectly(),i.parent===null)throw new p("writer-unwrap-element-no-parent",this);this.move(b._createIn(i),this.createPositionAfter(i)),this.remove(i)}addMarker(i,e){if(this._assertWriterUsedCorrectly(),!e||typeof e.usingOperation!="boolean")throw new p("writer-addmarker-no-usingoperation",this);const t=e.usingOperation,s=e.range,r=e.affectsData===void 0?!1:e.affectsData;if(this.model.markers.has(i))throw new p("writer-addmarker-marker-exists",this);if(!s)throw new p("writer-addmarker-no-range",this);return t?($i(this,i,null,s,r),this.model.markers.get(i)):this.model.markers._set(i,s,t,r)}updateMarker(i,e){this._assertWriterUsedCorrectly();const t=typeof i=="string"?i:i.name,s=this.model.markers.get(t);if(!s)throw new p("writer-updatemarker-marker-not-exists",this);if(!e){this.model.markers._refresh(s);return}const r=typeof e.usingOperation=="boolean",o=typeof e.affectsData=="boolean",a=o?e.affectsData:s.affectsData;if(!r&&!e.range&&!o)throw new p("writer-updatemarker-wrong-options",this);const l=s.getRange(),c=e.range?e.range:l;if(r&&e.usingOperation!==s.managedUsingOperations){e.usingOperation?$i(this,t,null,c,a):($i(this,t,l,null,a),this.model.markers._set(t,c,void 0,a));return}s.managedUsingOperations?$i(this,t,l,c,a):this.model.markers._set(t,c,void 0,a)}removeMarker(i){this._assertWriterUsedCorrectly();const e=typeof i=="string"?i:i.name;if(!this.model.markers.has(e))throw new p("writer-removemarker-no-marker",this);const t=this.model.markers.get(e);if(!t.managedUsingOperations){this.model.markers._remove(e);return}const s=t.getRange();$i(this,e,s,null,t.affectsData)}addRoot(i,e="$root"){this._assertWriterUsedCorrectly();const t=this.model.document.getRoot(i);if(t&&t.isAttached())throw new p("writer-addroot-root-exists",this);const s=this.model.document,r=new nt(i,e,!0,s,s.version);return this.batch.addOperation(r),this.model.applyOperation(r),this.model.document.getRoot(i)}detachRoot(i){this._assertWriterUsedCorrectly();const e=typeof i=="string"?this.model.document.getRoot(i):i;if(!e||!e.isAttached())throw new p("writer-detachroot-no-root",this);for(const r of this.model.markers)r.getRange().root===e&&this.removeMarker(r);for(const r of e.getAttributeKeys())this.removeAttribute(r,e);this.remove(this.createRangeIn(e));const t=this.model.document,s=new nt(e.rootName,e.name,!1,t,t.version);this.batch.addOperation(s),this.model.applyOperation(s)}setSelection(...i){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...i)}setSelectionFocus(i,e){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(i,e)}setSelectionAttribute(i,e){if(this._assertWriterUsedCorrectly(),typeof i=="string")this._setSelectionAttribute(i,e);else for(const[t,s]of je(i))this._setSelectionAttribute(t,s)}removeSelectionAttribute(i){if(this._assertWriterUsedCorrectly(),typeof i=="string")this._removeSelectionAttribute(i);else for(const e of i)this._removeSelectionAttribute(e)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(i){this.model.document.selection._restoreGravity(i)}_setSelectionAttribute(i,e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const s=Qe._getStoreAttributeKey(i);this.setAttribute(s,e,t.anchor.parent)}t._setAttribute(i,e)}_removeSelectionAttribute(i){const e=this.model.document.selection;if(e.isCollapsed&&e.anchor.parent.isEmpty){const t=Qe._getStoreAttributeKey(i);this.removeAttribute(t,e.anchor.parent)}e._removeAttribute(i)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new p("writer-incorrect-use",this)}_addOperationForAffectedMarkers(i,e){for(const t of this.model.markers){if(!t.managedUsingOperations)continue;const s=t.getRange();let r=!1;if(i==="move"){const o=e;r=o.containsPosition(s.start)||o.start.isEqual(s.start)||o.containsPosition(s.end)||o.end.isEqual(s.end)}else{const o=e,a=o.nodeBefore,l=o.nodeAfter,c=s.start.parent==a&&s.start.isAtEnd,d=s.end.parent==l&&s.end.offset==0,h=s.end.nodeAfter==l,f=s.start.nodeAfter==l;r=c||d||h||f}r&&this.updateMarker(t.name,{range:s})}}}function Pl(n,i,e,t){const s=n.model,r=s.document;let o=t.start,a,l,c;for(const h of t.getWalker({shallow:!0}))c=h.item.getAttribute(i),a&&l!=c&&(l!=e&&d(),o=a),a=h.nextPosition,l=c;a instanceof _&&a!=o&&l!=e&&d();function d(){const h=new b(o,a),f=h.root.document?r.version:null,m=new X(h,i,l,e,f);n.batch.addOperation(m),s.applyOperation(m)}}function Al(n,i,e,t){const s=n.model,r=s.document,o=t.getAttribute(i);let a,l;if(o!=e){if(t.root===t){const d=t.document?r.version:null;l=new ft(t,i,o,e,d)}else{a=new b(_._createBefore(t),n.createPositionAfter(t));const d=a.root.document?r.version:null;l=new X(a,i,o,e,d)}n.batch.addOperation(l),s.applyOperation(l)}}function $i(n,i,e,t,s){const r=n.model,o=r.document,a=new fe(i,e,t,r.markers,!!s,o.version);n.batch.addOperation(a),r.applyOperation(a)}function Bb(n,i,e,t){let s;if(n.root.document){const r=t.document,o=new _(r.graveyard,[0]);s=new N(n,i,o,r.version)}else s=new Mb(n,i);e.addOperation(s),t.applyOperation(s)}function xl(n,i){return n===i||n instanceof ks&&i instanceof ks}
128function Lb(n){n.document.registerPostFixer(i=>Fb(i,n))}function Fb(n,i){const e=i.document.selection,t=i.schema,s=[];let r=!1;for(const o of e.getRanges()){const a=ra(o,t);a&&!a.isEqual(o)?(s.push(a),r=!0):s.push(o)}return r&&n.setSelection(Hb(s),{backward:e.isBackward}),!1}function ra(n,i){return n.isCollapsed?Nb(n,i):Db(n,i)}function Nb(n,i){const e=n.start,t=i.getNearestSelectionRange(e);if(!t){const r=e.getAncestors().reverse().find(o=>i.isObject(o));return r?b._createOn(r):null}if(!t.isCollapsed)return t;const s=t.start;return e.isEqual(s)?null:new b(s)}function Db(n,i){const{start:e,end:t}=n,s=i.checkChild(e,"$text"),r=i.checkChild(t,"$text"),o=i.getLimitElement(e),a=i.getLimitElement(t);if(o===a){if(s&&r)return null;if(zb(e,t,i)){const h=e.nodeAfter&&i.isSelectable(e.nodeAfter)?null:i.getNearestSelectionRange(e,"forward"),m=t.nodeBefore&&i.isSelectable(t.nodeBefore)?null:i.getNearestSelectionRange(t,"backward"),g=h?h.start:e,w=m?m.end:t;return new b(g,w)}}const l=o&&!o.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const d=e.nodeAfter&&t.nodeBefore&&e.nodeAfter.parent===t.nodeBefore.parent,h=l&&(!d||!Il(e.nodeAfter,i)),f=c&&(!d||!Il(t.nodeBefore,i));let m=e,g=t;return h&&(m=_._createBefore(Sl(o,i))),f&&(g=_._createAfter(Sl(a,i))),new b(m,g)}return null}function Sl(n,i){let e=n,t=e;for(;i.isLimit(t)&&t.parent;)e=t,t=t.parent;return e}function zb(n,i,e){const t=n.nodeAfter&&!e.isLimit(n.nodeAfter)||e.checkChild(n,"$text"),s=i.nodeBefore&&!e.isLimit(i.nodeBefore)||e.checkChild(i,"$text");return t||s}function Hb(n){const i=[...n],e=new Set;let t=1;for(;t<i.length;){const r=i[t],o=i.slice(0,t);for(const[a,l]of o.entries())if(!e.has(a)){if(r.isEqual(l))e.add(a);else if(r.isIntersecting(l)){e.add(a),e.add(t);const c=r.getJoined(l);i.push(c)}}t++}return i.filter((r,o)=>!e.has(o))}function Il(n,i){return n&&i.isSelectable(n)}function Wb(n,i,e={}){if(i.isCollapsed)return;const t=i.getFirstRange();if(t.root.rootName=="$graveyard")return;const s=n.schema;n.change(r=>{if(!e.doNotResetEntireContent&&Yb(s,i)){Qb(r,i);return}const o={};if(!e.doNotAutoparagraph){const c=i.getSelectedElement();c&&Object.assign(o,s.getAttributesWithProperty(c,"copyOnReplace",!0))}let a,l;e.doNotFixSelection?(a=oe.fromPosition(t.start,"toPrevious"),l=oe.fromPosition(t.end,"toNext")):[a,l]=$b(t),a.isTouching(l)||r.remove(r.createRange(a,l)),e.leaveUnmerged||(qb(r,a,l),s.removeDisallowedAttributes(a.parent.getChildren(),r)),Rd(r,i,a),!e.doNotAutoparagraph&&jb(s,a)&&Md(r,a,i,o),a.detach(),l.detach()})}function $b(n){const i=n.root.document.model,e=n.start;let t=n.end;if(i.hasContent(n,{ignoreMarkers:!0})){const s=Ub(t);if(s&&t.isTouching(i.createPositionAt(s,0))){const r=i.createSelection(n);i.modifySelection(r,{direction:"backward"});const o=r.getLastPosition(),a=i.createRange(o,t);i.hasContent(a,{ignoreMarkers:!0})||(t=o)}}return[oe.fromPosition(e,"toPrevious"),oe.fromPosition(t,"toNext")]}function Ub(n){const i=n.parent,e=i.root.document.model.schema,t=i.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of t){if(e.isLimit(s))return null;if(e.isBlock(s))return s}}function qb(n,i,e){const t=n.model;if(!oa(n.model.schema,i,e))return;const[s,r]=Gb(i,e);!s||!r||(!t.hasContent(s,{ignoreMarkers:!0})&&t.hasContent(r,{ignoreMarkers:!0})?Od(n,i,e,s.parent):Id(n,i,e,s.parent))}function Id(n,i,e,t){const s=i.parent,r=e.parent;if(!(s==t||r==t)){for(i=n.createPositionAfter(s),e=n.createPositionBefore(r),e.isEqual(i)||n.insert(r,i),n.merge(i);e.parent.isEmpty;){const o=e.parent;e=n.createPositionBefore(o),n.remove(o)}oa(n.model.schema,i,e)&&Id(n,i,e,t)}}function Od(n,i,e,t){const s=i.parent,r=e.parent;if(!(s==t||r==t)){for(i=n.createPositionAfter(s),e=n.createPositionBefore(r),e.isEqual(i)||n.insert(s,e);i.parent.isEmpty;){const o=i.parent;i=n.createPositionBefore(o),n.remove(o)}e=n.createPositionBefore(r),Kb(n,e),oa(n.model.schema,i,e)&&Od(n,i,e,t)}}function Kb(n,i){const e=i.nodeBefore,t=i.nodeAfter;e.name!=t.name&&n.rename(e,t.name),n.clearAttributes(e),n.setAttributes(Object.fromEntries(t.getAttributes()),e),n.merge(i)}function oa(n,i,e){const t=i.parent,s=e.parent;return t==s||n.isLimit(t)||n.isLimit(s)?!1:Jb(i,e,n)}function Gb(n,i){const e=n.getAncestors(),t=i.getAncestors();let s=0;for(;e[s]&&e[s]==t[s];)s++;return[e[s],t[s]]}function jb(n,i){const e=n.checkChild(i,"$text"),t=n.checkChild(i,"paragraph");return!e&&t}function Jb(n,i,e){const t=new b(n,i);for(const s of t.getWalker())if(e.isLimit(s.item))return!1;return!0}function Md(n,i,e,t={}){const s=n.createElement("paragraph");n.model.schema.setAllowedAttributes(s,t,n),n.insert(s,i),Rd(n,e,n.createPositionAt(s,0))}function Qb(n,i){const e=n.model.schema.getLimitElement(i);n.remove(n.createRangeIn(e)),Md(n,n.createPositionAt(e,0),i)}function Yb(n,i){const e=n.getLimitElement(i);if(!i.containsEntireContent(e))return!1;const t=i.getFirstRange();return t.start.parent==t.end.parent?!1:n.checkChild(e,"paragraph")}function Rd(n,i,e){i instanceof Qe?n.setSelection(e):i.setTo(e)}/**
129 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
130 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
131 */function Xb(n,i){return n.change(e=>{const t=e.createDocumentFragment(),s=i.getFirstRange();if(!s||s.isCollapsed)return t;const r=s.start.root,o=s.start.getCommonPath(s.end),a=r.getNodeByPath(o);let l;s.start.parent==s.end.parent?l=s:l=e.createRange(e.createPositionAt(a,s.start.path[o.length]),e.createPositionAt(a,s.end.path[o.length]+1));const c=l.end.offset-l.start.offset;for(const d of l.getItems({shallow:!0}))d.is("$textProxy")?e.appendText(d.data,d.getAttributes(),t):e.append(e.cloneElement(d,!0),t);
131if(l!=s){const d=s._getTransformedByMove(l.start,e.createPositionAt(t,0),c)[0],h=e.createRange(e.createPositionAt(t,0),d.start),f=e.createRange(d.end,e.createPositionAt(t,"end"));Ol(f,e),Ol(h,e)}return t})}function Ol(n,i){const e=[];Array.from(n.getItems({direction:"backward"})).map(t=>i.createRangeOn(t)).filter(t=>(t.start.isAfter(n.start)||t.start.isEqual(n.start))&&(t.end.isBefore(n.end)||t.end.isEqual(n.end))).forEach(t=>{e.push(t.start.parent),i.remove(t)}),e.forEach(t=>{let s=t;for(;s.parent&&s.isEmpty;){const r=i.createRangeOn(s);s=s.parent,i.remove(r)}})}function Zb(n,i,e){return n.change(t=>{const s=e||n.document.selection;s.isCollapsed||n.deleteContent(s,{doNotAutoparagraph:!0});const r=new e_(n,t,s.anchor),o=[];let a;if(i.is("documentFragment")){if(i.markers.size){const d=[];for(const[h,f]of i.markers){const{start:m,end:g}=f,w=m.isEqual(g);d.push({position:m,name:h,isCollapsed:w},{position:g,name:h,isCollapsed:w})}d.sort(({position:h},{position:f})=>h.isBefore(f)?1:-1);for(const{position:h,name:f,isCollapsed:m}of d){let g=null,w=null;const v=h.parent===i&&h.isAtStart,O=h.parent===i&&h.isAtEnd;!v&&!O?(g=t.createElement("$marker"),t.insert(g,h)):m&&(w=v?"start":"end"),o.push({name:f,element:g,collapsed:w})}}a=i.getChildren()}else a=[i];r.handleNodes(a);let l=r.getSelectionRange();if(i.is("documentFragment")&&o.length){const d=l?Be.fromRange(l):null,h={};for(let f=o.length-1;f>=0;f--){const{name:m,element:g,collapsed:w}=o[f],v=!h[m];if(v&&(h[m]=[]),g){const O=t.createPositionAt(g,"before");h[m].push(O),t.remove(g)}else{const O=r.getAffectedRange();if(!O){w&&h[m].push(r.position);continue}w?h[m].push(O[w]):h[m].push(v?O.start:O.end)}}for(const[f,[m,g]]of Object.entries(h))m&&g&&m.root===g.root&&m.root.document&&!t.model.markers.has(f)&&t.addMarker(f,{usingOperation:!0,affectsData:!0,range:new b(m,g)});d&&(l=d.toRange(),d.detach())}/* istanbul ignore else -- @preserve */l&&(s instanceof Qe?t.setSelection(l):s.setTo(l));const c=r.getAffectedRange()||n.createRange(s.anchor);return r.destroy(),c})}class e_{constructor(i,e,t){u(this,"model");u(this,"writer");u(this,"position");u(this,"canMergeWith");u(this,"schema");u(this,"_documentFragment");u(this,"_documentFragmentPosition");u(this,"_firstNode",null);u(this,"_lastNode",null);u(this,"_lastAutoParagraph",null);u(this,"_filterAttributesOf",[]);u(this,"_affectedStart",null);u(this,"_affectedEnd",null);u(this,"_nodeToSelect",null);this.model=i,this.writer=e,this.position=t,this.canMergeWith=new Set([this.position.parent]),this.schema=i.schema,this._documentFragment=e.createDocumentFragment(),this._documentFragmentPosition=e.createPositionAt(this._documentFragment,0)}handleNodes(i){for(const e of Array.from(i))this._handleNode(e);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(i){const e=this.writer.createPositionAfter(this._lastNode),t=this.writer.createPositionAfter(i);if(t.isAfter(e)){this._lastNode=i;/* istanbul ignore if -- @preserve */if(this.position.parent!=i||!this.position.isAtEnd)throw new p("insertcontent-invalid-insertion-position",this);this.position=t,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?b._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new b(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(i){if(!this._checkAndSplitToAllowedPosition(i)){this.schema.isObject(i)||this._handleDisallowedNode(i);return}this._appendToFragment(i),this._firstNode||(this._firstNode=i),this._lastNode=i}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const i=oe.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=i.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=i.toPosition(),i.detach()}_handleDisallowedNode(i){i.is("element")&&this.handleNodes(i.getChildren())}_appendToFragment(i){/* istanbul ignore if -- @preserve */if(!this.schema.checkChild(this.position,i))throw new p("insertcontent-wrong-position",this,{node:i,position:this.position});this.writer.insert(i,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(i.offsetSize),this.schema.isObject(i)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=i:this._nodeToSelect=null,this._filterAttributesOf.push(i)}_setAffectedBoundaries(i){this._affectedStart||(this._affectedStart=oe.fromPosition(i,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(i))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=oe.fromPosition(i,"toNext"))}_mergeOnLeft(){const i=this._firstNode;if(!(i instanceof $)||!this._canMergeLeft(i))return;const e=oe._createBefore(i);e.stickiness="toNext";const t=oe.fromPosition(this.position,"toNext");this._affectedStart.isEqual(e)&&(this._affectedStart.detach(),this._affectedStart=oe._createAt(e.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=e.nodeBefore,this._lastNode=e.nodeBefore),this.writer.merge(e),e.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=oe._createAt(e.nodeBefore,"end","toNext")),this.position=t.toPosition(),t.detach(),this._filterAttributesOf.push(this.position.parent),e.detach()}_mergeOnRight(){const i=this._lastNode;if(!(i instanceof $)||!this._canMergeRight(i))return;const e=oe._createAfter(i);e.stickiness="toNext";/* istanbul ignore if -- @preserve */if(!this.position.isEqual(e))throw new p("insertcontent-invalid-insertion-position",this);this.position=_._createAt(e.nodeBefore,"end");const t=oe.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(e)&&(this._affectedEnd.detach(),this._affectedEnd=oe._createAt(e.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=e.nodeBefore,this._lastNode=e.nodeBefore),this.writer.merge(e),e.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=oe._createAt(e.nodeBefore,0,"toPrevious")),this.position=t.toPosition(),t.detach(),this._filterAttributesOf.push(this.position.parent),e.detach()}_canMergeLeft(i){const e=i.previousSibling;return e instanceof $&&this.canMergeWith.has(e)&&this.model.schema.checkMerge(e,i)}_canMergeRight(i){const e=i.nextSibling;return e instanceof $&&this.canMergeWith.has(e)&&this.model.schema.checkMerge(i,e)}_insertAutoParagraph(){this._insertPartialFragment();const i=this.writer.createElement("paragraph");this.writer.insert(i,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=i,this.position=this.writer.createPositionAt(i,0)}_checkAndSplitToAllowedPosition(i){const e=this._getAllowedIn(this.position.parent,i);if(!e)return!1;for(e!=this.position.parent&&this._insertPartialFragment();e!=this.position.parent;)if(this.position.isAtStart){const t=this.position.parent;this.position=this.writer.createPositionBefore(t),t.isEmpty&&t.parent===e&&this.writer.remove(t)}
131else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const t=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=t,this.canMergeWith.add(this.position.nodeAfter)}return this.schema.checkChild(this.position.parent,i)||this._insertAutoParagraph(),!0}_getAllowedIn(i,e){return this.schema.checkChild(i,e)||this.schema.checkChild(i,"paragraph")&&this.schema.checkChild("paragraph",e)?i:this.schema.isLimit(i)?null:this._getAllowedIn(i.parent,e)}}function t_(n,i,e,t={}){if(!n.schema.isObject(i))throw new p("insertobject-element-not-an-object",n,{object:i});const s=e||n.document.selection;let r=s;t.findOptimalPosition&&n.schema.isBlock(i)&&(r=n.createSelection(n.schema.findOptimalInsertionRange(s,t.findOptimalPosition)));const o=ye(s.getSelectedBlocks()),a={};return o&&Object.assign(a,n.schema.getAttributesWithProperty(o,"copyOnReplace",!0)),n.change(l=>{r.isCollapsed||n.deleteContent(r,{doNotAutoparagraph:!0});let c=i;const d=r.anchor.parent;!n.schema.checkChild(d,i)&&n.schema.checkChild(d,"paragraph")&&n.schema.checkChild("paragraph",i)&&(c=l.createElement("paragraph"),l.insert(i,c)),n.schema.setAllowedAttributes(c,a,l);const h=n.insertContent(c,r);return h.isCollapsed||t.setSelection&&i_(l,i,t.setSelection,a),h})}function i_(n,i,e,t){const s=n.model;if(e=="on"){n.setSelection(i,"on");return}if(e!="after")throw new p("insertobject-invalid-place-parameter-value",s);let r=i.nextSibling;if(s.schema.isInline(i)){n.setSelection(i,"after");return}!(r&&s.schema.checkChild(r,"$text"))&&s.schema.checkChild(i.parent,"paragraph")&&(r=n.createElement("paragraph"),s.schema.setAllowedAttributes(r,t,n),s.insertContent(r,n.createPositionAfter(i))),r&&n.setSelection(r,0)}const n_=' ,.?!:;"-()';function s_(n,i,e={}){const t=n.schema,s=e.direction!="backward",r=e.unit?e.unit:"character",o=!!e.treatEmojiAsSingleUnit,a=i.focus,l=new ht({boundaries:l_(a,s),singleCharacters:!0,direction:s?"forward":"backward"}
131),c={walker:l,schema:t,isForward:s,unit:r,treatEmojiAsSingleUnit:o};let d;for(;d=l.next();){if(d.done)return;const h=r_(c,d.value);if(h){i instanceof Qe?n.change(f=>{f.setSelectionFocus(h)}):i.setFocus(h);return}}}function r_(n,i){const{isForward:e,walker:t,unit:s,schema:r,treatEmojiAsSingleUnit:o}=n,{type:a,item:l,nextPosition:c}=i;if(a=="text")return n.unit==="word"?a_(t,e):o_(t,s,o);if(a==(e?"elementStart":"elementEnd")){if(r.isSelectable(l))return _._createAt(l,e?"after":"before");if(r.checkChild(c,"$text"))return c}else{if(r.isLimit(l)){t.skip(()=>!0);return}if(r.checkChild(c,"$text"))return c}}function o_(n,i,e){const t=n.position.textNode;if(t){const s=t.data;let r=n.position.offset-t.startOffset;for(;Jo(s,r)||i=="character"&&Qo(s,r)||e&&ju(s,r);)n.next(),r=n.position.offset-t.startOffset}return n.position}function a_(n,i){let e=n.position.textNode;for(e||(e=i?n.position.nodeAfter:n.position.nodeBefore);e&&e.is("$text");){const t=n.position.offset-e.startOffset;if(u_(e,t,i))e=i?n.position.nodeAfter:n.position.nodeBefore;else{if(c_(e.data,t,i))break;n.next()}}return n.position}function l_(n,i){const e=n.root,t=_._createAt(e,i?"end":0);return i?new b(n,t):new b(t,n)}function c_(n,i,e){const t=i+(e?0:-1);return n_.includes(n.charAt(t))}function u_(n,i,e){return i===(e?n.offsetSize:0)}class d_ extends q(){constructor(){super();u(this,"markers");u(this,"document");u(this,"schema");u(this,"_pendingChanges");u(this,"_currentWriter");this.markers=new Ob,this.document=new Ib(this),this.schema=new Gw,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>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(()=>!0,"$marker"),Lb(this),this.document.registerPostFixer(yd),this.on("insertContent",(e,[t,s])=>{e.return=Zb(this,t,s)}),this.on("insertObject",(e,[t,s,r])=>{e.return=t_(this,t,s,r)}),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 oi,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){/* istanbul ignore next -- @preserve */p.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new oi):e instanceof oi||(e=new oi(e)):e=new oi,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(s){/* istanbul ignore next -- @preserve */p.rethrowUnexpectedError(s,this)}}applyOperation(e){e._execute()}insertContent(e,t,s,...r){const o=gr(t,s);return this.fire("insertContent",[e,o,s,...r])}insertObject(e,t,s,r,...o){const a=gr(t,s);return this.fire("insertObject",[e,a,r,r,...o])}deleteContent(e,t){Wb(this,e,t)}modifySelection(e,t){s_(this,e,t)}getSelectedContent(e){return Xb(this,e)}hasContent(e,t={}){const s=e instanceof b?e:b._createIn(e);if(s.isCollapsed)return!1;const{ignoreWhitespaces:r=!1,ignoreMarkers:o=!1}=t;if(!o){for(const a of this.markers.getMarkersIntersectingRange(s))if(a.affectsData)return!0}for(const a of s.getItems())if(this.schema.isContent(a))if(a.is("$textProxy"))if(r){if(a.data.search(/\S/)!==-1)return!0}else return!0;else return!0;return!1}canEditAt(e){const t=gr(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,s){return new _(e,t,s)}createPositionAt(e,t){return _._createAt(e,t)}createPositionAfter(e){return _._createAfter(e)}createPositionBefore(e){return _._createBefore(e)}createRange(e,t){return new b(e,t)}createRangeIn(e){return b._createIn(e)}createRangeOn(e){return b._createOn(e)}createSelection(...e){return new ke(...e)}createBatch(e){return new oi(e)}createOperationFromJSON(e){return _b.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;
131){const t=this._pendingChanges[0].batch;this._currentWriter=new Vb(this,t);const s=this._pendingChanges[0].callback(this._currentWriter);e.push(s),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}}function gr(n,i){if(n)return n instanceof ke||n instanceof Qe?n:n instanceof Xt?i||i===0?new ke(n,i):n.is("rootElement")?new ke(n,"in"):new ke(n,"on"):new ke(n)}class h_ extends ot{constructor(){super(...arguments);u(this,"domEventType","click")}onDomEvent(e){this.fire(e.type,e)}}class aa extends ot{constructor(){super(...arguments);u(this,"domEventType",["mousedown","mouseup","mouseover","mouseout"])}onDomEvent(e){this.fire(e.type,e)}}class f_ extends ot{constructor(){super(...arguments);u(this,"domEventType",["touchstart","touchend","touchmove"])}onDomEvent(e){this.fire(e.type,e)}}class Vd extends ot{constructor(){super(...arguments);u(this,"domEventType",["pointerdown","pointerup","pointermove"])}onDomEvent(e){this.fire(e.type,e)}}class Vi{constructor(i){u(this,"document");this.document=i}createDocumentFragment(i){return new qt(this.document,i)}createElement(i,e,t){return new Je(this.document,i,e,t)}createText(i){return new te(this.document,i)}clone(i,e=!1){return i._clone(e)}appendChild(i,e){return e._appendChild(i)}insertChild(i,e,t){return t._insertChild(i,e)}removeChildren(i,e,t){return t._removeChildren(i,e)}remove(i){const e=i.parent;return e?this.removeChildren(e.getChildIndex(i),1,e):[]}replace(i,e){const t=i.parent;if(t){const s=t.getChildIndex(i);return this.removeChildren(s,1,t),this.insertChild(s,e,t),!0}return!1}unwrapElement(i){const e=i.parent;if(e){const t=e.getChildIndex(i);this.remove(i),this.insertChild(t,i.getChildren(),e)}}rename(i,e){const t=new Je(this.document,i,e.getAttributes(),e.getChildren());return this.replace(e,t)?t:null}setAttribute(i,e,t){t._setAttribute(i,e)}removeAttribute(i,e){e._removeAttribute(i)}addClass(i,e){e._addClass(i)}removeClass(i,e){e._removeClass(i)}setStyle(i,e,t){it(i)&&t===void 0?e._setStyle(i):t._setStyle(i,e)}removeStyle(i,e){e._removeStyle(i)}setCustomProperty(i,e,t){t._setCustomProperty(i,e)}removeCustomProperty(i,e){return e._removeCustomProperty(i)}createPositionAt(i,e){return k._createAt(i,e)}createPositionAfter(i){return k._createAfter(i)}createPositionBefore(i){return k._createBefore(i)}createRange(i,e){return new I(i,e)}createRangeOn(i){return I._createOn(i)}createRangeIn(i){return I._createIn(i)}createSelection(...i){return new Ge(...i)}}/**
132 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
133 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
134 */const m_=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,g_=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,p_=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,w_=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,b_=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,__=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,y_=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 v_(n){return n.startsWith("#")?m_.test(n):n.startsWith("rgb")?g_.test(n)||p_.test(n):n.startsWith("hsl")?w_.test(n)||b_.test(n):y_.has(n.toLowerCase())}const k_=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function C_(n){return k_.includes(n)}const E_=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Bd(n){return E_.test(n)}const T_=/^[+-]?[0-9]*([.][0-9]+)?%$/;function P_(n){return T_.test(n)}const A_=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function x_(n){return A_.includes(n)}const S_=["center","top","bottom","left","right"];function I_(n){return S_.includes(n)}const O_=["fixed","scroll","local"];function M_(n){return O_.includes(n)}const R_=/^url\(/;function V_(n){return R_.test(n)}function dn(n=""){if(n==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const i=la(n),e=i[0],t=i[2]||e,s=i[1]||e,r=i[3]||s;return{top:e,bottom:t,right:s,left:r}}function hn(n){return i=>{const{top:e,right:t,bottom:s,left:r}=i,o=[];return[e,t,r,s].every(a=>!!a)?o.push([n,B_(i)]):(e&&o.push([n+"-top",e]),t&&o.push([n+"-right",t]),s&&o.push([n+"-bottom",s]),r&&o.push([n+"-left",r])),o}}function B_({top:n,right:i,bottom:e,left:t}){const s=[];return t!==i?s.push(n,i,e,t):e!==n?s.push(n,i,e):i!==n?s.push(n,i):s.push(n),s.join(" ")}function Ld(n){return i=>({path:n,value:dn(i)})}function la(n){const i=n.trim().slice(0,1500).matchAll(__);return Array.from(i).map(e=>e[0])}function L_(n){n.setNormalizer("background",F_()),n.setNormalizer("background-color",N_()),n.setReducer("background",D_()),n.setStyleRelation("background",["background-color"])}function F_(){return n=>{const i={},e=la(n);for(const t of e)x_(t)?(i.repeat=i.repeat||[],i.repeat.push(t)):I_(t)?(i.position=i.position||[],i.position.push(t)):M_(t)?i.attachment=t:v_(t)?i.color=t:V_(t)&&(i.image=t);return{path:"background",value:i}}}function N_(){return n=>({path:"background.color",value:n})}function D_(){return n=>{const i=[];return i.push(["background-color",n.color]),i}}function iT(n){n.setNormalizer("border",z_()),n.setNormalizer("border-top",qn("top")),n.setNormalizer("border-right",qn("right")),n.setNormalizer("border-bottom",qn("bottom")),n.setNormalizer("border-left",qn("left")),n.setNormalizer("border-color",pr("color")),n.setNormalizer("border-width",pr("width")),n.setNormalizer("border-style",pr("style")),n.setNormalizer("border-top-color",Me("color","top")),n.setNormalizer("border-top-style",Me("style","top")),n.setNormalizer("border-top-width",Me("width","top")),n.setNormalizer("border-right-color",Me("color","right")),n.setNormalizer("border-right-style",Me("style","right")),n.setNormalizer("border-right-width",Me("width","right")),n.setNormalizer("border-bottom-color",Me("color","bottom")),n.setNormalizer("border-bottom-style",Me("style","bottom")),n.setNormalizer("border-bottom-width",Me("width","bottom")),n.setNormalizer("border-left-color",Me("color","left")),n.setNormalizer("border-left-style",Me("style","left")),n.setNormalizer("border-left-width",Me("width","left")),n.setExtractor("border-top",Kn("top")),n.setExtractor("border-right",Kn("right")),n.setExtractor("border-bottom",Kn("bottom")),n.setExtractor("border-left",Kn("left")),n.setExtractor("border-top-color","border.color.top"),n.setExtractor("border-right-color","border.color.right"),n.setExtractor("border-bottom-color","border.color.bottom"),n.setExtractor("border-left-color","border.color.left"),n.setExtractor("border-top-width","border.width.top"),n.setExtractor("border-right-width","border.width.right"),n.setExtractor("border-bottom-width","border.width.bottom"),n.setExtractor("border-left-width","border.width.left"),n.setExtractor("border-top-style","border.style.top"),n.setExtractor("border-right-style","border.style.right"),n.setExtractor("border-bottom-style","border.style.bottom"),n.setExtractor("border-left-style","border.style.left"),n.setReducer("border-color",hn("border-color")),n.setReducer("border-style",hn("border-style")),n.setReducer("border-width",hn("border-width")),n.setReducer("border-top",Gn("top")),n.setReducer("border-right",Gn("right")),n.setReducer("border-bottom",Gn("bottom")),n.setReducer("border-left",Gn("left")),n.setReducer("border",W_()),n.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"]),n.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),n.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),n.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),n.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),n.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),n.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),n.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function z_(){return n=>{const{color:i,style:e,width:t}=Fd(n);return{path:"border",value:{color:dn(i),style:dn(e),width:dn(t)}}}}function qn(n){return i=>{const{color:e,style:t,width:s}=Fd(i),r={};return e!==void 0&&(r.color={[n]:e}),t!==void 0&&(r.style={[n]:t}),s!==void 0&&(r.width={[n]:s}),{path:"border",value:r}}}function pr(n){return i=>({path:"border",value:H_(i,n)})}function H_(n,i){return{[i]:dn(n)}}function Me(n,i){return e=>({path:"border",value:{[n]:{[i]:e}}})}function Kn(n){return(i,e)=>{if(e.border)return Xi(e.border,n)}}function Xi(n,i){const e={};return n.width&&n.width[i]&&(e.width=n.width[i]),n.style&&n.style[i]&&(e.style=n.style[i]),n.color&&n.color[i]&&(e.color=n.color[i]),e}function Fd(n){const i={},e=la(n);for(const t of e)Bd(t)||/thin|medium|thick/.test(t)?i.width=t:C_(t)?i.style=t:i.color=t;return i}function W_(){return i=>{const e=Xi(i,"top"),t=Xi(i,"right"),s=Xi(i,"bottom"),r=Xi(i,"left"),o=[e,t,s,r],a={width:n(o,"width"),style:n(o,"style"),color:n(o,"color")},l=mi(a,"all");return l.length?l:[...Object.entries(a).reduce((d,[h,f])=>(f&&(d.push([`border-${h}`,f]),o.forEach(m=>delete m[h])),d),[]),...mi(e,"top"),...mi(t,"right"),...mi(s,"bottom"),...mi(r,"left")]};function n(i,e){return i.map(t=>t[e]).reduce((t,s)=>t==s?t:null)}}function Gn(n){return i=>mi(i,n)}function mi(n,i){const e=[];
134if(n&&n.width&&e.push("width"),n&&n.style&&e.push("style"),n&&n.color&&e.push("color"),e.length==3){const t=e.map(s=>n[s]).join(" ");return[i=="all"?["border",t]:[`border-${i}`,t]]}return i=="all"?[]:e.map(t=>[`border-${i}-${t}`,n[t]])}function $_(n){n.setNormalizer("margin",Ld("margin")),n.setNormalizer("margin-top",i=>({path:"margin.top",value:i})),n.setNormalizer("margin-right",i=>({path:"margin.right",value:i})),n.setNormalizer("margin-bottom",i=>({path:"margin.bottom",value:i})),n.setNormalizer("margin-left",i=>({path:"margin.left",value:i})),n.setReducer("margin",hn("margin")),n.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}function nT(n){n.setNormalizer("padding",Ld("padding")),n.setNormalizer("padding-top",i=>({path:"padding.top",value:i})),n.setNormalizer("padding-right",i=>({path:"padding.right",value:i})),n.setNormalizer("padding-bottom",i=>({path:"padding.bottom",value:i})),n.setNormalizer("padding-left",i=>({path:"padding.left",value:i})),n.setReducer("padding",hn("padding")),n.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}/**
135 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
136 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
137 *//**
138 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
139 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
140 */class Nd{constructor(i){u(this,"crashes",[]);u(this,"state","initializing");u(this,"_crashNumberLimit");u(this,"_now",Date.now);u(this,"_minimumNonErrorTimePeriod");u(this,"_boundErrorHandler");u(this,"_listeners");if(this.crashes=[],this._crashNumberLimit=typeof i.crashNumberLimit=="number"?i.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof i.minimumNonErrorTimePeriod=="number"?i.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=e=>{const t="error"in e?e.error:e.reason;t instanceof Error&&this._handleError(t,e)},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(i,e){this._listeners[i]||(this._listeners[i]=[]),this._listeners[i].push(e)}off(i,e){this._listeners[i]=this._listeners[i].filter(t=>t!==e)}_fire(i,...e){const t=this._listeners[i]||[];for(const s of t)s.apply(this,[null,...e])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(i,e){if(this._shouldReactToError(i)){this.crashes.push({message:i.message,stack:i.stack,filename:e instanceof ErrorEvent?e.filename:void 0,lineno:e instanceof ErrorEvent?e.lineno:void 0,colno:e instanceof ErrorEvent?e.colno:void 0,date:this._now()});const t=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:i,causesRestart:t}),t?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(i){return i.is&&i.is("CKEditorError")&&i.context!==void 0&&i.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(i)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;const i=this.crashes[this.crashes.length-1].date,e=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(i-e)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}/**
141 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
142 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
143 */function no(n,i=new Set){const e=[n],t=new Set;let s=0;for(;e.length>s;){const r=e[s++];if(!(t.has(r)||!U_(r)||i.has(r)))if(t.add(r),Symbol.iterator in r)try{for(const o of r)e.push(o)}catch{}else for(const o in r)o!=="defaultValue"&&e.push(r[o])}return t}function U_(n){const i=Object.prototype.toString.call(n),e=typeof n;return!(e==="number"||e==="boolean"||e==="string"||e==="symbol"||e==="function"||i==="[object Date]"||i==="[object RegExp]"||i==="[object Module]"||n===void 0||n===null||n._watchdogExcluded||n instanceof EventTarget||n instanceof Event)}function Dd(n,i,e=new Set){if(n===i&&q_(n))return!0;const t=no(n,e),s=no(i,e);for(const r of t)if(s.has(r))return!0;return!1}function q_(n){return typeof n=="object"&&n!==null}class zd extends Nd{constructor(e,t={}){super(t);u(this,"_editor",null);u(this,"_lifecyclePromise",null);u(this,"_throttledSave");u(this,"_data");u(this,"_lastDocumentVersion");u(this,"_elementOrData");u(this,"_initUsingData",!0);u(this,"_editables",{});u(this,"_config");u(this,"_excludedProps");this._throttledSave=wn(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(s,r)=>e.create(s,r)),this._destructor=s=>s.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=>{}).then(()=>{const e={},t=[],s=this._config.rootsAttributes||{},r={};for(const[a,l]of Object.entries(this._data.roots))l.isLoaded?(e[a]="",r[a]=s[a]||{}):t.push(a);const o={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:r,_watchdogInitialData:this._data};return delete o.initialData,o.extraPlugins.push(K_),this._initUsingData?this.create(e,o,o.context):xt(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,s){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=s,this._creator(e,this._config))).then(r=>{this._editor=r,r.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=r.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{}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter(l=>l.isAttached()&&l.rootName!="$graveyard"),{plugins:s}=e,r=s.has("CommentsRepository")&&s.get("CommentsRepository"),o=s.has("TrackChanges")&&s.get("TrackChanges"),a={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(l=>{a.roots[l.rootName]={content:JSON.stringify(Array.from(l.getChildren())),attributes:JSON.stringify(Array.from(l.getAttributes())),isLoaded:l._isLoaded}});for(const l of e.model.markers)l._affectsData&&(a.markers[l.name]={rangeJSON:l.getRange().toJSON(),usingOperation:l._managedUsingOperations,affectsData:l._affectsData});return r&&(a.commentThreads=JSON.stringify(r.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),o&&(a.suggestions=JSON.stringify(o.getSuggestions({toJSON:!0,skipNotAttached:!0}))),a}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const s=this.editor.ui.getEditableElement(t);s&&(e[t]=s)}return e}_isErrorComingFromThisItem(e){return Dd(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Ns(e,(t,s)=>{if(xt(t)||s==="context")return t})}}
143class K_{constructor(i){u(this,"editor");u(this,"_data");this.editor=i,this._data=i.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",i=>{i.stop(),this.editor.model.enqueueChange({isUndoable:!1},e=>{this._restoreCollaborationData(),this._restoreEditorData(e)}),this.editor.data.fire("ready")},{priority:999})}_createNode(i,e){if("name"in e){const t=i.createElement(e.name,e.attributes);if(e.children)for(const s of e.children)t._appendChild(this._createNode(i,s));return t}else return i.createText(e.data,e.attributes)}_restoreEditorData(i){const e=this.editor;Object.entries(this._data.roots).forEach(([t,{content:s,attributes:r}])=>{const o=JSON.parse(s),a=JSON.parse(r),l=e.model.document.getRoot(t);for(const[c,d]of a)i.setAttribute(c,d,l);for(const c of o){const d=this._createNode(i,c);i.insert(d,l,"end")}}),Object.entries(this._data.markers).forEach(([t,s])=>{const{document:r}=e.model,{rangeJSON:{start:o,end:a},...l}=s,c=r.getRoot(o.root),d=i.createPositionFromPath(c,o.path,o.stickiness),h=i.createPositionFromPath(c,a.path,a.stickiness),f=i.createRange(d,h);i.addMarker(t,{range:f,...l})})}_restoreCollaborationData(){const i=JSON.parse(this._data.commentThreads),e=JSON.parse(this._data.suggestions);if(this.editor.plugins.has("CommentsRepository")){const t=this.editor.plugins.get("CommentsRepository");for(const s of t.getCommentThreads())t._removeCommentThread({threadId:s.id});i.forEach(s=>{const r=this.editor.config.get("collaboration.channelId");this.editor.plugins.get("CommentsRepository").addCommentThread({channelId:r,...s})})}if(this.editor.plugins.has("TrackChangesEditing")){const t=this.editor.plugins.get("TrackChangesEditing");for(const s of t.getSuggestions())t._removeSuggestion(s);e.forEach(s=>{t.addSuggestionData(s)})}}}const fn=Symbol("MainQueueId");class G_ extends Nd{constructor(e,t={}){super(t);u(this,"_watchdogs",new Map);u(this,"_watchdogConfig");u(this,"_context",null);u(this,"_contextProps",new Set);u(this,"_actionQueues",new j_);u(this,"_contextConfig");u(this,"_item");this._watchdogConfig=t,this._creator=s=>e.create(s),this._destructor=s=>s.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(fn,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=Ml(e);return Promise.all(t.map(s=>this._actionQueues.enqueue(s.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 r;if(this._watchdogs.has(s.id))throw new Error(`Item with the given id is already added: '${s.id}'.`);if(s.type==="editor")return r=new zd(null,this._watchdogConfig),r.setCreator(s.creator),r._setExcludedProperties(this._contextProps),s.destructor&&r.setDestructor(s.destructor),this._watchdogs.set(s.id,r),r.on("error",(o,{error:a,causesRestart:l})=>{this._fire("itemError",{itemId:s.id,error:a}),l&&this._actionQueues.enqueue(s.id,()=>new Promise(c=>{const d=()=>{r.off("restart",d),this._fire("itemRestart",{itemId:s.id}),c()};r.on("restart",d)}))}),r.create(s.sourceElementOrData,s.config,this._context);throw new Error(`Not supported item type: '${s.type}'.`)})))}remove(e){const t=Ml(e);return Promise.all(t.map(s=>this._actionQueues.enqueue(s,()=>{const r=this._getWatchdog(s);return this._watchdogs.delete(s),r.destroy()})))}destroy(){return this._actionQueues.enqueue(fn,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(fn,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(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=no(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 Dd(this._context,e.context)}}class j_{constructor(){u(this,"_onEmptyCallbacks",[]);
143u(this,"_queues",new Map);u(this,"_activeActions",0)}onEmpty(i){this._onEmptyCallbacks.push(i)}enqueue(i,e){const t=i===fn;this._activeActions++,this._queues.get(i)||this._queues.set(i,Promise.resolve());const r=(t?Promise.all(this._queues.values()):Promise.all([this._queues.get(fn),this._queues.get(i)])).then(e),o=r.catch(()=>{});return this._queues.set(i,o),r.finally(()=>{this._activeActions--,this._queues.get(i)===o&&this._activeActions===0&&this._onEmptyCallbacks.forEach(a=>a())})}}function Ml(n){return Array.isArray(n)?n:[n]}/**
144 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
145 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
146 */class y extends q(){constructor(e){super();u(this,"editor");u(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",Rl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Rl),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}function Rl(n){n.return=!1,n.stop()}class j extends q(){constructor(e){super();u(this,"editor");u(this,"_isEnabledBasedOnSelection");u(this,"_affectsData");u(this,"_disableStack");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 s=e.model.document.selection,o=!(s.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(s);(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",Vl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Vl),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Vl(n){n.return=!1,n.stop()}class Bl extends j{constructor(){super(...arguments);u(this,"_childCommandsDefinitions",[])}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Mu(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}}class J_{constructor(){u(this,"_commands");this._commands=new Map}add(i,e){this._commands.set(i,e)}get(i){return this._commands.get(i)}execute(i,...e){const t=this.get(i);if(!t)throw new p("commandcollection-command-not-found",this,{commandName:i});return t.execute(...e)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const i of this.commands())i.destroy()}}class Hd extends H(){constructor(e,t=[],s=[]){super();u(this,"_context");u(this,"_plugins",new Map);u(this,"_availablePlugins");u(this,"_contextPlugins");this._context=e,this._availablePlugins=new Map;for(const r of t)r.pluginName&&this._availablePlugins.set(r.pluginName,r);this._contextPlugins=new Map;for(const[r,o]of s)this._contextPlugins.set(r,o),this._contextPlugins.set(o,r),r.pluginName&&this._availablePlugins.set(r.pluginName,r)}*[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 s=e;throw typeof e=="function"&&(s=e.pluginName||e.name),new p("plugincollection-
146plugin-not-loaded",this._context,{plugin:s})}return t}has(e){return this._plugins.has(e)}init(e,t=[],s=[]){const r=this,o=this._context;g(e),v(e);const a=e.filter(A=>!f(A,t)),l=[...w(a)];He(l,s);const c=ie(l);return Oe(c,"init").then(()=>Oe(c,"afterInit")).then(()=>c);function d(A){return typeof A=="function"}function h(A){return d(A)&&!!A.isContextPlugin}function f(A,L){return L.some(x=>x===A||m(A)===x||m(x)===A)}function m(A){return d(A)?A.pluginName||A.name:A}function g(A,L=new Set){A.forEach(x=>{d(x)&&(L.has(x)||(L.add(x),x.pluginName&&!r._availablePlugins.has(x.pluginName)&&r._availablePlugins.set(x.pluginName,x),x.requires&&g(x.requires,L)))})}function w(A,L=new Set){return A.map(x=>d(x)?x:r._availablePlugins.get(x)).reduce((x,S)=>L.has(S)?x:(L.add(S),S.requires&&(v(S.requires,S),w(S.requires,L).forEach(J=>x.add(J))),x.add(S)),new Set)}function v(A,L=null){A.map(x=>d(x)?x:r._availablePlugins.get(x)||x).forEach(x=>{O(x,L),M(x,L),W(x,L)})}function O(A,L){if(!d(A))throw L?new p("plugincollection-soft-required",o,{missingPlugin:A,requiredBy:m(L)}):new p("plugincollection-plugin-not-found",o,{plugin:A})}function M(A,L){if(h(L)&&!h(A))throw new p("plugincollection-context-required",o,{plugin:m(A),requiredBy:m(L)})}function W(A,L){if(L&&f(A,t))throw new p("plugincollection-required",o,{plugin:m(A),requiredBy:m(L)})}function ie(A){return A.map(L=>{let x=r._contextPlugins.get(L);return x=x||new L(o),r._add(L,x),x})}function Oe(A,L){return A.reduce((x,S)=>!S[L]||r._contextPlugins.has(S)?x:x.then(S[L].bind(S)),Promise.resolve())}function He(A,L){for(const x of L){if(typeof x!="function")throw new p("plugincollection-replace-plugin-invalid-type",null,{pluginItem:x});const S=x.pluginName;if(!S)throw new p("plugincollection-replace-plugin-missing-name",null,{pluginItem:x});if(x.requires&&x.requires.length)throw new p("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:S});const J=r._availablePlugins.get(S);if(!J)throw new p("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:S});const ge=A.indexOf(J);if(ge===-1){if(r._contextPlugins.has(J))return;throw new p("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:S})}if(J.requires&&J.requires.length)throw new p("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:S});A.splice(ge,1,x),r._availablePlugins.set(S,x)}}}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 s=e.pluginName;if(s){if(this._plugins.has(s))throw new p("plugincollection-plugin-name-conflict",null,{pluginName:s,plugin1:this._plugins.get(s).constructor,plugin2:e});this._plugins.set(s,t)}}}class Cs{constructor(i){u(this,"config");u(this,"plugins");u(this,"locale");u(this,"t");u(this,"editors");u(this,"_contextOwner",null);const{translations:e,...t}=i||{};this.config=new Lu(t,this.constructor.defaultConfig);const s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new Hd(this,s);const r=this.config.get("language")||{};this.locale=new Cg({uiLanguage:typeof r=="string"?r:r.ui,contentLanguage:this.config.get("language.content"),translations:e}),this.t=this.locale.t,this.editors=new Se}initPlugins(){const i=this.config.get("plugins")||[],e=this.config.get("substitutePlugins")||[];for(const t of i.concat(e)){if(typeof t!="function")throw new p("context-initplugins-constructor-only",null,{Plugin:t});if(t.isContextPlugin!==!0)throw new p("context-initplugins-invalid-plugin",null,{Plugin:t})}return this.plugins.init(i,[],e)}destroy(){return Promise.all(Array.from(this.editors,i=>i.destroy())).then(()=>this.plugins.destroy())}_addEditor(i,e){if(this._contextOwner)throw new p("context-addeditor-private-context");this.editors.add(i),e&&(this._contextOwner=i)}_removeEditor(i){return this.editors.has(i)&&this.editors.remove(i),this._contextOwner===i?this.destroy():Promise.resolve()}_getEditorConfig(){const i={};for(const e of this.config.names())["plugins","removePlugins","extraPlugins"].includes(e)||(i[e]=this.config.get(e));return i}static create(i){return new Promise(e=>{const t=new this(i);e(t.initPlugins().then(()=>t))})}}u(Cs,"defaultConfig"),u(Cs,"builtinPlugins");class Q_ extends Ie{constructor(e){super();u(this,"editor");this.editor=e}set(e,t,s={}){if(typeof t=="string"){const r=t;t=(o,a)=>{this.editor.execute(r),a()}}super.set(e,t,s)}}const wr="contentEditing",Ll="common";class Y_{constructor(i){u(this,"keystrokeInfos",new Map);u(this,"_editor");this._editor=i;const e=i.config.get("menuBar.isVisible"),t=i.locale.t;this.addKeystrokeInfoCategory({id:wr,label:t("Content editing keystrokes"),description:t("These keyboard shortcuts allow for quick access to content editing features.")});const s=[{label:t("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:t("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:t("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:t("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:t("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:t("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];e&&s.push({label:t("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:t("User interface and content navigation keystrokes"),description:t("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:s}]})}addKeystrokeInfoCategory({id:i,label:e,description:t,groups:s}){this.keystrokeInfos.set(i,{id:i,label:e,description:t,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:i,id:Ll}
146),s&&s.forEach(r=>{this.addKeystrokeInfoGroup({categoryId:i,...r})})}addKeystrokeInfoGroup({categoryId:i=wr,id:e,label:t,keystrokes:s}){const r=this.keystrokeInfos.get(i);if(!r)throw new p("accessibility-unknown-keystroke-info-category",this._editor,{groupId:e,categoryId:i});r.groups.set(e,{id:e,label:t,keystrokes:s||[]})}addKeystrokeInfos({categoryId:i=wr,groupId:e=Ll,keystrokes:t}){if(!this.keystrokeInfos.has(i))throw new p("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:i,keystrokes:t});const s=this.keystrokeInfos.get(i);if(!s.groups.has(e))throw new p("accessibility-unknown-keystroke-info-group",this._editor,{groupId:e,categoryId:i,keystrokes:t});s.groups.get(e).keystrokes.push(...t)}}function X_(n){return{sessionId:n0(),pageSessionId:s0(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:Z_(n),plugins:e0(n.plugins),distribution:t0(),env:i0(),integration:Object.create(null),menuBar:{isVisible:!!n.config.get("menuBar.isVisible")},language:{ui:n.locale.uiLanguage,content:n.locale.contentLanguage},toolbar:{main:br(n.config.get("toolbar")),block:br(n.config.get("blockToolbar")),balloon:br(n.config.get("balloonToolbar"))}}}function Z_(n){return Object.getPrototypeOf(n).constructor.editorName}function e0(n){return Array.from(n).filter(([i])=>!!i.pluginName).map(([i])=>{const{pluginName:e,isContextPlugin:t,isOfficialPlugin:s,isPremiumPlugin:r}=i;return{isContext:!!t,isOfficial:!!s,isPremium:!!r,name:e}})}function br(n){if(!n)return;const i=Array.isArray(n)?{items:n}:n,e=r(i.items||[]);return{isMultiline:e.includes("-"),shouldNotGroupWhenFull:!!i.shouldNotGroupWhenFull,items:s(e)};function s(o){return o.filter(a=>a!=="|"&&a!=="-")}function r(o){return o.flatMap(a=>typeof a=="string"?[a]:r(a.items))}}function t0(){return{channel:window[Symbol.for("cke distribution")]||"sh"}}function i0(){let n="unknown",i="unknown";return P.isMac?n="mac":P.isWindows?n="windows":P.isiOS?n="ios":P.isAndroid&&(n="android"),P.isGecko?i="gecko":P.isBlink?i="blink":P.isSafari&&(i="safari"),{os:n,browser:i}}function n0(){return localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",me()),localStorage.getItem("__ckeditor-session-id")}function s0(){return C.window.CKEDITOR_PAGE_SESSION_ID=C.window.CKEDITOR_PAGE_SESSION_ID||me(),C.window.CKEDITOR_PAGE_SESSION_ID}class gi extends q(){constructor(e={}){super();u(this,"accessibility");u(this,"commands");u(this,"config");u(this,"conversion");u(this,"data");u(this,"editing");u(this,"locale");u(this,"model");u(this,"plugins");u(this,"keystrokes");u(this,"t");u(this,"_context");u(this,"_readOnlyLocks");if("sanitizeHtml"in e)throw new p("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:s,...r}=t.defaultConfig||{},{translations:o=s,...a}=e,l=e.language||r.language;this._context=e.context||new Cs({language:l,translations:o}),this._context._addEditor(this,!e.context);const c=Array.from(t.builtinPlugins||[]);this.config=new Lu(a,r),this.config.define("plugins",c),this.config.define(this._context._getEditorConfig()),h(this.config),this.plugins=new Hd(this,c,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new J_,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new d_,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const d=new Kg;this.data=new gb(this.model,d),this.editing=new Kw(this.model,d),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new wb([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 Q_(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new Y_(this),f(this);function h(m){let g=m.get("licenseKey");if(!g&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(g=window.CKEDITOR_GLOBAL_LICENSE_KEY,m.set("licenseKey",g)),!g)throw new p("license-key-missing")}function f(m){const g=m.config.get("licenseKey"),w=window[Symbol.for("cke distribution")]||"sh";function v(S){m.enableReadOnlyMode(Symbol("invalidLicense")),m._showLicenseError(S)}function O(S){const J=S.split(".");return J.length!=3?null:J[1]}function M(S){return["exp","jti","vc"].every(ge=>ge in S)}function W(S){return Object.getOwnPropertyNames(S).sort().filter(ne=>ne!="vc"&&S[ne]!=null).map(ne=>S[ne])}function ie(S){const{hostname:J}=new URL(window.location.href);if(S.includes(J))return!0;const ge=J.split(".");return S.filter(ne=>ne.includes("*")).map(ne=>ne.split(".")).filter(ne=>ne.length<=ge.length).map(ne=>Array(ge.length-ne.length).fill(ne[0]==="*"?"*":"").concat(ne)).some(ne=>ge.every((uf,Ca)=>ne[Ca]===uf||ne[Ca]==="*"))}function Oe(S){const J=S[0].toUpperCase()+S.slice(1),ge=S==="evaluation"?"an":"a"}if(g=="GPL"){w=="cloud"&&v("distributionChannel");return}const He=O(g);if(!He){v("invalid");return}const A=jo(He);
146if(!A){v("invalid");return}if(!M(A)){v("invalid");return}if(A.distributionChannel&&!Y(A.distributionChannel).includes(w)){v("distributionChannel");return}if(xg(W(A))!=A.vc.toLowerCase()){v("invalid");return}if(new Date(A.exp*1e3)<Vm){v("expired");return}const x=A.licensedHosts;if(x&&x.length>0&&!ie(x)){v("domainLimit");return}if(["evaluation","trial"].includes(A.licenseType)&&A.exp*1e3<Date.now()){v("expired");return}if(["development","evaluation","trial"].includes(A.licenseType)){const{licenseType:S}=A;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[S]||(Oe(S),window.CKEDITOR_WARNING_SUPPRESSIONS[S]=!0)}if(["evaluation","trial"].includes(A.licenseType)){const S=A.licenseType,J=setTimeout(()=>{v(`${S}Limit`)},6e5);m.on("destroy",()=>{clearTimeout(J)})}A.usageEndpoint&&m.once("ready",()=>{const S={requestId:me(),requestTime:Math.round(Date.now()/1e3),license:g,editor:r0(m)};m._sendUsageRequest(A.usageEndpoint,S).then(J=>{const{status:ge,message:ne}=J;ge!="ok"&&v("usageLimit")},()=>{A.usageEndpoint})},{priority:"high"})}}static get editorName(){return"Editor"}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new p("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new p("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 p("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"),s=e.get("removePlugins")||[],r=e.get("extraPlugins")||[],o=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(r),s,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(s){/* istanbul ignore next -- @preserve */p.rethrowUnexpectedError(s,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}_showLicenseError(e,t){setTimeout(()=>{if(e=="invalid")throw new p("invalid-license-key");if(e=="expired")throw new p("license-key-expired");if(e=="domainLimit")throw new p("license-key-domain-limit");if(e=="featureNotAllowed")throw new p("license-key-plugin-not-allowed",null,{pluginName:t});if(e=="evaluationLimit")throw new p("license-key-evaluation-limit");if(e=="trialLimit")throw new p("license-key-trial-limit");if(e=="developmentLimit")throw new p("license-key-development-limit");if(e=="usageLimit")throw new p("license-key-usage-limit");if(e=="distributionChannel")throw new p("license-key-invalid-distribution-channel")},0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){const s=new Headers({"Content-Type":"application/json"}),r=await fetch(new URL(e),{method:"POST",headers:s,body:JSON.stringify(t)});if(!r.ok)throw new Error(`HTTP Response: ${r.status}`);return r.json()}}u(gi,"defaultConfig"),u(gi,"builtinPlugins"),u(gi,"Context",Cs),u(gi,"EditorWatchdog",zd),u(gi,"ContextWatchdog",G_);function r0(n){const i=X_(n);function e(t,s){if(At(i,t)!==void 0)throw new p("editor-usage-data-path-already-set",{path:t});Pu(i,t,s)}return n.fire("collectUsageData",{setUsageData:e}),i}function o0(n){if(!ps(n.updateSourceElement))throw new p("attachtoform-missing-elementapi-interface",n);const i=n.sourceElement;if(a0(i)&&i.form){let e;const t=i.form,s=()=>n.updateSourceElement();ps(t.submit)&&(e=t.submit,t.submit=()=>{s(),e.apply(t)}),t.addEventListener("submit",s),n.on("destroy",()=>{t.removeEventListener("submit",s),e&&(t.submit=e)})}}function a0(n){return!!n&&n.tagName.toLowerCase()==="textarea"}function l0(n){class i extends n{constructor(){super(...arguments);u(this,"sourceElement")}updateSourceElement(s){if(!this.sourceElement)throw new p("editor-missing-sourceelement",this);const r=this.config.get("updateSourceElementOnDestroy"),o=this.sourceElement instanceof HTMLTextAreaElement;if(!r&&!o){Da(this.sourceElement,"");return}const a=typeof s=="string"?s:this.data.get();Da(this.sourceElement,a)}}return i}
146function c0(n,i){if(i.ckeditorInstance)throw new p("editor-source-element-already-used",n);i.ckeditorInstance=n,n.once("destroy",()=>{delete i.ckeditorInstance})}/**
147 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
148 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
149 */var Fl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M8.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-.103z"/><path d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17m0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10" clip-rule="evenodd"/></svg>',sT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75.75 0 0 1-.511.187.75.75 0 0 1-.511-.187M4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5z"/></svg>',rT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75"/></svg>',oT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75"/></svg>',u0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75"/></svg>',aT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.75 11.875a.75.75 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.75.75 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.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.75.75 0 0 1-.508.184.75.75 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-.75"/></svg>',lT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75m0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75m0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75"/></svg>',cT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75.75 0 0 1 .511-.187.75.75 0 0 1 .511.187M15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5z"/></svg>',Wd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.187 17H5.773q-.956 0-1.364-.415-.41-.416-.409-1.323V4.738q0-.926.419-1.332.418-.405 1.354-.406h4.68q1.035 0 1.793.124.76.124 1.36.478.512.296.906.75a3.26 3.26 0 0 1 .808 2.162q0 2.102-2.167 3.075 2.846.879 2.847 3.421a3.76 3.76 0 0 1-2.296 3.504 6 6 0 0 1-1.517.377q-.857.11-2 .11zm-.217-6.217H7v4.087h3.069q2.965 0 2.965-2.072 0-1.061-.768-1.537-.768-.478-2.296-.478M7 5.13v3.619h2.606q1.093 0 1.69-.2a1.
1496 1.6 0 0 0 .91-.765q.247-.4.247-.897 0-1.06-.778-1.409-.778-.348-2.375-.348z"/></svg>',d0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m-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.75m6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-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.75"/></svg>',$d='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.414z"/></svg>',uT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2"/><path fill-opacity=".6" 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-2zm0 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-.492z"/></svg>',Ud='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.972 16.615a1 1 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.323a1 1 0 0 1-.745.292"/></svg>',dT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.174m2.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.207M16 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-2zM5.009 15l.003 1H3v-1zm2.188-2-1.471 1H5v-1zM10 11v.095L8.668 12H7v-1zm4-2v1H7V9zm0-2v1H7V7zm-4-2v1H5V5zM6 3v1H3V3z"/></svg>',h0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.1m-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.1"/></svg>',f0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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 9 9 0 0 1-.372.008m-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.414M9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415m4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415"/></svg>',m0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path 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 0" class="ck-icon__fill"/><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>',g0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7zM0 7h1v2H0zm15 0h1v2h-1zm-8 8h2v1H7z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>',p0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m-7 6.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',qs='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><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-.136z"/></svg>',w0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.053z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',b0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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-2m8.38 9.262H7.62L10 5.506zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453z"/></svg>',_0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M12.4 10.3 10 4.5l-2.4 5.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 2"/></svg>',Nl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973zm-2.754 2.5L8.038 4.785 5.261 11.5zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663z"/></svg>',Dl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825q0-.063.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782q.003.065.003.135z"/></svg>',y0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 9h16v2H2z"/></svg>',hT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1zM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1zm-5.655 6a2.13 2.13 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7"/></svg>',v0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.822zM14 5V2l3.3 3zm-3.692 12.5q.093.157.213.303L11.52 19H8v-.876a2.24 2.24 0 0 0 1.82-.624zm7.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 0zm-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>',zl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5M1.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>',k0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m9.586 14.633.021.004q-.054.502.393.962.123.125.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15q.711-.106 1.005-.334.235-.
149182.404-.597l2.416-9.55a1.05 1.05 0 0 0-.281-.823 1.1 1.1 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195q-.564.084-.823.296-.323.263-.623.79z"/></svg>',qd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 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.294zm5.494-5.335a.8.8 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.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-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-.184"/></svg>',fT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z" class="ck-icon__fill"/><path d="m2.556 16.727.234-.348q-.445-.226-.498-.426-.054-.206.115-.837.14-.375.169-.595a4.5 4.5 0 0 0 0-.725q-.313-.931-.284-1.26.03-.327.475-.862l6.77-9.414q.808-1.365 3.199.18 2.39 1.549 1.784 2.686l-5.877 10.36q-.237.618-.526.782-.29.163-1.232.21-.543.196-.738.318t-.526.47q-.44.397-.632.397-.143 0-.524-.226l-.31.41zm-.279.415 1.575 1.103-.392.515H1.19zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574q.263-.375-1.092-1.192-1.354-.819-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5z"/></svg>',mT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 42"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098s-4.538-.083-4.538-1.678 2.032-3.43 4.538-4.098c.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556L49 17zM29.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.99 1.99 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.805zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17m29.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.155zM20.6 21.375v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616V37.53zm24.233-16.155v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615V37.53zM29.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-.35z"/></svg>',gT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 20"><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.288zm16.448 0h1.003v1h-1.003zm-14.24 1h13.008v12H4.467zm-2.208 1h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003l-.029 1h-.974zm16.448 0h1.003v1h-1.003zm-16.448 2h.974v1h-.974zm16.448 0h1.003v1h-1.003z"/><path d="M8.374 6.648a.4.4 0 0 1 .395-.4.4.4 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-.35z"/></svg>',Kd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.382z"/></svg>',C0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75M3.5 3v5H2V3.7H1v-1h2.5zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001q-.073.607-.333.988-.263.381-1.244 1.312H4.3v1h-4zM7 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-.75"/></svg>',pT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><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 1m-1.506.5H6.5V12h6.997z"/></svg>',wT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><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 1m-1.505.5H3.504V12h12.991z"/></svg>',bT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z" opacity=".5"/><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 1m-1.506.5H3.5V12h6.997z"/></svg>',_T='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z" opacity=".5"/><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 1m-1.506.5H9.5V12h6.997z"/></svg>',yT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z" opacity=".5"/><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 1m-1.506.5H3.5V12h6.997z"/></svg>',vT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><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 1m-1.506.5H3.5V12h6.997z"/></svg>',kT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><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 1m-1.506.5H9.5V12h6.997z"/></svg>',CT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.95 1.43a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h.75v6.3H.95a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-.65h1.932l1.539-1.5H5v-.95a.95.95 0 0 0-.95-.95H3.2v-6.3h.85A.95.95 0 0 0 5 5.48v-.55h10v.55a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-3.1a.95.95 0 0 0-.95-.95h-3.1a.95.95 0 0 0-.95.95v1.05H5V2.38a.95.95 0 0 0-.95-.95zm.55 3.5v-2h2v2zm0 9.3v2h2v-2zm15-11.3v2h2v-2zM8.139 20.004v-2.388l7.045-7.048 2.391 2.391-7.046 7.046zm11.421-9.101a.6.6 0 0 1-.138.206l-1.165 1.168-2.391-2.391 1.167-1.163a.6.6 0 0 1 .206-.138.6.6 0 0 1 .243-.049.63.63 0 0 1 .449.187l1.491 1.488c.059.059.108.129.138.206s.049.16.049.243a.6.6 0 0 1-.049.243"/></svg>',ET='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15.5v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm0-2v1h-1v-1zm-19 0v1H0v-1zM14.5 2v1h-1V2zm2 0v1h-1V2zm2 0v1h-1V2zm-8 0v1h-1V2zm-2 0v1h-1V2zm-2 0v1h-1V2zm-2 0v1h-1V2zm8 0v1h-1V2zm-10 0v1h-1V2z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2m0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.49.49 0 0 1-.476-.5V4c0-.276.213-.5.476-.5z"/></svg>',TT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z"/><path d="M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2M13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7z"/></svg>',PT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z"/><path d="M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2M10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9z"/></svg>',AT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z"/>
149<path d="M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11z"/></svg>',Hl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5m1.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>',E0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5M5 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-1"/></svg>',T0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m7.3 17.37-.061.088a1.52 1.52 0 0 1-.934.535l-4.178.663-.806-4.153a1.5 1.5 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.055zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346zM6.07 16.512l-3.276-2.295.53 2.73zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328M8 18.5 9.375 17H19v1.5z"/></svg>',xT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568z" class="ck-icon__fill"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97q.249-.348.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.005zm-.634.166-1.976.516-.026-1.918zM9.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-.349M8.245 18.5 9.59 17h9.406v1.5z"/></svg>',P0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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-4"/></svg>',A0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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-1"/></svg>',Ks='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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"/></svg>',x0=`<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="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 
1491.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"/><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>
150`,S0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.003zm8 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.003z"/></svg>',Wl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.75.75 0 0 0 .21-.284.7
1505.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.8.8 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-.032z"/></svg>',I0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8.69 14.915q.08.078.36.093a.366.366 0 0 1 .345.485l-.003.01a.74.74 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.68.68 0 0 1 .644-.458q.295-.018.386-.093a.3.3 0 0 0 .072-.11L9.592 4.5H6.269q-.538-.026-.75.09-.213.117-.442.563c-.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-.486q.002-.426-.167-.54-.168-.114-.766-.091h-3.28l-2.68 10.257q-.009.111.038.158M3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1m11.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.414z"/></svg>',O0='<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>',M0='<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-.75m18.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-.75m-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-.2zm4 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-.2zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.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-.2zm18.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-.2zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.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-.2zm18.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-.2zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.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 0zM18.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.5zM8.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-.2zm4 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-.2z"/></svg>',R0=`<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.734 6.375H1.75a.75.75 0 0 1 0-1.5h1.984a2.626 2.626 0 0 1 5.032 0h9.48a.75.75 0 0 1 0 1.5h-9.48a2.626 2.626 0 0 1-5.032 0Zm1.141-.75a1.375 1.375 0 1 1 2.75 0 1.375 1.375 0 0 1-2.75 0ZM16.263 14.625h1.983a.75.75 0 0 1 0 1.5h-1.983a2.626 2.626 0 0 1-5.033 0H1.75a.75.75 0 0 1 0-1.5h9.48a2.626 2.626 0 0 1 5.033 0Zm-1.142.75a1.375 1.375 0 1 1-2.75 0 1.375 1.375 0 0 1 2.75 0Z"/></svg>
151`,ST='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.27 7.27 0 0 1 2.703 3.454 7.13 7.13 0 0 1 .199 4.353c-.39 1.436-1.475 2.72-2.633 3.677h2.013c0-.226.092-.443.254-.603a.876.876 0 0 1 1.229 0c.163.16.254.377.254.603v.853c0 .209-.078.41-.22.567a.87.87 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.6 5.6 0 0 0 2.492-2.371 5.46 5.46 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.7 5.7 0 0 0 10 4.206 5.7 5.7 0 0 0 6.419 5.46 5.53 5.53 0 0 0 4.46 8.663a5.46 5.46 0 0 0 .554 3.695 5.6 5.6 0 0 0 2.497 2.37.55.55 0 0 1 .317.49v1.264c0 .286-.23.518-.516.518H2.618a.88.88 0 0 1-.614-.25.85.85 0 0 1-.254-.603v-.853c0-.226.091-.443.254-.603a.876.876 0 0 1 1.228 0c.163.16.255.377.255.603h1.925c-1.158-.958-2.155-2.241-2.545-3.678a7.13 7.13 0 0 1 .199-4.352 7.27 7.27 0 0 1 2.703-3.455A7.5 7.5 0 0 1 10 2.5"/></svg>',V0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.
1511 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6M6.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>',B0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.53zm8.147 7.829h2.549q.38 0 .58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197a.62.62 0 0 1-.205-.463q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553t.405-.57.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646c.3-.289.454-.349.762-.467a3 3 0 0 1 1.081-.178q.747 0 1.274.228a1.92 1.92 0 0 1 1.004 1.032 1.98 1.98 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.584-1.008.906a3 3 0 0 0-.24.309z"/></svg>',L0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.677 8.678h2.549q.38 0 .58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197a.62.62 0 0 1-.205-.463q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553.265-.278.405-.57t.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646c.3-.289.454-.349.762-.467a3 3 0 0 1 1.081-.178q.747 0 1.274.228a1.92 1.92 0 0 1 1.004 1.032 1.98 1.98 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.584-1.008.906a3 3 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.53z"/></svg>',IT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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 13v5zM2 12h5V8H2zm10-4H8v4h4zM2 2v5h5V2zm0 16h5v-5H2zM13 7h5V2h-5zM8 2v5h4V2z" 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-.43zM13 6a1 1 0 0 1 1 1v3.172a2 2 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.98 1.98 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm-1 2H8v4h4z"/></svg>',OT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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 1M2 2v16h16V2z" opacity=".6"/><path d="M18 7v1H2V7zm0 5v1H2v-1z" 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 1m-2 1H8v4h4zm0 6H8v4h4zm0 6H8v4h4z"/></svg>',MT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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 1M2 2v16h16V2z" opacity=".6"/><path d="M7 2h1v16H7zm5 0h1v7h-1zm6 5v1H2V7zM8 12v1H2v-1z" 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-1m1 2v9h10V9z"/></svg>',RT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2zm4 6H8v4h4z" 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-.43zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2 2 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2z"/></svg>',VT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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 1M2 2v16h16V2z" opacity=".6"/><path d="M7 2h1v16H7zm5 0h1v16h-1z" 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-1m1 2v4h4V8zm6 0v4h4V8zm6 0v4h4V8z"/></svg>',BT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 5.5v3h4v-3zm0 4v3h4v-3zm0 4v3h4v-3zm5 3h4v-3H8zm5 0h4v-3h-4zm4-4v-3h-4v3zm0-4v-3h-4v3zm1.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.5zm-6.5-4v-3H8v3zm0-4v-3H8v3z"/></svg>',LT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1zm10.453 2.61a1.89 1.89 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.9 1.9 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598M7.463 8.163a.6.6 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.63.63 0 0 0-.417-.185m6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.62.62 0 0 0-.42-.165M.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.91.91 0 0 0-.912-.912zM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516zm4.947 0h1.801v4.3h2.7v1.4h-4.5zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9zm-8.517 1.457-.614 2.059h1.262z"/></svg>',F0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254z"/></svg>',ca='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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>',N0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m2.315 14.705 2.224-2.24a.69.69 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.7.7 0 0 1-.112.089.65.65 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0zm5.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-.75M2.329 5.745l2.21-2.226a.69.69 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.7.7 0 0 1-.496.196.64.64 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-.75"/></svg>',D0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.8s3.4
151-.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-4"/></svg>',$l='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.75.75 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.8.8 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-.032z"/></svg>',z0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 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.294zm5.494-5.335a.8.8 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.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-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-.184m4.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.06z"/></svg>';const so={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
151],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]};for(const n in so)Object.freeze(so[n]);const jt=Object.freeze(so);var Ul={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function ql(n){var d,h;var i,e=[],t=1,s;if(typeof n=="number")return{space:"rgb",values:[n>>>16,(n&65280)>>>8,n&255],alpha:1};if(typeof n=="number")return{space:"rgb",values:[n>>>16,(n&65280)>>>8,n&255],alpha:1};if(n=String(n).toLowerCase(),jt[n])e=jt[n].slice(),s="rgb";else if(n==="transparent")t=0,s="rgb",e=[0,0,0];else if(n[0]==="#"){var r=n.slice(1),o=r.length,a=o<=4;t=1,a?(e=[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16)],o===4&&(t=parseInt(r[3]+r[3],16)/255)):(e=[parseInt(r[0]+r[1],16),parseInt(r[2]+r[3],16),parseInt(r[4]+r[5],16)],o===8&&(t=parseInt(r[6]+r[7],16)/255)),e[0]||(e[0]=0),e[1]||(e[1]=0),e[2]||(e[2]=0),s="rgb"}else if(i=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(n)){var l=i[1];s=l.replace(/a$/,"");var c=s==="cmyk"?4:s==="gray"?1:3;e=i[2].trim().split(/\s*[,\/]\s*|\s+/),s==="color"&&(s=e.shift()),e=e.map(function(f,m){if(f[f.length-1]==="%")return f=parseFloat(f)/100,m===3?f:s==="rgb"?f*255:s[0]==="h"||s[0]==="l"&&!m?f*100:s==="lab"?f*125:s==="lch"?m<2?f*150:f*360:s[0]==="o"&&!m?f:s==="oklab"?f*.4:s==="oklch"?m<2?f*.4:f*360:f;if(s[m]==="h"||m===2&&s[s.length-1]==="h"){if(Ul[f]!==void 0)return Ul[f];if(f.endsWith("deg"))return parseFloat(f);if(f.endsWith("turn"))return parseFloat(f)*360;if(f.endsWith("grad"))return parseFloat(f)*360/400;if(f.endsWith("rad"))return parseFloat(f)*180/Math.PI}return f==="none"?0:parseFloat(f)}),t=e.length>c?e.pop():1}else/[0-9](?:\s|\/|,)/.test(n)&&(e=n.match(/([0-9]+)/g).map(function(f){return parseFloat(f)}),s=((h=(d=n.match(/([a-z])/ig))==null?void 0:d.join(""))==null?void 0:h.toLowerCase())||"rgb");return{space:s,values:e,alpha:t}}const Gd={};for(const n of Object.keys(jt))Gd[jt[n]]=n;const E={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"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},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"]}},mt=(6/29)**3;function Ci(n){const i=n>.0031308?1.055*n**.4166666666666667-.055:n*12.92;return Math.min(Math.max(0,i),1)}function Ei(n){return n>.04045?((n+.055)/1.055)**2.4:n/12.92}for(const n of Object.keys(E)){if(!("channels"in E[n]))throw new Error("missing channels property: "+n);if(!("labels"in E[n]))throw new Error("missing channel labels property: "+n);if(E[n].labels.length!==E[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:i,labels:e}=E[n];delete E[n].channels,delete E[n].labels,Object.defineProperty(E[n],"channels",{value:i}),Object.defineProperty(E[n],"labels",{value:e})}E.rgb.hsl=function(n){const i=n[0]/255,e=n[1]/255,t=n[2]/255,s=Math.min(i,e,t),r=Math.max(i,e,t),o=r-s;let a,l;switch(r){case s:{a=0;break}case i:{a=(e-t)/o;break}case e:{a=2+(t-i)/o;break}case t:{a=4+(i-e)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+r)/2;return r===s?l=0:c<=.5?l=o/(r+s):l=o/(2-r-s),[a,l*100,c*100]};E.rgb.hsv=function(n){let i,e,t,s,r;const o=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),h=function(f){return(c-f)/6/d+1/2};if(d===0)s=0,r=0;else{switch(r=d/c,i=h(o),e=h(a),t=h(l),c){case o:{s=t-e;break}case a:{s=1/3+i-t;break}case l:{s=2/3+e-i;break}}s<0?s+=1:s>1&&(s-=1)}return[s*360,r*100,c*100]};E.rgb.hwb=function(n){const i=n[0],e=n[1];let t=n[2];const s=E.rgb.hsl(n)[0],r=1/255*Math.min(i,Math.min(e,t));return t=1-1/255*Math.max(i,Math.max(e,t)),[s,r*100,t*100]};E.rgb.oklab=function(n){const i=Ei(n[0]/255),e=Ei(n[1]/255),t=Ei(n[2]/255),s=Math.cbrt(.4122214708*i+.5363325363*e+.0514459929*t),r=Math.cbrt(.2119034982*i+.6806995451*e+.1073969566*t),o=Math.cbrt(.0883024619*i+.2817188376*e+.6299787005*t),a=.2104542553*s+.793617785*r-.0040720468*o,l=1.9779984951*s-2.428592205*r+.4505937099*o,c=.0259040371*s+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};E.rgb.cmyk=function(n){const i=n[0]/255,e=n[1]/255,t=n[2]/255,s=Math.min(1-i,1-e,1-t),r=(1-i-s)/(1-s)||0,o=(1-e-s)/(1-s)||0,a=(1-t-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function H0(n,i){return(n[0]-i[0])**2+(n[1]-i[1])**2+(n[2]-i[2])**2}
151E.rgb.keyword=function(n){const i=Gd[n];if(i)return i;let e=Number.POSITIVE_INFINITY,t;for(const s of Object.keys(jt)){const r=jt[s],o=H0(n,r);o<e&&(e=o,t=s)}return t};E.keyword.rgb=function(n){return jt[n]};E.rgb.xyz=function(n){const i=Ei(n[0]/255),e=Ei(n[1]/255),t=Ei(n[2]/255),s=i*.4124564+e*.3575761+t*.1804375,r=i*.2126729+e*.7151522+t*.072175,o=i*.0193339+e*.119192+t*.9503041;return[s*100,r*100,o*100]};E.rgb.lab=function(n){const i=E.rgb.xyz(n);let e=i[0],t=i[1],s=i[2];e/=95.047,t/=100,s/=108.883,e=e>mt?e**(1/3):7.787*e+16/116,t=t>mt?t**(1/3):7.787*t+16/116,s=s>mt?s**(1/3):7.787*s+16/116;const r=116*t-16,o=500*(e-t),a=200*(t-s);return[r,o,a]};E.hsl.rgb=function(n){const i=n[0]/360,e=n[1]/100,t=n[2]/100;let s,r;if(e===0)return r=t*255,[r,r,r];const o=t<.5?t*(1+e):t+e-t*e,a=2*t-o,l=[0,0,0];for(let c=0;c<3;c++)s=i+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?r=a+(o-a)*6*s:2*s<1?r=o:3*s<2?r=a+(o-a)*(2/3-s)*6:r=a,l[c]=r*255;return l};E.hsl.hsv=function(n){const i=n[0];let e=n[1]/100,t=n[2]/100,s=e;const r=Math.max(t,.01);t*=2,e*=t<=1?t:2-t,s*=r<=1?r:2-r;const o=(t+e)/2,a=t===0?2*s/(r+s):2*e/(t+e);return[i,a*100,o*100]};E.hsv.rgb=function(n){const i=n[0]/60,e=n[1]/100;let t=n[2]/100;const s=Math.floor(i)%6,r=i-Math.floor(i),o=255*t*(1-e),a=255*t*(1-e*r),l=255*t*(1-e*(1-r));switch(t*=255,s){case 0:return[t,l,o];case 1:return[a,t,o];case 2:return[o,t,l];case 3:return[o,a,t];case 4:return[l,o,t];case 5:return[t,o,a]}};E.hsv.hsl=function(n){const i=n[0],e=n[1]/100,t=n[2]/100,s=Math.max(t,.01);let r,o;o=(2-e)*t;const a=(2-e)*s;return r=e*s,r/=a<=1?a:2-a,r=r||0,o/=2,[i,r*100,o*100]};E.hwb.rgb=function(n){const i=n[0]/360;let e=n[1]/100,t=n[2]/100;const s=e+t;let r;s>1&&(e/=s,t/=s);const o=Math.floor(6*i),a=1-t;r=6*i-o,(o&1)!==0&&(r=1-r);const l=e+r*(a-e);let c,d,h;switch(o){default:case 6:case 0:{c=a,d=l,h=e;break}case 1:{c=l,d=a,h=e;break}case 2:{c=e,d=a,h=l;break}case 3:{c=e,d=l,h=a;break}case 4:{c=l,d=e,h=a;break}case 5:{c=a,d=e,h=l;break}}return[c*255,d*255,h*255]};E.cmyk.rgb=function(n){const i=n[0]/100,e=n[1]/100,t=n[2]/100,s=n[3]/100,r=1-Math.min(1,i*(1-s)+s),o=1-Math.min(1,e*(1-s)+s),a=1-Math.min(1,t*(1-s)+s);return[r*255,o*255,a*255]};E.xyz.rgb=function(n){const i=n[0]/100,e=n[1]/100,t=n[2]/100;let s,r,o;return s=i*3.2404542+e*-1.5371385+t*-.4985314,r=i*-.969266+e*1.8760108+t*.041556,o=i*.0556434+e*-.2040259+t*1.0572252,s=Ci(s),r=Ci(r),o=Ci(o),[s*255,r*255,o*255]};E.xyz.lab=function(n){let i=n[0],e=n[1],t=n[2];i/=95.047,e/=100,t/=108.883,i=i>mt?i**(1/3):7.787*i+16/116,e=e>mt?e**(1/3):7.787*e+16/116,t=t>mt?t**(1/3):7.787*t+16/116;const s=116*e-16,r=500*(i-e),o=200*(e-t);return[s,r,o]};E.xyz.oklab=function(n){const i=n[0]/100,e=n[1]/100,t=n[2]/100,s=Math.cbrt(.8189330101*i+.3618667424*e-.1288597137*t),r=Math.cbrt(.0329845436*i+.9293118715*e+.0361456387*t),o=Math.cbrt(.0482003018*i+.2643662691*e+.633851707*t),a=.2104542553*s+.793617785*r-.0040720468*o,l=1.9779984951*s-2.428592205*r+.4505937099*o,c=.0259040371*s+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};E.oklab.oklch=function(n){return E.lab.lch(n)};E.oklab.xyz=function(n){const i=n[0]/100,e=n[1]/100,t=n[2]/100,s=(.999999998*i+.396337792*e+.215803758*t)**3,r=(1.000000008*i-.105561342*e-.063854175*t)**3,o=(1.000000055*i-.089484182*e-1.291485538*t)**3,a=1.227013851*s-.55779998*r+.281256149*o,l=-.040580178*s+1.11225687*r-.071676679*o,c=-.076381285*s-.421481978*r+1.58616322*o;return[a*100,l*100,c*100]};E.oklab.rgb=function(n){const i=n[0]/100,e=n[1]/100,t=n[2]/100,s=(i+.3963377774*e+.2158037573*t)**3,r=(i-.1055613458*e-.0638541728*t)**3,o=(i-.0894841775*e-1.291485548*t)**3,a=Ci(4.0767416621*s-3.3077115913*r+.2309699292*o),l=Ci(-1.2684380046*s+2.6097574011*r-.3413193965*o),c=Ci(-.0041960863*s-.7034186147*r+1.707614701*o);return[a*255,l*255,c*255]};E.oklch.oklab=function(n){return E.lch.lab(n)};E.lab.xyz=function(n){const i=n[0],e=n[1],t=n[2];let s,r,o;r=(i+16)/116,s=e/500+r,o=r-t/200;const a=r**3,l=s**3,c=o**3;return r=a>mt?a:(r-16/116)/7.787,s=l>mt?l:(s-16/116)/7.787,o=c>mt?c:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]};E.lab.lch=function(n){const i=n[0],e=n[1],t=n[2];let s;s=Math.atan2(t,e)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(e*e+t*t);return[i,o,s]};E.lch.lab=function(n){const i=n[0],e=n[1],s=n[2]/360*2*Math.PI,r=e*Math.cos(s),o=e*Math.sin(s);return[i,r,o]};E.rgb.ansi16=function(n,i=null){const[e,t,s]=n;let r=i===null?E.rgb.hsv(n)[2]:i;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(t/255)<<1|Math.round(e/255));return r===2&&(o+=60),o};E.hsv.ansi16=function(n){return E.rgb.ansi16(E.hsv.rgb(n),n[2])};E.rgb.ansi256=function(n){const i=n[0],e=n[1],t=n[2];return i>>4===e>>4&&e>>4===t>>4?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5)};E.ansi16.rgb=function(n){n=n[0];let i=n%10;if(i===0||i===7)return n>50&&(i+=3.5),i=i/10.5*255,[i,i,i];const e=(Math.trunc(n>50)+1)*.5,t=(i&1)*e*255,s=(i>>1&1)*e*255,r=(i>>2&1)*e*255;return[t,s,r]};E.ansi256.rgb=function(n){if(n=n[0],n>=232){const r=(n-232)*10+8;return[r,r,r]}n-=16;let i;const e=Math.floor(n/36)/5*255,t=Math.floor((i=n%36)/6)/5*255,s=i%6/5*255;return[e,t,s]};E.rgb.hex=function(n){const e=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".slice(e.length)+e};E.hex.rgb=function(n){const i=n.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!i)return[0,0,0];let e=i[0];i[0].length===3&&(e=[...e].map(a=>a+a).join(""));const t=Number.parseInt(e,16),s=t>>16&255,r=t>>8&255,o=t&255;return[s,r,o]};E.rgb.hcg=function(n){const i=n[0]/255,e=n[1]/255,t=n[2]/255,s=Math.max(Math.max(i,e),t),r=Math.min(Math.min(i,e),t),o=s-r;let a;const l=o<1?r/(1-o):0;return o<=0?a=0:s===i?a=(e-t)/o%6:s===e?a=2+(t-i)/o:a=4+(i-e)/o,a/=6,a%=1,[a*360,o*100,l*100]};E.hsl.hcg=function(n){const i=n[1]/100,e=n[2]/100,t=e<.5?2*i*e:2*i*(1-e);let s=0;return t<1&&(s=(e-.5*t)/(1-t)),[n[0],t*100,s*100]};E.hsv.hcg=function(n){const i=n[1]/100,e=n[2]/100,t=i*e;let s=0;return t<1&&(s=(e-t)/(1-t)),[n[0],t*100,s*100]};E.hcg.rgb=function(n){const i=n[0]/360,e=n[1]/100,t=n[2]/100;if(e===0)return[t*255,t*255,t*255];const s=[0,0,0],r=i%1*6,o=r%1,a=1-o;let l=0;switch(Math.floor(r)){case 0:{s[0]=1,s[1]=o,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]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-e)*t,[(e*s[0]+l)*255,(e*s[1]+l)*255,(e*s[2]+l)*255]};E.hcg.hsv=function(n){const i=n[1]/100,e=n[2]/100,t=i+e*(1-i);let s=0;return t>0&&(s=i/t),[n[0],s*100,t*100]};E.hcg.hsl=function(n){const i=n[1]/100,t=n[2]/100*(1-i)+.5*i;let s=0;return t>0&&t<.5?s=i/(2*t):t>=.5&&t<1&&(s=i/(2*(1-t))),[n[0],s*100,t*100]};E.hcg.hwb=function(n){const i=n[1]/100,e=n[2]/100,t=i+e*(1-i);return[n[0],(t-i)*100,(1-t)*100]};E.hwb.hcg=function(n){const i=n[1]/100,t=1-n[2]/100,s=t-i;let r=0;return s<1&&(r=(t-s)/(1-s)),[n[0],s*100,r*100]};E.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};E.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};E.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};E.gray.hsl=function(n){return[0,0,n[0]]};E.gray.hsv=E.gray.hsl;E.gray.hwb=function(n){return[0,100,n[0]]};E.gray.cmyk=function(n){return[0,0,0,n[0]]};E.gray.lab=function(n){return[n[0],0,0]};E.gray.hex=function(n){const i=Math.round(n[0]/100*255)&255,t=((i<<16)+(i<<8)+i).toString(16).toUpperCase();return"000000".slice(t.length)+t};E.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};function W0(){const n={},i=Object.keys(E);for(let{length:e}=i,t=0;t<e;t++)n[i[t]]={distance:-1,parent:null};return n}function $0(n){const i=W0(),e=[n];for(i[n].distance=0;e.length>0;){const t=e.pop(),s=Object.keys(E[t]);for(let{length:r}=s,o=0;o<r;o++){const a=s[o],l=i[a];l.distance===-1&&(l.distance=i[t].distance+1,l.parent=t,e.unshift(a))}}return i}function U0(n,i){return function(e){return i(n(e))}}function q0(n,i){const e=[i[n].parent,n];let t=E[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)e.unshift(i[s].parent),t=U0(E[i[s].parent][s],t),s=i[s].parent;return t.conversion=e,t}function K0(n){const i=$0(n),e={},t=Object.keys(i);for(let{length:s}=t,r=0;r<s;r++){const o=t[r];i[o].parent!==null&&(e[o]=q0(o,i))}return e}const Ht={},G0=Object.keys(E);function j0(n){const i=function(...e){const t=e[0];return t==null?t:(t.length>1&&(e=t),n(e))};return"conversion"in n&&(i.conversion=n.conversion),i}function J0(n){const i=function(...e){const t=e[0];if(t==null)return t;t.length>1&&(e=t);const s=n(e);if(typeof s=="object")for(let{length:r}=s,o=0;o<r;o++)s[o]=Math.round(s[o]);return s};return"conversion"in n&&(i.conversion=n.conversion),i}for(const n of G0){Ht[n]={},Object.defineProperty(Ht[n],"channels",{value:E[n].channels}),Object.defineProperty(Ht[n],"labels",{value:E[n].labels});const i=K0(n),e=Object.keys(i);for(const t of e){const s=i[t];Ht[n][t]=J0(s),Ht[n][t].raw=j0(s)}}const Pn=(n,i=0,e=1)=>n>e?e:n<i?i:n,le=(n,i=0,e=Math.pow(10,i))=>Math.round(e*n)/e,Q0=n=>t1(ro(n)),ro=n=>(n[0]==="#"&&(n=n.substring(1)),n.length<6?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?le(parseInt(n[3]+n[3],16)/255,2):1}:{r:parseInt(n.substring(0,2),16),g:parseInt(n.substring(2,4),16),b:parseInt(n.substring(4,6),16),a:n.length===8?le(parseInt(n.substring(6,8),16)/255,2):1}),Y0=n=>e1(Z0(n)),X0=({h:n,s:i,v:e,a:t})=>{const s=(200-i)*e/100;return{h:le(n),s:le(s>0&&s<200?i*e/100/(s<=100?s:200-s)*100:0),l:le(s/2),a:le(t,2)}},oo=n=>{const{h:i,s:e,l:t}=X0(n);return`hsl(${i}, ${e}%, ${t}%)`},Z0=({h:n,s:i,v:e,a:t})=>{n=n/360*6,i=i/100,e=e/100;const s=Math.floor(n),r=e*(1-i),o=e*(1-(n-s)*i),a=e*(1-(1-n+s)*i),l=s%6;return{r:le([e,o,r,r,a,e][l]*255),g:le([a,e,e,o,r,r][l]*255),b:le([r,r,a,e,e,o][l]*255),a:le(t,2)}},jn=n=>{const i=n.toString(16);return i.length<2?"0"+i:i},e1=({r:n,g:i,b:e,a:t})=>{const s=t<1?jn(le(t*255)):"";return"#"+jn(n)+jn(i)+jn(e)+s},t1=({r:n,g:i,b:e,a:t})=>{const s=Math.max(n,i,e),r=s-Math.min(n,i,e),o=r?s===n?(i-e)/r:s===i?2+(e-n)/r:4+(n-i)/r:0;return{h:le(60*(o<0?o+6:o)),s:le(s?r/s*100:0),v:le(s/255*100),a:t}},jd=(n,i)=>{if(n===i)return!0;for(const e in n)if(n[e]!==i[e])return!1;return!0},i1=(n,i)=>n.toLowerCase()===i.toLowerCase()?!0:jd(ro(n),ro(i)),Kl={},Jd=n=>{let i=Kl[n];
151return i||(i=document.createElement("template"),i.innerHTML=n,Kl[n]=i),i},ua=(n,i,e)=>{n.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:e}))};let Ti=!1;const ao=n=>"touches"in n,n1=n=>Ti&&!ao(n)?!1:(Ti||(Ti=ao(n)),!0),Gl=(n,i)=>{const e=ao(i)?i.touches[0]:i,t=n.el.getBoundingClientRect();ua(n.el,"move",n.getMove({x:Pn((e.pageX-(t.left+window.pageXOffset))/t.width),y:Pn((e.pageY-(t.top+window.pageYOffset))/t.height)}))},s1=(n,i)=>{const e=i.keyCode;e>40||n.xy&&e<37||e<33||(i.preventDefault(),ua(n.el,"move",n.getMove({x:e===39?.01:e===37?-.01:e===34?.05:e===33?-.05:e===35?1:e===36?-1:0,y:e===40?.01:e===38?-.01:0},!0)))};class Qd{constructor(i,e,t,s){const r=Jd(`<div role="slider" tabindex="0" part="${e}" ${t}><div part="${e}-pointer"></div></div>`);i.appendChild(r.content.cloneNode(!0));const o=i.querySelector(`[part=${e}]`);o.addEventListener("mousedown",this),o.addEventListener("touchstart",this),o.addEventListener("keydown",this),this.el=o,this.xy=s,this.nodes=[o.firstChild,o]}set dragging(i){const e=i?document.addEventListener:document.removeEventListener;e(Ti?"touchmove":"mousemove",this),e(Ti?"touchend":"mouseup",this)}handleEvent(i){switch(i.type){case"mousedown":case"touchstart":if(i.preventDefault(),!n1(i)||!Ti&&i.button!=0)return;this.el.focus(),Gl(this,i),this.dragging=!0;break;case"mousemove":case"touchmove":i.preventDefault(),Gl(this,i);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":s1(this,i);break}}style(i){i.forEach((e,t)=>{for(const s in e)this.nodes[t].style.setProperty(s,e[s])})}}class r1 extends Qd{constructor(i){super(i,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:i}){this.h=i,this.style([{left:`${i/360*100}%`,color:oo({h:i,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${le(i)}`)}getMove(i,e){return{h:e?Pn(this.h+i.x*360,0,360):360*i.x}}}class o1 extends Qd{constructor(i){super(i,"saturation",'aria-label="Color"',!0)}update(i){this.hsva=i,this.style([{top:`${100-i.v}%`,left:`${i.s}%`,color:oo(i)},{"background-color":oo({h:i.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${le(i.s)}%, Brightness ${le(i.v)}%`)}getMove(i,e){return{s:e?Pn(this.hsva.s+i.x*100,0,100):i.x*100,v:e?Pn(this.hsva.v-i.y*100,0,100):Math.round(100-i.y*100)}}}const a1=':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',l1="[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}",c1="[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}",Jn=Symbol("same"),_r=Symbol("color"),jl=Symbol("hsva"),yr=Symbol("update"),Jl=Symbol("parts"),Ql=Symbol("css"),Yl=Symbol("sliders");class u1 extends HTMLElement{static get observedAttributes(){return["color"]}get[Ql](){return[a1,l1,c1]}get[Yl](){return[o1,r1]}get color(){return this[_r]}set color(i){if(!this[Jn](i)){const e=this.colorModel.toHsva(i);this[yr](e),this[_r]=i}}constructor(){super();const i=Jd(`<style>${this[Ql].join("")}</style>`),e=this.attachShadow({mode:"open"});e.appendChild(i.content.cloneNode(!0)),e.addEventListener("move",this),this[Jl]=this[Yl].map(t=>new t(e))}connectedCallback(){if(this.hasOwnProperty("color")){const i=this.color;delete this.color,this.color=i}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(i,e,t){const s=this.colorModel.fromAttr(t);this[Jn](s)||(this.color=s)}handleEvent(i){const e=this[jl],t={...e,...i.detail};this[yr](t);let s;!jd(t,e)&&!this[Jn](s=this.colorModel.fromHsva(t))&&(this[_r]=s,ua(this,"color-changed",{value:s}))}[Jn](i){return this.color&&this.colorModel.equal(i,this.color)}
151[yr](i){this[jl]=i,this[Jl].forEach(e=>e.update(i))}}const d1={defaultColor:"#000",toHsva:Q0,fromHsva:({h:n,s:i,v:e})=>Y0({h:n,s:i,v:e,a:1}),equal:i1,fromAttr:n=>n};class h1 extends u1{get colorModel(){return d1}}/**
152 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
153 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
154 */class Ye extends Se{constructor(e=[]){super(e,{idProperty:"viewUid"});u(this,"_parentElement");this.on("add",(t,s,r)=>{this._renderViewIntoCollectionParent(s,r)}),this.on("remove",(t,s)=>{s.element&&this._parentElement&&s.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||!f1(e))throw new p("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const s of this)for(const r of e)s.delegate(r).to(t);this.on("add",(s,r)=>{for(const o of e)r.delegate(o).to(t)}),this.on("remove",(s,r)=>{for(const o of e)r.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 f1(n){return n.every(i=>typeof i=="string")}const m1="http://www.w3.org/1999/xhtml";class Ee extends H(){constructor(e){super();u(this,"ns");u(this,"tag");u(this,"text");u(this,"attributes");u(this,"children");u(this,"eventListeners");u(this,"_isRendered");u(this,"_revertData");Object.assign(this,Zl(Xl(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=ic(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new p("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(const s of t.children)Es(s)?yield s:da(s)&&(yield*e(s))}yield*e(this)}static bind(e,t){return{to(s,r){return new g1({eventNameOrFunction:s,attribute:s,observable:e,emitter:t,callback:r})},if(s,r,o){return new Yd({observable:e,emitter:t,attribute:s,valueIfTrue:r,callback:o})}}}static extend(e,t){if(e._isRendered)throw new p("template-extend-render",[this,e]);th(e,Zl(Xl(t)))}_renderNode(e){let t;if(e.node?t=this.tag&&this.text:t=this.tag?this.text:!this.text,t)throw new p("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||m1,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(""),cs(this.text)?this._bindToObservable({schema:this.text,updater:w1(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,s=e.revertData;for(const r in this.attributes){const o=t.getAttribute(r),a=this.attributes[r];s&&(s.attributes[r]=o);const l=tc(a)?a[0].ns:null;if(cs(a)){const c=tc(a)?a[0].value:a;s&&nc(r)&&c.unshift(o),this._bindToObservable({schema:c,updater:b1(t,r,l),data:e})}else if(r=="style"&&typeof a[0]!="string")this._renderStyleAttribute(a[0],e);else{s&&o&&nc(r)&&a.unshift(o);const c=a.map(d=>d&&(d.value||d)).reduce((d,h)=>d.concat(h),[]).reduce(eh,"");Ii(c)||t.setAttributeNS(l,r,c)}}}_renderStyleAttribute(e,t){const s=t.node;for(const r in e){const o=e[r];cs(o)?this._bindToObservable({schema:[o],updater:_1(s,r),data:t}):s.style[r]=o}}_renderElementChildren(e){const t=e.node,s=e.intoFragment?document.createDocumentFragment():t,r=e.isApplying;let o=0;for(const a of this.children)if(ha(a)){if(!r){a.setParent(t);for(const l of a)s.appendChild(l.element)}}else if(Es(a))r||(a.isRendered||a.render(),s.appendChild(a.element));else if(St(a))s.appendChild(a);else if(r){const l=e.revertData,c=ic();l.children.push(c),a._renderNode({intoFragment:!1,node:s.childNodes[o++],isApplying:!0,revertData:c})}else s.appendChild(a.render());e.intoFragment&&t.appendChild(s)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const s=this.eventListeners[t].map(r=>{const[o,a]=t.split("@");return r.activateDomEventListener(o,a,e)});e.revertData&&e.revertData.bindings.push(s)}}_bindToObservable({schema:e,updater:t,data:s}){const r=s.revertData;Xd(e,t,s);const o=e.filter(a=>!Ii(a)).filter(a=>a.observable).map(a=>a.activateAttributeListener(e,t,s));r&&r.bindings.push(o)}_revertTemplateFromNode(e,t){for(const r of t.bindings)for(const o of r)o();if(t.text){e.textContent=t.text;return}const s=e;for(const r in t.attributes){const o=t.attributes[r];o===null?s.removeAttribute(r):s.setAttribute(r,o)}for(let r=0;r<t.children.length;++r)this._revertTemplateFromNode(s.childNodes[r],t.children[r])}}class Ln{constructor(i){u(this,"attribute");u(this,"observable");u(this,"emitter");u(this,"callback");this.attribute=i.attribute,this.observable=i.observable,this.emitter=i.emitter,this.callback=i.callback}getValue(i){const e=this.observable[this.attribute];return this.callback?this.callback(e,i):e}activateAttributeListener(i,e,t){const s=()=>Xd(i,e,t);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class g1 extends Ln{constructor(e){super(e);u(this,"eventNameOrFunction");this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,s){const r=(o,a)=>{(!t||a.target.matches(t))&&(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(a):this.observable.fire(this.eventNameOrFunction,a))};return this.emitter.listenTo(s.node,e,r),()=>{this.emitter.stopListening(s.node,e,r)}}}class Yd extends Ln{constructor(e){super(e);u(this,"valueIfTrue");this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return Ii(t)?!1:this.valueIfTrue||!0}}function cs(n){return n?(n.value&&(n=n.value),Array.isArray(n)?n.some(cs):n instanceof Ln):!1}function p1(n,i){return n.map(e=>e instanceof Ln?e.getValue(i):e)}function Xd(n,i,{node:e}){const t=p1(n,e);let s;n.length==1&&n[0]instanceof Yd?s=t[0]:s=t.reduce(eh,""),Ii(s)?i.remove():i.set(s)}function w1(n){return{set(i){n.textContent=i},remove(){n.textContent=""}}}function b1(n,i,e){return{set(t){n.setAttributeNS(e,i,t)},remove(){n.removeAttributeNS(e,i)}}}function _1(n,i){return{set(e){n.style[i]=e},remove(){n.style[i]=null}}}function Xl(n){return Ns(n,e=>{if(e&&(e instanceof Ln||da(e)||Es(e)||ha(e)))return e})}function Zl(n){if(typeof n=="string"?n=k1(n):n.text&&C1(n),n.on&&(n.eventListeners=v1(n.on),delete n.on),!n.text){n.attributes&&y1(n.attributes);const i=[];if(n.children)if(ha(n.children))i.push(n.children);else for(const e of n.children)da(e)||Es(e)||St(e)?i.push(e):i.push(new Ee(e));n.children=i}return n}function y1(n){for(const i in n)n[i].value&&(n[i].value=Y(n[i].value)),Zd(n,i)}function v1(n){for(const i in n)Zd(n,i);return n}function k1(n){return{text:[n]}}function C1(n){n.text=Y(n.text)}function Zd(n,i){n[i]=Y(n[i])}function eh(n,i){return Ii(i)?n:Ii(n)?i:`${n} ${i}`}function ec(n,i){for(const e in i)n[e]?n[e].push(...i[e]):n[e]=i[e]}
154function th(n,i){if(i.attributes&&(n.attributes||(n.attributes={}),ec(n.attributes,i.attributes)),i.eventListeners&&(n.eventListeners||(n.eventListeners={}),ec(n.eventListeners,i.eventListeners)),i.text&&n.text.push(...i.text),i.children&&i.children.length){if(n.children.length!=i.children.length)throw new p("ui-template-extend-children-mismatch",n);let e=0;for(const t of i.children)th(n.children[e++],t)}}function Ii(n){return!n&&n!==0}function Es(n){return n instanceof T}function da(n){return n instanceof Ee}function ha(n){return n instanceof Ye}function tc(n){return Le(n[0])&&n[0].ns}function ic(){return{children:[],bindings:[],attributes:{}}}function nc(n){return n=="class"||n=="style"}class T extends De(q()){constructor(e){super();u(this,"element");u(this,"isRendered");u(this,"locale");u(this,"t");u(this,"template");u(this,"_viewCollections");u(this,"_unboundChildren");u(this,"_bindTemplate");this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Se,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,s)=>{s.locale=e,s.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Ee.bind(this,this)}createCollection(e){const t=new Ye(e);return this._viewCollections.add(t),t}registerChild(e){Te(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Te(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Ee(e)}extendTemplate(e){Ee.extend(this.template,e)}render(){if(this.isRendered)throw new p("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)}}const sc={POLITE:"polite",ASSERTIVE:"assertive"};class E1{constructor(i){u(this,"editor");u(this,"view");this.editor=i,i.once("ready",()=>{for(const e of Object.values(sc))this.announce("",e)})}announce(i,e=sc.POLITE){const t=this.editor;if(!t.ui.view)return;this.view||(this.view=new T1(t.locale),t.ui.view.body.add(this.view));const{politeness:s,isUnsafeHTML:r}=typeof e=="string"?{politeness:e}:e;let o=this.view.regionViews.find(a=>a.politeness===s);o||(o=new P1(t,s),this.view.regionViews.add(o)),o.announce({announcement:i,isUnsafeHTML:r})}}class T1 extends T{constructor(e){super(e);u(this,"regionViews");this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class P1 extends T{constructor(e,t){super(e.locale);u(this,"politeness");u(this,"_domConverter");u(this,"_pruneAnnouncementsInterval");this.setTemplate({tag:"div",attributes:{"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 s=document.createElement("li");t?this._domConverter.setContentOf(s,e):s.innerText=e,this._listElement.appendChild(s)}get _listElement(){return this.element.querySelector("ul")}}/**
155 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
156 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
157 */function Gs({emitter:n,activator:i,callback:e,contextElements:t,listenerOptions:s}){n.listenTo(document,"mousedown",(r,o)=>{if(!i())return;const a=typeof o.composedPath=="function"?o.composedPath():[],l=typeof t=="function"?t():t;for(const c of l)if(c.contains(o.target)||a.includes(c))return;e()},s)}/**
158 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
159 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
160 */function rc(n){class i extends n{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...t){super(...t),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.template&&this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}return i}function A1(n){class i extends n{constructor(...s){super(...s);u(this,"_onDragBound",this._onDrag.bind(this));u(this,"_onDragEndBound",this._onDragEnd.bind(this));u(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(C.document,"mouseup",this._onDragEndBound),this.listenTo(C.document,"touchend",this._onDragEndBound),this.listenTo(C.document,"mousemove",this._onDragBound),this.listenTo(C.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(C.document,"mouseup",this._onDragEndBound),this.stopListening(C.document,"touchend",this._onDragEndBound),this.stopListening(C.document,"mousemove",this._onDragBound),this.stopListening(C.document,"touchmove",this._onDragBound)}_onDragStart(s,r){if(!this._isHandleElementPressed(r))return;this._attachDragListeners();let o=0,a=0;r instanceof MouseEvent?(o=r.clientX,a=r.clientY):(o=r.touches[0].clientX,a=r.touches[0].clientY),this._lastDraggingCoordinates={x:o,y:a},this.isDragging=!0}_onDrag(s,r){if(!this.isDragging){this._detachDragListeners();return}let o=0,a=0;r instanceof MouseEvent?(o=r.clientX,a=r.clientY):(o=r.touches[0].clientX,a=r.touches[0].clientY),r.preventDefault(),this.fire("drag",{deltaX:Math.round(o-this._lastDraggingCoordinates.x),deltaY:Math.round(a-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:o,y:a}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(s){return this.dragHandleElement?this.dragHandleElement===s.target||s.target instanceof HTMLElement&&this.dragHandleElement.contains(s.target):!1}}return i}/**
161 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
162 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
163 */function x1({view:n}){n.listenTo(n.element,"submit",(i,e)=>{e.preventDefault(),n.fire("submit")},{useCapture:!0})}/**
164 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
165 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
166 */function S1({keystrokeHandler:n,focusTracker:i,gridItems:e,numberOfColumns:t,uiLanguageDirection:s}){const r=typeof t=="number"?()=>t:t;n.set("arrowright",o((c,d)=>s==="rtl"?l(c,d.length):a(c,d.length))),n.set("arrowleft",o((c,d)=>s==="rtl"?a(c,d.length):l(c,d.length))),n.set("arrowup",o((c,d)=>{let h=c-r();return h<0&&(h=c+r()*Math.floor(d.length/r()),h>
166d.length-1&&(h-=r())),h})),n.set("arrowdown",o((c,d)=>{let h=c+r();return h>d.length-1&&(h=c%r()),h}));function o(c){return d=>{const h=e.find(g=>g.element===i.focusedElement),f=e.getIndex(h),m=c(f,e);e.get(m).focus(),d.stopPropagation(),d.preventDefault()}}function a(c,d){return c===d-1?0:c+1}function l(c,d){return c===0?d-1:c-1}}class js extends T{constructor(e){super(e);u(this,"id");this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${me()}`;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")}]})}}class I1 extends T{constructor(i,e){super(i);const t=i.t,s=new js;s.text=t("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:[Ue(document,"p",{},t("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(e.values())),s]})}focus(){this.element.focus()}_createCategories(i){return i.map(e=>{const t=[Ue(document,"h3",{},e.label),...Array.from(e.groups.values()).map(s=>this._createGroup(s)).flat()];return e.description&&t.splice(1,0,Ue(document,"p",{},e.description)),Ue(document,"section",{},t)})}_createGroup(i){const e=i.keystrokes.sort((s,r)=>s.label.localeCompare(r.label)).map(s=>this._createGroupRow(s)).flat(),t=[Ue(document,"dl",{},e)];return i.label&&t.unshift(Ue(document,"h4",{},i.label)),t}_createGroupRow(i){const e=this.locale.t,t=Ue(document,"dt"),s=Ue(document,"dd"),r=M1(i.keystroke),o=[];for(const a of r)o.push(a.map(O1).join(""));return t.innerHTML=i.label,s.innerHTML=o.join(", ")+(i.mayRequireFn&&P.isMac?` ${e("(may require <kbd>Fn</kbd>)")}`:""),[t,s]}}function O1(n){return bs(n).split("+").map(i=>`<kbd>${i}</kbd>`).join("+")}function M1(n){return typeof n=="string"?[[n]]:typeof n[0]=="string"?[n]:n}const As=class As extends T{constructor(){super();const i=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",i.if("isVisible","ck-hidden",e=>!e),"ck-reset_all-excluded",i.if("isColorInherited","ck-icon_inherit-color")],viewBox:i.to("viewBox"),"aria-hidden":!0}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg");if(!e)throw new p("ui-iconview-invalid-svg",this);const t=e.getAttribute("viewBox");t&&(this.viewBox=t);for(const{name:s,value:r}of Array.from(e.attributes))As.presentationalAttributeNames.includes(s)&&this.element.setAttribute(s,r);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(i=>{i.style.fill=this.fillColor})}};u(As,"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
166-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"]);let st=As;class ih extends T{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const i=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:i.to("style"),id:i.to("id")},children:[{text:i.to("text")}]})}}class B extends T{constructor(e,t=new ih){super(e);u(this,"children");u(this,"labelView");u(this,"iconView");u(this,"keystrokeView");u(this,"_focusDelayed",null);const s=this.bindTemplate,r=me();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${r}`),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 st,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.iconView.bind("content").to(this,"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",s.to("class"),s.if("isEnabled","ck-disabled",a=>!a),s.if("isVisible","ck-hidden",a=>!a),s.to("isOn",a=>a?"ck-on":"ck-off"),s.if("withText","ck-button_with-text"),s.if("withKeystroke","ck-button_with-keystroke")],role:s.to("role"),type:s.to("type",a=>a||"button"),tabindex:s.to("tabindex"),"aria-checked":s.to("_ariaChecked"),"aria-pressed":s.to("_ariaPressed"),"aria-label":s.to("ariaLabel"),"aria-labelledby":s.to("ariaLabelledBy"),"aria-disabled":s.if("isEnabled",!0,a=>!a),"data-cke-tooltip-text":s.to("_tooltipString"),"data-cke-tooltip-position":s.to("tooltipPosition")},children:this.children,on:{click:s.to(a=>{this.isEnabled?this.fire("execute"):a.preventDefault()})}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",(a,l,c)=>!l||oc(c)?!1:String(!!a)),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",(a,l,c)=>!l||!oc(c)?!1:String(!!a)),P.isSafari&&(this._focusDelayed||(this._focusDelayed=Go(()=>this.focus(),0)),o.on.mousedown=s.to(()=>{this._focusDelayed()}),o.on.mouseup=s.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(o)}render(){super.render(),this.icon&&this.children.add(this.iconView),this.on("change:icon",(e,t,s,r)=>{s&&!r?this.children.add(this.iconView,0):!s&&r&&this.children.remove(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 T;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>bs(t))}]}),e}_getTooltipString(e,t,s){return e?typeof e=="string"?e:(s&&(s=bs(s)),e instanceof Function?e(t,s):`${t}${s?` (${s})`:""}`):""}}function oc(n){switch(n){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}class Js extends T{constructor(e,t={}){super(e);u(this,"children");u(this,"iconView");const s=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",s.to("class")]},children:this.children}),t.icon&&(this.iconView=new st,this.iconView.content=t.icon,this.children.add(this.iconView));const r=new T(e);r.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:s.to("label")}]}),this.children.add(r)}}class vt extends H(){constructor(e){super();u(this,"focusables");u(this,"focusTracker");u(this,"keystrokeHandler");u(this,"actions");
166if(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 s=e.actions[t];typeof s=="string"&&(s=[s]);for(const r of s)e.keystrokeHandler.set(r,(o,a)=>{this[t](),a()},e.keystrokeHandlerOptions)}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"})}get first(){return this.focusables.find(vr)||null}get last(){return this.focusables.filter(vr).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,s)=>{const r=t.element===this.focusTracker.focusedElement;return r&&(e=s),r}),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)}chain(e){const t=()=>this.current===null?null:this.focusables.get(this.current);this.listenTo(e,"forwardCycle",s=>{const r=t();this.focusNext(),r!==t()&&s.stop()},{priority:"low"}),this.listenTo(e,"backwardCycle",s=>{const r=t();this.focusPrevious(),r!==t()&&s.stop()},{priority:"low"})}unchain(e){this.stopListening(e)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const s=this.current;if(s===null)return this[e===1?"first":"last"];let r=this.focusables.get(s),o=(s+t+e)%t;do{const a=this.focusables.get(o);if(vr(a)){r=a;break}o=(o+t+e)%t}while(o!==s);return r}}function vr(n){return Fn(n)&&bt(n.element)}function Fn(n){return"focus"in n&&typeof n.focus=="function"}function R1(n){return Fn(n)&&"focusCycler"in n&&n.focusCycler instanceof vt}class V1 extends T{constructor(e){super(e);u(this,"children");u(this,"keystrokes");u(this,"focusCycler");u(this,"_focusTracker");u(this,"_focusables");this.children=this.createCollection(),this.keystrokes=new Ie,this._focusTracker=new de,this._focusables=new Ye,this.focusCycler=new vt({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 s=new B(this.locale);let r;s.on("execute",()=>t.onExecute()),t.onCreate&&t.onCreate(s);for(r in t)r!="onExecute"&&r!="onCreate"&&s.set(r,t[r]);this.children.add(s)}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)})}}class B1 extends T{constructor(e){super(e);u(this,"children");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)}}const We={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"},ac=Ri("px"),xs=class xs extends A1(T){constructor(e,{getCurrentDomRoot:t,getViewportOffset:s,keystrokeHandlerOptions:r}){super(e);u(this,"parts");u(this,"headerView");u(this,"closeButtonView");u(this,"actionsView");u(this,"contentView");u(this,"keystrokes");u(this,"focusTracker");u(this,"wasMoved",!1);u(this,"_getCurrentDomRoot");u(this,"_getViewportOffset");u(this,"_focusables");u(this,"_focusCycler");const o=this.bindTemplate,a=e.t;this.set("className",""),this.set("ariaLabel",a("Editor dialog")),this.set("isModal",!1),this.set("position",We.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=s,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new Ie,this.focusTracker=new de,this._focusables=new Ye,this._focusCycler=new vt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"},keystrokeHandlerOptions:r}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",o.if("isModal","ck-dialog-overlay__transparent",l=>!l),o.if("_isVisible","ck-hidden",l=>!l)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",o.if("isModal","ck-dialog_modal"),o.to("className")],role:"dialog","aria-label":o.to("ariaLabel"),style:{to
166p:o.to("_top",l=>ac(l)),left:o.to("_left",l=>ac(l)),visibility:o.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",(e,t)=>{e.defaultPrevented||(this.fire("close",{source:"escKeyPress"}),t())}),this.on("drag",(e,{deltaX:t,deltaY:s})=>{this.wasMoved=!0,this.moveBy(t,s)}),this.listenTo(C.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(C.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on("change:_isVisible",(e,t,s)=>{s&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView&&!this.isModal?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:s=!0,content:r,actionButtons:o}){t&&(this.headerView=new Js(this.locale,{icon:e}),s&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),r&&(r instanceof T&&(r=[r]),this.contentView=new B1(this.locale),this.contentView.children.addMany(r),this.parts.add(this.contentView)),o&&(this.actionsView=new V1(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const s=this._getViewportRect(),r=this._getDialogRect();e+r.width>s.right&&(e=s.right-r.width),e<s.left&&(e=s.left),t<s.top&&(t=s.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,s;this._getCurrentDomRoot()?s=this._getVisibleDomRootRect(e):t=We.SCREEN_CENTER;const r=xs.defaultOffset,o=this._getDialogRect();switch(t){case We.EDITOR_TOP_SIDE:{if(s){const a=this.locale.contentLanguageDirection==="ltr"?s.right-o.width-r:s.left+r;this.moveTo(a,s.top+r)}else this._moveOffScreen();break}case We.EDITOR_CENTER:{s?this.moveTo(Math.round(s.left+s.width/2-o.width/2),Math.round(s.top+s.height/2-o.height/2)):this._moveOffScreen();break}case We.SCREEN_CENTER:{this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break}case We.EDITOR_TOP_CENTER:{s?this.moveTo(Math.round(s.left+s.width/2-o.width/2),s.top+r):this._moveOffScreen();break}case We.EDITOR_BOTTOM_CENTER:{s?this.moveTo(Math.round(s.left+s.width/2-o.width/2),s.bottom-o.height-r):this._moveOffScreen();break}case We.EDITOR_ABOVE_CENTER:{s?this.moveTo(Math.round(s.left+s.width/2-o.width/2),s.top-o.height-r):this._moveOffScreen();break}case We.EDITOR_BELOW_CENTER:{s?this.moveTo(Math.round(s.left+s.width/2-o.width/2),s.bottom+r):this._moveOffScreen();break}}}_getVisibleDomRootRect(e){let t=new R(this._getCurrentDomRoot()).getVisible();if(t){if(t=e.getIntersection(t),!t)return null}else return null;return t}_getDialogRect(){return new R(this.element.firstElementChild)}_getViewportRect(){const e=new R(C.window);if(this.isModal)return e;const t={top:0,bottom:0,left:0,right:0,...this._getViewportOffset()};return e.top+=t.top,e.height-=t.top,e.bottom-=t.bottom,e.height-=t.bottom,e.left+=t.left,e.right-=t.right,e.width-=t.left+t.right,e}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)Fn(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),R1(t)&&this._focusCycler.chain(t.focusCycler)})}_createCloseButton(){const e=new B(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:$d}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}};u(xs,"defaultOffset",15);let lo=xs;const $e=class $e extends y{constructor(e){super(e);u(this,"view");u(this,"_onHide");const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}static get pluginName(){return"Dialog"}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),$e._visibleDialogPlugin===this&&this._unlockBodyScroll()}_initShowHideListeners(){this.on("show",(e,t)=>{this._show(t)}),this.on("show",(e,t)=>{t.onShow&&t.onShow(this)},{priority:"low"}),this.on("hide",()=>{$e._visibleDialogPlugin&&$e._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,s)=>{!this.isOpen||this.view.isModal||(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),s())})}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",()=>{if(!this.view)return;
166const t=e.document.differ.getChangedRoots();for(const s of t)s.state&&this.view.updatePosition()})}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:s,hasCloseButton:r=!0,content:o,actionButtons:a,className:l,isModal:c,position:d,onHide:h,keystrokeHandlerOptions:f}){const m=this.editor;this.view=new lo(m.locale,{getCurrentDomRoot:()=>m.editing.view.getDomRoot(m.model.document.selection.anchor.root.rootName),getViewportOffset:()=>m.ui.viewportOffset,keystrokeHandlerOptions:f});const g=this.view;g.on("close",()=>{this.hide()}),m.ui.view.body.add(g),m.keystrokes.listenTo(g.element),d||(d=c?We.SCREEN_CENTER:We.EDITOR_CENTER),c&&this._lockBodyScroll(),g.set({position:d,_isVisible:!0,className:l,isModal:c}),g.setupParts({icon:t,title:s,hasCloseButton:r,content:o,actionButtons:a}),this.id=e,h&&(this._onHide=h),this.isOpen=!0,$e._visibleDialogPlugin=this}hide(){$e._visibleDialogPlugin&&$e._visibleDialogPlugin.fire(`hide:${$e._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;const e=this.editor,t=this.view;t.isModal&&this._unlockBodyScroll(),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,$e._visibleDialogPlugin=null}_lockBodyScroll(){document.documentElement.classList.add("ck-dialog-scroll-locked")}_unlockBodyScroll(){document.documentElement.classList.remove("ck-dialog-scroll-locked")}};u($e,"_visibleDialogPlugin");let co=$e;class Bi extends B{constructor(e,t=new ih){super(e,t);u(this,"_checkIconHolderView",new L1);this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});const s=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",s.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",(r,o)=>r||o)}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind("isOn").to(this,"isOn",e=>this.isToggleable&&e),this.on("change:_hasCheck",(e,t,s)=>{const{children:r,_checkIconHolderView:o}=this;s?r.add(o,0):r.remove(o)})}}class L1 extends T{constructor(){super();u(this,"children");u(this,"_checkIconView",this._createCheckIconView());const e=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",!1),this.setTemplate({tag:"span",children:this.children,attributes:{class:["ck","ck-list-item-button__check-holder",e.to("isOn",t=>t?"ck-on":"ck-off")]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",(e,t,s)=>{const{children:r,_checkIconView:o}=this;s&&!r.has(o)?r.add(o):!s&&r.has(o)&&r.remove(o)})}_createCheckIconView(){const e=new st;return e.content=Ud,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}}class Z extends Bi{constructor(i){super(i),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}class F1 extends y{constructor(){super(...arguments);u(this,"contentView",null)}static get requires(){return[co]}static get pluginName(){return"AccessibilityHelp"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",()=>{const s=this._createButton(B);return s.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),s}),e.ui.componentFactory.add("menuBar:accessibilityHelp",()=>{const s=this._createButton(Z);return s.label=t("Accessibility"),s}),e.keystrokes.set("Alt+0",(s,r)=>{this._toggleDialog(),r()}),this._setupRootLabels()}_createButton(e){const t=this.editor,s=t.plugins.get("Dialog"),r=t.locale,o=new e(r);return o.set({keystroke:"Alt+0",icon:Fl,isToggleable:!0}),o.on("execute",()=>this._toggleDialog()),o.bind("isOn").to(s,"id",a=>a==="accessibilityHelp"),o}_setupRootLabels(){const e=this.editor,t=e.editing.view,s=e.t;e.ui.on("ready",()=>{t.change(o=>{for(const a of t.document.roots)r(o,a)}),e.on("addRoot",(o,a)=>{const l=e.editing.view.document.getRoot(a.rootName);t.change(c=>r(c,l))},{priority:"low"})});function r(o,a){const c=[a.getAttribute("aria-label"),s("Press %0 for help.",[b
166s("Alt+0")])].filter(d=>d).join(". ");o.setAttribute("aria-label",c,a)}}_toggleDialog(){const e=this.editor,t=e.plugins.get("Dialog"),s=e.locale.t;this.contentView||(this.contentView=new I1(e.locale,e.accessibility.keystrokeInfos)),t.id==="accessibilityHelp"?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:s("Accessibility help"),icon:Fl,hasCloseButton:!0,content:this.contentView})}}const Ve=class Ve extends Ye{constructor(e,t=[]){super(t);u(this,"locale");u(this,"_bodyCollectionContainer");this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new Ee({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render(),(!Ve._bodyWrapper||!Ve._bodyWrapper.isConnected)&&(Ve._bodyWrapper=Ue(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(Ve._bodyWrapper)),Ve._bodyWrapper.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove(),Ve._bodyWrapper&&!Ve._bodyWrapper.childElementCount&&(Ve._bodyWrapper.remove(),delete Ve._bodyWrapper)}};u(Ve,"_bodyWrapper");let uo=Ve;const lc=Ri("px"),N1={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}},ve=class ve extends T{constructor(e){super(e);u(this,"content");u(this,"_pinWhenIsVisibleCallback");u(this,"_resizeObserver");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._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",s=>`ck-balloon-panel_${s}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",lc),left:t.to("left",lc)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){const t=us(e.target);if(t&&!bt(t))return!1;this.show();const s=ve.defaultPositions,r=Object.assign({},{element:this.element,positions:[s.southArrowNorth,s.southArrowNorthMiddleWest,s.southArrowNorthMiddleEast,s.southArrowNorthWest,s.southArrowNorthEast,s.northArrowSouth,s.northArrowSouthMiddleWest,s.northArrowSouthMiddleEast,s.northArrowSouthWest,s.northArrowSouthEast,s.viewportStickyNorth],limiter:C.document.body,fitInViewport:!0},e),o=ve._getOptimalPosition(r)||N1,a=parseInt(o.left),l=parseInt(o.top),c=o.name,d=o.config||{},{withArrow:h=!0}=d;return this.top=l,this.left=a,this.position=c,this.withArrow=h,!0}pin(e){this.unpin(),this._startPinning(e)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback))}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){if(!this.attachTo(e))return!1;let t=us(e.target);const s=e.limiter?us(e.limiter):C.document.body;if(this.listenTo(C.document,"scroll",(r,o)=>{const a=o.target,l=t&&a.contains(t),c=s&&a.contains(s);(l||c||!t||!s)&&this.attachTo(e)},{useCapture:!0}),this.listenTo(C.window,"resize",()=>{this.attachTo(e)}),!this._resizeObserver&&(t&&G(t)&&(t=t.parentElement),t)){const r=()=>{bt(t)||this.unpin()};this._resizeObserver=new Si(t,r)}return!0}_stopPinning(){this.stopListening(C.document,"scroll"),this.stopListening(C.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(e={}){const{sideOffset:t=ve.arrowSideOffset,heightOffset:s=ve.arrowHeightOffset,stickyVerticalOffset:r=ve.stickyVerticalOffset,config:o}=e;return{northWestArrowSouthWest:(c,d)=>({top:a(c,d),left:c.left-t,name:"arrow_sw",...o&&{config:o}}),northWestArrowSouthMiddleWest:(c,d)=>({top:a(c,d),left:c.left-d.width*.25-t,name:"arrow_smw",...o&&{config:o}}),northWestArrowSouth:(c,d)=>({top:a(c,d),left:c.left-d.width/2,name:"arrow_s",...o&&{config:o}}),northWestArrowSouthMiddleEast:(c,d)=>({top:a(c,d),left:c.left-d.width*.75+t,name:"arrow_sme",...o&&{config:o}}),northWestArrowSouthEast:(c,d)=>({top:a(c,d),left:c.left-d.width+t,name:"arrow_se",...o&&{config:o}}),northArrowSouthWest:(c,d)=>({top:a(c,d),left:c.left+c.width/2-t,name:"arrow_sw",...o&&{config:o}}),northArrowSouthMiddleWest:(c,d)=>({top:a(c,d),left:c.left+c.width/2-d.width*.25-t,name:"arrow_smw",...o&&{config:o}}),northArrowSouth:(c,d)=>({top:a(c,d),left:c.left+c.width/2-d.width/2,name:"arrow_s",...o&&{config:o}}),northArrowSouthMiddleEast:(c,d)=>({top:a(c,d),left:c.left+c.width/2-d.width*.75+t,name:"arrow_sme",...o&&{config:o}}),northArrowSouthEast:(c,d)=>({top:a(c,d),left:c.left+c.width/2-d.width+t,name:"arrow_se",...o&&{config:o}}),northEastArrowSouthWest:(c,d)=>({top:a(c,d),left:c.right-t,name:"arrow_sw",...o&&{config:o}}),northEastArrowSouthMiddleWest:(c,d)=>({top:a(c,d),left:c.right-d.width*.25-t,name:"arrow_smw",...o&&{config:o}}),northEastArrowSouth:(c,d)=>({top:a(c,d),left:c.right-d.width/2,name:"arrow_s",...o&&{config:o}}),northEastArrowSouthMiddleEast:(c,d)=>({top:a(c,d),left:c.right-d.width*.75+t,name:"arrow_sme",...o&&{config:o}}),northEastArrowSouthEast:(c,d)=>({top:a(c,d),left:c.right-d.width+t,name:"arrow_se",...o&&{config:o}}),southWestArrowNorthWest:c=>({top:l(c),left:c.left-t,name:"arrow_nw",...o&&{config:o}}),southWestArrowNorthMiddleWest:(c,d)=>({top:l(c),left:c.left-d.width*.25-t,name:"arrow_nmw",...o&&{config:o}}),southWestArrowNorth:(c,d)=>({top:l(c),left:c.left-d.width/2,name:"arrow_n",...o&&{config:o}}),southWestArrowNorthMiddleEast:(c,d)=>({top:l(c),left:c.left-d.width*.75+t,name:"arrow_nme",...o&&{config:o}}),southWestArrowNorthEast:(c,d)=>({top:l(c),left:c.left-d.width+t,name:"arrow_ne",...o&&{config:o}}),southArrowNorthWest:c=>({top:l(c),left:c.left+c.width/2-t,name:"arrow_nw",...o&&{config:o}}),southArrowNorthMiddleWest:(c,d)=>({top:l(c),left:c.left+c.width/2-d.width*.25-t,name:"arrow_nmw",...o&&{config:o}}),southArrowNorth:(c,d)=>({top:l(c),left:c.left+c.width/2-d.width/2,name:"arrow_n",...o&&{config:o}}),southArrowNorthMiddleEast:(c,d)=>({top:l(c),left:c.left+c.width/2-d.width*.75+t,name:"arrow_nme",...o&&{config:o}}),southArrowNorthEast:(c,d)=>({top:l(c),left:c.left+c.width/2-d.width+t,name:"arrow_ne",...o&&{config:o}}),southEastArrowNorthWest:c=>({top:l(c),left:c.right-t,name:"arrow_nw",...o&&{config:o}}),southEastArrowNorthMiddleWest:(c,d)=>({top:l(c),left:c.right-d.width*.25-t,name:"arrow_nmw",...o&&{config:o}}),southEastArrowNorth:(c,d)=>({top:l(c),left:c.right-d.width/2,name:"arrow_n",...o&&{config:o}}),southEastArrowNorthMiddleEast:(c,d)=>({top:l(c),left:c.right-d.width*.75+t,name:"arrow_nme",...o&&{config:o}}),southEastArrowNorthEast:(c,d)=>({top:l(c),left:c.right-d.width+t,name:"arrow_ne",...o&&{config:o}}),westArrowEast:(c,d)=>({top:c.top+c.height/2-d.height/2,left:c.left-d.width-s,name:"arrow_e",...o&&{config:o}}),eastArrowWest:(c,d)=>({top:c.top+c.height/2-d.height/2,left:c.right+s,name:"arrow_w",...o&&{config:o}}),viewportStickyNorth:(c,d,h)=>{const f=new R(C.document.body).getIntersection(h.getVisible());if(!f)return null;const m=f.getVisible();return!c.getIntersection(m)||!(m.top-c.top-r<d.height&&m.bottom-c.bottom<d.height)?null:{top:m.top+r,left:c.left+c.width/2-d.width/2,name:"arrowless",config:{withArrow:!1,...o}}}};function a(c,d){return c.top-d.height-s}function l(c){return c.bottom+s}}};u(ve,"arrowSideOffset",25),u(ve,"arrowHeightOffset",10),u(ve,"stickyVerticalOffset",20),u(ve,"_getOptimalPosition",Uo),u(ve,"defaultPositions",ve.generatePositions());let It=ve;function us(n){return xt(n)?n:Ds(n)?n.commonAncestorContainer:typeof n=="function"?us(n()):null}const D1=50,z1=350;class nh extends De(){constructor(e,t={}){super();u(this,"editor");u(this,"_balloonView",null);u(this,"_showBalloonThrottled",wn(()=>this._showBalloon(),50,{leading:!0}));u(this,"_lastFocusedEditableElement",null);u(this,"_balloonClass");this.editor=e,this._balloonClass=t.balloonClass,e.on("ready",()=>this._handleEditorReady())}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;this._isEnabled()&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(t,s,r)=>{this._updateLastFocusedEditableElement(),r?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(t,s,r)=>{this._updateLastFocusedEditableElement(),r&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_getNormalizedConfig(){return{side:this.editor.locale.contentLanguageDirection==="ltr"?"right":"left",position:"border",verticalOffset:0,horizontalOffset:5}}_showBalloon(){const e=this._getBalloonAttachOptions();e&&(this._balloonView||(this._balloonView=this._createBalloonView()),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_createBalloonView(){const e=this.editor,t=new It,s=this._createBadgeContent();return t.content.add(s),this._balloonClass&&(t.class=this._balloonClass),e.ui.view.body.add(t),t}_getBalloonAttachOptions(){if(!this._lastFocusedEditableElement)return null;const e=this._getNormalizedConfig(),t=e.side==="right"?H1(this._lastFocusedEditableElement,e):W1(this._lastFocusedEditableElement,e);return{target:this._lastFocusedEditableElement,positions:[t]}}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,s=e.ui.focusTracker.focusedElement;if(!t||!s){this._lastFocusedEditableElement=null;return}const r=Array.from(e.ui.getEditableElementsNames()).map(o=>e.ui.getEditableElement(o));r.includes(s)?this._lastFocusedEditableElement=s:this._lastFocusedEditableElement=r[0]}}function H1(n,i){return sh(n,i,(e,t)=>e.left+e.width-t.width-i.horizontalOffset)}function W1(n,i){return sh(n,i,e=>e.left+i.horizontalOffset)}function sh(n,i,e){return(t,s)=>{const r=new R(n);if(r.width<z1||r.height<D1)return null;let o;i.position==="inside"?o=r.bottom-s.height:o=r.bottom-s.height/2,o-=i.verticalOffset;const a=e(r,s),c=t.clone().moveTo(a,o).getIntersection(s.clone().moveTo(a,o)).getVisible();return!c||c.getArea()<s.getArea()?null:{top:o,left:a,name:`position_${i.position}-side_${i.side}`,config:{withArrow:!1}
166}}}const $1="Powered by";class U1 extends nh{constructor(i){super(i,{balloonClass:"ck-powered-by-balloon"})}_isEnabled(){const i=this.editor;if(i.config.get("ui.poweredBy.forceVisible"))return!0;const t=i.config.get("licenseKey");if(t=="GPL")return!0;const s=jo(t.split(".")[1]);return s?!s.whiteLabel:!0}_createBadgeContent(){return new q1(this.editor.locale,this._getNormalizedConfig().label)}_getNormalizedConfig(){const i=super._getNormalizedConfig(),e=this.editor.config.get("ui.poweredBy")||{},t=e.position||i.position,s=t==="inside"?5:i.verticalOffset;return{position:t,side:e.side||i.side,label:e.label===void 0?$1:e.label,verticalOffset:e.verticalOffset!==void 0?e.verticalOffset:s,horizontalOffset:e.horizontalOffset!==void 0?e.horizontalOffset:i.horizontalOffset,forceVisible:!!e.forceVisible}}}class q1 extends T{constructor(i,e){super(i);const t=new st,s=this.bindTemplate;t.set({content:x0,isColorInherited:!1}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/powered-by-ckeditor/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...e?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[e]}]:[],t],on:{dragstart:s.to(r=>r.preventDefault())}}]})}}class fa extends B{constructor(e){super(e);u(this,"toggleSwitchView");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 T;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}class K1 extends G1(Bi){}function G1(n){class i extends n{constructor(...s){super(...s);u(this,"_fileInputView");this._fileInputView=new j1(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",()=>{this._fileInputView.open()}),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}return i}class j1 extends T{constructor(i){super(i),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to(()=>{var t,s;(s=(t=this.element)==null?void 0:t.files)!=null&&s.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}class FT extends T{constructor(e,t){super(e);u(this,"buttonView");u(this,"children");const s=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",s.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:s.if("isCollapsed","hidden"),"aria-labelledby":s.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){const e=new B(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:qs}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",s=>String(s))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",s=>!s),e.on("execute",()=>{this.isCollapsed=!this.isCollapsed}),e}}/**
167 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
168 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
169 */function J1(n,i){const e=n.t,t={Black:e("Black"),"Dim grey":e("Dim grey"),Grey:e("Grey"),"Light grey":e("Light grey"),White:e("White"),Red:e("Red"),Orange:e("Orange"),Yellow:e("Yellow"),"Light green":e("Light green"),Green:e("Green"),Aquamarine:e("Aquamarine"),Turquoise:e("Turquoise"),"Light blue":e("Light blue"),Blue:e("Blue"),Purple:e("Purple")};return i.map(s=>{const r=t[s.label];return r&&r!=s.label&&(s.label=r),s})}function Q1(n){return n.map(Y1).filter(i=>!!i)}function Y1(n){return typeof n=="string"?{model:n,label:n,hasBorder:!1,view:{name:"span",styles:{color:n}}}:{model:n.color,label:n.label||n.color,hasBorder:n.hasBorder===void 0?!1:n.hasBorder,view:{name:"span",styles:{color:`${n.color}`}}}}class rh extends B{constructor(i){super(i);const e=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=m0,this.extendTemplate({attributes:{style:{backgroundColor:e.to("color",t=>P.isMediaForcedColors?null:t)}
169,class:["ck","ck-color-grid__tile",e.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class cc extends T{constructor(e,t){super(e);u(this,"columns");u(this,"items");u(this,"focusTracker");u(this,"keystrokes");const s=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=(t==null?void 0:t.columns)||5;const r={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new de,this.keystrokes=new Ie,this.items.on("add",(o,a)=>{a.isOn=a.color===this.selectedColor}),s.forEach(o=>{const a=new rh;a.set({color:o.color,label:o.label,tooltip:!0,hasBorder:o.options.hasBorder}),a.on("execute",()=>{this.fire("execute",{value:o.color,hasBorder:o.options.hasBorder,label:o.label})}),this.items.add(a)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:r}}),this.on("change:selectedColor",(o,a,l)=>{for(const c of this.items)c.isOn=c.color===l})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){var e;super.render();for(const t of this.items)this.focusTracker.add(t.element);this.items.on("add",(t,s)=>{this.focusTracker.add(s.element)}),this.items.on("remove",(t,s)=>{this.focusTracker.remove(s.element)}),this.keystrokes.listenTo(this.element),S1({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:(e=this.locale)==null?void 0:e.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}function oh(n,i){if(!n)return"";const e=ah(n);if(!e)return"";if(e.space===i)return n;if(!ty(e))return"";const s=Ht[e.space][i];if(!s)return"";const r=s(e.space==="hex"?e.hexValue:e.values);return ey(r,i)}function X1(n){if(!n)return"";const i=ah(n);return i?i.space==="hex"?i.hexValue:oh(n,"hex"):"#000"}function Z1(n,i){customElements.get(n)===void 0&&customElements.define(n,i)}function ey(n,i){switch(i){case"hex":return`#${n}`;case"rgb":return`rgb(${n[0]}, ${n[1]}, ${n[2]})`;case"hsl":return`hsl(${n[0]}, ${n[1]}%, ${n[2]}%)`;case"hwb":return`hwb(${n[0]}, ${n[1]}, ${n[2]})`;case"lab":return`lab(${n[0]}% ${n[1]} ${n[2]})`;case"lch":return`lch(${n[0]}% ${n[1]} ${n[2]})`;default:return""}}function ah(n){if(n.startsWith("#")){const e=ql(n);return{space:"hex",values:e.values,hexValue:n,alpha:e.alpha}}const i=ql(n);return i.space?i:null}function ty(n){return Object.keys(Ht).includes(n.space)}class ho extends T{constructor(e,t){super(e);u(this,"fieldView");u(this,"labelView");u(this,"statusView");u(this,"fieldWrapperChildren");const s=`ck-labeled-field-view-${me()}`,r=`ck-labeled-field-view-status-${me()}`;this.fieldView=t(this,s,r),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(s),this.statusView=this._createStatusView(r),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(a,l)=>a||l);const o=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",o.to("class"),o.if("isEnabled","ck-disabled",a=>!a),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 js(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new T(this.locale),s=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",s.if("errorText","ck-labeled-field-view__status_error"),s.if("_statusText","ck-hidden",r=>!r)],id:e,role:s.if("errorText","alert")},children:[{text:s.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}class iy extends T{constructor(e){super(e);u(this,"focusTracker");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 de,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;
169this.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((...s)=>{this.fire("input",...s),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,s)=>{this._setDomElementValue(s),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=ny(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?"":e}}function ny(n){return!n.value}class lh extends iy{constructor(i){super(i),this.set("inputMode","text");const e=this.bindTemplate;this.extendTemplate({attributes:{inputmode:e.to("inputMode")}})}}class sy extends lh{constructor(i){super(i),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class ry extends lh{constructor(i,{min:e,max:t,step:s}={}){super(i);const r=this.bindTemplate;this.set("min",e),this.set("max",t),this.set("step",s),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:r.to("min"),max:r.to("max"),step:r.to("step")}})}}class oy extends T{constructor(e){super(e);u(this,"children");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",s=>`ck-dropdown__panel_${s}`),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to(s=>{s.target.tagName.toLocaleLowerCase()!=="input"&&s.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():(this.children.first,void 0)}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}const vi=class vi extends T{constructor(e,t,s){super(e);u(this,"buttonView");u(this,"panelView");u(this,"focusTracker");u(this,"keystrokes");u(this,"listView");u(this,"toolbarView");u(this,"menuView");const r=this.bindTemplate;this.buttonView=t,this.panelView=s,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 Ie,this.focusTracker=new de,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",r.to("class"),r.if("isEnabled","ck-disabled",o=>!o)],id:r.to("id"),"aria-describedby":r.to("ariaDescribedById")},children:[t,s]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":r.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,s,r)=>{if(r)if(this.panelPosition==="auto"){const o=vi._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=o?o.name:this._defaultPanelPositionName}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);const e=(t,s)=>{this.isOpen&&(this.isOpen=!1,s())};this.keystrokes.set("arrowdown",(t,s)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,s())}),this.keystrokes.set("arrowright",(t,s)=>{this.isOpen&&s()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:s,southWest:r,northEast:o,northWest:a,southMiddleEast:l,southMiddleWest:c,northMiddleEast:d,northMiddleWest:h}=vi.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[s,r,l,c,e,o,a,d,h,t]:[r,s,c,l,e,a,o,h,d,t]}get _defaultPanelPositionName(){return this.locale.uiLanguageDirection==="rtl"?"sw":"se"}};u(vi,"defaultPanelPositions",{south:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/2,name:"s"}),southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>
169({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),southMiddleEast:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/4,name:"sme"}),southMiddleWest:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)*3/4,name:"smw"}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:"n"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:"nme"}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)*3/4,name:"nmw"})}),u(vi,"_getOptimalPosition",Uo);let fo=vi;class ay extends B{constructor(e){super(e);u(this,"arrowView");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 st;return e.content=qs,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class Fe extends T{constructor(e){super(e);u(this,"children");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",s=>!s)],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}class ma extends T{constructor(i){super(i),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}class ds extends T{constructor(e,t=new js){super(e);u(this,"labelView");u(this,"items");u(this,"children");const s=this.bindTemplate,r=new Zt(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,r]),r.set({role:"group",ariaLabelledBy:t.id}),r.focusTracker.destroy(),r.keystrokes.destroy(),this.items=r.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",s.if("isVisible","ck-hidden",o=>!o)]},children:this.children})}focus(){if(this.items){const e=this.items.find(t=>!(t instanceof ma));e&&e.focus()}}}class Zt extends T{constructor(e){super(e);u(this,"focusables");u(this,"items");u(this,"focusTracker");u(this,"keystrokes");u(this,"_focusCycler");u(this,"_listItemGroupToChangeListeners",new WeakMap);const t=this.bindTemplate;this.focusables=new Ye,this.items=this.createCollection(),this.focusTracker=new de,this.keystrokes=new Ie,this._focusCycler=new vt({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 ds?this._registerFocusableItemsGroup(e):e instanceof Fe&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(const s of t.removed)s instanceof ds?this._deregisterFocusableItemsGroup(s):s instanceof Fe&&this._deregisterFocusableListItem(s);for(const s of Array.from(t.added).reverse())s instanceof ds?this._registerFocusableItemsGroup(s,t.index):this._registerFocusableListItem(s,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,s)=>{for(const r of s.removed)this._deregisterFocusableListItem(r);for(const r of Array.from(s.added).reverse())this._registerFocusableListItem(r,this.items.getIndex(e)+s.index)}}
169_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((r,o)=>{const a=typeof t<"u"?t+o:void 0;this._registerFocusableListItem(r,a)});const s=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,s),e.items.on("change",s)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}class ch extends T{constructor(i){super(i),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class ly extends T{constructor(i){super(i),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}/**
170 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
171 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
172 */function cy(n){return n.bindTemplate.to(i=>{i.target===n.element&&i.preventDefault()})}/**
173 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
174 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
175 */function uh(n){if(Array.isArray(n))return{items:n,removeItems:[]};const i={items:[],removeItems:[]};return n?{...i,...n}:i}const uy={alignLeft:u0,bold:Wd,importExport:v0,paragraph:E0,plus:A0,text:F0,threeVerticalDots:ca,pilcrow:P0,dragIndicator:p0};class Qs extends T{constructor(e,t){super(e);u(this,"options");u(this,"items");u(this,"focusTracker");u(this,"keystrokes");u(this,"itemsView");u(this,"children");u(this,"focusables");u(this,"_focusCycler");u(this,"_behavior");const s=this.bindTemplate,r=this.t;this.options=t||{},this.set("ariaLabel",r("Editor toolbar")),this.set("maxWidth","auto"),this.set("role","toolbar"),this.set("isGrouping",!!this.options.shouldGroupWhenFull),this.items=this.createCollection(),this.focusTracker=new de,this.keystrokes=new Ie,this.set("class",void 0),this.set("isCompact",!1),this.set("isVertical",!1),this.itemsView=new dy(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const o=e.uiLanguageDirection==="rtl";this._focusCycler=new vt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[o?"arrowright":"arrowleft","arrowup"],focusNext:[o?"arrowleft":"arrowright","arrowdown"]}});const a=["ck","ck-toolbar",s.to("class"),s.if("isCompact","ck-toolbar_compact"),s.if("isGrouping","ck-toolbar_grouping"),s.if("isVertical","ck-toolbar_vertical")];this.options.shouldGroupWhenFull&&this.options.isFloating&&a.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:a,role:s.to("role"),"aria-label":s.to("ariaLabel"),style:{maxWidth:s.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:cy(this)}}),this._behavior=this.options.shouldGroupWhenFull?new dc(this):new uc(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e);this.items.on("add",(e,t)=>{this.focusTracker.add(t)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t)}),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,s){this.items.addMany(this._buildItemsFromConfig(e,t,s))}switchBehavior(e){this._behavior.type!==e&&(this._behavior.destroy(),this.itemsView.children.clear(),this.focusables.clear(),e==="dynamic"?(this._behavior=new dc(this),this._behavior.render(this),this._behavior.refreshItems()):(this._behavior=new uc(this),this._behavior.render(this)))}_buildItemsFromConfig(e,t,s){const r=uh(e),o=s||r.removeItems;return this._cleanItemsConfiguration(r.items,t,o).map(l=>Le(l)?this._createNestedToolbarDropdown(l,t,o):l==="|"?new ch:l==="-"?new ly:t.create(l)).filter(l=>!!l)}_cleanItemsConfiguration(e,t,s){const r=e.filter((o,a,l)=>o==="|"?!0:s.indexOf(o)!==-1?!1:o==="-"?this.options.shouldGroupWhenFull?!1:!0:!Le(o)&&!t.has(o)?!1:!0);return this._cleanSeparatorsAndLineBreaks(r)}_cleanSeparatorsAndLineBreaks(e){const t=a=>a!=="-"&&a!=="|",s=e.length,r=e.findIndex(t);if(r===-1)return[];const o=s-e.slice().reverse().findIndex(t);return e.slice(r,o).filter((a,l,c)=>t(a)?!0:!(l>0&&c[l-1]===a))}_createNestedToolbarDropdown(e,t,s){let{label:r,icon:o,items:a,tooltip:l=!0,withText:c=!1}=e;if(a=this._cleanItemsConfiguration(a,t,s),!a.length)return null;const d=this.locale,h=ei(d);return r||void 0,h.class="ck-toolbar__nested-toolbar-dropdown",h.buttonView.set({label:r,tooltip:l,withText:!!c}),o!==!1?h.buttonView.icon=uy[o]||o||ca:h.buttonView.withText=!0,dh(h,(
175)=>h.toolbarView._buildItemsFromConfig(a,t,s)),h}}class dy extends T{constructor(e){super(e);u(this,"children");this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class uc{constructor(i){u(this,"type","static");i.isGrouping=!1,i.itemsView.children.bindTo(i.items).using(e=>e),i.focusables.bindTo(i.items).using(e=>Fn(e)?e:null)}render(){}destroy(){}}class dc{constructor(i){u(this,"type","dynamic");u(this,"view");u(this,"viewChildren");u(this,"viewFocusables");u(this,"viewItemsView");u(this,"viewFocusTracker");u(this,"viewLocale");u(this,"ungroupedItems");u(this,"groupedItems");u(this,"groupedItemsDropdown");u(this,"resizeObserver",null);u(this,"cachedPadding",null);u(this,"shouldUpdateGroupingOnNextResize",!1);u(this,"viewElement");this.view=i,this.viewChildren=i.children,this.viewFocusables=i.focusables,this.viewItemsView=i.itemsView,this.viewFocusTracker=i.focusTracker,this.viewLocale=i.locale,this.view.isGrouping=!0,this.ungroupedItems=i.createCollection(),this.groupedItems=i.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),i.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),i.children.on("change",this._updateFocusCyclableItems.bind(this)),i.items.on("change",(e,t)=>{const s=t.index,r=Array.from(t.added);for(const o of t.removed)s>=this.ungroupedItems.length?this.groupedItems.remove(o):this.ungroupedItems.remove(o);for(let o=s;o<s+r.length;o++){const a=r[o-s];o>this.ungroupedItems.length?this.groupedItems.add(a,o-this.ungroupedItems.length):this.ungroupedItems.add(a,o)}this._updateGrouping()})}render(i){this.viewElement=i.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(i)}destroy(){this.groupedItemsDropdown.destroy(),this.viewChildren.length>1&&(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last)),this.resizeObserver.destroy()}refreshItems(){const i=this.view;if(i.items.length){for(let e=0;e<i.items.length;e++){const t=[...i.items][e];this.ungroupedItems.add(t,e)}this._updateGrouping()}}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!bt(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}const i=this.groupedItems.length;let e;for(;this._areItemsOverflowing;)this._groupLastItem(),e=!0;if(!e&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==i&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const i=this.viewElement,e=this.viewLocale.uiLanguageDirection,t=new R(i.lastChild),s=new R(i);if(!this.cachedPadding){const r=C.window.getComputedStyle(i),o=e==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(r[o])}return e==="ltr"?t.right>s.right-this.cachedPadding:t.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let i;this.resizeObserver=new Si(this.viewElement,e=>{(!i||i!==e.contentRect.width||this.shouldUpdateGroupingOnNextResize)&&(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),i=e.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(i){i.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new ch),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 i=this.viewLocale,e=i.t,t=ei(i);return t.class="ck-toolbar__grouped-dropdown",t.panelPosition=i.uiLanguageDirection==="ltr"?"sw":"se",dh(t,this.groupedItems),t.buttonView.set({label:e("Show more items"),tooltip:!0,tooltipPosition:i.uiLanguageDirection==="rtl"?"se":"sw",icon:ca}),t}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(i=>{Fn(i)&&this.viewFocusables.add(i)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}class hy extends T{constructor(e,t){super(e);u(this,"children");u(this,"actionView");u(this,"arrowView");u(this,"keystrokes");u(this,"focusTracker");const s=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 Ie,this.focusTracker=new de,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",s.to("class"),s.if("isVisible","ck-hidden",r=>!r),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 B;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 B,t=e.bindTemplate;return e.icon=qs,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",s=>String(s))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}function ei(n,i=ay){const e=typeof i=="function"?new i(n):i,t=new oy(n),s=new fo(n,e,t);return e.bind("isEnabled").to(s),e instanceof hy?e.arrowView.bind("isOn").to(s,"isOpen"):e.bind("isOn").to(s,"isOpen"),fy(s),s}function dh(n,i,e={}){n.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),n.isOpen?hc(n,i,e):n.once("change:isOpen",()=>hc(n,i,e),{priority:"highest"}),e.enableActiveItemFocusOnDropdownOpen&&pa(n,()=>n.toolbarView.items.find(t=>t.isOn))}function hc(n,i,e){const t=n.locale,s=t.t,r=n.toolbarView=new Qs(t),o=typeof i=="function"?i():i;r.ariaLabel=e.ariaLabel||s("Dropdown toolbar"),e.maxWidth&&(r.maxWidth=e.maxWidth),e.class&&(r.class=e.class),e.isCompact&&(r.isCompact=e.isCompact),e.isVertical&&(r.isVertical=!0),o 
175instanceof Ye?r.items.bindTo(o).using(a=>a):r.items.addMany(o),n.panelView.children.add(r),n.focusTracker.add(r),r.items.delegate("execute").to(n)}function ga(n,i,e={}){n.isOpen?fc(n,i,e):n.once("change:isOpen",()=>fc(n,i,e),{priority:"highest"}),pa(n,()=>n.listView.items.find(t=>t instanceof Fe?t.children.first.isOn:!1))}function fc(n,i,e){const t=n.locale,s=n.listView=new Zt(t),r=typeof i=="function"?i():i;s.ariaLabel=e.ariaLabel,s.role=e.role,fh(n,s.items,r,t),n.panelView.children.add(s),s.items.delegate("execute").to(n)}function pa(n,i){n.on("change:isOpen",()=>{if(!n.isOpen)return;const e=i();e&&(typeof e.focus=="function"?e.focus():void 0)},{priority:Tt.low-10})}function fy(n){my(n),gy(n),py(n),wy(n),by(n),_y(n)}function my(n){Gs({emitter:n,activator:()=>n.isRendered&&n.isOpen,callback:()=>{n.isOpen=!1},contextElements:()=>[n.element,...hh(n.focusTracker).filter(i=>!n.element.contains(i))]})}function hh(n){return[...n.elements,...n.externalViews.flatMap(i=>hh(i.focusTracker))]}function gy(n){n.on("execute",i=>{i.source instanceof fa||(n.isOpen=!1)})}function py(n){n.focusTracker.on("change:isFocused",(i,e,t)=>{t||!n.isOpen||(n.isOpen=!1)})}function wy(n){n.keystrokes.set("arrowdown",(i,e)=>{n.isOpen&&(n.panelView.focus(),e())}),n.keystrokes.set("arrowup",(i,e)=>{n.isOpen&&(n.panelView.focusLast(),e())})}function by(n){n.on("change:isOpen",(i,e,t)=>{if(t)return;n.focusTracker.elements.some(r=>r.contains(C.document.activeElement))&&n.buttonView.focus()})}function _y(n){n.on("change:isOpen",(i,e,t)=>{t&&n.panelView.focus()},{priority:"low"})}function fh(n,i,e,t){yy(i),i.bindTo(e).using(s=>{if(s.type==="separator")return new ma(t);if(s.type==="group"){const r=new ds(t);return r.set({label:s.label}),fh(n,r.items,s.items,t),r.items.delegate("execute").to(n),r}else if(s.type==="button"||s.type==="switchbutton"){const r=s.model.role==="menuitemcheckbox"||s.model.role==="menuitemradio",o=new Fe(t);let a;return s.type==="button"?(a=new Bi(t),a.set({isToggleable:r})):a=new fa(t),a.bind(...Object.keys(s.model)).to(s.model),a.delegate("execute").to(o),o.children.add(a),o}return null})}function yy(n){let i=0;const e=r=>!(r instanceof Fe)||!(r.children.first instanceof Bi)?null:r.children.first,t=r=>{const o=e(r);return!o||!o.isToggleable?null:o},s=r=>{for(const o of n){const a=e(o);a&&(a.hasCheckSpace=r)}};n.on("change",(r,o)=>{const a=i>0;for(const c of o.removed)t(c)&&i--;for(const c of o.added){const d=e(c);d&&(d.isToggleable&&i++,d.hasCheckSpace=i>0)}const l=i>0;a!==l&&s(l)})}const mo=(n,i,e)=>{const t=new sy(n.locale);return t.set({id:i,ariaDescribedById:e}),t.bind("isReadOnly").to(n,"isEnabled",s=>!s),t.bind("hasError").to(n,"errorText",s=>!!s),t.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(t),t},NT=(n,i,e)=>{const t=new ry(n.locale);return t.set({id:i,ariaDescribedById:e,inputMode:"numeric"}),t.bind("isReadOnly").to(n,"isEnabled",s=>!s),t.bind("hasError").to(n,"errorText",s=>!!s),t.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(t),t},DT=(n,i,e)=>{const t=ei(n.locale);return t.set({id:i,ariaDescribedById:e}),t.bind("isEnabled").to(n),t},vy=150;class ky extends T{constructor(e,t={}){super(e);u(this,"hexInputRow");u(this,"_debounceColorPickerEvent");u(this,"_config");this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const s=this.createCollection();t.hideInput||s.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:s}),this._config=t,this._debounceColorPickerEvent=pt(r=>{this.set("color",r),this.fire("colorSelected",{color:this.color})},vy,{leading:!0}),this.on("set:color",(r,o,a)=>{r.return=oh(a,this._config.format||"hsl")}),this.on("change:color",()=>{this._hexColor=kr(this.color)}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),kr(this.color)!=kr(this._hexColor)&&(this.color=this._hexColor)})}render(){if(super.render(),Z1("hex-color-picker",h1),this.picker=C.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&&(P.isGecko||P.isiOS||P.isSafari||P.isBlink)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const s=[...this.picker.shadowRoot.children].filter(r=>r.getAttribute("role")==="slider").map(r=>new Cy(r));
175this.slidersView=this.createCollection(),s.forEach(r=>{this.slidersView.add(r)})}_createInputRow(){const e=this._createColorInput();return new Ty(this.locale,e)}_createColorInput(){const e=new ho(this.locale,mo),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",s=>e.isFocused?e.fieldView.value:s.startsWith("#")?s.substring(1):s),e.fieldView.on("input",()=>{const s=e.fieldView.element.value;if(s){const r=mh(s);r&&this._debounceColorPickerEvent(r)}}),e}isValid(){const{t:e}=this.locale;return this._config.hideInput?!0:(this.resetValidationStatus(),this.hexInputRow.getParsedColor()?!0:(this.hexInputRow.inputView.errorText=e('Please enter a valid color (e.g. "ff0000").'),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function kr(n){let i=X1(n);return i||(i="#000"),i.length===4&&(i="#"+[i[1],i[1],i[2],i[2],i[3],i[3]].join("")),i.toLowerCase()}class Cy extends T{constructor(i){super(),this.element=i}focus(){this.element.focus()}}class Ey extends T{constructor(i){super(i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class Ty extends T{constructor(e,t){super(e);u(this,"children");u(this,"inputView");this.inputView=t,this.children=this.createCollection([new Ey,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return mh(this.inputView.fieldView.element.value)}}function mh(n){if(!n)return null;const i=n.trim().replace(/^#/,"");return![3,4,6,8].includes(i.length)||!/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(i)?null:`#${i}`}class Py extends q(Se){constructor(i){super(i),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",this.length===0)})}add(i,e){return this.find(t=>t.color===i.color)?this:super.add(i,e)}hasColor(i){return!!this.find(e=>e.color===i)}}class Ay extends T{constructor(e,{colors:t,columns:s,removeButtonLabel:r,documentColorsLabel:o,documentColorsCount:a,colorPickerLabel:l,focusTracker:c,focusables:d}){super(e);u(this,"items");u(this,"colorDefinitions");u(this,"focusTracker");u(this,"columns");u(this,"documentColors");u(this,"documentColorsCount");u(this,"staticColorsGrid");u(this,"documentColorsGrid");u(this,"colorPickerButtonView");u(this,"removeColorButtonView");u(this,"_focusables");u(this,"_documentColorsLabel");u(this,"_removeButtonLabel");u(this,"_colorPickerLabel");const h=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=c,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=s,this.documentColors=new Py,this.documentColorsCount=a,this._focusables=d,this._removeButtonLabel=r,this._colorPickerLabel=l,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",h.if("isVisible","ck-hidden",f=>!f)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const s=e.document,r=this.documentColorsCount;this.documentColors.clear();for(const o of s.getRoots()){const a=e.createRangeIn(o);for(const l of a.getItems())if(l.is("$textProxy")&&l.hasAttribute(t)&&(this._addColorToDocumentColors(l.getAttribute(t)),this.documentColors.length>=r))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,s=this.selectedColor;t.selectedColor=s,e&&(e.selectedColor=s)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=Ee.bind(this.documentColors,this.documentColors),t=new T(this.locale);t.setTemplate({tag:"span",attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]},children:[{text:this._documentColorsLabel}]}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}
175addColorPickerButton(){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 B,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:f0,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show")})}_createRemoveColorButton(){const e=new B;return e.set({withText:!0,icon:w0,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 cc(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",(t,s)=>{this.fire("execute",{value:s.value,source:"staticColorsGrid"})}),e}_createDocumentColorsGrid(){const e=Ee.bind(this.documentColors,this.documentColors),t=new cc(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(s=>{var o;const r=new rh;return r.set({color:s.color,hasBorder:(o=s.options)==null?void 0:o.hasBorder}),s.label&&r.set({label:s.label,tooltip:!0}),r.on("execute",()=>{this.fire("execute",{value:s.color,source:"documentColorsGrid"})}),r}),this.documentColors.on("change:isEmpty",(s,r,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(s=>s.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}class xy extends T{constructor(e,{focusTracker:t,focusables:s,keystrokes:r,colorPickerViewConfig:o}){super(e);u(this,"items");u(this,"colorPickerView");u(this,"saveButtonView");u(this,"cancelButtonView");u(this,"actionBarView");u(this,"focusTracker");u(this,"keystrokes");u(this,"_focusables");u(this,"_colorPickerViewConfig");this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=r,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=s,this._colorPickerViewConfig=o;const a=this.bindTemplate,{saveButtonView:l,cancelButtonView:c}=this._createActionButtons();this.saveButtonView=l,this.cancelButtonView=c,this.actionBarView=this._createActionBarView({saveButtonView:l,cancelButtonView:c}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",a.if("isVisible","ck-hidden",d=>!d)]},children:this.items})}render(){super.render();const e=new ky(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,s,r)=>{e.color=r}),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 s=new T,r=this.createCollection();return r.add(e),r.add(t),s.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:r}),s}_createActionButtons(){const e=this.locale,t=e.t,s=new B(e),r=new B(e);return s.set({icon:Ud,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),r.set({icon:$d,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),s.on("execute",()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})}),r.on("execute",()=>{this.fire("colorPicker:cancel")}),{saveButtonView:s,cancelButtonView:r}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",(e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)})}}class gh extends T{constructor(e,{colors:t,columns:s,removeButtonLabel:r,documentColorsLabel:o,documentColorsCount:a,colorPickerLabel:l,colorPickerViewConfig:c}
175){super(e);u(this,"focusTracker");u(this,"keystrokes");u(this,"items");u(this,"colorGridsFragmentView");u(this,"colorPickerFragmentView");u(this,"_focusCycler");u(this,"_focusables");u(this,"_colorPickerViewConfig");this.items=this.createCollection(),this.focusTracker=new de,this.keystrokes=new Ie,this._focusables=new Ye,this._colorPickerViewConfig=c,this._focusCycler=new vt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new Ay(e,{colors:t,columns:s,removeButtonLabel:r,documentColorsLabel:o,documentColorsCount:a,colorPickerLabel:l,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new xy(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:c}),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",(d,h,f)=>{this.colorGridsFragmentView.set("selectedColor",f),this.colorPickerFragmentView.set("selectedColor",f)}),this.colorGridsFragmentView.on("change:selectedColor",(d,h,f)=>{this.set("selectedColor",f)}),this.colorPickerFragmentView.on("change:selectedColor",(d,h,f)=>{this.set("selectedColor",f)}),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))}}class Sy{constructor(i){u(this,"editor");u(this,"_components",new Map);this.editor=i}*names(){for(const i of this._components.values())yield i.originalName}add(i,e){this._components.set(Cr(i),{callback:e,originalName:i})}create(i){if(!this.has(i))throw new p("componentfactory-item-missing",this,{name:i});return this._components.get(Cr(i)).callback(this.editor.locale)}has(i){return this._components.has(Cr(i))}}function Cr(n){return String(n).toLowerCase()}const mc="ck-tooltip",re=class re extends De(){constructor(e){super();u(this,"tooltipTextView");u(this,"balloonPanelView");u(this,"_currentElementWithTooltip",null);u(this,"_currentTooltipPosition",null);u(this,"_mutationObserver",null);u(this,"_pinTooltipDebounced");u(this,"_unpinTooltipDebounced");u(this,"_watchdogExcluded");if(re._editors.add(e),re._instance)return re._instance;re._instance=this,this.tooltipTextView=new T(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 It(e.locale),this.balloonPanelView.class=mc,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=Iy(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=pt(this._pinTooltip,600),this._unpinTooltipDebounced=pt(this._unpinTooltip,400),this.listenTo(C.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(C.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(C.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(C.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(C.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(C.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;re._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),re._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),re._instance=null)}static getPositioningFunctions(e){const t=re.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]}
175_onKeyDown(e,t){t.key==="Escape"&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const s=Er(t);if(!s){e.name==="focus"&&this._unpinTooltip();return}if(s===this._currentElementWithTooltip){this._unpinTooltipDebounced.cancel();return}this._unpinTooltip(),e.name==="focus"&&!s.matches(":hover")||s.matches("[data-cke-tooltip-instant]")?this._pinTooltip(s,Tr(s)):this._pinTooltipDebounced(s,Tr(s))}_onLeaveOrBlur(e,{target:t,relatedTarget:s}){if(e.name==="mouseleave"){if(!xt(t))return;const r=this.balloonPanelView.element,o=r&&(r===s||r.contains(s)),a=!o&&t===r;if(o){this._unpinTooltipDebounced.cancel();return}if(!a&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const l=Er(t),c=Er(s);(a||l&&l!==c)&&(this._pinTooltipDebounced.cancel(),this._currentElementWithTooltip&&this._currentElementWithTooltip.matches("[data-cke-tooltip-instant]")||l&&l.matches("[data-cke-tooltip-instant]")?this._unpinTooltip():this._unpinTooltipDebounced())}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._pinTooltipDebounced.cancel(),this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:s,cssClass:r}){this._unpinTooltip();const o=ye(re._editors.values()).ui.view.body;o.has(this.balloonPanelView)||o.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.class=[mc,r].filter(a=>a).join(" "),this.balloonPanelView.pin({target:e,positions:re.getPositioningFunctions(s)}),this._mutationObserver.attach(e);for(const a of re._editors)this.listenTo(a.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=s}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of re._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;const e=Tr(this._currentElementWithTooltip);if(!bt(this._currentElementWithTooltip)||!e.text){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:re.getPositioningFunctions(e.position)})}};u(re,"defaultBalloonPositions",It.generatePositions({heightOffset:5,sideOffset:13})),u(re,"_editors",new Set),u(re,"_instance",null);let go=re;function Er(n){return xt(n)?n.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function Tr(n){return{text:n.dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}}function Iy(n){const i=new MutationObserver(()=>{n()});return{attach(e){i.observe(e,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){i.disconnect()}}}class Oy extends nh{constructor(e){super(e,{balloonClass:"ck-evaluation-badge-balloon"});u(this,"licenseTypeMessage",{evaluation:"For evaluation purposes only",trial:"For evaluation purposes only",development:"For development purposes only"})}_isEnabled(){const t=this.editor.config.get("licenseKey"),s=gc(t);return!!(s&&this.licenseTypeMessage[s])}_createBadgeContent(){const e=this.editor.config.get("licenseKey"),t=gc(e);return new My(this.editor.locale,this.licenseTypeMessage[t])}_getNormalizedConfig(){const e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{},s=t.position||e.position,r=t.side||e.side;return{position:s,side:r==="left"?"right":"left",verticalOffset:e.verticalOffset,horizontalOffset:e.horizontalOffset}}}class My extends T{constructor(i,e){super(i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-evaluation-badge"],"aria-hidden":!0},children:[{tag:"span",attributes:{class:["ck","ck-evaluation-badge__label"]},children:[e]}]})}}function gc(n){if(n=="GPL")return"GPL";const i=jo(n.split(".")[1]);return i?i.licenseType||"production":null}class Nn extends Fe{constructor(i,e){super(i);const t=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:t.to("mouseenter")}}),this.delegate("mouseenter").to(e)}}const Qn=5,ai={toggleMenusAndFocusItemsOnHover(n){n.on("menu:mouseenter",i=>{if(!(!n.isFocusBorderEnabled&&!n.isOpen)){if(n.isOpen)for(const e of n.menus){const t=i.path[0],s=t instanceof Nn&&t.children.first===e;e.isOpen=(i.path.includes(e)||s)&&e.isEnabled}
175i.source.focus()}})},focusCycleMenusOnArrows(n){const i=n.locale.uiLanguageDirection==="rtl";n.on("menu:arrowright",t=>{e(t.source,i?-1:1)}),n.on("menu:arrowleft",t=>{e(t.source,i?1:-1)});function e(t,s){const r=n.children.getIndex(t),o=t.isOpen,a=n.children.length,l=n.children.get((r+a+s)%a);t.isOpen=!1,o&&(l.isOpen=!0),l.buttonView.focus()}},closeMenusWhenTheBarCloses(n){n.on("change:isOpen",()=>{n.isOpen||n.menus.forEach(i=>{i.isOpen=!1})})},closeMenuWhenAnotherOnTheSameLevelOpens(n){n.on("menu:change:isOpen",(i,e,t)=>{t&&n.menus.filter(s=>i.source.parentMenuView===s.parentMenuView&&i.source!==s&&s.isOpen).forEach(s=>{s.isOpen=!1})})},closeOnClickOutside(n){Gs({emitter:n,activator:()=>n.isOpen,callback:()=>n.close(),contextElements:()=>n.children.map(i=>i.element)})},enableFocusHighlightOnInteraction(n){let i=!1;n.on("change:isOpen",(e,t,s)=>{s||(i||(n.isFocusBorderEnabled=!1),i=!1)}),n.listenTo(n.element,"keydown",()=>{i=!0},{useCapture:!0}),n.listenTo(n.element,"keyup",()=>{i=!1},{useCapture:!0}),n.listenTo(n.element,"focus",()=>{i&&(n.isFocusBorderEnabled=!0)},{useCapture:!0})}},kt={openAndFocusPanelOnArrowDownKey(n){n.keystrokes.set("arrowdown",(i,e)=>{n.isEnabled&&n.focusTracker.focusedElement===n.buttonView.element&&(n.isOpen||(n.isOpen=!0),n.panelView.focus(),e())})},openOnArrowRightKey(n){const i=n.locale.uiLanguageDirection==="rtl"?"arrowleft":"arrowright";n.keystrokes.set(i,(e,t)=>{n.focusTracker.focusedElement!==n.buttonView.element||!n.isEnabled||(n.isOpen||(n.isOpen=!0),n.panelView.focus(),t())})},openOnButtonClick(n){n.buttonView.on("execute",()=>{n.isOpen=!0})},toggleOnButtonClick(n){n.buttonView.on("execute",()=>{n.isOpen=!n.isOpen})},openAndFocusOnEnterKeyPress(n){n.keystrokes.set("enter",(i,e)=>{n.focusTracker.focusedElement===n.buttonView.element&&(n.isOpen=!0,n.panelView.focus(),e())})},closeOnArrowLeftKey(n){const i=n.locale.uiLanguageDirection==="rtl"?"arrowright":"arrowleft";n.keystrokes.set(i,(e,t)=>{n.isOpen&&(n.isOpen=!1,n.focus(),t())})},closeOnEscKey(n){n.keystrokes.set("esc",(i,e)=>{n.isOpen&&(n.isOpen=!1,n.focus(),e())})},closeOnParentClose(n){n.parentMenuView.on("change:isOpen",(i,e,t)=>{!t&&i.source===n.parentMenuView&&(n.isOpen=!1)})}},Ry={southEast:n=>({top:n.bottom,left:n.left,name:"se"}),southWest:(n,i)=>({top:n.bottom,left:n.left-i.width+n.width,name:"sw"}),northEast:(n,i)=>({top:n.top-i.height,left:n.left,name:"ne"}),northWest:(n,i)=>({top:n.top-i.height,left:n.left-i.width+n.width,name:"nw"}),eastSouth:n=>({top:n.top,left:n.right-Qn,name:"es"}),eastNorth:(n,i)=>({top:n.top-i.height,left:n.right-Qn,name:"en"}),westSouth:(n,i)=>({top:n.top,left:n.left-i.width+Qn,name:"ws"}),westNorth:(n,i)=>({top:n.top-i.height,left:n.left-i.width+Qn,name:"wn"})},Vy=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditingEnhanced",items:["menuBar:sourceEditingEnhanced"]},{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"fullscreen",items:["menuBar:fullscreen"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable","menuBar:insertTableLayout"]},{groupId:"insertInline",items:["menuBar:link","menuBar:bookmark","menuBar:comment","menuBar:insertMergeField","menuBar:emoji"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]}
175,{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:lineHeight","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 By(n){let i;return!("items"in n)||!n.items?i={items:_e(Vy),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...n}:i={items:n.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...n},i}function Ly({normalizedConfig:n,locale:i,componentFactory:e,extraItems:t}){const s=_e(n);return pc(n,s,t),Fy(n,s),pc(n,s,s.addItems),Ny(n,s,e),ph(n,s),Dy(s,i),s}function Fy(n,i){const e=i.removeItems,t=[];i.items=i.items.filter(({menuId:s})=>e.includes(s)?(t.push(s),!1):!0),Li(i.items,s=>{s.groups=s.groups.filter(({groupId:r})=>e.includes(r)?(t.push(r),!1):!0);for(const r of s.groups)r.items=r.items.filter(o=>{const a=wh(o);return e.includes(a)?(t.push(a),!1):!0})});for(const s of e)t.includes(s)||void 0}function pc(n,i,e){const t=[];if(e.length!=0){for(const s of e){const r=Wy(s.position),o=$y(s.position);if(zy(s))if(!o)r==="start"?(i.items.unshift(s.menu),t.push(s)):r==="end"&&(i.items.push(s.menu),t.push(s));else{const a=i.items.findIndex(l=>l.menuId===o);a!=-1?r==="before"?(i.items.splice(a,0,s.menu),t.push(s)):r==="after"&&(i.items.splice(a+1,0,s.menu),t.push(s)):wc(i,s.menu,o,r)&&t.push(s)}else Hy(s)?Li(i.items,a=>{if(a.menuId===o)r==="start"?(a.groups.unshift(s.group),t.push(s)):r==="end"&&(a.groups.push(s.group),t.push(s));else{const l=a.groups.findIndex(c=>c.groupId===o);l!==-1&&(r==="before"?(a.groups.splice(l,0,s.group),t.push(s)):r==="after"&&(a.groups.splice(l+1,0,s.group),t.push(s)))}}):wc(i,s.item,o,r)&&t.push(s)}for(const s of e)t.includes(s)||void 0}}function wc(n,i,e,t){let s=!1;return Li(n.items,r=>{for(const{groupId:o,items:a}of r.groups){if(s)return;if(o===e)t==="start"?(a.unshift(i),s=!0):t==="end"&&(a.push(i),s=!0);else{const l=a.findIndex(c=>wh(c)===e);l!==-1&&(t==="before"?(a.splice(l,0,i),s=!0):t==="after"&&(a.splice(l+1,0,i),s=!0))}}}),s}function Ny(n,i,e){Li(i.items,t=>{for(const s of t.groups)s.items=s.items.filter(r=>{const o=typeof r=="string"&&!e.has(r);return o&&!i.isUsingDefaultConfig&&(_e(t),void 0),!o})})}function ph(n,i){const e=i.isUsingDefaultConfig;let t=!1;if(i.items=i.items.filter(s=>s.groups.length?!0:(Pr(n,s,e),!1)),!i.items.length){Pr(n,n,e);return}Li(i.items,s=>{s.groups=s.groups.filter(r=>r.items.length?!0:(t=!0,!1));for(const r of s.groups)r.items=r.items.filter(o=>bh(o)&&!o.groups.length?(Pr(n,o,e),t=!0,!1):!0)}),t&&ph(n,i)}function Pr(n,i,e){e||void 0}function Dy(n,i){const e=i.t,t={File:e({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:e({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:e({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:e({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:e({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:e({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:e({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:e({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:e({string:"Font",id:"MENU_BAR_MENU_FONT"})};Li(n.items,s=>{s.label in t&&(s.label=t[s.label])})}
175function Li(n,i){if(Array.isArray(n))for(const t of n)e(t);function e(t){i(t);for(const s of t.groups)for(const r of s.items)bh(r)&&e(r)}}function zy(n){return typeof n=="object"&&"menu"in n}function Hy(n){return typeof n=="object"&&"group"in n}function Wy(n){return n.startsWith("start")?"start":n.startsWith("end")?"end":n.startsWith("after")?"after":"before"}function $y(n){const i=n.match(/^[^:]+:(.+)/);return i?i[1]:null}function wh(n){return typeof n=="string"?n:n.menuId}function bh(n){return typeof n=="object"&&"menuId"in n}class Uy extends q(){constructor(e){super();u(this,"editor");u(this,"componentFactory");u(this,"focusTracker");u(this,"tooltipManager");u(this,"poweredBy");u(this,"evaluationBadge");u(this,"ariaLiveAnnouncer");u(this,"isReady",!1);u(this,"_editableElementsMap",new Map);u(this,"_focusableToolbarDefinitions",[]);u(this,"_extraMenuBarElements",[]);u(this,"_lastFocusedForeignElement",null);u(this,"_domEmitter");const t=e.editing.view;this.editor=e,this.componentFactory=new Sy(e),this.focusTracker=new de,this.tooltipManager=new go(e),this.poweredBy=new U1(e),this.evaluationBadge=new Oy(e),this.ariaLiveAnnouncer=new E1(e),this._initViewportOffset(this._readViewportOffsetFromConfig()),this.once("ready",()=>{this._bindBodyCollectionWithFocusTracker(),this.isReady=!0}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking(),this._initVisualViewportSupport()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy(),this.evaluationBadge.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this._domEmitter&&this._domEmitter.stopListening()}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const s=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?s():this.once("ready",s)}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),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}extendMenuBar(e){this._extraMenuBarElements.push(e)}initMenuBar(e){const t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);const s=By(this.editor.config.get("menuBar")||{});e.fillFromConfig(s,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",(r,o)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),o())}),this.editor.keystrokes.set("Alt+F9",(r,o)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),o())})}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const s=e.config.get("toolbar.viewportTopOffset");return s?{top:s}:{top:0}}_initFocusTracking(){const e=this.editor;let t;e.keystrokes.set("Alt+F10",(s,r)=>{this._saveLastFocusedForeignElement();const o=this._getCurrentFocusedToolbarDefinition();(!o||!t)&&(t=this._getFocusableCandidateToolbarDefinitions());for(let a=0;a<t.length;a++){const l=t.shift();if(t.push(l),l!==o&&this._focusFocusableCandidateToolbar(l)){o&&o.options.afterBlur&&o.options.afterBlur();break}}r()}),e.keystrokes.set("Esc",(s,r)=>{const o=this._getCurrentFocusedToolbarDefinition();o&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),o.options.afterBlur&&o.options.afterBlur(),r())})}_saveLastFocusedForeignElement(){const e=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(e)&&!Array.from(this.editor.editing.view.domRoots.values()).includes(e)&&(this._lastFocusedForeignElement=e)}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:s,options:r}=t;(bt(s.element)||r.beforeFocus)&&e.push(t)}return e.sort((t,s)=>bc(t)-bc(s)),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:s}}=e;return s&&s(),bt(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){const s={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=s.top,t.viewportOffset.bottom+=s.bottom,t.viewportOffset.left+=s.left,t.viewportOffset.right+=s.right}_bindBodyCollectionWithFocusTracker(){const e=this.view.body;for(const t of e)this.focusTracker.add(t.element);e.on("add",(t,s)=>{this.focusTracker.add(s.element)}),e.on("remove",(t,s)=>{this.focusTracker.remove(s.element)})}_initViewportOffset(e){this.on("set:viewportOffset",(t,s,r)=>{const o=this._getVisualViewportTopOffset(r);r.visualTop!==o&&(t.return={...r,visualTop:o})}),this.set("viewportOffset",e)}
175_initVisualViewportSupport(){if(!C.window.visualViewport)return;const e=()=>{const t=this._getVisualViewportTopOffset(this.viewportOffset);this.viewportOffset.visualTop!==t&&(this.viewportOffset={...this.viewportOffset,visualTop:t})};this._domEmitter=new(De()),this._domEmitter.listenTo(C.window.visualViewport,"scroll",e),this._domEmitter.listenTo(C.window.visualViewport,"resize",e)}_getVisualViewportTopOffset(e){const t=as().top,s=e.top||0;return t>s?0:s-t}}function bc(n){const{toolbarView:i,options:e}=n;let t=10;return bt(i.element)&&t--,e.isContextual&&(t-=2),t}class _h extends T{constructor(e){super(e);u(this,"body");u(this,"menuBarView");u(this,"toolbar");this.body=new uo(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class zT extends _h{constructor(e){super(e);u(this,"top");u(this,"main");u(this,"_voiceLabelView");this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir: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 js;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class qy extends T{constructor(e,t,s){super(e);u(this,"name",null);u(this,"_editingView");u(this,"_editableElement");u(this,"_hasExternalElement");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=s,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?s(this):t(this);function t(r){e.change(o=>{const a=e.document.getRoot(r.name);o.addClass(r.isFocused?"ck-focused":"ck-blurred",a),o.removeClass(r.isFocused?"ck-blurred":"ck-focused",a)})}function s(r){e.once("change:isRenderingInProgress",(o,a,l)=>{l?s(r):t(r)})}}}class Ky extends qy{constructor(e,t,s,r={}){super(e,t,s);u(this,"_options");this._options=r,this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView;e.change(t=>{const s=e.document.getRoot(this.name);t.setAttribute("aria-label",this.getEditableAriaLabel(),s)})}getEditableAriaLabel(){const e=this.locale.t,t=this._options.label,s=this._editableElement,r=this.name;if(typeof t=="string")return t;if(typeof t=="object")return t[r];if(typeof t=="function")return t(this);if(s){const o=s.getAttribute("aria-label");if(o)return o}return e("Rich Text Editor. Editing area: %0",r)}}class _c extends T{constructor(e,t={}){super(e);u(this,"children");const s=this.bindTemplate;this.set("class",["ck","ck-form__row",...Y(t.class||[])]),this.children=this.createCollection(),t.children&&t.children.forEach(r=>this.children.add(r)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:s.to("class",r=>r.join(" ")),role:s.to("_role"),"aria-labelledby":s.to("_ariaLabelledBy")},children:this.children})}}class wa extends q(){constructor(i,e){super(),e&&Su(this,e),i&&this.set(i)}}const Yn=Ri("px");class An extends y{constructor(e){super(e);u(this,"positionLimiter");u(this,"visibleStack");u(this,"_viewToStack",new Map);u(this,"_idToStack",new Map);u(this,"_view",null);u(this,"_rotatorView",null);u(this,"_fakePanelsView",null);this.positionLimiter=()=>{const t=this.editor.editing.view,r=t.document.selection.editableElement;return r?t.domConverter.mapViewToDom(r.root):null},this.decorate("getPositionOptions"),this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}static get pluginName(){return"ContextualBalloon"}static get isOfficialPlugin(){return!0}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 p("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 s=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),s.set(e.view,e),this._viewToStack.set(e.view,s),s===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new p("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.getPositionOptions()),this._fakePanelsView.updatePosition()}getPositionOptions(){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,top:this.editor.ui.viewportOffset.visualTop}})),e}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new p("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new It(this.editor.locale),this.editor.ui.view.body.add(this._view),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(s=>s[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 Gy(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(s,r)=>!r&&s>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(s,r)=>{if(r<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,r])}),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 jy(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,s)=>!s&&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:s=!0,singleViewMode:r=!1}){this.view.class=t,this.view.withArrow=s,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition(),r&&(this._singleViewMode=!0)}}class Gy extends T{constructor(e){super(e);u(this,"focusTracker");u(this,"buttonPrevView");u(this,"buttonNextView");u(this,"content");const t=e.t,s=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new de,this.buttonPrevView=this._createButtonView(t("Previous"),Ks),this.buttonNextView=this._createButtonView(t("Next"),Kd),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",s.to("isNavigationVisible",r=>r?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:s.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 s=new B(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s}}class jy extends T{constructor(e,t){super(e);u(this,"content");u(this,"_balloonPanelView");const s=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",s.to("numberOfPanels",r=>
175r?"":"ck-hidden")],style:{top:s.to("top",Yn),left:s.to("left",Yn),width:s.to("width",Yn),height:s.to("height",Yn)}},children:this.content}),this.on("change:numberOfPanels",(r,o,a,l)=>{a>l?this._addPanels(a-l):this._removePanels(l-a),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new T;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:s,height:r}=new R(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:s,height:r})}}}const li=Ri("px");class HT extends T{constructor(e){super(e);u(this,"content");u(this,"contentPanelElement");u(this,"_contentPanelPlaceholder");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 Ee({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",s=>s?"block":"none"),height:t.to("isSticky",s=>s?li(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new Ee({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",s=>s?li(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",s=>s&&li(s)),bottom:t.to("_stickyBottomOffset",s=>s&&li(s)),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(C.document,"scroll",()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky()}),C.window.visualViewport&&(this.listenTo(C.window.visualViewport,"scroll",()=>{this.checkIfShouldBeSticky()}),this.listenTo(C.window.visualViewport,"resize",()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive){this._unstick();return}const e=new R(this.limiterElement);let t=e.getVisible();if(t){const o=new R(C.window);o.top+=this.viewportTopOffset,o.height-=this.viewportTopOffset,t=t.getIntersection(o)}const{left:s,top:r}=as();if(e.moveBy(s,r),t&&t.moveBy(s,r),t&&e.top<t.top)if(this._contentPanelRect.height+this.limiterBottomOffset>t.height){const o=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;this._contentPanelRect.height+o+1<e.height?this._stickToBottomOfLimiter(o):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(t.top):this._unstick();else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=li(-C.window.scrollX+as().left)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=li(-C.window.scrollX+as().left)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new R(this.contentPanelElement)}}class Jy extends Bi{constructor(e){super(e);u(this,"arrowView");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",s=>String(s)),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new st;return e.content=qs,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}class Qy extends T{constructor(e){super(e);u(this,"children");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",s=>`ck-menu-bar__menu__panel_position_${s}`),t.if("isVisible","ck-hidden",s=>!s)],tabindex:"-1"},children:this.children,on:{selectstart:t.to(s=>{s.target.tagName.toLocaleLowerCase()!=="input"&&s.preventDefault()})}})}focus(e=1){this.children.length&&(e===1?this.children.first.focus():this.children.last.focus())}}const Ss=class Ss extends T{constructor(e){super(e);u(this,"buttonView");u(this,"panelView");u(this,"focusTracker");u(this,"keystrokes");const t=this.bindTemplate;this.buttonView=new Jy(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new Qy(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new Ie,this.focusTracker=new de,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",s=>!s),t.if("parentMenuView","ck-menu-bar__menu_top-level",s=>!s)]},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),kt.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(kt.openOnButtonClick(this),kt.openOnArrowRightKey(this),kt.closeOnArrowLeftKey(this),kt.openAndFocusOnEnterKeyPress(this),kt.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),kt.openAndFocusPanelOnArrowDownKey(this),kt.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,s)=>{if(!s)return;const r=Ss._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=r?r.name:this._defaultMenuPositionName})}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:s,northWest:r,westSouth:o,eastSouth:a,westNorth:l,eastNorth:c}=Ry;return this.locale.uiLanguageDirection==="ltr"?this.parentMenuView?[a,c,o,l]:[e,t,s,r]:this.parentMenuView?[o,l,a,c]:[t,e,r,s]}get _defaultMenuPositionName(){return this.locale.uiLanguageDirection==="ltr"?this.parentMenuView?"es":"se":this.parentMenuView?"ws":"sw"}};u(Ss,"_getOptimalPosition",Uo);let gt=Ss;class xn extends Zt{constructor(i){super(i),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){const i=Array.from(this.items).some(e=>{const t=yc(e);return t&&t.isToggleable});
175this.items.forEach(e=>{const t=yc(e);t&&(t.hasCheckSpace=i)})}}function yc(n){return n instanceof Fe?n.children.map(i=>Yy(i)?i.buttonView:i).find(i=>i instanceof Bi):null}function Yy(n){return typeof n=="object"&&"buttonView"in n&&n.buttonView instanceof B}class Xy extends K1{constructor(i){super(i),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}const vc=["mouseenter","arrowleft","arrowright","change:isOpen"];class Zy extends T{constructor(e){super(e);u(this,"children");u(this,"menus",[]);const t=e.t,s=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",s.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t,s=[]){const r=this.locale,a=Ly({normalizedConfig:e,locale:r,componentFactory:t,extraItems:s}).items.map(l=>this._createMenu({componentFactory:t,menuDefinition:l}));this.children.addMany(a)}render(){super.render(),ai.toggleMenusAndFocusItemsOnHover(this),ai.closeMenusWhenTheBarCloses(this),ai.closeMenuWhenAnotherOnTheSameLevelOpens(this),ai.focusCycleMenusOnArrows(this),ai.closeOnClickOutside(this),ai.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}disable(){for(const e of this.children)e.isEnabled=!1}enable(){for(const e of this.children)e.isEnabled=!0}registerMenu(e,t=null){t?(e.delegate(...vc).to(t),e.parentMenuView=t):e.delegate(...vc).to(this,s=>"menu:"+s),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:s}){const r=this.locale,o=new gt(r);return this.registerMenu(o,s),o.buttonView.set({label:t.label}),o.once("change:isOpen",()=>{const a=new xn(r);a.ariaLabel=t.label,o.panelView.children.add(a),a.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:o,componentFactory:e}))}),o}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:s}){const r=this.locale,o=[];for(const a of e.groups){for(const l of a.items){const c=new Nn(r,t);if(Le(l))c.children.add(this._createMenu({componentFactory:s,menuDefinition:l,parentMenuView:t}));else{const d=this._createMenuItemContentFromFactory({componentName:l,componentFactory:s,parentMenuView:t});if(!d)continue;c.children.add(d)}o.push(c)}a!==e.groups[e.groups.length-1]&&o.push(new ma(r))}return o}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:s}){const r=s.create(e);return r instanceof gt||r instanceof Z||r instanceof Xy?(this._registerMenuTree(r,t),r.on("execute",()=>{this.close()}),r):null}_registerMenuTree(e,t){if(!(e instanceof gt)){e.delegate("mouseenter").to(t);return}this.registerMenu(e,t);const s=e.panelView.children.filter(o=>o instanceof xn)[0];if(!s){e.delegate("mouseenter").to(t);return}const r=s.items.filter(o=>o instanceof Fe);for(const o of r)this._registerMenuTree(o.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",(t,s,r)=>{clearTimeout(e),r?this.isOpen=!0:e=setTimeout(()=>{this.isOpen=Array.from(this.children).some(o=>o.isOpen)},0)})}}/**
176 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
177 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
178 *//**
179 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
180 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
181 */class yh{constructor(i,e=20){u(this,"model");u(this,"limit");u(this,"_isLocked");u(this,"_size");u(this,"_batch",null);u(this,"_changeCallback");u(this,"_selectionChangeCallback");this.model=i,this._size=0,this.limit=e,this._isLocked=!1,this._changeCallback=(t,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(i){this._size+=i,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("
181change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(i=!1){(!this.isLocked||i)&&(this._batch=null,this._size=0)}}class ev extends j{constructor(e,t){super(e);u(this,"_buffer");this._buffer=new yh(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,s=t.document,r=e.text||"",o=r.length;let a=s.selection;if(e.selection?a=e.selection:e.range&&(a=t.createSelection(e.range)),!t.canEditAt(a))return;const l=e.resultRange;t.enqueueChange(this._buffer.batch,c=>{this._buffer.lock();const d=Array.from(s.selection.getAttributes());t.deleteContent(a),r&&t.insertContent(c.createText(r,d),a),l?c.setSelection(l):a.is("documentSelection")||c.setSelection(a),this._buffer.unlock(),this._buffer.input(o)})}}const vh=["insertText","insertReplacementText"],tv=[...vh,"insertCompositionText"];class iv extends yt{constructor(e){super(e);u(this,"focusObserver");this.focusObserver=e.getObserver(vs);const t=P.isAndroid?tv:vh,s=e.document;s.on("beforeinput",(r,o)=>{if(!this.isEnabled)return;const{data:a,targetRanges:l,inputType:c,domEvent:d,isComposing:h}=o;if(!t.includes(c))return;this.focusObserver.flush();const f=new wt(s,"insertText");s.fire(f,new Gt(e,d,{text:a,selection:e.createSelection(l),isComposing:h})),f.stop.called&&r.stop()}),P.isAndroid||s.on("compositionend",(r,{data:o,domEvent:a})=>{this.isEnabled&&o&&s.fire("insertText",new Gt(e,a,{text:o,isComposing:!0}))},{priority:"low"})}observe(){}stopObserving(){}}class kh extends y{constructor(){super(...arguments);u(this,"_typingQueue")}static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,s=e.editing.view,r=e.editing.mapper,o=t.document.selection;this._typingQueue=new nv(e),s.addObserver(iv);const a=new ev(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",a),e.commands.add("input",a),this.listenTo(s.document,"beforeinput",()=>{this._typingQueue.flush("next beforeinput")},{priority:"high"}),this.listenTo(s.document,"insertText",(l,c)=>{const{text:d,selection:h}=c;if(s.document.selection.isFake&&h&&s.document.selection.isSimilar(h)&&c.preventDefault(),h&&Array.from(h.getRanges()).some(w=>!w.isCollapsed)&&c.preventDefault(),!a.isEnabled){c.preventDefault();return}let f;h?f=Array.from(h.getRanges()).map(w=>r.toModelRange(w)).map(w=>ra(w,t.schema)||w):f=Array.from(o.getRanges());let m=d;if(P.isAndroid){const w=Array.from(f[0].getItems()).reduce((v,O)=>v+(O.is("$textProxy")?O.data:""),"");if(w&&(w.length<=m.length?m.startsWith(w)&&(m=m.substring(w.length),f[0].start=f[0].start.getShiftedBy(w.length)):w.startsWith(m)&&(f[0].start=f[0].start.getShiftedBy(m.length),m="")),m.length==0&&f[0].isCollapsed)return}const g={text:m,selection:t.createSelection(f)};this._typingQueue.push(g,!!c.isComposing),c.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented")}),P.isAndroid?this.listenTo(s.document,"keydown",(l,c)=>{o.isCollapsed||c.keyCode!=229||!s.document.isComposing||kc(t,a)}):this.listenTo(s.document,"compositionstart",()=>{o.isCollapsed||kc(t,a)},{priority:"high"}),this.listenTo(s.document,"mutations",(l,{mutations:c})=>{if(this._typingQueue.hasAffectedElements())for(const{node:d}of c){const h=rv(d,r),f=r.toModelElement(h);if(this._typingQueue.isElementAffected(f)){this._typingQueue.flush("mutations");return}}}),this.listenTo(s.document,"compositionend",()=>{this._typingQueue.flush("before composition end")},{priority:"high"}),this.listenTo(s.document,"compositionend",()=>{this._typingQueue.flush("after composition end");const l=[];if(this._typingQueue.hasAffectedElements())for(const c of this._typingQueue.flushAffectedElements()){const d=r.toViewElement(c);d&&l.push({type:"children",node:d})}(l.length||!P.isAndroid)&&s.document.fire("mutations",{mutations:l})},{priority:"lowest"})}destroy(){super.destroy(),this._typingQueue.destroy()}}class nv{constructor(i){u(this,"editor");u(this,"flushDebounced",pt(()=>this.flush("timeout"),50));u(this,"_queue",[]);u(this,"_isComposing",!1);u(this,"_affectedElements",new Set);this.editor=i}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(i,e){const t={text:i.text};
181if(i.selection){t.selectionRanges=[];for(const s of i.selection.getRanges())t.selectionRanges.push(Be.fromRange(s)),this._affectedElements.add(s.start.parent)}this._queue.push(t),this._isComposing||(this._isComposing=e),this.flushDebounced()}shift(){const i=this._queue.shift(),e={text:i.text};if(i.selectionRanges){const t=i.selectionRanges.map(s=>sv(s)).filter(s=>!!s);t.length&&(e.selection=this.editor.model.createSelection(t))}return e}flush(i){const e=this.editor,t=e.model,s=e.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const o=e.commands.get("insertText").buffer;t.enqueueChange(o.batch,()=>{for(o.lock();this._queue.length;){const a=this.shift();e.execute("insertText",a)}o.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1}),s.scrollToTheSelection()}isElementAffected(i){return this._affectedElements.has(i)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){const i=Array.from(this._affectedElements);return this._affectedElements.clear(),i}}function kc(n,i){if(!i.isEnabled)return;const e=i.buffer;e.lock(),n.enqueueChange(e.batch,()=>{n.deleteContent(n.document.selection)}),e.unlock()}function sv(n){const i=n.toRange();return n.detach(),i.root.rootName=="$graveyard"?null:i}function rv(n,i){let e=n.is("$text")?n.parent:n;for(;!i.toModelElement(e);)e=e.parent;return e}class Cc extends j{constructor(e,t){super(e);u(this,"direction");u(this,"_buffer");this.direction=t,this._buffer=new yh(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,s=t.document;t.enqueueChange(this._buffer.batch,r=>{this._buffer.lock();const o=r.createSelection(e.selection||s.selection);if(!t.canEditAt(o))return;const a=e.sequence||1,l=o.isCollapsed;if(o.isCollapsed&&t.modifySelection(o,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(a)){this._replaceEntireContentWithParagraph(r);return}if(this._shouldReplaceFirstBlockWithParagraph(o,a)){this.editor.execute("paragraph",{selection:o});return}if(o.isCollapsed)return;let c=0;
181o.getFirstRange().getMinimalFlatRanges().forEach(d=>{c+=jr(d.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(o,{doNotResetEntireContent:l,direction:this.direction}),this._buffer.input(c),r.setSelection(o),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,r=t.document.selection,o=t.schema.getLimitElement(r);if(!(r.isCollapsed&&r.containsEntireContent(o))||!t.schema.checkChild(o,"paragraph"))return!1;const l=o.getChild(0);return!(l&&l.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,r=t.document.selection,o=t.schema.getLimitElement(r),a=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(a,o),e.setSelection(a,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const s=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const r=e.getFirstPosition(),o=s.schema.getLimitElement(r),a=o.getChild(0);return!(r.parent!=a||!e.containsEntireContent(a)||!s.schema.checkChild(o,"paragraph")||a.name=="paragraph")}}const ov="character",Ec="word",av="codePoint",Et="selection",pi="backward",Zi="forward",Ch={deleteContent:{unit:Et,direction:pi},deleteContentBackward:{unit:av,direction:pi},deleteWordBackward:{unit:Ec,direction:pi},deleteHardLineBackward:{unit:Et,direction:pi},deleteSoftLineBackward:{unit:Et,direction:pi},deleteContentForward:{unit:ov,direction:Zi},deleteWordForward:{unit:Ec,direction:Zi},deleteHardLineForward:{unit:Et,direction:Zi},deleteSoftLineForward:{unit:Et,direction:Zi}};class lv extends yt{constructor(i){super(i);const e=i.document;let t=0;e.on("keydown",()=>{t++}),e.on("keyup",()=>{t=0}),e.on("beforeinput",(s,r)=>{if(!this.isEnabled)return;const{targetRanges:o,domEvent:a,inputType:l}=r,c=Ch[l];if(!c)return;const d={direction:c.direction,unit:c.unit,sequence:t};d.unit==Et&&(d.selectionToRemove=i.createSelection(o[0])),l==="deleteContentBackward"&&(P.isAndroid&&(d.sequence=1),uv(o)&&(d.unit=Et,d.selectionToRemove=i.createSelection(o)));const h=new Yt(e,"delete",o[0]);e.fire(h,new Gt(i,a,d)),h.stop.called&&s.stop()}),P.isBlink&&cv(this)}observe(){}stopObserving(){}}function cv(n){const i=n.view,e=i.document;let t=null,s=!1;e.on("keydown",(a,{keyCode:l})=>{t=l,s=!1}),e.on("keyup",(a,{keyCode:l,domEvent:c})=>{const d=e.selection,h=n.isEnabled&&l==t&&r(l)&&!d.isCollapsed&&!s;if(t=null,h){const f=d.getFirstRange(),m=new Yt(e,"delete",f),g={unit:Et,direction:o(l),selectionToRemove:d};e.fire(m,new Gt(i,c,g))}}),e.on("beforeinput",(a,{inputType:l})=>{const c=Ch[l];r(t)&&c&&c.direction==o(t)&&(s=!0)},{priority:"high"}),e.on("beforeinput",(a,{inputType:l,data:c})=>{t==V.delete&&l=="insertText"&&c=="�"&&a.stop()},{priority:"high"});function r(a){return a==V.backspace||a==V.delete}function o(a){return a==V.backspace?pi:Zi}}function uv(n){if(n.length!=1||n[0].isCollapsed)return!1;const i=n[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let e=0;for(const{nextPosition:t,item:s}of i){if(t.parent.is("$text")){const r=t.parent.data,o=t.offset;if(Jo(r,o)||Qo(r,o)||ju(r,o))continue;e++}else(s.is("containerElement")||s.is("emptyElement"))&&e++;if(e>1)return!0}return!1}class Fi extends y{constructor(){super(...arguments);u(this,"_undoOnBackspace")}static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,s=t.document,r=e.model.document;t.addObserver(lv),this._undoOnBackspace=!1;const o=new Cc(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new Cc(e,"backward")),this.listenTo(s,"delete",(a,l)=>{s.isComposing||l.preventDefault();const{direction:c,sequence:d,selectionToRemove:h,unit:f}=l,m=c==="forward"?"deleteForward":"delete",g={sequence:d};if(f=="selection"){const w=Array.from(h.getRanges()).map(v=>e.editing.mapper.toModelRange(v)).map(v=>ra(v,e.model.schema)||v);g.selection=e.model.createSelection(w)}else g.unit=f;e.execute(m,g),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(s,"keydown",(a,l)=>{if(s.isComposing||l.keyCode!=V.backspace||!r.selection.isCollapsed)return;const c=e.model.schema.getLimitElement(r.selection),d=e.model.createPositionAt(c,0);if(d.isTouching(r.selection.getFirstPosition())){l.preventDefault();const h=e.model.schema.getNearestSelectionRange(d,"forward");
181if(!h)return;const f=t.createSelection(e.editing.mapper.toViewRange(h)),m=f.getFirstRange(),g=new Yt(document,"delete",m),w={unit:"selection",direction:"backward",selectionToRemove:f};s.fire(g,new Gt(t,l.domEvent,w))}}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(s,"delete",(a,l)=>{this._undoOnBackspace&&l.direction=="backward"&&l.sequence==1&&l.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),l.preventDefault(),a.stop())},{context:"$capture"}),this.listenTo(r,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class dv extends y{static get requires(){return[kh,Fi]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}/**
182 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
183 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
184 */function Eh(n,i){let e=n.start;return{text:Array.from(n.getWalker({ignoreElementEnd:!1})).reduce((s,{item:r})=>r.is("$text")||r.is("$textProxy")?s+r.data:(e=i.createPositionAfter(r),""),""),range:i.createRange(e,n.end)}}class ba extends q(){constructor(e,t){super();u(this,"model");u(this,"testCallback");u(this,"_hasMatch");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",(s,{directChange:r})=>{if(r){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(s,r)=>{r.isUndo||!r.isLocal||this._evaluateTextBeforeSelection("data",{batch:r})})}_evaluateTextBeforeSelection(e,t={}){const s=this.model,o=s.document.selection,a=s.createRange(s.createPositionAt(o.focus.parent,0),o.focus),{text:l,range:c}=Eh(a,s),d=this.testCallback(l);if(!d&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!d,d){const h=Object.assign(t,{text:l,range:c});typeof d=="object"&&Object.assign(h,d),this.fire(`matched:${e}`,h)}}}class Ts extends y{constructor(e){super(e);u(this,"attributes");u(this,"_overrideUid");u(this,"_isNextGravityRestorationSkipped",!1);this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,s=e.editing.view,r=e.locale,o=t.document.selection;this.listenTo(s.document,"arrowKey",(a,l)=>{if(!o.isCollapsed||l.shiftKey||l.altKey||l.ctrlKey)return;const c=l.keyCode==V.arrowright,d=l.keyCode==V.arrowleft;if(!c&&!d)return;const h=r.contentLanguageDirection;let f=!1;h==="ltr"&&c||h==="rtl"&&d?f=this._handleForwardMovement(l):f=this._handleBackwardMovement(l),f===!0&&a.stop()},{context:"$text",priority:"highest"}),this.listenTo(o,"change:range",(a,l)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!l.directChange&&Re(o.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,s=this.editor.model,r=s.document.selection,o=r.getFirstPosition();return this._isGravityOverridden||o.isAtStart&&lt(r,t)?!1:Re(o,t)?(e&&qi(e),lt(r,t)&&Re(o,t,!0)?Ui(s,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,s=this.editor.model,r=s.document.selection,o=r.getFirstPosition();return this._isGravityOverridden?(e&&qi(e),this._restoreGravity(),Re(o,t,!0)?Ui(s,t):Xn(s,t,o),!0):o.isAtStart?lt(r,t)?(e&&qi(e),Xn(s,t,o),!0):!1:!lt(r,t)&&Re(o,t,!0)?(e&&qi(e),Xn(s,t,o),!0):Tc(o,t)?o.isAtEnd&&!lt(r,t)&&Re(o,t)?(e&&qi(e),Xn(s,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,s=t.document.selection,r=e.editing.view.document;e.editing.view.addObserver(aa),e.editing.view.addObserver(f_);let o=!1,a=!1;this.listenTo(r,"touchstart",()=>{a=!1,o=!0}),this.listenTo(r,"mousedown",()=>{a=!0}),this.listenTo(r,"selectionChange",()=>{const l=this.attributes;if(!a&&!o||(a=!1,o=!1,!s.isCollapsed)||!lt(s,l))return;const c=s.getFirstPosition();Re(c,l)&&(c.isAtStart||Re(c,l,!0)?Ui(t,l):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,s=t.document.selection,r=this.attributes;this.listenTo(t,"insertContent",()=>{const o=s.getFirstPosition();lt(s,r)&&Re(o,r)&&Ui(t,r)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,s=t.document.selection,r=e.editing.view;let o=!1,a=!1;this.listenTo(r.document,"delete",(l,c)=>{o=c.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!o)return;const l=s.getFirstPosition();a=lt(s,this.attributes)&&!Tc(l,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{o&&(o=!1,!a&&e.model.enqueueChange(()=>{const l=s.getFirstPosition();lt(s,this.attributes)&&Re(l,this.attributes)&&(l.isAtStart||Re(l,this.attributes,!0)?Ui(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 lt(n,i){for(const e of i)if(n.hasAttribute(e))return!0;return!1}function Xn(n,i,e){const t=e.nodeBefore;n.change(s=>{if(t){const r=[],o=n.schema.isObject(t)&&n.schema.isInline(t);for(const[a,l]of t.getAttributes())n.schema.checkAttribute("$text",a)&&(!o||n.schema.getAttributeProperties(a).copyFromObject!==!1)&&r.push([a,l]);s.setSelectionAttribute(r)}else s.removeSelectionAttribute(i)})}function Ui(n,i){n.change(e=>{e.removeSelectionAttribute(i)})}function qi(n){n.preventDefault()}function Tc(n,i){const e=n.getShiftedBy(-1);return Re(e,i)}function Re(n,i,e=!1){const{nodeBefore:t,nodeAfter:s}=n;for(const r of i){const o=t?t.getAttribute(r):void 0,a=s?s.getAttribute(r):void 0;if(!(e&&(o===void 0||a===void 0))&&a!==o)return!0}return!1}const Pc={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:ci('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:ci("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:ci("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:ci('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:ci('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:ci("'"),to:[null,"‚",null,"’"]}},Ac={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},hv=["symbols","mathematical","typography","quotes"];class WT extends y{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.config.define("typing",{transformations:{include:hv}})}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const i=this.editor,e=i.model,t=i.plugins.get("Delete"),s=pv(i.config.get("typing.transformations")),r=a=>{for(const l of s)if(l.from.test(a))return{normalizedTransformation:l}},o=new ba(i.model,r);o.on("matched:data",(a,l)=>{if(!l.batch.isTyping)return;const{from:c,to:d}
184=l.normalizedTransformation,h=c.exec(l.text),f=d(h.slice(1)),m=l.range;let g=h.index;e.enqueueChange(w=>{for(let v=1;v<h.length;v++){const O=h[v],M=f[v-1];if(M==null){g+=O.length;continue}const W=m.start.getShiftedBy(g),ie=e.createRange(W,W.getShiftedBy(O.length)),Oe=gv(W);e.insertContent(w.createText(M,Oe),ie),g+=M.length}e.enqueueChange(()=>{t.requestUndoOnBackspace()})})}),o.bind("isEnabled").to(this)}}function fv(n){return typeof n=="string"?new RegExp(`(${gm(n)})$`):n}function mv(n){return typeof n=="string"?()=>[n]:n instanceof Array?()=>n:n}function gv(n){return(n.textNode?n.textNode:n.nodeAfter).getAttributes()}function ci(n){return new RegExp(`(^|\\s)(${n})([^${n}]*)(${n})$`)}function pv(n){const i=n.extra||[],e=n.remove||[],t=r=>!e.includes(r),s=n.include.concat(i).filter(t);return wv(s).filter(t).map(r=>typeof r=="string"&&Pc[r]?Pc[r]:r).filter(r=>typeof r=="object").map(r=>({from:fv(r.from),to:mv(r.to)}))}function wv(n){const i=new Set;for(const e of n)if(typeof e=="string"&&Ac[e])for(const t of Ac[e])i.add(t);else i.add(e);return Array.from(i)}/**
185 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
186 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
187 */function Ys(n,i,e,t){return t.createRange(xc(n,i,e,!0,t),xc(n,i,e,!1,t))}function xc(n,i,e,t,s){let r=n.textNode||(t?n.nodeBefore:n.nodeAfter),o=null;for(;r&&r.getAttribute(i)==e;)o=r,r=t?r.previousSibling:r.nextSibling;return o?s.createPositionAt(o,t?"before":"after"):n}function Th(n,i,e,t){const s=n.editing.view,r=new Set;s.document.registerPostFixer(o=>{const a=n.model.document.selection;let l=!1;if(a.hasAttribute(i)){const c=Ys(a.getFirstPosition(),i,a.getAttribute(i),n.model),d=n.editing.mapper.toViewRange(c);for(const h of d.getItems())h.is("element",e)&&!h.hasClass(t)&&(o.addClass(t,h),r.add(h),l=!0)}return l}),n.conversion.for("editingDowncast").add(o=>{o.on("insert",a,{priority:"highest"}),o.on("remove",a,{priority:"highest"}),o.on("attribute",a,{priority:"highest"}),o.on("selection",a,{priority:"highest"});function a(){s.change(l=>{for(const c of r.values())l.removeClass(t,c),r.delete(c)})}})}/**
188 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
189 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
190 */class ti extends j{constructor(e,t){super(e);u(this,"attributeKey");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,r=t.document.selection,o=e.forceValue===void 0?!this.value:e.forceValue;t.change(a=>{if(r.isCollapsed)o?a.setSelectionAttribute(this.attributeKey,!0):a.removeSelectionAttribute(this.attributeKey);else{const l=t.schema.getValidRanges(r.getRanges(),this.attributeKey);for(const c of l)o?a.setAttribute(this.attributeKey,o,c):a.removeAttribute(this.attributeKey,c)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,s=e.document.selection;if(s.isCollapsed)return s.hasAttribute(this.attributeKey);for(const r of s.getRanges())for(const o of r.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}}const ui="bold";class bv extends y{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=this.editor.t;i.model.schema.extend("$text",{allowAttributes:ui}),i.model.schema.setAttributeProperties(ui,{isFormatting:!0,copyOnEnter:!0}),i.conversion.attributeToElement({model:ui,view:"strong",upcastAlso:["b",t=>{const s=t.getStyle("font-weight");return s&&(s=="bold"||Number(s)>=600)?{name:!0,styles:["font-weight"]}:null}]}),i.commands.add(ui,new ti(i,ui)),i.keystrokes.set("CTRL+B",ui),i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Bold text"),keystroke:"CTRL+B"}]})}}function ii({editor:n,commandName:i,plugin:e,icon:t,label:s,keystroke:r}){return o=>{const a=n.commands.get(i),l=new o(n.locale);return l.set({label:s,icon:t,keystroke:r,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),l.bind("isOn").to(a,"value"),l instanceof Z?l.set({role:"menuitemcheckbox"}):l.set({tooltip:!0}),e.listenTo(l,"execute",()=>{n.execute(i),n.editing.view.focus()}),l}}const Ar="bold";class _v extends y{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:Ar,plugin:this,icon:Wd,label:e("Bold"),keystroke:"CTRL+B"});i.ui.componentFactory.add(Ar,()=>t(B)),i.ui.componentFactory.add("menuBar:"+Ar,()=>t(Z))}}class $T extends y{static get requires(){return[bv,_v]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}const Ft="code",yv="ck-code_selected";class vv extends y{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Ts]}init(){const i=this.editor,e=this.editor.t;i.model.schema.extend("$text",{allowAttributes:Ft}),i.model.schema.setAttributeProperties(Ft,{isFormatting:!0,copyOnEnter:!1}),i.conversion.attributeToElement({model:Ft,view:"code"}),i.commands.add(Ft,new ti(i,Ft)),i.plugins.get(Ts).registerAttribute(Ft),Th(i,Ft,"code",yv),i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const xr="code";class kv extends y{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:xr,plugin:this,icon:h0,label:e("Code")});i.ui.componentFactory.add(xr,()=>t(B)),i.ui.componentFactory.add("menuBar:"+xr,()=>t(Z))}}class UT extends y{static get requires(){return[vv,kv]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}}const di="italic";class Cv extends y{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=this.editor.t;i.model.schema.extend("$text",{allowAttributes:di}),i.model.schema.setAttributeProperties(di,{isFormatting:!0,copyOnEnter:!0}),i.conversion.attributeToElement({model:di,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),i.commands.add(di,new ti(i,di)),i.keystrokes.set("CTRL+I",di),i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Italic text"),keystroke:"CTRL+I"}]})}}const Sr="italic";class Ev extends y{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:Sr,plugin:this,icon:k0,keystroke:"CTRL+I",label:e("Italic")});i.ui.componentFactory.add(Sr,()=>t(B)),i.ui.componentFactory.add("menuBar:"+Sr,()=>t(Z))}}class qT extends y{static get requires(){return[Cv,Ev]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}const Ki="strikethrough";class Tv extends y{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=this.editor.t;i.model.schema.extend("$text",{allowAttributes:Ki}),i.model.schema.setAttributeProperties(Ki,{isFormatting:!0,copyOnEnter:!0}),i.conversion.attributeToElement({model:Ki,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),i.commands.add(Ki,new ti(i,Ki)),i.keystrokes.set("CTRL+SHIFT+X","strikethrough"),i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const Ir="strikethrough";class Pv extends y{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:Ir,plugin:this,icon:V0,keystroke:"CTRL+SHIFT+X",label:e("Strikethrough")});i.ui.componentFactory.add(Ir,()=>t(B)),i.ui.componentFactory.add("menuBar:"+Ir,()=>t(Z))}}class KT extends y{static get requires(){return[Tv,Pv]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}}const Gi="subscript";class Av extends y{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.model.schema.extend("$text",{allowAttributes:Gi}),i.model.schema.setAttributeProperties(Gi,{isFormatting:!0,copyOnEnter:!0}),i.conversion.attributeToElement({model:Gi,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}
190),i.commands.add(Gi,new ti(i,Gi))}}const Or="subscript";class xv extends y{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:Or,plugin:this,icon:B0,label:e("Subscript")});i.ui.componentFactory.add(Or,()=>t(B)),i.ui.componentFactory.add("menuBar:"+Or,()=>t(Z))}}class GT extends y{static get requires(){return[Av,xv]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}}const ji="superscript";class Sv extends y{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.model.schema.extend("$text",{allowAttributes:ji}),i.model.schema.setAttributeProperties(ji,{isFormatting:!0,copyOnEnter:!0}),i.conversion.attributeToElement({model:ji,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),i.commands.add(ji,new ti(i,ji))}}const Mr="superscript";class Iv extends y{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:Mr,plugin:this,icon:L0,label:e("Superscript")});i.ui.componentFactory.add(Mr,()=>t(B)),i.ui.componentFactory.add("menuBar:"+Mr,()=>t(Z))}}class jT extends y{static get requires(){return[Sv,Iv]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}}const Ji="underline";class Ov extends y{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=this.editor.t;i.model.schema.extend("$text",{allowAttributes:Ji}),i.model.schema.setAttributeProperties(Ji,{isFormatting:!0,copyOnEnter:!0}),i.conversion.attributeToElement({model:Ji,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),i.commands.add(Ji,new ti(i,Ji)),i.keystrokes.set("CTRL+U","underline"),i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Underline text"),keystroke:"CTRL+U"}]})}}const Rr="underline";class Mv extends y{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale.t,t=ii({editor:i,commandName:Rr,plugin:this,icon:D0,label:e("Underline"),keystroke:"CTRL+U"});i.ui.componentFactory.add(Rr,()=>t(B)),i.ui.componentFactory.add("menuBar:"+Rr,()=>t(Z))}}class JT extends y{static get requires(){return[Ov,Mv]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}/**
191 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
192 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
193 *//**
194 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
195 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
196 */function*Ph(n,i){for(const e of i)e&&n.getAttributeProperties(e[0]).copyOnEnter&&(yield e)}class Rv extends j{execute(){this.editor.model.change(i=>{this.enterBlock(i),this.fire("afterExecute",{writer:i})})}enterBlock(i){const e=this.editor.model,t=e.document.selection,s=e.schema,r=t.isCollapsed,o=t.getFirstRange(),a=o.start.parent,l=o.end.parent;if(s.isLimit(a)||s.isLimit(l))return!r&&a==l&&e.deleteContent(t),!1;if(r){const c=Ph(i.model.schema,t.getAttributes());return Sc(i,o.start),i.setSelectionAttribute(c),!0}else{const c=!(o.start.isAtStart&&o.end.isAtEnd),d=a==l;if(e.deleteContent(t,{leaveUnmerged:c}),c){if(d)return Sc(i,t.focus),!0;i.setSelection(l,0)}}return!1}}function Sc(n,i){n.split(i),n.setSelection(i.parent.nextSibling,0)}const Vv={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Ah extends yt{constructor(i){super(i);const e=this.document;let t=!1;e.on("keydown",(s,r)=>{t=r.shiftKey}),e.on("beforeinput",(s,r)=>{if(!this.isEnabled)return;let o=r.inputType;P.isSafari&&t&&o=="insertParagraph"&&(o="insertLineBreak");const a=r.domEvent,l=Vv[o];if(!l)return;const c=new Yt(e,"enter",r.targetRanges[0]);e.fire(c,new Gt(i,a,{isSoft:l.isSoft})),c.stop.called&&s.stop()})}observe(){}stopObserving(){}}class Xs extends y{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.editing.view,t=e.document,s=this.editor.t;e.addObserver(Ah),i.commands.add("enter",new Rv(i)),this.listenTo(t,"enter",(r,o)=>{t.isComposing||o.preventDefault(),!o.isSoft&&(i.execute("enter"),e.scrollToTheSelection())},{priority:"low"}),i.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class Bv extends j{execute(){const i=this.editor.model,e=i.document;i.change(t=>
196{Fv(i,t,e.selection),this.fire("afterExecute",{writer:t})})}refresh(){const i=this.editor.model,e=i.document;this.isEnabled=Lv(i.schema,e.selection)}}function Lv(n,i){if(i.rangeCount>1)return!1;const e=i.anchor;if(!e||!n.checkChild(e,"softBreak"))return!1;const t=i.getFirstRange(),s=t.start.parent,r=t.end.parent;return!((po(s,n)||po(r,n))&&s!==r)}function Fv(n,i,e){const t=e.isCollapsed,s=e.getFirstRange(),r=s.start.parent,o=s.end.parent,a=r==o;if(t){const l=Ph(n.schema,e.getAttributes());Ic(n,i,s.end),i.removeSelectionAttribute(e.getAttributeKeys()),i.setSelectionAttribute(l)}else{const l=!(s.start.isAtStart&&s.end.isAtEnd);n.deleteContent(e,{leaveUnmerged:l}),a?Ic(n,i,e.focus):l&&i.setSelection(o,0)}}function Ic(n,i,e){const t=i.createElement("softBreak");n.insertContent(t,e),i.setSelection(t,"after")}function po(n,i){return n.is("rootElement")?!1:i.isLimit(n)||po(n.parent,i)}class Nv extends y{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.model.schema,t=i.conversion,s=i.editing.view,r=s.document,o=this.editor.t;e.register("softBreak",{allowWhere:"$text",isInline:!0}),t.for("upcast").elementToElement({model:"softBreak",view:"br"}),t.for("downcast").elementToElement({model:"softBreak",view:(a,{writer:l})=>l.createEmptyElement("br")}),s.addObserver(Ah),i.commands.add("shiftEnter",new Bv(i)),this.listenTo(r,"enter",(a,l)=>{r.isComposing||l.preventDefault(),l.isSoft&&(i.execute("shiftEnter"),s.scrollToTheSelection())},{priority:"low"}),i.accessibility.addKeystrokeInfos({keystrokes:[{label:o("Insert a soft break (a <code>&lt;br&gt;</code> element)"),keystroke:"Shift+Enter"}]})}}/**
197 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
198 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
199 */class Dv extends j{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(i={}){const e=this.editor.model,t=e.schema,s=e.document.selection,r=Array.from(s.getSelectedBlocks()),o=i.forceValue===void 0?!this.value:i.forceValue;e.change(a=>{if(!o)this._removeQuote(a,r.filter(Zn));else{const l=r.filter(c=>Zn(c)||Mc(t,c));this._applyQuote(a,l)}})}_getValue(){const i=this.editor.model.document.selection,e=ye(i.getSelectedBlocks());return!!(e&&Zn(e))}_checkEnabled(){if(this.value)return!0;const i=this.editor.model.document.selection,e=this.editor.model.schema,t=ye(i.getSelectedBlocks());return t?Mc(e,t):!1}_removeQuote(i,e){Oc(i,e).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd){i.unwrap(t.start.parent);return}if(t.start.isAtStart){const r=i.createPositionBefore(t.start.parent);i.move(t,r);return}t.end.isAtEnd||i.split(t.end);const s=i.createPositionAfter(t.end.parent);i.move(t,s)})}_applyQuote(i,e){const t=[];Oc(i,e).reverse().forEach(s=>{let r=Zn(s.start);r||(r=i.createElement("blockQuote"),i.wrap(s,r)),t.push(r)}),t.reverse().reduce((s,r)=>s.nextSibling==r?(i.merge(i.createPositionAfter(s)),s):r)}}function Zn(n){return n.parent.name=="blockQuote"?n.parent:null}function Oc(n,i){let e,t=0;const s=[];for(;t<i.length;){const r=i[t],o=i[t+1];e||(e=n.createPositionBefore(r)),(!o||r.nextSibling!=o)&&(s.push(n.createRange(e,n.createPositionAfter(r))),e=null),t++}return s}function Mc(n,i){const e=n.checkChild(i.parent,"blockQuote"),t=n.checkChild(["$root","blockQuote"],i);return e&&t}class zv extends y{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Xs,Fi]}init(){const i=this.editor,e=i.model.schema;i.commands.add("blockQuote",new Dv(i)),e.register("blockQuote",{inheritAllFrom:"$container"}),i.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),i.model.document.registerPostFixer(o=>{const a=i.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 o.remove(c),!0;if(c.is("element","blockQuote")&&!e.checkChild(l.position,c))return o.unwrap(c),!0;if(c.is("element")){const d=o.createRangeIn(c);for(const h of d.getItems())if(h.is("element","blockQuote")&&!e.checkChild(o.createPositionBefore(h),h))return o.unwrap(h),!0}}else if(l.type=="remove"){const c=l.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return o.remove(c),!0}return!1});const t=this.editor.editing.view.document,s=i.model.document.selection,r=i.commands.get("blockQuote");this.listenTo(t,"enter",(o,a)=>
199{if(!s.isCollapsed||!r.value)return;s.getLastPosition().parent.isEmpty&&(i.execute("blockQuote"),i.editing.view.scrollToTheSelection(),a.preventDefault(),o.stop())},{context:"blockquote"}),this.listenTo(t,"delete",(o,a)=>{if(a.direction!="backward"||!s.isCollapsed||!r.value)return;const l=s.getLastPosition().parent;l.isEmpty&&!l.previousSibling&&(i.execute("blockQuote"),i.editing.view.scrollToTheSelection(),a.preventDefault(),o.stop())},{context:"blockquote"})}}class Hv extends y{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.ui.componentFactory.add("blockQuote",()=>{const e=this._createButton(B);return e.set({tooltip:!0}),e}),i.ui.componentFactory.add("menuBar:blockQuote",()=>{const e=this._createButton(Z);return e.set({role:"menuitemcheckbox"}),e})}_createButton(i){const e=this.editor,t=e.locale,s=e.commands.get("blockQuote"),r=new i(e.locale),o=t.t;return r.set({label:o("Block quote"),icon:S0,isToggleable:!0}),r.bind("isEnabled").to(s,"isEnabled"),r.bind("isOn").to(s,"value"),this.listenTo(r,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),r}}class QT extends y{static get requires(){return[zv,Hv]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}/**
200 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
201 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
202 */class Wv extends H(){constructor(){super(...arguments);u(this,"_stack",[])}add(e,t){const s=this._stack,r=s[0];this._insertDescriptor(e);const o=s[0];r!==o&&!Vr(r,o)&&this.fire("change:top",{oldDescriptor:r,newDescriptor:o,writer:t})}remove(e,t){const s=this._stack,r=s[0];this._removeDescriptor(e);const o=s[0];r!==o&&!Vr(r,o)&&this.fire("change:top",{oldDescriptor:r,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,s=t.findIndex(o=>o.id===e.id);if(Vr(e,t[s]))return;s>-1&&t.splice(s,1);let r=0;for(;t[r]&&$v(t[r],e);)r++;t.splice(r,0,e)}_removeDescriptor(e){const t=this._stack,s=t.findIndex(r=>
202r.id===e);s>-1&&t.splice(s,1)}}function Vr(n,i){return n&&i&&n.priority==i.priority&&Ps(n.classes)==Ps(i.classes)}function $v(n,i){return n.priority>i.priority?!0:n.priority<i.priority?!1:Ps(n.classes)>Ps(i.classes)}function Ps(n){return Array.isArray(n)?n.sort().join(","):n}const Uv="ck-widget",Rc="ck-widget_selected";function ee(n){return n.is("element")?!!n.getCustomProperty("widget"):!1}function qv(n,i,e={}){if(!n.is("containerElement"))throw new p("widget-to-widget-wrong-element-type",null,{element:n});return i.setAttribute("contenteditable","false",n),i.addClass(Uv,n),i.setCustomProperty("widget",!0,n),n.getFillerOffset=Yv,i.setCustomProperty("widgetLabel",[],n),e.label&&jv(n,e.label),e.hasSelectionHandle&&Xv(n,i),xh(n,i),n}function Kv(n,i,e){if(i.classes&&e.addClass(Y(i.classes),n),i.attributes)for(const t in i.attributes)e.setAttribute(t,i.attributes[t],n)}function Gv(n,i,e){if(i.classes&&e.removeClass(Y(i.classes),n),i.attributes)for(const t in i.attributes)e.removeAttribute(t,n)}function xh(n,i,e=Kv,t=Gv){const s=new Wv;s.on("change:top",(a,l)=>{l.oldDescriptor&&t(n,l.oldDescriptor,l.writer),l.newDescriptor&&e(n,l.newDescriptor,l.writer)});const r=(a,l,c)=>s.add(l,c),o=(a,l,c)=>s.remove(l,c);i.setCustomProperty("addHighlight",r,n),i.setCustomProperty("removeHighlight",o,n)}function jv(n,i){n.getCustomProperty("widgetLabel").push(i)}function Jv(n){return n.getCustomProperty("widgetLabel").reduce((e,t)=>typeof t=="function"?e?e+". "+t():t():e?e+". "+t:t,"")}function YT(n,i,e={}){return i.addClass(["ck-editor__editable","ck-editor__nested-editable"],n),e.withAriaRole!==!1&&i.setAttribute("role","textbox",n),n.isReadOnly||i.setAttribute("tabindex","-1",n),e.label&&i.setAttribute("aria-label",e.label,n),i.setAttribute("contenteditable",n.isReadOnly?"false":"true",n),n.on("change:isReadOnly",(t,s,r)=>{i.setAttribute("contenteditable",r?"false":"true",n),r?i.removeAttribute("tabindex",n):i.setAttribute("tabindex","-1",n)}),n.on("change:isFocused",(t,s,r)=>{r?i.addClass("ck-editor__nested-editable_focused",n):i.removeClass("ck-editor__nested-editable_focused",n)}),xh(n,i),n}function Qv(n,i){const e=n.getSelectedElement();if(e){const t=Ct(n);if(t)return i.createRange(i.createPositionAt(e,t))}return i.schema.findOptimalInsertionRange(n)}function Yv(){return null}function Xv(n,i){const e=i.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(t){const s=this.toDomElement(t),r=new st;return r.set("content",g0),r.render(),s.appendChild(r.element),s});i.insert(i.createPositionAt(n,0),e),i.addClass(["ck-widget_with-selection-handle"],n)}function Zv(n){const i=a=>{const{width:l,paddingLeft:c,paddingRight:d}=a.ownerDocument.defaultView.getComputedStyle(a);return parseFloat(l)-(parseFloat(c)||0)-(parseFloat(d)||0)},e=n.parentElement;if(!e)return 0;let t=i(e);const s=5;let r=0,o=e;for(;isNaN(t);){if(o=o.parentElement,++r>s)return 0;t=i(o)}return t}function ek(n,i=new R(n)){const e=Zv(n);return e?i.width/e*100:0}const ct="widget-type-around";function Nt(n,i,e){return!!n&&ee(n)&&!e.isInline(i)}function tk(n){return n.closest(".ck-widget__type-around__button")}function ik(n){return n.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function nk(n,i){const e=n.closest(".ck-widget");return i.mapDomToView(e)}function Ct(n){return n.getAttribute(ct)}const Sh=["before","after"],sk=new DOMParser().parseFromString(O0,"image/svg+xml").firstChild,Vc="ck-widget__type-around_disabled";class rk extends y{constructor(){super(...arguments);u(this,"_currentFakeCaretModelElement",null)}static get pluginName(){return"WidgetTypeAround"}static get isOfficialPlugin(){return!0}static get requires(){return[Xs,Fi]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(s,r,o)=>{t.change(a=>{for(const l of t.document.roots)o?a.removeClass(Vc,l):a.addClass(Vc,l)}),o||e.model.change(a=>{a.removeSelectionAttribute(ct)})}),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 s=this.editor,r=s.editing.view,o=s.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);s.execute("insertParagraph",{position:s.model.createPositionAt(e,t),attributes:o}),r.focus(),r.scrollToTheSelection()}_listenToIfEnabled(e,t,s,r){this.listenTo(e,t,(...o)=>{this.isEnabled&&s(...o)},r)}_insertParagraphAccordingToFakeCaretPosition(){const s=this.editor.model.document.selection,r=Ct(s);if(!r)return!1;
202const o=s.getSelectedElement();return this._insertParagraph(o,r),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,s=e.locale.t,r={before:s("Insert paragraph before block"),after:s("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(o,a,l)=>{const c=l.mapper.toViewElement(a.item);c&&Nt(c,a.item,t)&&(ok(l.writer,r,c),c.getCustomProperty("widgetLabel").push(()=>this.isEnabled?s("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,s=t.document.selection,r=t.schema,o=e.editing.view;this._listenToIfEnabled(o.document,"arrowKey",(l,c)=>{this._handleArrowKeyPress(l,c)},{context:[ee,"$text"],priority:"high"}),this._listenToIfEnabled(s,"change:range",(l,c)=>{c.directChange&&e.model.change(d=>{d.removeSelectionAttribute(ct)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const l=s.getSelectedElement();if(l){const c=e.editing.mapper.toViewElement(l);if(Nt(c,l,r))return}e.model.change(c=>{c.removeSelectionAttribute(ct)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(l,c,d)=>{const h=d.writer;if(this._currentFakeCaretModelElement){const w=d.mapper.toViewElement(this._currentFakeCaretModelElement);w&&(h.removeClass(Sh.map(a),w),this._currentFakeCaretModelElement=null)}const f=c.selection.getSelectedElement();if(!f)return;const m=d.mapper.toViewElement(f);if(!Nt(m,f,r))return;const g=Ct(c.selection);g&&(h.addClass(a(g),m),this._currentFakeCaretModelElement=f)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(l,c,d)=>{d||e.model.change(h=>{h.removeSelectionAttribute(ct)})});function a(l){return`ck-widget_type-around_show-fake-caret_${l}`}}_handleArrowKeyPress(e,t){const s=this.editor,r=s.model,o=r.document.selection,a=r.schema,l=s.editing.view,c=t.keyCode,d=gg(c,s.locale.contentLanguageDirection),h=l.document.selection.getSelectedElement(),f=s.editing.mapper.toModelElement(h);let m;Nt(h,f,a)?m=this._handleArrowKeyPressOnSelectedWidget(d):o.isCollapsed?m=this._handleArrowKeyPressWhenSelectionNextToAWidget(d):t.shiftKey||(m=this._handleArrowKeyPressWhenNonCollapsedSelection(d)),m&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const s=this.editor.model,r=s.document.selection,o=Ct(r);return s.change(a=>{if(o){if(!(o===(e?"after":"before")))return a.removeSelectionAttribute(ct),!0}else return a.setSelectionAttribute(ct,e?"after":"before"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,s=t.model,r=s.schema,o=t.plugins.get("Widget"),a=o._getObjectElementNextToSelection(e),l=t.editing.mapper.toViewElement(a);return Nt(l,a,r)?(s.change(c=>{o._setSelectionOverElement(a),c.setSelectionAttribute(ct,e?"before":"after")}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,s=t.model,r=s.schema,o=t.editing.mapper,a=s.document.selection,l=e?a.getLastPosition().nodeBefore:a.getFirstPosition().nodeAfter,c=o.toViewElement(l);return Nt(c,l,r)?(s.change(d=>{d.setSelection(l,"on"),d.setSelectionAttribute(ct,e?"after":"before")}),!0):!1}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(s,r)=>{const o=tk(r.domTarget);if(!o)return;const a=ik(o),l=nk(o,t.domConverter),c=e.editing.mapper.toModelElement(l);this._insertParagraph(c,a),r.preventDefault(),s.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,s=e.editing.view;this._listenToIfEnabled(s.document,"enter",(r,o)=>{if(r.eventPhase!="atTarget")return;const a=t.getSelectedElement(),l=e.editing.mapper.toViewElement(a),c=e.model.schema;let d;this._insertParagraphAccordingToFakeCaretPosition()?d=!0:Nt(l,a,c)&&(this._insertParagraph(a,o.isSoft?"before":"after"),d=!0),d&&(o.preventDefault(),r.stop())},{context:ee})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",(s,r)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(r.selection=t.selection)},{priority:"high"}),P.isAndroid?this._listenToIfEnabled(t,"keydown",(s,r)=>{r.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(t,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"highest"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,s=e.model,r=s.schema;this._listenToIfEnabled(t.document,"delete",(o,a)=>
202{if(o.eventPhase!="atTarget")return;const l=Ct(s.document.selection);if(!l)return;const c=a.direction,d=s.document.selection.getSelectedElement(),h=l==="before",f=c=="forward";if(h===f)e.execute("delete",{selection:s.createSelection(d,"on")});else{const g=r.getNearestSelectionRange(s.createPositionAt(d,l),c);if(g)if(!g.isCollapsed)s.change(w=>{w.setSelection(g),e.execute(f?"deleteForward":"delete")});else{const w=s.createSelection(g.start);if(s.modifySelection(w,{direction:c}),!w.focus.isEqual(g.start))s.change(v=>{v.setSelection(g),e.execute(f?"deleteForward":"delete")});else{const v=ck(r,g.start.parent);s.deleteContent(s.createSelection(v,"on"),{doNotAutoparagraph:!0})}}}a.preventDefault(),o.stop()},{context:ee})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,s=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(r,[o,a])=>{if(a&&!a.is("documentSelection"))return;const l=Ct(s);if(l)return r.stop(),t.change(c=>{const d=s.getSelectedElement(),h=t.createPositionAt(d,l),f=c.createSelection(h),m=t.insertContent(o,f);return c.setSelection(f),m})},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,s=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(r,o)=>{const[,a,l={}]=o;if(a&&!a.is("documentSelection"))return;const c=Ct(s);c&&(l.findOptimalPosition=c,o[3]=l)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,s=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(r,[o])=>{if(o&&!o.is("documentSelection"))return;Ct(s)&&r.stop()},{priority:"high"})}}function ok(n,i,e){const t=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(s){const r=this.toDomElement(s);return ak(r,i),lk(r),r});n.insert(n.createPositionAt(e,"end"),t)}function ak(n,i){for(const e of Sh){const t=new Ee({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${e}`],title:i[e],"aria-hidden":"true"},children:[n.ownerDocument.importNode(sk,!0)]});n.appendChild(t.render())}}function lk(n){const i=new Ee({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});n.appendChild(i.render())}function ck(n,i){let e=i;for(const t of i.getAncestors({parentFirst:!0})){if(t.childCount>1||n.isLimit(t))break;e=t}return e}function uk(n){const i=n.model;return(e,t)=>{const s=t.keyCode==V.arrowup,r=t.keyCode==V.arrowdown,o=t.shiftKey,a=i.document.selection;if(!s&&!r)return;const l=r;if(o&&fk(a,l))return;const c=dk(n,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(o)return}(c.isCollapsed||hk(n,c,l))&&(i.change(d=>{const h=l?c.end:c.start;if(o){const f=i.createSelection(a.anchor);f.setFocus(h),d.setSelection(f)}else d.setSelection(h)}),e.stop(),t.preventDefault(),t.stopPropagation())}}}function dk(n,i,e){const t=n.model;if(e){const s=i.isCollapsed?i.focus:i.getLastPosition(),r=Bc(t,s,"forward");if(!r)return null;const o=t.createRange(s,r),a=Lc(t.schema,o,"backward");return a?t.createRange(s,a):null}else{const s=i.isCollapsed?i.focus:i.getFirstPosition(),r=Bc(t,s,"backward");if(!r)return null;const o=t.createRange(r,s),a=Lc(t.schema,o,"forward");return a?t.createRange(a,s):null}}function Bc(n,i,e){const t=n.schema,s=n.createRangeIn(i.root),r=e=="forward"?"elementStart":"elementEnd";for(const{previousPosition:o,item:a,type:l}of s.getWalker({startPosition:i,direction:e})){if(t.isLimit(a)&&!t.isInline(a))return o;if(l==r&&t.isBlock(a))return null}return null}function Lc(n,i,e){const t=e=="backward"?i.end:i.start;if(n.checkChild(t,"$text"))return t;for(const{nextPosition:s}of i.getWalker({direction:e}))if(n.checkChild(s,"$text"))return s;return null}function hk(n,i,e){const t=n.model,s=n.view.domConverter;if(e){const c=t.createSelection(i.start);t.modifySelection(c),!c.focus.isAtEnd&&!i.start.isEqual(c.focus)&&(i=t.createRange(c.focus,i.end))}const r=n.mapper.toViewRange(i),o=s.viewRangeToDom(r),a=R.getDomRangeRects(o);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 fk(n,i){return!n.isCollapsed&&n.isBackward==i}class Ih extends y{constructor(){super(...arguments);u(this,"_previouslySelected",new Set)}static get pluginName(){return"Widget"}static get isOfficialPlugin(){return!0}static get requires(){return[rk,Fi]}init(){const e=this.editor,t=e.editing.view,s=t.document,r=e.t;this.editor.editing.downcastDispatcher.on("selection",(o,a,l)=>{const c=l.writer,d=a.selection;if(d.isCollapsed)return;const h=d.getSelectedElement();if(!h)return;const f=e.editing.mapper.toViewElement(h);ee(f)&&l.consumable.consume(d,"selection")&&c.setSelection(c.createRangeOn(f),{fake:!0,label:Jv(f)})}),this.editor.editing.downcastDispatcher.on("selection",(o,a,l)=>{this._clearPreviouslySelectedWidgets(l.writer);const c=l.writer,d=c.document.selection;let h=null;for(const f of d.getRanges())for(const m of f){const g=m.item;ee(g)&&!pk(g,h)&&(c.addClass(Rc,g),this._previouslySelected.add(g),h=g)}},{priority:"low"}),t.addObserver(aa),t.addObserver(Vd),this.listenTo(s,"mousedown",(...o)=>this._onMousedown(...o)),this.listenTo(s,"pointerdown",(...o)=>this._onPointerdown(...o)),this.listenTo(s,"arrowKey",(...o)=>
202{this._handleSelectionChangeOnArrowKeyPress(...o)},{context:[ee,"$text"]}),this.listenTo(s,"arrowKey",(...o)=>{this._preventDefaultOnArrowKeyPress(...o)},{context:"$root"}),this.listenTo(s,"arrowKey",uk(this.editor.editing),{context:"$text"}),this.listenTo(s,"delete",(o,a)=>{this._handleDelete(a.direction=="forward")&&(a.preventDefault(),o.stop())},{context:"$root"}),this.listenTo(s,"tab",(o,a)=>{o.eventPhase=="atTarget"&&(a.shiftKey||this._selectFirstNestedEditable()&&(a.preventDefault(),o.stop()))},{context:ee,priority:"low"}),this.listenTo(s,"tab",(o,a)=>{a.shiftKey&&this._selectAncestorWidget()&&(a.preventDefault(),o.stop())},{priority:"low"}),this.listenTo(s,"keydown",(o,a)=>{a.keystroke==V.esc&&this._selectAncestorWidget()&&(a.preventDefault(),o.stop())},{priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:r("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:r("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:r("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:r("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:r("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:r("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){const s=t.target;s&&t.domEvent.detail>=3&&this._selectBlockContent(s)&&t.preventDefault()}_onPointerdown(e,t){if(!t.domEvent.isPrimary)return;const s=this.editor,r=s.editing.view,o=r.document;let a=t.target;if(!a)return;if(!ee(a)){const c=mk(a);if(!c)return;if(ee(c))a=c;else{const d=gk(r,t);if(d&&ee(d))a=d;else return}}(P.isAndroid||P.isiOS)&&t.preventDefault(),o.isFocused||r.focus();const l=s.editing.mapper.toModelElement(a);this._setSelectionOverElement(l)}_selectBlockContent(e){const t=this.editor,s=t.model,r=t.editing.mapper,o=s.schema,a=r.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),l=wk(r.toModelElement(a),s.schema);return l?(s.change(c=>{const d=o.isLimit(l)?null:bk(c.createPositionAfter(l),o),h=c.createPositionAt(l,0),f=d?c.createPositionAt(d,0):c.createPositionAt(l,"end");c.setSelection(c.createRange(h,f))}),!0):!1}_handleSelectionChangeOnArrowKeyPress(e,t){const s=t.keyCode,r=this.editor.model,o=r.schema,a=r.document.selection,l=a.getSelectedElement(),c=Ko(s,this.editor.locale.contentLanguageDirection),d=c=="down"||c=="right",h=c=="up"||c=="down";if(l&&o.isObject(l)){const m=d?a.getLastPosition():a.getFirstPosition(),g=o.getNearestSelectionRange(m,d?"forward":"backward");g&&(r.change(w=>{w.setSelection(g)}),t.preventDefault(),e.stop());return}if(!a.isCollapsed&&!t.shiftKey){const m=a.getFirstPosition(),g=a.getLastPosition(),w=m.nodeAfter,v=g.nodeBefore;(w&&o.isObject(w)||v&&o.isObject(v))&&(r.change(O=>{O.setSelection(d?g:m)}),t.preventDefault(),e.stop());return}if(!a.isCollapsed)return;const f=this._getObjectElementNextToSelection(d);if(f&&o.isObject(f)){if(o.isInline(f)&&h)return;this._setSelectionOverElement(f),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const s=this.editor.model,r=s.schema,o=s.document.selection.getSelectedElement();o&&r.isObject(o)&&(t.preventDefault(),e.stop())}_handleDelete(e){const s=this.editor.model.document.selection;if(!this.editor.model.canEditAt(s)||!s.isCollapsed)return;const r=this._getObjectElementNextToSelection(e);if(r)return this.editor.model.change(o=>{let a=s.anchor.parent;for(;a.isEmpty;){const l=a;a=l.parent,o.remove(l)}this._setSelectionOverElement(r)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,s=t.schema,r=t.document.selection,o=t.createSelection(r);if(t.modifySelection(o,{direction:e?"forward":"backward"}),o.isEqual(r))return null;const a=e?o.focus.nodeBefore:o.focus.nodeAfter;return a&&s.isObject(a)?a:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Rc,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,s=this.editor.editing.view.document;for(const r of s.selection.getFirstRange().getItems())if(r.is("editableElement")){const o=e.editing.mapper.toModelElement(r);/* istanbul ignore next -- @preserve */if(!o)continue;const a=e.model.createPositionAt(o,0),l=e.model.schema.getNearestSelectionRange(a,"forward");return e.model.change(c=>{c.setSelection(l)}),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,r=e.editing.view.document.selection.getFirstPosition().parent,a=(r.is("$text")?r.parent:r).findAnce
202stor(ee);if(!a)return!1;const l=t.toModelElement(a);/* istanbul ignore next -- @preserve */return l?(e.model.change(c=>{c.setSelection(l,"on")}),!0):!1}}function mk(n){let i=n;for(;i;){if(i.is("editableElement")||ee(i))return i;i=i.parent}return null}function gk(n,i){const e=Du(i.domEvent);let t=null;if(e?t=n.domConverter.domRangeToView(e):t=n.createRange(n.createPositionAt(i.target,0)),!t)return null;const s=t.start;if(!s.parent)return null;let r=s.parent;return s.parent.is("editableElement")&&(s.isAtEnd&&s.nodeBefore?r=s.nodeBefore:s.isAtStart&&s.nodeAfter&&(r=s.nodeAfter)),r.is("$text")?r.parent:r}function pk(n,i){return i?Array.from(n.getAncestors()).includes(i):!1}function wk(n,i){for(const e of n.getAncestors({includeSelf:!0,parentFirst:!0})){if(i.checkChild(e,"$text"))return e;if(i.isLimit(e)&&!i.isObject(e))break}return null}function bk(n,i){const e=new ht({startPosition:n});for(const{item:t}of e){if(i.isLimit(t)||!t.is("element"))return null;if(i.checkChild(t,"$text"))return t}return null}class XT extends y{constructor(){super(...arguments);u(this,"_toolbarDefinitions",new Map);u(this,"_balloon")}static get requires(){return[An]}static get pluginName(){return"WidgetToolbarRepository"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",s=>{_k(e.editing.view.document.selection)&&s.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:s,getRelatedElement:r,balloonClassName:o="ck-toolbar-container",positions:a}){if(!s.length){return}const l=this.editor,c=l.t,d=new Qs(l.locale);if(d.ariaLabel=t||c("Widget toolbar"),this._toolbarDefinitions.has(e))throw new p("widget-toolbar-duplicated",this,{toolbarId:e});const h={view:d,getRelatedElement:r,balloonClassName:o,itemsConfig:s,positions:a,initialized:!1};l.ui.addToolbar(d,{isContextual:!0,beforeFocus:()=>{const f=r(l.editing.view.document.selection);f&&this._showToolbar(h,f)},afterBlur:()=>{this._hideToolbar(h)}}),this._toolbarDefinitions.set(e,h)}_updateToolbarsVisibility(){let e=0,t=null,s=null;for(const r of this._toolbarDefinitions.values()){const o=r.getRelatedElement(this.editor.editing.view.document.selection);if(!this.isEnabled||!o)this._isToolbarInBalloon(r)&&this._hideToolbar(r);else if(!this.editor.ui.focusTracker.isFocused)this._isToolbarVisible(r)&&this._hideToolbar(r);else{const a=o.getAncestors().length;a>e&&(e=a,t=o,s=r)}}s&&this._showToolbar(s,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Fc(this.editor,t,e.positions):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Oh(this.editor,t,e.positions),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const s of this._toolbarDefinitions.values())if(this._isToolbarVisible(s)){const r=s.getRelatedElement(this.editor.editing.view.document.selection);Fc(this.editor,r,e.positions)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Fc(n,i,e){const t=n.plugins.get("ContextualBalloon"),s=Oh(n,i,e);t.updatePosition(s)}function Oh(n,i,e){const t=n.editing.view,s=It.defaultPositions;return{target:t.domConverter.mapViewToDom(i),positions:e||[s.northArrowSouth,s.northArrowSouthWest,s.northArrowSouthEast,s.southArrowNorth,s.southArrowNorthWest,s.southArrowNorthEast,s.viewportStickyNorth]}}function _k(n){const i=n.getSelectedElement();return!!(i&&ee(i))}class yk extends q(){constructor(e){super();u(this,"_referenceCoordinates");u(this,"_options");u(this,"_originalWidth");u(this,"_originalHeight");u(this,"_originalWidthPercents");u(this,"_aspectRatio");this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,s){const r=new R(t);this.activeHandlePosition=Ck(e),this._referenceCoordinates=vk(t,Ek(this.activeHandlePosition)),this._originalWidth=r.width,this._originalHeight=r.height,this._aspectRatio=r.width/r.height;const o=s.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=ek(s,r)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}function vk(n,i){const e=new R(n),t=i.split("-"),s={x:t[1]=="right"?e.right:e.left,y:t[0]=="bottom"?e.bottom:e.top};return s.x+=n.ownerDocument.defaultView.scrollX,s.y+=n.ownerDocument.defaultView.scrollY,s}function kk(n){return`ck-widget__resizer__handle-${n}`}function Ck(n){const i=["top-left","top-right","bottom-right","bottom-left"];for(const e of i)if(n.classList.contains(kk(e)))return e}function Ek(n){const i=n.split("-"),e={top:"bottom",bottom:"top",left:"r
202ight",right:"left"};return`${e[i[0]]}-${e[i[1]]}`}class Tk extends T{constructor(){super();const i=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",i.to("_viewPosition",e=>e?`ck-orientation-${e}`:"")],style:{display:i.if("_isVisible","none",e=>!e)}},children:[{text:i.to("_label")}]})}_bindToState(i,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",(t,s)=>t!==null&&s!==null),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",(t,s,r)=>i.unit==="px"?`${t}×${s}`:`${r}%`),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",(t,s,r)=>s<50||r<50?"above-center":t)}_dismiss(){this.unbind(),this._isVisible=!1}}class Nc extends q(){constructor(e){super();u(this,"_state");u(this,"_sizeView");u(this,"_options");u(this,"_viewResizerWrapper",null);u(this,"_initialViewWidth");this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",(t,s)=>t&&s),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",t=>{!this.state.proposedWidth&&!this.state.proposedWidthPercents&&(this._cleanup(),t.stop())},{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change(t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)})}hide(){this._options.editor.editing.view.change(t=>{t.addClass("ck-hidden",this._viewResizerWrapper)})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(r=>{const o=r.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},function(a){const l=this.toDomElement(a);return e._appendHandles(l),e._appendSizeUI(l),l});r.insert(r.createPositionAt(t,"end"),o),r.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=o,this.isVisible||this.hide()}),this.on("change:isVisible",()=>{this.isVisible?(this.show(),this.redraw()):this.hide()})}begin(e){this._state=new yk(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(d=>{const h=this._options.unit||"%",f=(h==="%"?t.widthPercents:t.width)+h;d.setStyle("width",f,this._options.viewElement)});const r=this._getHandleHost(),o=new R(r),a=Math.round(o.width),l=Math.round(o.height),c=new R(r);t.width=Math.round(c.width),t.height=Math.round(c.height),this.redraw(o),this.state.update({...t,handleHostWidth:a,handleHostHeight:l})}commit(){const e=this._options.unit||"%",t=(e==="%"?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!xk(t))return;const s=t.parentElement,r=this._getHandleHost(),o=this._viewResizerWrapper,a=[o.getStyle("width"),o.getStyle("height"),o.getStyle("left"),o.getStyle("top")];let l;if(s.isSameNode(r)){const c=e||new R(r);l=[c.width+"px",c.height+"px",void 0,void 0]}else l=[r.offsetWidth+"px",r.offsetHeight+"px",r.offsetLeft+"px",r.offsetTop+"px"];ue(a,l)!=="same"&&this._options.editor.editing.view.change(c=>{c.setStyle({width:l[0],height:l[1],left:l[2],top:l[3]},o)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change(t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,s=Ak(e),r=this._options.isCentered?this._options.isCentered(this):!0,o={x:t._referenceCoordinates.x-(s.x+t.originalWidth),y:s.y-t.originalHeight-t._referenceCoordinates.y};r&&t.activeHandlePosition.endsWith("-right")&&(o.x=s.x-(t._referenceCoordinates.x+t.originalWidth)),r&&(o.x*=2);let a=Math.abs(t.originalWidth+o.x),l=Math.abs(t.originalHeight+o.y);return(a/t.aspectRatio>l?"width":"height")=="width"?l=a/t.aspectRatio:a=l*t.aspectRatio,{width:Math.round(a),height:Math.round(l),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const s of t)e.appendChild(new Ee({tag:"div",attributes:{class:`ck-widget__resizer__handle ${Pk(s)}`}}).render())}_appendSizeUI(e){this._sizeView=new Tk,this._sizeView.render(),e.appendChild(this._sizeView.element)}}function Pk(n){return`ck-widget__resizer__handle-${n}`}function Ak(n){return{x:n.pageX,y:n.pageY}}function xk(n){return n&&n.ownerDocument&&n.ownerDocument.contains(n)}class ZT extends y{constructor(){super(...arguments);u(this,"_resizers",new Map);u(this,"_observer");u(this,"_redrawSelectedResizerThrottled")}static get pluginName(){return"WidgetResize"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.editing,t=C.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(aa),this._observer=new(De()),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=wn(()=>this.redrawSelectedResizer(),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[r,o]of this._resizers)r.isAttached()||(this._resizers.delete(r),o.destroy())},{priority:"lowest"}),this._observer.listenTo(C.window,"resize",this._redrawSelectedResizerThrottled);const s=this.editor.editing.view.document.selection;s.on("change",()=>{const r=s.getSelectedElement(),o=this.getResizerByViewElement(r)||null;o?this.select(o):this.deselect()})}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new Nc(e),s=this.editor.plugins;if(t.attach(),s.has("WidgetToolbarRepository")){const a=s.get("WidgetToolbarRepository");t.on("begin",()=>{a.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{a.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{a.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const s=t.domTarget;Nc.isResizeHandle(s)&&(this._activeResizer=this._getResizerByHandle(s)||null,this._activeResizer&&(this._activeResizer.begin(s),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}/**
203 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
204 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
205 */class Sn extends ot{constructor(e){super(e);u(this,"domEventType",["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"]);const t=this.document;this.listenTo(t,"paste",s("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",s("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",s("dragging"),{priority:"low"});function s(r){return(o,a)=>{a.preventDefault();const l=a.dropRange?[a.dropRange]:null,c=new wt(t,r);
205t.fire(c,{dataTransfer:a.dataTransfer,method:o.name,targetRanges:l,target:a.target,domEvent:a.domEvent}),c.stop.called&&a.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,s=e.type=="drop"||e.type=="paste",r={dataTransfer:new rd(t,{cacheFiles:s})};if(e.type=="drop"||e.type=="dragover"){const o=Du(e);r.dropRange=o&&this.view.domConverter.domRangeToView(o)}this.fire(e.type,e,r)}}/**
206 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
207 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
208 */function Sk(n){return n=n.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;"),(n.includes("</p><p>")||n.includes("<br>"))&&(n=`<p>${n}</p>`),n}/**
209 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
210 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
211 */function Ik(n){return n.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(i,e)=>e.length==1?" ":e).replace(/<!--[\s\S]*?-->/g,"")}/**
212 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
213 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
214 */const Dc=["figcaption","li"],zc=["ol","ul"];function Mh(n,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`
215`;let e="",t=null;for(const s of i.getChildren())e+=Ok(s,t)+Mh(n,s),t=s;if(i.is("rawElement")){const r=document.implementation.createHTMLDocument("").createElement("div");i.render(r,n),e+=Rh(r)}return e}function Rh(n){let i="";if(n.nodeType===Node.TEXT_NODE)return n.textContent;if(n.tagName==="BR")return`
216`;for(const e of n.childNodes)i+=Rh(e);return i}function Ok(n,i){return i?n.is("element","li")&&!n.isEmpty&&n.getChild(0).is("containerElement")||zc.includes(n.name)&&zc.includes(i.name)?`
217
218`:!n.is("containerElement")&&!i.is("containerElement")?"":Dc.includes(n.name)||Dc.includes(i.name)?`
219`:n.is("element")&&n.getCustomProperty("dataPipeline:transparentRendering")||i.is("element")&&i.getCustomProperty("dataPipeline:transparentRendering")?"":`
220
221`:""}class Vh extends y{constructor(){super(...arguments);u(this,"_markersToCopy",new Map)}static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,s=r=>r.model.getSelectedContent(r.model.document.selection)){return this.editor.model.change(r=>{const o=r.model.document.selection;r.setSelection(t);const a=this._insertFakeMarkersIntoSelection(r,r.model.document.selection,e),l=s(r),c=this._removeFakeMarkersInsideElement(r,l);for(const[d,h]of Object.entries(a)){c[d]||(c[d]=r.createRangeIn(l));for(const f of h)r.remove(f)}l.markers.clear();for(const[d,h]of Object.entries(c))l.markers.set(d,h);return r.setSelection(o),l})}_pasteMarkersIntoTransformedElement(e,t){const s=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(r=>{const o=this._insertFakeMarkersElements(r,s),a=t(r),l=this._removeFakeMarkersInsideElement(r,a);for(const c of Object.values(o).flat())r.remove(c);for(const[c,d]of Object.entries(l))r.model.markers.has(c)||r.addMarker(c,{usingOperation:!0,affectsData:!0,range:d});return a})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const s of t)e.markers.set(s.name,s.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,s={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const r=this._markersToCopy.get(e);this._markersToCopy.set(e,s),t(),r?this._markersToCopy.set(e,r):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const s=this._getMarkerClipboardConfig(e);if(!s)return!1;if(!t)return!0;const{allowedActions:r}=s;return r==="all"||r.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,s){const r=this._getCopyableMarkersFromSelection(e,t,s);return this._insertFakeMarkersElements(e,r)}_getCopyableMarkersFromSelection(e,t,s){const r=Array.from(t.getRanges()),o=new Set(r.flatMap(l=>
221Array.from(e.model.markers.getMarkersIntersectingRange(l)))),a=l=>{if(!this._isMarkerCopyable(l.name,s))return!1;const{copyPartiallySelected:d}=this._getMarkerClipboardConfig(l.name);if(!d){const h=l.getRange();return r.some(f=>f.containsRange(h,!0))}return!0};return Array.from(o).filter(a).map(l=>({name:s==="dragstart"?this._getUniqueMarkerName(l.name):l.name,range:l.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:s}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([o,a])=>{if(!this._hasMarkerConfiguration(o))return[{name:o,range:a}];if(this._isMarkerCopyable(o,t)){const l=this._getMarkerClipboardConfig(o),c=s.markers.has(o)&&s.markers.get(o).getRange().root.rootName==="$graveyard";return(l.duplicateOnPaste||c)&&(o=this._getUniqueMarkerName(o)),[{name:o,range:a}]}return[]})}_insertFakeMarkersElements(e,t){const s={},r=t.flatMap(o=>{const{start:a,end:l}=o.range;return[{position:a,marker:o,type:"start"},{position:l,marker:o,type:"end"}]}).sort(({position:o},{position:a})=>o.isBefore(a)?1:-1);for(const{position:o,marker:a,type:l}of r){const c=e.createElement("$marker",{"data-name":a.name,"data-type":l});s[a.name]||(s[a.name]=[]),s[a.name].push(c),e.insert(c,o)}return s}_removeFakeMarkersInsideElement(e,t){const r=this._getAllFakeMarkersFromElement(e,t).reduce((o,a)=>{const l=a.markerElement&&e.createPositionBefore(a.markerElement);let c=o[a.name],d=!1;return c!=null&&c.start&&(c!=null&&c.end)&&(this._getMarkerClipboardConfig(a.name).duplicateOnPaste?o[this._getUniqueMarkerName(a.name)]=o[a.name]:d=!0,c=null),d||(o[a.name]={...c,[a.type]:l}),a.markerElement&&e.remove(a.markerElement),o},{});return dm(r,o=>new b(o.start||e.createPositionFromPath(t,[0]),o.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const s=Array.from(e.createRangeIn(t)).flatMap(({item:a})=>{if(!a.is("element","$marker"))return[];const l=a.getAttribute("data-name"),c=a.getAttribute("data-type");return[{markerElement:a,name:l,type:c}]}),r=[],o=[];for(const a of s)a.type==="end"&&(s.some(c=>c.name===a.name&&c.type==="start")||r.push({markerElement:null,name:a.name,type:"start"})),a.type==="start"&&(s.some(c=>c.name===a.name&&c.type==="end")||o.unshift({markerElement:null,name:a.name,type:"end"}));return[...r,...s,...o]}_getUniqueMarkerName(e){const t=e.split(":"),s=me().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${s}`:`${t.join(":")}:${s}`}}class Ot extends y{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[Vh]}init(){this.editor.editing.view.addObserver(Sn),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(i,e,t){const s=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:t==="cut"},()=>{const r=s._copySelectedFragmentWithMarkers(t,e);this.fire("outputTransformation",{dataTransfer:i,content:r,method:t})})}_setupPasteDrop(){const i=this.editor,e=i.model,t=i.editing.view,s=t.document,r=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(s,"clipboardInput",(o,a)=>{a.method=="paste"&&!i.model.canEditAt(i.model.document.selection)&&o.stop()},{priority:"highest"}),this.listenTo(s,"clipboardInput",(o,a)=>{const l=a.dataTransfer;let c;if(a.content)c=a.content;else{let f="";l.getData("text/html")?f=Ik(l.getData("text/html")):l.getData("text/plain")&&(f=Sk(l.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(f)}const d=new wt(this,"inputTransformation"),h=l.getData("application/ckeditor5-editor-id")||null;this.fire(d,{content:c,dataTransfer:l,sourceEditorId:h,targetRanges:a.targetRanges,method:a.method}),d.stop.called&&o.stop(),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(o,a)=>{if(a.content.isEmpty)return;const c=this.editor.data.toModel(a.content,"$clipboardHolder");c.childCount!=0&&(o.stop(),e.change(()=>{this.fire("contentInsertion",{content:c,method:a.method,sourceEditorId:a.sourceEditorId,dataTransfer:a.dataTransfer,targetRanges:a.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(o,a)=>{a.resultRange=r._pasteFragmentWithMarkers(a.content)},{priority:"low"})}_setupCopyCut(){const i=this.editor,e=i.model.document,s=i.editing.view.document,r=(o,a)=>{const l=a.dataTransfer;a.preventDefault(),this._fireOutputTransformationEvent(l,e.selection,o.name)};this.listenTo(s,"copy",r,{priority:"low"}),this.listenTo(s,"cut",(o,a)=>{i.model.canEditAt(i.model.document.selection)?r(o,a):a.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(o,a)=>{const l=i.data.toView(a.content,{isClipboardPipeline:!0});s.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:l,method:a.method})},{priority:"low"}),this.listenTo(s,"clipboardOutput",(o,a)=>{a.content.isEmpty||(a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content)),a.dataTransfer.setData("text/plain",Mh(i.data.htmlProcessor.domConverter,a.content)),a.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),a.method=="cut"&&i.model.deleteContent(e.selection)},{priority:"low"})}}const Br=Ri("px");class Mk extends T{constructor(){super();const i=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",i.if("isVisible","ck-hidden",e=>!e)],style:{left:i.to("left",e=>Br(e)),top:i.to("top",e=>Br(e)),width:i.to("width",e=>Br(e))}}})}}class es extends y{constructor(){super(...arguments);u(this,"removeDropMarkerDelayed",Go(()=>this.removeDropMarker(),40));u(this,"_updateDropMarkerThrottled",wn(e=>this._updateDropMarker(e),40));u(this,"_reconvertMarkerThrottled",wn(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0));u(this,"_dropTargetLineView",new Mk);
221u(this,"_domEmitter",new(De()));u(this,"_scrollables",new Map)}static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}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,s,r,o,a){this.removeDropMarkerDelayed.cancel();const l=Hc(this.editor,e,t,s,r,o,a);/* istanbul ignore next -- @preserve */if(l){if(a&&a.containsRange(l))return this.removeDropMarker();this._updateDropMarkerThrottled(l)}}getFinalDropRange(e,t,s,r,o,a){const l=Hc(this.editor,e,t,s,r,o,a);return this.removeDropMarker(),l}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:s})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(s);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,s=t.model.markers;t.model.change(r=>{s.has("drop-target")?s.get("drop-target").getRange().isEqual(e)||r.updateMarker("drop-target",{range:e}):r.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 s=this.toDomElement(t);return s.append("⁠",t.createElement("span"),"⁠"),s})}_updateDropTargetLine(e){const t=this.editor.editing,s=e.start.nodeBefore,r=e.start.nodeAfter,o=e.start.parent,a=s?t.mapper.toViewElement(s):null,l=a?t.view.domConverter.mapViewToDom(a):null,c=r?t.mapper.toViewElement(r):null,d=c?t.view.domConverter.mapViewToDom(c):null,h=t.mapper.toViewElement(o);if(!h)return;const f=t.view.domConverter.mapViewToDom(h),m=this._getScrollableRect(h),{scrollX:g,scrollY:w}=C.window,v=l?new R(l):null,O=d?new R(d):null,M=new R(f).excludeScrollbarsAndBorders(),W=v?v.bottom:M.top,ie=O?O.top:M.bottom,Oe=C.window.getComputedStyle(f),He=W<=ie?(W+ie)/2:ie;if(m.top<He&&He<m.bottom){const A=M.left+parseFloat(Oe.paddingLeft),L=M.right-parseFloat(Oe.paddingRight),x=Math.max(A+g,m.left),S=Math.min(L+g,m.right);this._dropTargetLineView.set({isVisible:!0,left:x,top:He+w,width:S-x})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let s;if(this._scrollables.has(t))s=this._scrollables.get(t).domElement;else{const r=this.editor.editing.view.domConverter.mapViewToDom(e);s=Vk(r),this._domEmitter.listenTo(s,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const o=new Si(s,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:s,resizeObserver:o})}return new R(s).excludeScrollbarsAndBorders()}}function Hc(n,i,e,t,s,r,o){const a=n.model,l=n.editing.mapper;let d=Wc(n,i);for(;d;){if(!r){if(a.schema.checkChild(d,"$text")){if(e){const h=e[0].start,f=l.toModelPosition(h);if(!o||Array.from(o.getItems({shallow:!0})).every(g=>a.schema.checkChild(f,g))){if(a.schema.checkChild(f,"$text"))return a.createRange(f);if(h)return ts(n,Wc(n,h.parent),t,s)}}}else if(a.schema.isInline(d))return ts(n,d,t,s)}if(a.schema.isBlock(d))return ts(n,d,t,s);if(a.schema.checkChild(d,"$block")){const h=Array.from(d.getChildren()).filter(g=>g.is("element")&&!Rk(n,g));let f=0,m=h.length;if(m==0)return a.createRange(a.createPositionAt(d,"end"));for(;f<m-1;){const g=Math.floor((f+m)/2);Bh(n,h[g],t,s)=="before"?m=g:f=g}return ts(n,h[f],t,s)}d=d.parent}return null}function Rk(n,i){const e=n.editing.mapper,t=n.editing.view.domConverter,s=e.toViewElement(i);if(!s)return!0;const r=t.mapViewToDom(s);return C.window.getComputedStyle(r).float!="none"}function ts(n,i,e,t){const s=n.model;return s.createRange(s.createPositionAt(i,Bh(n,i,e,t)))}function Bh(n,i,e,t){const s=n.editing.mapper,r=n.editing.view.domConverter,o=s.toViewElement(i),a=r.mapViewToDom(o),l=new R(a);return n.model.schema.isInline(i)?e<(l.left+l.right)/2?"before":"after":t<(l.top+l.bottom)/2?"before":"after"}function Wc(n,i){const e=n.editing.mapper,t=n.editing.view,s=e.toModelElement(i);if(s)return s;const r=t.createPositionBefore(i),o=e.findMappedViewAncestor(r);return e.toModelElement(o)}function Vk(n){let i=n;do{i=i.parentElement;const e=C.window.getComputedStyle(i).overflowY;if(e=="auto"||e=="scroll")break}while(i.tagName!="BODY");return i}class Bk extends y{constructor(){super(...arguments);u(this,"_isBlockDragging",!1);u(this,"_domEmitter",new(De()))}static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,s,r)=>{r?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),P.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const s=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(s,"dragstart",(r,o)=>this._handleBlockDragStart(o)),this._domEmitter.listenTo(C.document,"dragover",(r,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(C.document,"drop",(r,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(C.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&s.setAttribute("draggable","true"),this.on("change:isEnabled",(r,o,a)=>{s.setAttribute("draggable",a?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,s=t.document.selection,r=this.editor.editing.view,o=Array.from(s.getSelectedBlocks()),a=t.createRange(t.createPositionBefore(o[0]),t.createPositionAfter(o[o.length-1]));t.change(l=>l.setSelection(a)),this._isBlockDragging=!0,r.focus(),r.getObserver(Sn).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),s=e.clientY,r=document.elementFromPoint(t,s),o=this.editor.editing.view;!r||!r.closest(".ck-editor__editable")||o.getObserver(Sn).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:r,clientX:t,clientY:s,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class Lk extends y{constructor(){super(...arguments);u(this,"_draggedRange");u(this,"_draggingUid");u(this,"_draggableElement");u(this,"_clearDraggableAttributesDelayed",Go(()=>this._clearDraggableAttributes(),40));u(this,"_blockMode",!1);u(this,"_domEmitter",new(De()));u(this,"_previewContainer")}static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[Ot,Ih,es,Bk]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(Sn),t.addObserver(Vd),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(s,r,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(s,r,o)=>{o||this._finalizeDragging(!1)}),P.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,s=e.editing.view,r=s.document,o=e.plugins.get(es);this.listenTo(r,"dragstart",(a,l)=>{var w;if((w=l.target)!=null&&w.is("editableElement")){l.preventDefault();return}if(this._prepareDraggedRange(l.target),!this._draggedRange){l.preventDefault();return}this._draggingUid=me(),l.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",l.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const c=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(l.dataTransfer,c,"dragstart");const{dataTransfer:h,domTarget:f,domEvent:m}=l,{clientX:g}=m;this._updatePreview({dataTransfer:h,domTarget:f,clientX:g}),l.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(r,"dragend",(a,l)=>{this._finalizeDragging(!l.dataTransfer.isCanceled&&l.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(C.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(r,"dragenter",()=>{this.isEnabled&&s.focus()}),this.listenTo(r,"dragleave",()=>{o.removeDropMarkerDelayed()}),this.listenTo(r,"dragging",(a,l)=>{if(!this.isEnabled){l.dataTransfer.dropEffect="none";return}const{clientX:c,clientY:d}=l.domEvent;o.updateDropMarker(l.target,l.targetRanges,c,d,this._blockMode,this._draggedRange),this._draggedRange||(l.dataTransfer.dropEffect="copy"),P.isGecko||(l.dataTransfer.effectAllowed=="copy"?l.dataTransfer.dropEffect="copy":["all","copyMove"].includes(l.dataTransfer.effectAllowed)&&(l.dataTransfer.dropEffect="move")),a.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,s=e.editing.view.document,r=e.plugins.get(es);this.listenTo(s,"clipboardInput",(o,a)=>
221{if(a.method!="drop")return;const{clientX:l,clientY:c}=a.domEvent,d=r.getFinalDropRange(a.target,a.targetRanges,l,c,this._blockMode,this._draggedRange);if(!d){this._finalizeDragging(!1),o.stop();return}if(this._draggedRange&&this._draggingUid!=a.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),$c(a.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(d,!0)){this._finalizeDragging(!1),o.stop();return}a.targetRanges=[e.editing.mapper.toViewRange(d)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Ot);e.on("contentInsertion",(t,s)=>{if(!this.isEnabled||s.method!=="drop")return;const r=s.targetRanges.map(o=>this.editor.editing.mapper.toModelRange(o));this.editor.model.change(o=>o.setSelection(r))},{priority:"high"}),e.on("contentInsertion",(t,s)=>{if(!this.isEnabled||s.method!=="drop")return;const r=$c(s.dataTransfer)=="move",o=!s.resultRange||!s.resultRange.isCollapsed;this._finalizeDragging(o&&r)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,s=t.document;this.listenTo(s,"pointerdown",(r,o)=>{if(P.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let a=Uc(o.target);if(P.isBlink&&!e.isReadOnly&&!a&&!s.selection.isCollapsed){const l=s.selection.getSelectedElement();(!l||!ee(l))&&(a=s.selection.editableElement)}a&&(t.change(l=>{l.setAttribute("draggable","true",a)}),this._draggableElement=e.editing.mapper.toModelElement(a))}),this.listenTo(s,"pointerup",()=>{P.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,s=t.model;t.plugins.get(es).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&&s.change(o=>{const a=s.createSelection(this._draggedRange);s.deleteContent(a,{doNotAutoparagraph:!0});const l=a.getFirstPosition().parent;l.isEmpty&&!s.schema.checkChild(l,"$text")&&s.schema.checkChild(l,"paragraph")&&o.insertElement("paragraph",l,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,s=t.model,r=s.document.selection,o=e?Uc(e):null;if(o){const d=t.editing.mapper.toModelElement(o);this._draggedRange=Be.fromRange(s.createRangeOn(d)),this._blockMode=s.schema.isBlock(d),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(r.isCollapsed&&!r.getFirstPosition().parent.isEmpty)return;const a=Array.from(r.getSelectedBlocks()),l=r.getFirstRange();if(a.length==0){this._draggedRange=Be.fromRange(l);return}const c=Lh(s,a);if(a.length>1)this._draggedRange=Be.fromRange(c),this._blockMode=!0;else if(a.length==1){const d=l.start.isTouching(c.start)&&l.end.isTouching(c.end);this._draggedRange=Be.fromRange(d?c:l),this._blockMode=d}s.change(d=>d.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:s}){const r=this.editor.editing.view,o=r.document.selection.editableElement,a=r.domConverter.mapViewToDom(o),l=C.window.getComputedStyle(a);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Ue(C.document,"div",{style:"position: fixed; left: -999999px;"}),C.document.body.appendChild(this._previewContainer));const c=Ue(C.document,"div");c.className="ck ck-content ck-clipboard-preview";const d=new R(a),h=parseFloat(l.paddingLeft),f=parseFloat(l.paddingRight),m=parseFloat(l.width)-h-f;if(a.contains(t))if(P.isiOS)c.style.maxWidth=`${m}px`,c.style.padding="10px",c.style.minWidth="200px",c.style.minHeight="20px",c.style.boxSizing="border-box",c.style.backgroundColor="var(--ck-color-base-background)";else return;else if(P.isiOS)c.style.width=`${m}px`,c.style.backgroundColor="var(--ck-color-base-background)";else{const g=d.left-s+h;c.style.width=`${m+g}px`,c.style.paddingLeft=`${g}px`}r.domConverter.setContentOf(c,e.getData("text/html")),e.setDragImage(c,0,0),this._previewContainer.appendChild(c)}}function $c(n){return P.isGecko?n.dropEffect:["all","copyMove"].includes(n.effectAllowed)?"move":"copy"}function Uc(n){if(n.is("editableElement"))return null;
221if(n.hasClass("ck-widget__selection-handle"))return n.findAncestor(ee);if(ee(n))return n;const i=n.findAncestor(e=>ee(e)||e.is("editableElement"));return ee(i)?i:null}function Lh(n,i){const e=i[0],t=i[i.length-1],s=e.getCommonAncestor(t),r=n.createPositionBefore(e),o=n.createPositionAfter(t);if(s&&s.is("element")&&!n.schema.isLimit(s)){const a=n.createRangeOn(s),l=r.isTouching(a.start),c=o.isTouching(a.end);if(l&&c)return Lh(n,[s])}return n.createRange(r,o)}class Fk extends y{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[Ot]}init(){const i=this.editor,e=i.model,t=i.editing.view,s=e.document.selection;t.addObserver(Sn),i.plugins.get(Ot).on("contentInsertion",(r,o)=>{Nk(o.content,e)&&e.change(a=>{const l=Array.from(s.getAttributes()).filter(([d])=>e.schema.getAttributeProperties(d).isFormatting);s.isCollapsed||e.deleteContent(s,{doNotAutoparagraph:!0}),l.push(...s.getAttributes());const c=a.createRangeIn(o.content);for(const d of c.getItems())for(const h of l)e.schema.checkAttribute(d,h[0])&&a.setAttribute(h[0],h[1],d)})})}}function Nk(n,i){let e=i.createRangeIn(n);if(n.childCount==1){const t=n.getChild(0);t.is("element")&&i.schema.isBlock(t)&&!i.schema.isObject(t)&&!i.schema.isLimit(t)&&(e=i.createRangeIn(t))}for(const t of e.getItems())if(!i.schema.isInline(t)||Array.from(t.getAttributeKeys()).find(r=>i.schema.getAttributeProperties(r).isFormatting))return!1;return!0}class Dk extends y{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Vh,Ot,Lk,Fk]}init(){const i=this.editor,e=this.editor.t;i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Copy selected content"),keystroke:"CTRL+C"},{label:e("Paste content"),keystroke:"CTRL+V"},{label:e("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}/**
222 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
223 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
224 */class zk extends Uy{constructor(e,t){super(e);u(this,"view");u(this,"_toolbarConfig");this.view=t,this._toolbarConfig=uh(e.config.get("toolbar"))}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,s=e.editing.view,r=t.editable,o=s.document.getRoot();r.name=o.rootName,t.render();const a=r.element;this.setEditableElement(r.name,a),r.bind("isFocused").to(this.focusTracker),s.attachDomRoot(a),this._initPlaceholder(),this._initToolbar(),t.menuBarView&&this.initMenuBar(t.menuBarView),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.editor,t=this.view,s=t.editable.element,r=t.toolbar;t.panel.bind("isVisible").to(this.focusTracker,"isFocused"),t.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:o})=>o||0),t.listenTo(e.ui,"update",()=>{t.panel.isVisible&&t.panel.pin({target:s,positions:t.panelPositions})}),r.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(r)}_initPlaceholder(){const e=this.editor,t=e.editing.view,s=t.document.getRoot(),r=e.config.get("placeholder");if(r){const o=typeof r=="string"?r:r[s.rootName];o&&(s.placeholder=o)}Vg({view:t,element:s,isDirectHost:!1,keepOnFocus:!0})}}const Hk=Ri("px");class Wk extends _h{constructor(e,t,s,r={}){super(e);u(this,"toolbar");u(this,"panel");u(this,"panelPositions");u(this,"editable");u(this,"_resizeObserver");this.toolbar=new Qs(e,{shouldGroupWhenFull:r.shouldToolbarGroupWhenFull,isFloating:!0}),r.useMenuBar&&(this.menuBarView=new Zy(e)),this.set("viewportTopOffset",0),this.panel=new It(e),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new Ky(e,t,s,{label:r.label}),this._resizeObserver=null}render(){if(super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.menuBarView?this.panel.content.addMany([this.menuBarView,this.toolbar]):this.panel.content.add(this.toolbar),this.toolbar.options.shouldGroupWhenFull){const t=this.editable.element;this._resizeObserver=new Si(t,()=>{this.toolbar.maxWidth=Hk(new R(t).width)})}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(e,t){let s;return e.top>t.height+this.viewportTopOffset?s=e.top-t.height:e.bottom>t.height+this.viewportTopOffset+50?s=this.viewportTopOffset:s=e.bottom,s}_getPanelPositions(){const e=[(t,s)=>
224({top:this._getPanelPositionTop(t,s),left:t.left,name:"toolbar_west",config:{withArrow:!1}}),(t,s)=>({top:this._getPanelPositionTop(t,s),left:t.left+t.width-s.width,name:"toolbar_east",config:{withArrow:!1}})];return this.locale.uiLanguageDirection==="ltr"?e:e.reverse()}}class eP extends l0(gi){constructor(e,t={}){if(!hs(e)&&t.initialData!==void 0)throw new p("editor-create-initial-data",null);super(t);u(this,"ui");this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",$k(e)),this.model.document.createRoot(),hs(e)&&(this.sourceElement=e,c0(this,e));const s=!this.config.get("toolbar.shouldNotGroupWhenFull"),r=this.config.get("menuBar"),o=new Wk(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:s,useMenuBar:r.isVisible,label:this.config.get("label")});this.ui=new zk(this,o),o0(this)}static get editorName(){return"InlineEditor"}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,t={}){return new Promise(s=>{if(hs(e)&&e.tagName==="TEXTAREA")throw new p("editor-wrong-element",null);const r=new this(e,t);s(r.initPlugins().then(()=>r.ui.init()).then(()=>r.data.init(r.config.get("initialData"))).then(()=>r.fire("ready")).then(()=>r))})}}function $k(n){return hs(n)?eg(n):n}function hs(n){return xt(n)}/**
225 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
226 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
227 */class Uk extends j{constructor(i){super(i),this.affectsData=!1}execute(){const i=this.editor.model,e=i.document.selection;let t=i.schema.getLimitElement(e);if(e.containsEntireContent(t)||!qc(i.schema,t))do if(t=t.parent,!t)return;while(!qc(i.schema,t));i.change(s=>{s.setSelection(t,"in")})}}function qc(n,i){return n.isLimit(i)&&(n.checkChild(i,"$text")||n.checkChild(i,"paragraph"))}const qk=zs("Ctrl+A");class Kk extends y{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.t,s=i.editing.view.document;i.commands.add("selectAll",new Uk(i)),this.listenTo(s,"keydown",(r,o)=>{Kt(o)===qk&&(i.execute("selectAll"),o.preventDefault())}),i.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Select all"),keystroke:"CTRL+A"}]})}}class Gk extends y{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.ui.componentFactory.add("selectAll",()=>{const e=this._createButton(B);return e.set({tooltip:!0}),e}),i.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(Z))}_createButton(i){const e=this.editor,t=e.locale,s=e.commands.get("selectAll"),r=new i(e.locale),o=t.t;return r.set({label:o("Select all"),icon:M0,keystroke:"Ctrl+A"}),r.bind("isEnabled").to(s,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),r}}class jk extends y{static get requires(){return[Kk,Gk]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}/**
228 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
229 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
230 */class Fh extends j{constructor(e){super(e);u(this,"_stack",[]);u(this,"_createdBatches",new WeakSet);this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,s)=>{s[1]={...s[1]};const r=s[1];r.batchType||(r.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,s)=>{s[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,s={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:s}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,s){const r=this.editor.model,o=r.document,a=[],l=e.map(d=>d.getTransformedByOperations(s)),c=l.flat();for(const d of l){const h=d.filter(f=>f.root!=o.graveyard).filter(f=>!Qk(f,c));h.length&&(Jk(h),a.push(h[0]))}a.length&&r.change(d=>{d.setSelection(a,{backward:t})})}_undo(e,t){const s=this.editor.model,r=s.document;this._createdBatches.add(t);const o=e.operations.slice().filter(a=>a.isDocumentOperation);o.reverse();for(const a of o){const l=a.baseVersion+1,c=Array.from(r.history.getOperations(l)),h=kb([a.getReversed()],c,{useRelations:!0,document:this.editor.model.document,forceWeakRemove:!0}).operationsA;for(let f of h){const m=f.affectedSelectable;m&&!s.canEditAt(m)&&(f=new se(f.baseVersion)),t.addOperation(f),s.applyOperation(f),r.history.setOperationAsUndone(a,f)}}}}function Jk(n){n.sort((i,e)=>i.start.isBefore(e.start)?-1:1);for(let i=1;i<n.length;i++){const t=n[i-1].getJoined(n[i],!0);t&&(i--,n.splice(i,2,t))}}function Qk(n,i){return i.some(e=>e!==n&&e.containsRange(n,!0))}class Yk extends Fh{execute(i=null){const e=i?this._stack.findIndex(r=>r.batch==i):this._stack.length-1,t=this._stack.splice(e,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>
230{this._undo(t.batch,s);const r=this.editor.model.document.history.getOperations(t.batch.baseVersion);this._restoreSelection(t.selection.ranges,t.selection.isBackward,r)}),this.fire("revert",t.batch,s),this.refresh()}}class Xk extends Fh{execute(){const i=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,()=>{const s=i.batch.operations[i.batch.operations.length-1].baseVersion+1,r=this.editor.model.document.history.getOperations(s);this._restoreSelection(i.selection.ranges,i.selection.isBackward,r),this._undo(i.batch,e)}),this.refresh()}}class Zk extends y{constructor(){super(...arguments);u(this,"_undoCommand");u(this,"_redoCommand");u(this,"_batchRegistry",new WeakSet)}static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;this._undoCommand=new Yk(e),this._redoCommand=new Xk(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(s,r)=>{const o=r[0];if(!o.isDocumentOperation)return;const a=o.batch,l=this._redoCommand.createdBatches.has(a),c=this._undoCommand.createdBatches.has(a);this._batchRegistry.has(a)||(this._batchRegistry.add(a),a.isUndoable&&(l?this._undoCommand.addBatch(a):c||(this._undoCommand.addBatch(a),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(s,r,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"]]}]})}}class eC extends y{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale,t=i.t,s=e.uiLanguageDirection=="ltr"?$l:Wl,r=e.uiLanguageDirection=="ltr"?Wl:$l;this._addButtonsToFactory("undo",t("Undo"),"CTRL+Z",s),this._addButtonsToFactory("redo",t("Redo"),"CTRL+Y",r)}_addButtonsToFactory(i,e,t,s){const r=this.editor;r.ui.componentFactory.add(i,()=>{const o=this._createButton(B,i,e,t,s);return o.set({tooltip:!0}),o}),r.ui.componentFactory.add("menuBar:"+i,()=>this._createButton(Z,i,e,t,s))}_createButton(i,e,t,s,r){const o=this.editor,a=o.locale,l=o.commands.get(e),c=new i(a);return c.set({label:t,icon:r,keystroke:s}),c.bind("isEnabled").to(l,"isEnabled"),this.listenTo(c,"execute",()=>{o.execute(e),o.editing.view.focus()}),c}}class tC extends y{static get requires(){return[Zk,eC]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}}/**
231 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
232 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
233 */class tP extends y{static get requires(){return[F1,Dk,Xs,jk,Nv,dv,tC]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}/**
234 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
235 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
236 */class Zs extends j{constructor(e,t){super(e);u(this,"attributeKey");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,r=t.document.selection,o=e.value,a=e.batch,l=c=>{if(r.isCollapsed)o?c.setSelectionAttribute(this.attributeKey,o):c.removeSelectionAttribute(this.attributeKey);else{const d=t.schema.getValidRanges(r.getRanges(),this.attributeKey);for(const h of d)o?c.setAttribute(this.attributeKey,o,h):c.removeAttribute(this.attributeKey,h)}};a?t.enqueueChange(a,c=>{l(c)}):t.change(c=>{l(c)})}}const pe="fontSize",we="fontFamily",tt="fontColor",dt="fontBackgroun
236dColor";function Nh(n,i){const e={model:{key:n,values:[]},view:{},upcastAlso:{}};for(const t of i)e.model.values.push(t.model),e.view[t.model]=t.view,t.upcastAlso&&(e.upcastAlso[t.model]=t.upcastAlso);return e}function Dh(n){return i=>nC(i.getStyle(n))}function zh(n){return(i,{writer:e})=>e.createAttributeElement("span",{style:`${n}:${i}`},{priority:7})}function iC({dropdownView:n,colors:i,columns:e,removeButtonLabel:t,colorPickerLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerViewConfig:a}){const l=n.locale,c=new gh(l,{colors:i,columns:e,removeButtonLabel:t,colorPickerLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerViewConfig:a});return n.colorSelectorView=c,n.panelView.children.add(c),c}function nC(n){return n.replace(/\s/g,"")}class sC extends Zs{constructor(i){super(i,we)}}/**
237 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
238 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
239 */function Hh(n){return n.map(rC).filter(i=>i!==void 0)}function wo(n){return n.replace(/["']/g,"").split(",").map(i=>i.trim())}function rC(n){if(typeof n=="object")return n;if(n==="default")return{title:"Default",model:void 0};if(typeof n=="string")return oC(n)}function oC(n){const i=wo(n),e=i[0],t=i.map(aC).join(", ");return{title:e,model:t,view:{name:"span",styles:{"font-family":t},priority:7}}}function aC(n){return n=n.trim(),n.indexOf(" ")>0&&(n=`'${n}'`),n}class lC extends y{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.config.define(we,{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 i=this.editor;i.model.schema.extend("$text",{allowAttributes:we}),i.model.schema.setAttributeProperties(we,{isFormatting:!0,copyOnEnter:!0});const e=Hh(i.config.get("fontFamily.options")).filter(s=>s.model),t=Nh(we,e);i.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):i.conversion.attributeToElement(t),i.commands.add(we,new sC(i))}_prepareAnyValueConverters(){const i=this.editor;i.conversion.for("downcast").attributeToElement({model:we,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),i.conversion.for("upcast").elementToAttribute({model:{key:we,value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:we,value:e=>e.getAttribute("face")}})}}class cC extends y{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.t,t=this._getLocalizedOptions(),s=i.commands.get(we),r=e("Font Family"),o=uC(t,s);i.ui.componentFactory.add(we,a=>{const l=ei(a);return ga(l,o,{role:"menu",ariaLabel:r}),l.buttonView.set({label:r,icon:Nl,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),l.bind("isEnabled").to(s),this.listenTo(l,"execute",c=>{i.execute(c.source.commandName,{value:c.source.commandParam}),i.editing.view.focus()}),l}),i.ui.componentFactory.add(`menuBar:${we}`,a=>{const l=new gt(a);l.buttonView.set({label:r,icon:Nl}),l.bind("isEnabled").to(s);const c=new xn(a);for(const d of o){const h=new Nn(a,l),f=new Z(a);f.set({role:"menuitemradio",isToggleable:!0}),f.bind(...Object.keys(d.model)).to(d.model),f.delegate("execute").to(l),f.on("execute",()=>{i.execute(d.model.commandName,{value:d.model.commandParam}),i.editing.view.focus()}),h.children.add(f),c.items.add(h)}return l.panelView.children.add(c),l})}_getLocalizedOptions(){const i=this.editor,e=i.t;return Hh(i.config.get(we).options).map(s=>(s.title==="Default"&&(s.title=e("Default")),s))}}function uC(n,i){const e=new Se;for(const t of n){const s={type:"button",model:new wa({commandName:we,commandParam:t.model,label:t.title,role:"menuitemradio",withText:!0})};s.model.bind("isOn").to(i,"value",r=>{if(r===t.model)return!0;
239if(!r||!t.model)return!1;const o=wo(r)[0].toLowerCase(),a=wo(t.model)[0].toLowerCase();return o===a}),t.view&&typeof t.view!="string"&&t.view.styles&&s.model.set("labelStyle",`font-family: ${t.view.styles["font-family"]}`),e.add(s)}return e}class dC extends y{static get requires(){return[lC,cC]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}class hC extends Zs{constructor(i){super(i,pe)}}function In(n){return n.map(i=>fC(i)).filter(i=>i!==void 0)}const Kc={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function fC(n){if(typeof n=="number"&&(n=String(n)),typeof n=="object"&&pC(n))return bo(n);const i=gC(n);if(i)return bo(i);if(n==="default")return{model:void 0,title:"Default"};if(!wC(n))return mC(n)}function mC(n){return typeof n=="string"&&(n={title:n,model:`${parseFloat(n)}px`}),n.view={name:"span",styles:{"font-size":n.model}},bo(n)}function bo(n){return n.view&&typeof n.view!="string"&&!n.view.priority&&(n.view.priority=7),n}function gC(n){return typeof n=="string"?Kc[n]:Kc[n.model]}function pC(n){return n.title&&n.model&&n.view}function wC(n){let i;if(typeof n=="object")if(n.model)i=parseFloat(n.model);else throw new p("font-size-invalid-definition",null,n);else i=parseFloat(n);return isNaN(i)}const Gc=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class bC extends y{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.config.define(pe,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const i=this.editor;i.model.schema.extend("$text",{allowAttributes:pe}),i.model.schema.setAttributeProperties(pe,{isFormatting:!0,copyOnEnter:!0});const e=i.config.get("fontSize.supportAllValues"),t=In(this.editor.config.get("fontSize.options")).filter(r=>r.model),s=Nh(pe,t);e?(this._prepareAnyValueConverters(s),this._prepareCompatibilityConverter()):i.conversion.attributeToElement(s),i.commands.add(pe,new hC(i))}_prepareAnyValueConverters(i){const e=this.editor,t=i.model.values.filter(s=>!Bd(String(s))&&!P_(String(s)));if(t.length)throw new p("font-size-invalid-use-of-named-presets",null,{presets:t});e.conversion.for("downcast").attributeToElement({model:pe,view:(s,{writer:r})=>{if(s)return r.createAttributeElement("span",{style:"font-size:"+s},{priority:7})}}),e.conversion.for("upcast").elementToAttribute({model:{key:pe,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:pe,value:e=>{const t=e.getAttribute("size"),s=t[0]==="-"||t[0]==="+";let r=parseInt(t,10);s&&(r=3+r);const o=Gc.length-1,a=Math.min(Math.max(r,0),o);return Gc[a]}}})}}class _C extends y{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.t,t=this._getLocalizedOptions(),s=i.commands.get(pe),r=e("Font Size"),o=yC(t,s);i.ui.componentFactory.add(pe,a=>{const l=ei(a);return ga(l,o,{role:"menu",ariaLabel:r}),l.buttonView.set({label:r,icon:Dl,tooltip:!0}),l.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),l.bind("isEnabled").to(s),this.listenTo(l,"execute",c=>{i.execute(c.source.commandName,{value:c.source.commandParam}),i.editing.view.focus()}),l}),i.ui.componentFactory.add(`menuBar:${pe}`,a=>{const l=new gt(a);l.buttonView.set({label:r,icon:Dl}),l.bind("isEnabled").to(s);const c=new xn(a);for(const d of o){const h=new Nn(a,l),f=new Z(a);f.set({role:"menuitemradio",isToggleable:!0}),f.bind(...Object.keys(d.model)).to(d.model),f.delegate("execute").to(l),f.on("execute",()=>{i.execute(d.model.commandName,{value:d.model.commandParam}),i.editing.view.focus()}),h.children.add(f),c.items.add(h)}return l.panelView.children.add(c),l})}_getLocalizedOptions(){const i=this.editor,e=i.t,t={Default:e("Default"),Tiny:e("Tiny"),Small:e("Small"),Big:e("Big"),Huge:e("Huge")};
239return In(i.config.get(pe).options).map(r=>{const o=t[r.title];return o&&o!=r.title&&(r=Object.assign({},r,{title:o})),r})}}function yC(n,i){const e=new Se;for(const t of n){const s={type:"button",model:new wa({commandName:pe,commandParam:t.model,label:t.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};t.view&&typeof t.view!="string"&&(t.view.styles&&s.model.set("labelStyle",`font-size:${t.view.styles["font-size"]}`),t.view.classes&&s.model.set("class",`${s.model.class} ${t.view.classes}`)),s.model.bind("isOn").to(i,"value",r=>r===t.model),e.add(s)}return e}class vC extends y{static get requires(){return[bC,_C]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(i){return In(i)}}class kC extends Zs{constructor(i){super(i,tt)}}class CC extends y{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.config.define(tt,{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}),i.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:tt,value:Dh("color")}}),i.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:tt,value:e=>e.getAttribute("color")}}),i.conversion.for("downcast").attributeToElement({model:tt,view:zh("color")}),i.commands.add(tt,new kC(i)),i.model.schema.extend("$text",{allowAttributes:tt}),i.model.schema.setAttributeProperties(tt,{isFormatting:!0,copyOnEnter:!0})}}class Wh extends y{constructor(e,{commandName:t,componentName:s,icon:r,dropdownLabel:o}){super(e);u(this,"commandName");u(this,"componentName");u(this,"icon");u(this,"dropdownLabel");u(this,"columns");this.commandName=t,this.componentName=s,this.icon=r,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,s=t.t,r=e.commands.get(this.commandName),o=e.config.get(this.componentName),a=Q1(o.colors),l=J1(t,a),c=o.documentColors,d=o.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,h=>{const f=ei(h);let m=!1;const g=iC({dropdownView:f,colors:l.map(w=>({label:w.label,color:w.model,options:{hasBorder:w.hasBorder}})),columns:this.columns,removeButtonLabel:s("Remove color"),colorPickerLabel:s("Color picker"),documentColorsLabel:c!==0?s("Document colors"):"",documentColorsCount:c===void 0?this.columns:c,colorPickerViewConfig:d?o.colorPicker||{}:!1});return g.bind("selectedColor").to(r,"value"),f.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),f.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),f.bind("isEnabled").to(r),g.on("execute",(w,v)=>{f.isOpen&&e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),v.source!=="colorPicker"&&e.editing.view.focus(),v.source==="colorPickerSaveButton"&&(f.isOpen=!1)}),g.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),g.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(f.isOpen=!1,e.execute("undo",this._und
239oStepBatch)),e.editing.view.focus()}),f.on("change:isOpen",(w,v,O)=>{m||(m=!0,f.colorSelectorView.appendUI()),O&&(c!==0&&g.updateDocumentColors(e.model,this.componentName),g.updateSelectedColors(),g.showColorGridsFragment())}),pa(f,()=>f.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(w=>w.isOn)),f}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,h=>{const f=new gt(h);f.buttonView.set({label:this.dropdownLabel,icon:this.icon}),f.bind("isEnabled").to(r);let m=!1;const g=new gh(h,{colors:l.map(w=>({label:w.label,color:w.model,options:{hasBorder:w.hasBorder}})),columns:this.columns,removeButtonLabel:s("Remove color"),colorPickerLabel:s("Color picker"),documentColorsLabel:c!==0?s("Document colors"):"",documentColorsCount:c===void 0?this.columns:c,colorPickerViewConfig:!1});return g.bind("selectedColor").to(r,"value"),g.delegate("execute").to(f),g.on("execute",(w,v)=>{e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),e.editing.view.focus()}),f.on("change:isOpen",(w,v,O)=>{m||(m=!0,g.appendUI()),O&&(c!==0&&g.updateDocumentColors(e.model,this.componentName),g.updateSelectedColors(),g.showColorGridsFragment())}),f.panelView.children.add(g),f})}}class EC extends Wh{constructor(i){const e=i.locale.t;super(i,{commandName:tt,componentName:tt,icon:_0,dropdownLabel:e("Font Color")})}static get pluginName(){return"FontColorUI"}}class TC extends y{static get requires(){return[CC,EC]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class PC extends Zs{constructor(i){super(i,dt)}}class AC extends y{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.config.define(dt,{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}),i.data.addStyleProcessorRules(L_),i.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:dt,value:Dh("background-color")}}),i.conversion.for("downcast").attributeToElement({model:dt,view:zh("background-color")}),i.commands.add(dt,new PC(i)),i.model.schema.extend("$text",{allowAttributes:dt}),i.model.schema.setAttributeProperties(dt,{isFormatting:!0,copyOnEnter:!0})}}class xC extends Wh{constructor(i){const e=i.locale.t;super(i,{commandName:dt,componentName:dt,icon:b0,dropdownLabel:e("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class SC extends y{static get requires(){return[AC,xC]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}class iP extends y{static get requires(){return[dC,vC,TC,SC]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}}/**
240 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
241 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
242 */class IC extends j{constructor(i){super(i),this._isEnabledBasedOnSelection=!1}refresh(){const i=this.editor.model,e=i.document,t=ye(e.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&jc(t,i.schema)}execute(i={}){const e=this.editor.model,t=e.document,s=i.selection||t.selection;e.canEditAt(s)&&e.change(r=>{const o=s.getSelectedBlocks();for(const a of o)!a.is("element","paragraph")&&jc(a,e.schema)&&r.rename(a,"paragraph")})}}function jc(n,i){return i.checkChild(n.parent,"paragraph")&&!i.isObject(n)}class OC extends j{constructor(i){super(i),this._isEnabledBasedOnSelection=!1}execute(i){const e=this.editor.model,t=i.attributes;let s=i.position;return e.canEditAt(s)?e.change(r=>{if(s=this._findPositionToInsertParagraph(s,r),!s)return null;const o=r.createElement("paragraph");return t&&e.schema.setAllowedAttributes(o,t,r),e.insertContent(o,s),r.setSelection(o,"in"),r.createPositionAt(o,0)}):null}_findPositionToInsertParagraph(i,e){const t=this.editor.model;if(t.schema.checkChild(i,"paragraph"))return i;const s=t.schema.findAllowedParent(i,"paragraph");if(!s)return null;const r=i.parent,o=t.schema.checkChild(r,"$text");return r.isEmpty||o&&i.isAtEnd?t.createPositionAfter(r):!r.isEmpty&&o&&i.isAtStart?t.createPositionBefore(r):e.split(i,s).position}}const Is=class Is extends y{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.model;i.commands.add("paragraph",new IC(i)),i.commands.add("insertParagraph",new OC(i)),e.schema.register("paragraph",{inheritAllFrom
242:"$block"}),i.conversion.elementToElement({model:"paragraph",view:"p"}),i.conversion.for("upcast").elementToElement({model:(t,{writer:s})=>!Is.paragraphLikeElements.has(t.name)||t.isEmpty?null:s.createElement("paragraph"),view:/.+/,converterPriority:"low"})}};u(Is,"paragraphLikeElements",new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]));let _o=Is;/**
243 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
244 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
245 */class MC extends j{constructor(e,t){super(e);u(this,"modelElements");this.modelElements=t}refresh(){const e=ye(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>Jc(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,s=t.document,r=e.value;t.change(o=>{const a=Array.from(s.selection.getSelectedBlocks()).filter(l=>Jc(l,r,t.schema));for(const l of a)l.is("element",r)||o.rename(l,r)})}}function Jc(n,i,e){return e.checkChild(n.parent,i)&&!e.isObject(n)}const Qc="paragraph";class RC extends y{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(i){super(i),i.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[_o]}init(){const i=this.editor,e=i.config.get("heading.options"),t=[];for(const s of e)s.model!=="paragraph"&&(i.model.schema.register(s.model,{inheritAllFrom:"$block"}),i.conversion.elementToElement(s),t.push(s.model));this._addDefaultH1Conversion(i),i.commands.add("heading",new MC(i,t))}afterInit(){const i=this.editor,e=i.commands.get("enter"),t=i.config.get("heading.options");e&&this.listenTo(e,"afterExecute",(s,r)=>{const o=i.model.document.selection.getFirstPosition().parent;t.some(l=>o.is("element",l.model))&&!o.is("element",Qc)&&o.childCount===0&&r.writer.rename(o,Qc)})}_addDefaultH1Conversion(i){i.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:Tt.low+1})}}/**
246 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
247 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
248 */function VC(n){const i=n.t,e={Paragraph:i("Paragraph"),"Heading 1":i("Heading 1"),"Heading 2":i("Heading 2"),"Heading 3":i("Heading 3"),"Heading 4":i("Heading 4"),"Heading 5":i("Heading 5"),"Heading 6":i("Heading 6")};return n.config.get("heading.options").map(t=>{const s=e[t.title];return s&&s!=t.title&&(t.title=s),t})}class BC extends y{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.t,t=VC(i),s=e("Choose heading"),r=e("Heading");i.ui.componentFactory.add("heading",o=>{const a={},l=new Se,c=i.commands.get("heading"),d=i.commands.get("paragraph"),h=[c];for(const m of t){const g={type:"button",model:new wa({label:m.title,class:m.class,role:"menuitemradio",withText:!0})};m.model==="paragraph"?(g.model.bind("isOn").to(d,"value"),g.model.set("commandName","paragraph"),h.push(d)):(g.model.bind("isOn").to(c,"value",w=>w===m.model),g.model.set({commandName:"heading",commandValue:m.model})),l.add(g),a[m.model]=m.title}const f=ei(o);return ga(f,l,{ariaLabel:r,role:"menu"}),f.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),f.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),f.bind("isEnabled").toMany(h,"isEnabled",(...m)=>m.some(g=>g)),f.buttonView.bind("label").to(c,"value",d,"value",(m,g)=>{const w=g?"paragraph":m;return typeof w=="boolean"||!a[w]?s:a[w]}),f.buttonView.bind("ariaLabel").to(c,"value",d,"value",(m,g)=>{const w=g?"paragraph":m;return typeof w=="boolean"||!a[w]?r:`${a[w]}, ${r}`}),this.listenTo(f,"execute",m=>{const{commandName:g,commandValue:w}=m.source;i.execute(g,w?{value:w}:void 0),i.editing.view.focus()}),f}),i.ui.componentFactory.add("menuBar:heading",o=>{const a=new gt(o),l=i.commands.get("heading"),c=i.commands.get("paragraph"),d=[l],h=new xn(o);a.set({class:"ck-heading-dropdown"}),h.set({ariaLabel:e("Heading"),role:"menu"}),a.buttonView.set({label:e("Heading")}),a.panelView.children.add(h);for(const f of t){const m=new Nn(o,a),g=new Z(o);m.children.add(g),h.items.add(m),g.set({isToggleable:!0,label:f.title,role:"menuitemradio",class:f.class}),g.delegate("execute").to(a),g.on("execute",()=>{const w=f.model==="paragraph"?"paragraph":"heading";i.execute(w,{value:f.model}),i.editing.view.focus()}),f.model==="paragraph"?(g.bind("isOn").to(c,"value"),d.push(c)):g.bind("isOn").to(l,"value",w=>w===f.model)}return a.bind("isEnabled").toMany(d,"isEnabled",(...f)=>f.some(m=>m)),a})}}class nP extends y{static get requires(){return[RC,BC]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}}/**
249 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
250 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
251 */class LC extends j{refresh(){const i=this.editor.model,e=i.schema,t=i.document.selection;this.isEnabled=FC(t,e,i)}execute(){const i=this.editor.model;i.change(e=>{const t=e.createElement("horizontalLine");i.insertObject(t,null,null,{setSelection:"after"})})}}function FC(n,i,e){const t=NC(n,e);return i.checkChild(t,"horizontalLine")}function NC(n,i){const t=Qv(n,i).start.parent;return t.isEmpty&&!t.is("element","$root")?t.parent:t}class DC extends y{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.model.schema,t=i.t,s=i.conversion;
251e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),s.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:o})=>o.createEmptyElement("hr")}),s.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:o})=>{const a=t("Horizontal line"),l=o.createContainerElement("div",null,o.createEmptyElement("hr"));return o.addClass("ck-horizontal-line",l),o.setCustomProperty("hr",!0,l),zC(l,o,a)}}),s.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),i.commands.add("horizontalLine",new LC(i))}}function zC(n,i,e){return i.setCustomProperty("horizontalLine",!0,n),qv(n,i,{label:e})}class HC extends y{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.ui.componentFactory.add("horizontalLine",()=>{const e=this._createButton(B);return e.set({tooltip:!0}),e}),i.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(Z))}_createButton(i){const e=this.editor,t=e.locale,s=e.commands.get("horizontalLine"),r=new i(e.locale),o=t.t;return r.set({label:o("Horizontal line"),icon:y0}),r.bind("isEnabled").to(s,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),r}}class sP extends y{static get requires(){return[DC,HC,Ih]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}/**
252 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
253 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
254 */class WC extends y{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.commands.add("indent",new Bl(i)),i.commands.add("outdent",new Bl(i))}}class $C extends y{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.locale,t=i.t,s=e.uiLanguageDirection=="ltr"?zl:Hl,r=e.uiLanguageDirection=="ltr"?Hl:zl;this._defineButton("indent",t("Increase indent"),s),this._defineButton("outdent",t("Decrease indent"),r)}_defineButton(i,e,t){const s=this.editor;s.ui.componentFactory.add(i,()=>{const r=this._createButton(B,i,e,t);return r.set({tooltip:!0}),r}),s.ui.componentFactory.add("menuBar:"+i,()=>this._createButton(Z,i,e,t))}_createButton(i,e,t,s){const r=this.editor,o=r.commands.get(e),a=new i(r.locale);return a.set({label:t,icon:s}),a.bind("isEnabled").to(o,"isEnabled"),this.listenTo(a,"execute",()=>{r.execute(e),r.editing.view.focus()}),a}}class rP extends y{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[WC,$C]}}class is extends j{constructor(e,t){super(e);u(this,"_indentBehavior");this._indentBehavior=t}refresh(){const t=this.editor.model,s=ye(t.document.selection.getSelectedBlocks());if(!s||!this._isIndentationChangeAllowed(s)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(s.getAttribute("blockIndent"))}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change(s=>{for(const r of t){const o=r.getAttribute("blockIndent"),a=this._indentBehavior.getNextIndent(o);a?s.setAttribute("blockIndent",a,r):s.removeAttribute("blockIndent",r)}})}_getBlocksToChange(){const t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(r=>this._isIndentationChangeAllowed(r))}_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}}/**
255 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
256 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
257 */class Yc{constructor(i){u(this,"isForward");u(this,"offset");u(this,"unit");this.isForward=i.direction==="forward",this.offset=i.offset,this.unit=i.unit}checkEnabled(i){const e=parseFloat(i||"0");return this.isForward||e>0}getNextIndent(i){const e=parseFloat(i||"0");if(!(!i||i.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const s=this.isForward?this.offset:-this.offset,r=e+s;return r>0?r+this.unit:void 0}}/**
258 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
259 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
260 */class Xc{constructor(i){u(this,"isForward");u(this,"classes");this.isForward=i.direction==="forward",this.classes=i.classes}checkEnabled(i){const e=this.classes.indexOf(i);return this.isForward?e<this.classes.length-1:e>=0}getNextIndent(i){const e=this.classes.indexOf(i),t=this.isForward?1:-1;return this.classes[e+t]}}const UC=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class oP extends y{constructor(i){super(i),i.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),i.commands.add("indentBlock",new is(i,new Xc({direction:"forward",classes:e.classes}
260))),i.commands.add("outdentBlock",new is(i,new Xc({direction:"backward",classes:e.classes})))):(i.data.addStyleProcessorRules($_),this._setupConversionUsingOffset(),i.commands.add("indentBlock",new is(i,new Yc({direction:"forward",offset:e.offset,unit:e.unit}))),i.commands.add("outdentBlock",new is(i,new Yc({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const i=this.editor,e=i.model.schema,t=i.commands.get("indent"),s=i.commands.get("outdent"),r=i.config.get("heading.options");(r&&r.map(l=>l.model)||UC).forEach(l=>{e.isRegistered(l)&&e.extend(l,{allowAttributes:"blockIndent"})}),e.setAttributeProperties("blockIndent",{isFormatting:!0}),t.registerChildCommand(i.commands.get("indentBlock")),s.registerChildCommand(i.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const i=this.editor.conversion,t=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";i.for("upcast").attributeToAttribute({view:{styles:{[t]:/[\s\S]+/}},model:{key:"blockIndent",value:s=>{if(!s.is("element","li"))return s.getStyle(t)}}}),i.for("downcast").attributeToAttribute({model:"blockIndent",view:s=>({key:"style",value:{[t]:s}})})}_setupConversionUsingClasses(i){const e={model:{key:"blockIndent",values:[]},view:{}};for(const t of i)e.model.values.push(t),e.view[t]={key:"class",value:[t]};this.editor.conversion.attributeToAttribute(e)}}/**
261 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
262 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
263 */class qC{constructor(){u(this,"_definitions",new Set)}get length(){return this._definitions.size}add(i){Array.isArray(i)?i.forEach(e=>this._definitions.add(e)):this._definitions.add(i)}getDispatcher(){return i=>{i.on("attribute:linkHref",(e,t,s)=>{if(!s.consumable.test(t.item,"attribute:linkHref")||!(t.item.is("selection")||s.schema.isInline(t.item)))return;const r=s.writer,o=r.document.selection;for(const a of this._definitions){const l=r.createAttributeElement("a",a.attributes,{priority:5});a.classes&&r.addClass(a.classes,l);for(const c in a.styles)r.setStyle(c,a.styles[c],l);r.setCustomProperty("link",!0,l),a.callback(t.attributeNewValue)?t.item.is("selection")?r.wrap(o.getFirstRange(),l):r.wrap(s.mapper.toViewRange(t.range),l):r.unwrap(s.mapper.toViewRange(t.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return i=>{i.on("attribute:linkHref:imageBlock",(e,t,{writer:s,mapper:r})=>{const o=r.toViewElement(t.item),a=Array.from(o.getChildren()).find(l=>l.is("element","a"));if(a)for(const l of this._definitions){const c=je(l.attributes);if(l.callback(t.attributeNewValue)){for(const[d,h]of c)d==="class"?s.addClass(h,a):s.setAttribute(d,h,a);l.classes&&s.addClass(l.classes,a);for(const d in l.styles)s.setStyle(d,l.styles[d],a)}else{for(const[d,h]of c)d==="class"?s.removeClass(h,a):s.removeAttribute(d,a);l.classes&&s.removeClass(l.classes,a);for(const d in l.styles)s.removeStyle(d,a)}}})}}}const KC=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,GC="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",jC=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,JC=/^((\w+:(\/{2,})?)|(\W))/i,QC=["https?","ftps?","mailto"],en="Ctrl+K";function YC(n){return n.is("attributeElement")&&!!n.getCustomProperty("link")}function Zc(n,{writer:i}){const e=i.createAttributeElement("a",{href:n},{priority:5});return i.setCustomProperty("link",!0,e),e}function $h(n,i=QC){const e=String(n),t=i.join("|"),s=new RegExp(`${GC.replace("<protocols>",t)}`,"i");return XC(e,s)?e:"#"}function XC(n,i){return!!n.replace(KC,"").match(i)}function ZC(n,i){const e={"Open in a new tab":n("Open in a new tab"),Downloadable:n("Downloadable")};return i.forEach(t=>("label"in t&&e[t.label]&&(t.label=e[t.label]),t)),i}function e5(n){const i=[];if(n)for(const[e,t]of Object.entries(n)){const s=Object.assign({},t,{id:`link${wm(e)}`});i.push(s)}return i}function yo(n,i){return n?i.checkAttribute(n.name,"linkHref"):!1}function t5(n){return jC.test(n)}function _a(n,i){const e=t5(n)?"mailto:":i,t=!!e&&!Uh(n);return n&&t?e+n:n}function Uh(n){return JC.test(n)}function i5(n){window.open(n,"_blank","noopener")}function vo(n){let i="";for(const e of n.getItems()){if(!e.is("$text")&&!e.is("$textProxy"))return;i+=e.data}return i}class n5 extends j{constructor(){super(...arguments);u(this,"manualDecorators",new Se);u(this,"automaticDecorators",new qC)}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,s=t.getSelectedElement()||ye(t.getSelectedBlocks());yo(s,e.schema)?(this.value=s.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(s,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const r of this.manualDecorators)r.value=this._getDecoratorStateFromModel(r.id)}
263execute(e,t={},s){const r=this.editor.model,o=r.document.selection,a=[],l=[];for(const c in t)t[c]?a.push(c):l.push(c);r.change(c=>{const d=m=>{c.setAttribute("linkHref",e,m),a.forEach(g=>c.setAttribute(g,!0,m)),l.forEach(g=>c.removeAttribute(g,m))},h=(m,g)=>{const w=vo(m);if(!w)return m;let v=s;if(v||(v=g&&g==w?e:w),v!=w){const O=s5(w,v);let M=0;for(const{offset:W,actual:ie,expected:Oe}of O){const He=W+M,A=c.createRange(m.start.getShiftedBy(He),m.start.getShiftedBy(He+ie.length)),x=r5(A,m).getAttributes(),S=Array.from(x).filter(([ge])=>r.schema.getAttributeProperties(ge).isFormatting),J=c.createText(Oe,S);d(J),r.insertContent(J,A),M+=Oe.length}return c.createRange(m.start,m.start.getShiftedBy(v.length))}},f=m=>{const{plugins:g}=this.editor;if(c.setSelection(m.end),g.has("TwoStepCaretMovement"))g.get("TwoStepCaretMovement")._handleForwardMovement();else for(const w of["linkHref",...a,...l])c.removeSelectionAttribute(w)};if(o.isCollapsed){const m=o.getFirstPosition();if(o.hasAttribute("linkHref")){const g=o.getAttribute("linkHref"),w=Ys(m,"linkHref",g,r),v=h(w,g);d(v||w),v&&f(v)}else if(e!==""){const g=je(o.getAttributes());g.set("linkHref",e),a.forEach(v=>{g.set(v,!0)});const w=r.insertContent(c.createText(s||e,g),m);f(w)}}else{const m=Array.from(o.getRanges()),g=r.schema.getValidRanges(m,"linkHref"),w=[];for(const M of o.getSelectedBlocks())r.schema.checkAttribute(M,"linkHref")&&w.push(c.createRangeOn(M));const v=w.slice();for(const M of g)this._isRangeToUpdate(M,w)&&v.push(M);const O=m.map(M=>({start:oe.fromPosition(M.start,"toPrevious"),end:oe.fromPosition(M.end,"toNext")}));for(let M of v){const W=(M.start.textNode||M.start.nodeAfter).getAttribute("linkHref");M=h(M,W)||M,d(M)}c.setSelection(O.map(M=>{const W=M.start.toPosition(),ie=M.end.toPosition();return M.start.detach(),M.end.detach(),r.createRange(W,ie)}))}})}_getDecoratorStateFromModel(e){const t=this.editor.model,s=t.document.selection,r=s.getSelectedElement();return yo(r,t.schema)?r.getAttribute(e):s.getAttribute(e)}_isRangeToUpdate(e,t){for(const s of t)if(s.containsRange(e))return!1;return!0}}function s5(n,i){const e=ki(n,i),t={equal:0,insert:0,delete:0},s=[];let r="",o="";for(const a of[...e,null])a=="insert"?o+=i[t.equal+t.insert]:a=="delete"?r+=n[t.equal+t.delete]:(r.length||o.length)&&(s.push({offset:t.equal,actual:r,expected:o}),r="",o=""),a&&t[a]++;return s}function r5(n,i){if(!n.isCollapsed)return ye(n.getItems());const e=n.start;return e.textNode?e.textNode:!e.nodeBefore||e.isEqual(i.start)?e.nodeAfter:e.nodeBefore}class o5 extends j{refresh(){const i=this.editor.model,e=i.document.selection,t=e.getSelectedElement();yo(t,i.schema)?this.isEnabled=i.schema.checkAttribute(t,"linkHref"):this.isEnabled=i.schema.checkAttributeInSelection(e,"linkHref")}execute(){const i=this.editor,e=this.editor.model,t=e.document.selection,s=i.commands.get("link");e.change(r=>{const o=t.isCollapsed?[Ys(t.getFirstPosition(),"linkHref",t.getAttribute("linkHref"),e)]:e.schema.getValidRanges(t.getRanges(),"linkHref");for(const a of o)if(r.removeAttribute("linkHref",a),s)for(const l of s.manualDecorators)r.removeAttribute(l.id,a)})}}class a5 extends q(){constructor({id:e,label:t,attributes:s,classes:r,styles:o,defaultValue:a}){super();u(this,"id");u(this,"defaultValue");u(this,"label");u(this,"attributes");u(this,"classes");u(this,"styles");this.id=e,this.set("value",void 0),this.defaultValue=a,this.label=t,this.attributes=s,this.classes=r,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const l5="ck-link_selected",eu="automatic",c5="manual",u5=/^(https?:)?\/\//;class Oi extends y{constructor(e){super(e);u(this,"_linkOpeners",[]);e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Ts,kh,Ot]}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:Zc}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(o,a)=>Zc($h(o,t),a)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:o=>o.getAttribute("href")}}),e.commands.add("link",new n5(e)),e.commands.add("unlink",new o5(e));const s=ZC(e.t,e5(e.config.get("link.decorators")));this._enableAutomaticDecorators(s.filter(o=>o.mode===eu)),this._enableManualDecorators(s.filter(o=>o.mode===c5)),e.plugins.get(Ts).registerAttribute("linkHref"),Th(e,"linkHref","a",l5),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){const t=this.editor,r=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&r.add({id:"linkIsExternal",mode:eu,callback:o=>!!o&&u5.test(o),attributes:{target:"_blank",rel:"noopener noreferrer"}}),r.add(e),r.length&&t.conversion.for("downcast").add(r.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,r=t.commands.get("link").manualDecorators;e.forEach(o=>{t.model.schema.extend("$text",{allowAttributes:o.id});const a=new a5(o);r.add(a),t.conversion.for("downcast").attributeToElement({model:a.id,view:(l,{writer
263:c,schema:d},{item:h})=>{if((h.is("selection")||d.isInline(h))&&l){const f=c.createAttributeElement("a",a.attributes,{priority:5});a.classes&&c.addClass(a.classes,f);for(const m in a.styles)c.setStyle(m,a.styles[m],f);return c.setCustomProperty("link",!0,f),f}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...a._createPattern()},model:{key:a.id}})})}_enableLinkOpen(){const e=this.editor,s=e.editing.view.document,r=o=>{this._linkOpeners.some(a=>a(o))||i5(o)};this.listenTo(s,"click",(o,a)=>{if(!(P.isMac?a.domEvent.metaKey:a.domEvent.ctrlKey))return;let c=a.domTarget;if(c.tagName.toLowerCase()!="a"&&(c=c.closest("a")),!c)return;const d=c.getAttribute("href");d&&(o.stop(),a.preventDefault(),r(d))},{context:"$capture"}),this.listenTo(s,"keydown",(o,a)=>{const c=e.commands.get("link").value;c&&a.keyCode===V.enter&&a.altKey&&(o.stop(),r(c))})}_enableSelectionAttributesFixer(){const t=this.editor.model,s=t.document.selection;this.listenTo(s,"change:attribute",(r,{attributeKeys:o})=>{!o.includes("linkHref")||s.hasAttribute("linkHref")||t.change(a=>{d5(a,h5(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,s=this.editor.config.get("link.defaultProtocol");s&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(r,o)=>{t.change(a=>{const l=a.createRangeIn(o.content);for(const c of l.getItems())if(c.hasAttribute("linkHref")){const d=_a(c.getAttribute("linkHref"),s);a.setAttribute("linkHref",d,c)}})})}}function d5(n,i){n.removeSelectionAttribute("linkHref");for(const e of i)n.removeSelectionAttribute(e)}function h5(n){return n.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}class f5 extends B{constructor(i){super(i);const e=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:e.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:e.to(t=>{if(this.href){const s=()=>t.preventDefault();this.fire("navigate",this.href,s)}})}}),this.template.tag="a"}}class m5 extends T{constructor(e,t){super(e);u(this,"focusTracker",new de);u(this,"keystrokes",new Ie);u(this,"backButtonView");u(this,"saveButtonView");u(this,"displayedTextInputView");u(this,"urlInputView");u(this,"children");u(this,"providersListChildren");u(this,"_validators");u(this,"_focusables",new Ye);u(this,"_focusCycler");this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView())}),this._focusCycler=new vt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),x1({view:this}),[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].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}_createBackButton(){const e=this.locale.t,t=new B(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Ks,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new B(this.locale);return t.set({label:e("Insert"),tooltip:!1,withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Js(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){const e=new Zt(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-l
263ist"]}}),e.items.bindTo(this.providersListChildren).using(t=>{const s=new Fe(this.locale);return s.children.add(t),s}),e}_createDisplayedTextInput(){const e=this.locale.t,t=new ho(this.locale,mo);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){const e=this.locale.t,t=new ho(this.locale,mo);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new _c(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new _c(this.locale,{children:[this.urlInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}))}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class g5 extends T{constructor(e){super(e);u(this,"focusTracker",new de);u(this,"keystrokes",new Ie);u(this,"backButtonView");u(this,"listView");u(this,"listChildren");u(this,"emptyListInformation");u(this,"children");u(this,"_focusables",new Ye);u(this,"_focusCycler");this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",!1),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0}),this.on("change:hasItems",(t,s,r)=>{r?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation))}),this.keystrokes.set("Esc",(t,s)=>{this.fire("cancel"),s()}),this._focusCycler=new vt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children})}render(){super.render(),[this.listView,this.backButtonView].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()}_createListView(){const e=new Zt(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{const s=new Fe(this.locale);return s.children.add(t),s}),e}_createBackButton(){const e=this.locale.t,t=new B(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Ks,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=new Js(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){const e=new T(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class p5 extends T{constructor(e){super(e);u(this,"focusTracker",new de);u(this,"keystrokes",new Ie);u(this,"backButtonView");u(this,"children");u(this,"listChildren");u(this,"_focusables",new Ye);u(this,"_focusCycler");this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new vt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(t,s)=>{this.fire("back"),s()})}render(){super.render(),[...this.listChildren,this.backButtonView].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()}_createBackButton(){const e=this.locale.t,t=new B(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Ks,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){const e=this.locale.t,t=new Js(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){const e=new Zt(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}
263),e.items.bindTo(this.listChildren).using(t=>{const s=new Fe(this.locale);return s.children.add(t),s}),e}}class w5 extends B{constructor(e){super(e);u(this,"arrowView");this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new st;return e.content=Kd,e}}const Ze="link-ui";class qh extends y{constructor(){super(...arguments);u(this,"toolbarView",null);u(this,"formView",null);u(this,"linkProviderItemsView",null);u(this,"propertiesView",null);u(this,"_balloon");u(this,"_linksProviders",new Se)}static get requires(){return[An,Oi]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(h_),this._balloon=e.plugins.get(An),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Ze,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Ze,view:(s,{writer:r})=>{if(!s.markerRange.isCollapsed)return null;const o=r.createUIElement("span");return r.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],o),o}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:en},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy()}registerLinksListProvider(e){const t=this._linksProviders.filter(s=>(s.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){const e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){const e=this.editor,t=new Qs(e.locale),s=e.commands.get("link");t.class="ck-link-toolbar";let r=e.config.get("link.toolbar");return s.manualDecorators.length||(r=r.filter(o=>o!=="linkProperties")),t.fillFromConfig(r,e.ui.componentFactory),t.keystrokes.set("Esc",(o,a)=>{this._hideUI(),a()}),t.keystrokes.set(en,(o,a)=>{this._addFormView(),a()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){const e=this.editor,t=e.locale.t,s=e.commands.get("link"),r=e.config.get("link.defaultProtocol"),o=new(rc(m5))(e.locale,b5(e));return o.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",a=>a!==void 0),o.urlInputView.bind("isEnabled").to(s,"isEnabled"),o.saveButtonView.bind("isEnabled").to(s,"isEnabled"),o.saveButtonView.bind("label").to(s,"value",a=>t(a?"Update":"Insert")),this.listenTo(o,"submit",()=>{if(o.isValid()){const a=o.urlInputView.fieldView.element.value,l=_a(a,r),c=o.displayedTextInputView.fieldView.element.value;e.execute("link",l,this._getDecoratorSwitchesState(),c!==this.selectedLinkableText?c:void 0),this._closeFormView()}}),this.listenTo(o.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(a,l)=>{this._closeFormView(),l()}),o.providersListChildren.bindTo(this._linksProviders).using(a=>this._createLinksListProviderButton(a)),o}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:s,icon:r})=>{const o=new B;return o.set({label:s,icon:r,tooltip:!1,withText:!0}),o.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),o})}_createLinkProviderItemsView(e){const t=this.editor,s=t.locale.t,r=new g5(t.locale),{emptyListPlaceholder:o,label:a}=e;return r.emptyListPlaceholder=o||s("No links available"),r.title=a,this.listenTo(r,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),r}_createPropertiesView(){const e=this.editor,t=this.editor.commands.get("link"),s=new(rc(p5))(e.locale);return this.listenTo(s,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),s.listChildren.bindTo(t.manualDecorators).using(r=>{const o=new fa(e.locale);return o.set({label:r.label,withText:!0}),o.bind("isOn").toMany([r,t],"value",(a,l)=>l===void 0&&a===void 0?!!r.defaultValue:!!a),o.on("execute",()=>{r.set("value",!o.isOn),e.execute("link",t.value,this._getDecoratorSwitchesState())}),o}),s}_getDecoratorSwitchesState(){const e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,s)=>{const r=e.value===void 0&&s.value===void 0?s.defaultValue:s.value;return{...t,[s.id]:!!r}},{})}
263_registerEditingOpeners(){this.editor.plugins.get(Oi)._registerLinkOpener(t=>{const s=this._getLinkProviderLinkByHref(t);if(!s)return!1;const{item:r,provider:o}=s;return o.navigate?o.navigate(r):!1})}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const t=this._createButton(B);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{const t=this._createButton(Z);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{const s=new f5(t),r=e.config.get("link.allowedProtocols"),o=e.commands.get("link"),a=t.t;s.bind("isEnabled").to(o,"value",c=>!!c),s.bind("href").to(o,"value",c=>c&&$h(c,r));const l=c=>{if(!c){s.label=void 0,s.icon=void 0,s.tooltip=a("Open link in new tab");return}const d=this._getLinkProviderLinkByHref(c);if(d){const{label:h,tooltip:f,icon:m}=d.item;s.label=h,s.tooltip=f||!1,s.icon=m}else s.label=c,s.icon=void 0,s.tooltip=a("Open link in new tab")};return l(o.value),this.listenTo(o,"change:value",(c,d,h)=>{l(h)}),this.listenTo(s,"navigate",(c,d,h)=>{const f=this._getLinkProviderLinkByHref(d);if(!f)return;const{provider:m,item:g}=f,{navigate:w}=m;w&&w(g)&&(c.stop(),h())}),s}),e.ui.componentFactory.add("unlink",t=>{const s=e.commands.get("unlink"),r=new B(t),o=t.t;return r.set({label:o("Unlink"),icon:z0,tooltip:!0}),r.bind("isEnabled").to(s),this.listenTo(r,"execute",()=>{e.execute("unlink"),this._hideUI()}),r}),e.ui.componentFactory.add("editLink",t=>{const s=e.commands.get("link"),r=new B(t),o=t.t;return r.set({label:o("Edit link"),icon:T0,tooltip:!0}),r.bind("isEnabled").to(s),this.listenTo(r,"execute",()=>{this._addFormView()}),r}),e.ui.componentFactory.add("linkProperties",t=>{const s=e.commands.get("link"),r=new B(t),o=t.t;return r.set({label:o("Link properties"),icon:R0,tooltip:!0}),r.bind("isEnabled").to(s,"isEnabled",s,"value",s,"manualDecorators",(a,l,c)=>a&&!!l&&c.length>0),this.listenTo(r,"execute",()=>{this._addPropertiesView()}),r})}_createLinksListProviderButton(e){const t=this.editor.locale,s=new w5(t);return s.set({label:e.label}),this.listenTo(s,"execute",()=>{this._showLinksProviderView(e)}),s}_createButton(e){const t=this.editor,s=t.locale,r=t.commands.get("link"),o=new e(t.locale),a=s.t;return o.set({label:a("Link"),icon:qd,keystroke:en,isToggleable:!0}),o.bind("isEnabled").to(r,"isEnabled"),o.bind("isOn").to(r,"value",l=>!!l),this.listenTo(o,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),o}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(en,(s,r)=>{r(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Gs({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){const e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpd
263atingUI()}_hideUI(e=!0){const t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let s=this._getSelectedLinkElement(),r=a();const o=()=>{const l=this._getSelectedLinkElement(),c=a();s&&!l||!s&&c!==r?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),s=l,r=c};function a(){return t.selection.focus.getAncestors().reverse().find(l=>l.is("element"))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _arePropertiesInPanel(){return!!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return!!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return!!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return!!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return!!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(Ze)){const r=this.editor.editing.mapper.markerNameToElements(Ze);if(r){const o=Array.from(r),a=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));return{target:e.domConverter.viewRangeToDom(a)}}}return{target:()=>{const r=this._getSelectedLinkElement();return r?e.domConverter.mapViewToDom(r):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,s=t.getSelectedElement();if(t.isCollapsed||s&&ee(s))return Lr(t.getFirstPosition());{const r=t.getFirstRange().getTrimmed(),o=Lr(r.start),a=Lr(r.end);return!o||o!=a?null:e.createRangeIn(o).getTrimmed().isEqual(r)?o:null}}_getSelectedLinkableText(){const e=this.editor.model,t=this.editor.editing,s=this._getSelectedLinkElement();if(!s)return vo(e.document.selection.getFirstRange());const r=t.view.createRangeOn(s),o=t.mapper.toModelRange(r);return vo(o)}_getLinkProviderLinkByHref(e){if(!e)return null;for(const t of this._linksProviders){const s=t.getItem?t.getItem(e):t.getListItems().find(r=>r.href===e);if(s)return{provider:t,item:s}}return null}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const s=e.document.selection.getFirstRange();if(e.markers.has(Ze))t.updateMarker(Ze,{range:s});else if(s.start.isAtEnd){const r=s.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:s});t.addMarker(Ze,{usingOperation:!1,affectsData:!1,range:t.createRange(r,s.end)})}else t.addMarker(Ze,{usingOperation:!1,affectsData:!1,range:s})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Ze)&&e.change(t=>{t.removeMarker(Ze)})}}function Lr(n){return n.getAncestors().find(i=>YC(i))||null}function b5(n){const i=n.t,e=n.config.get("link.allowCreatingEmptyLinks");return[t=>{if(!e&&!t.url.length)return i("Link URL must not be empty.")}]}const _5=4,Kh=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}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),y5=2;class v5 extends y{static get requires(){return[Fi,Oi]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(i,e){return e.textNode&&e.textNode.hasAttribute("linkHref")?Ys(e,"linkHref",e.textNode.getAttribute("linkHref"),i):null}_selectEntireLinks(i,e){const s=this.editor.model,r=s.document.selection,o=r.getFirstPosition(),a=r.getLastPosition();let l=e.getJoined(this._expandLinkRange(s,o)||e);l&&(l=l.getJoined(this._expandLinkRange(s,a)||e)),l&&(l.start.isBefore(o)||l.end.isAfter(a))&&i.setSelection(l)}_enablePasteLinking(){const i=this.editor,e=i.model,t=e.document.selection,s=i.plugins.get("ClipboardPipeline"),r=i.commands.get("link");s.on("inputTransformation",(o,a)=>
263{if(!this.isEnabled||!r.isEnabled||t.isCollapsed||a.method!=="paste"||t.rangeCount>1)return;const l=t.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const d=c.match(Kh);d&&d[2]===c&&(e.change(h=>{this._selectEntireLinks(h,l),r.execute(c)}),o.stop())},{priority:"high"})}_enableTypingHandling(){const i=this.editor,e=new ba(i.model,t=>{let s=t;if(!k5(s))return;s=s.slice(0,-1),"!.:,;?".includes(s[s.length-1])&&(s=s.slice(0,-1));const r=tu(s);if(r)return{url:r,removedTrailingCharacters:t.length-s.length}});e.on("matched:data",(t,s)=>{const{batch:r,range:o,url:a,removedTrailingCharacters:l}=s;if(!r.isTyping)return;const c=o.end.getShiftedBy(-l),d=c.getShiftedBy(-a.length),h=i.model.createRange(d,c);this._applyAutoLink(a,h)}),e.bind("isEnabled").to(this)}_enableEnterHandling(){const i=this.editor,e=i.model,t=i.commands.get("enter");t&&t.on("execute",()=>{var o;const s=e.document.selection.getFirstPosition();let r;(o=s.parent.previousSibling)!=null&&o.is("element")?r=e.createRangeIn(s.parent.previousSibling):r=e.createRange(e.createPositionAt(s.parent,0),s),this._checkAndApplyAutoLinkOnRange(r)})}_enableShiftEnterHandling(){const i=this.editor,e=i.model,t=i.commands.get("shiftEnter");t&&t.on("execute",()=>{const s=e.document.selection.getFirstPosition(),r=e.createRange(e.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(r)})}_checkAndApplyAutoLinkOnRange(i){const e=this.editor.model,{text:t,range:s}=Eh(i,e),r=tu(t);if(r){const o=e.createRange(s.end.getShiftedBy(-r.length),s.end);this._applyAutoLink(r,o)}}_applyAutoLink(i,e){const t=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),r=_a(i,s);!this.isEnabled||!C5(e,t)||!Uh(r)||E5(e)||this._persistAutoLink(r,e)}_persistAutoLink(i,e){const t=this.editor.model,s=this.editor.plugins.get("Delete");t.enqueueChange(r=>{r.setAttribute("linkHref",i,e),t.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function k5(n){return n.length>_5&&n[n.length-1]===" "&&n[n.length-2]!==" "}function tu(n){const i=Kh.exec(n);return i?i[y5]:null}function C5(n,i){return i.schema.checkAttributeInSelection(i.createSelection(n),"linkHref")}function E5(n){const i=n.start.nodeAfter;return!!i&&i.hasAttribute("linkHref")}class aP extends y{static get requires(){return[Oi,qh,v5]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class T5 extends y{static get requires(){return["ImageEditing","ImageUtils",Oi]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){const i=this.editor,e=i.model.schema;i.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["linkHref"]}),i.conversion.for("upcast").add(P5(i)),i.conversion.for("downcast").add(A5(i)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const i=this.editor,t=i.commands.get("link").automaticDecorators;t.length&&i.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const i=this.editor,e=i.commands.get("link");for(const t of e.manualDecorators)i.plugins.has("ImageBlockEditing")&&i.model.schema.extend("imageBlock",{allowAttributes:t.id}),i.plugins.has("ImageInlineEditing")&&i.model.schema.extend("imageInline",{allowAttributes:t.id}),i.conversion.for("downcast").add(x5(t)),i.conversion.for("upcast").add(S5(i,t))}}function P5(n){const i=n.plugins.has("ImageInlineEditing"),e=n.plugins.get("ImageUtils");return t=>{t.on("element:a",(s,r,o)=>{const a=r.viewItem,l=e.findViewImgElement(a);if(!l)return;const c=l.findAncestor(m=>e.isBlockImageView(m));if(i&&!c)return;const d={attributes:["href"]};if(!o.consumable.consume(a,d))return;const h=a.getAttribute("href");if(!h)return;let f=r.modelCursor.parent;if(!f.is("element","imageBlock")){const m=o.convertItem(l,r.modelCursor);r.modelRange=m.modelRange,r.modelCursor=m.modelCursor,f=r.modelCursor.nodeBefore}f&&f.is("element","imageBlock")&&o.writer.setAttribute("linkHref",h,f)},{priority:"high"})}}function A5(n){const i=n.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",(t,s,r)=>{if(!r.consumable.consume(s.item,t.name))return;const o=r.mapper.toViewElement(s.item),a=r.writer,l=Array.from(o.getChildren()).find(h=>h.is("element","a")),c=i.findViewImgElement(o),d=c.parent.is("element","picture")?c.parent:c;
263if(l)s.attributeNewValue?a.setAttribute("href",s.attributeNewValue,l):(a.move(a.createRangeOn(d),a.createPositionAt(o,0)),a.remove(l));else{const h=a.createContainerElement("a",{href:s.attributeNewValue});a.insert(a.createPositionAt(o,0),h),a.move(a.createRangeOn(d),a.createPositionAt(h,0))}},{priority:"high"})}}function x5(n){return i=>{i.on(`attribute:${n.id}:imageBlock`,(e,t,s)=>{const r=s.mapper.toViewElement(t.item),o=Array.from(r.getChildren()).find(a=>a.is("element","a"));if(o){if(n.value===void 0){for(const a in n.attributes)s.writer.removeAttribute(a,o);n.classes&&s.writer.removeClass(n.classes,o);for(const a in n.styles)s.writer.removeStyle(a,o);return}for(const[a,l]of je(n.attributes))s.writer.setAttribute(a,l,o);n.classes&&s.writer.addClass(n.classes,o);for(const a in n.styles)s.writer.setStyle(a,n.styles[a],o)}})}}function S5(n,i){const e=n.plugins.has("ImageInlineEditing"),t=n.plugins.get("ImageUtils");return s=>{s.on("element:a",(r,o,a)=>{const l=o.viewItem,c=t.findViewImgElement(l);if(!c)return;const d=c.findAncestor(g=>t.isBlockImageView(g));if(e&&!d)return;const f=new Pe(i._createPattern()).match(l);if(!f||!a.consumable.consume(l,f.match))return;const m=o.modelCursor.nodeBefore||o.modelCursor.parent;a.writer.setAttribute(i.id,!0,m)},{priority:"high"})}}class I5 extends y{static get requires(){return[Oi,qh,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.editing.view.document;this.listenTo(e,"click",(t,s)=>{this._isSelectedLinkedImage(i.model.document.selection)&&(s.preventDefault(),t.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const i=this.editor,e=i.t;i.ui.componentFactory.add("linkImage",t=>{const s=new B(t),r=i.plugins.get("LinkUI"),o=i.commands.get("link");return s.set({isEnabled:!0,label:e("Link image"),icon:qd,keystroke:en,tooltip:!0,isToggleable:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value",a=>!!a),this.listenTo(s,"execute",()=>{this._isSelectedLinkedImage(i.model.document.selection)?r._addToolbarView():r._showUI(!0)}),s})}_isSelectedLinkedImage(i){const e=i.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(e)&&e.hasAttribute("linkHref")}}class lP extends y{static get requires(){return[T5,I5]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}/**
264 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
265 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
266 */class Ne{constructor(i,e){u(this,"_startElement");u(this,"_referenceIndent");u(this,"_isForward");u(this,"_includeSelf");u(this,"_sameAttributes");u(this,"_sameIndent");u(this,"_lowerIndent");u(this,"_higherIndent");this._startElement=i,this._referenceIndent=i.getAttribute("listIndent"),this._isForward=e.direction=="forward",this._includeSelf=!!e.includeSelf,this._sameAttributes=Y(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(i,e){const s=new this(i,e)[Symbol.iterator]();return ye(s)}*[Symbol.iterator](){const i=[];for(const{node:e}of new Dn(this._getStartNode(),this._isForward?"forward":"backward")){const t=e.getAttribute("listIndent");if(t<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=t}else if(t>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){i.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){i.length&&(yield*i,i.length=0);break}continue}if(this._sameAttributes.some(s=>e.getAttribute(s)!==this._startElement.getAttribute(s)))break}i.length&&(yield*i,i.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}class Dn{constructor(i,e="forward"){u(this,"_node");u(this,"_isForward");u(this,"_previousNodesByIndent",[]);u(this,"_previous",null);u(this,"_previousNodeIndent",null);this._node=i,this._isForward=e==="forward"}[Symbol.iterator](){return this}next(){if(!D(this._node))return{done:!0,value:void 0};const i=this._node.getAttribute("listIndent");let e=null;if(this._previous){const s=this._previousNodeIndent;i>s?this._previousNodesByIndent[s]=this._previous:i<s?(e=this._previousNodesByIndent[i]||null,this._previousNodesByIndent.length=i):e=this._previous}const t={node:this._node,previous:this._previous,previousNodeInList:e};return this._previous=this._node,this._previousNodeIndent=i,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:t,done:!1}}}class O5{constructor(i){u(this,"_listHead");this._listHead=i}[Symbol.iterator](){return new Dn(this._listHead)}}class Mi{static next(){return me()}}function D(n){return!!n&&n.is("element")&&n.hasAttribute("listItemId")}function _t(n,i={}){return[...Mt(n,{...i,direction:"backward"}),...Mt(n,{...i,direction:"forward"})]}function Mt(n,i={}){const e=i.direction=="forward",t=Array.from(new Ne(n,{...i,includeSelf:e,sameIndent:!0,sameAttributes:"listItemId"}));return e?t:t.reverse()}function M5(n){return Array.from(new Ne(n,{direction:"forward",higherIndent:!0}))}function Gh(n,i){const e=new Ne(n,{sameIndent:!0,sameAttributes:"listType",...i}),t=new Ne(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...i});return[...Array.from(e).reverse(),...t]}function rt(n){return!Ne.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function iu(n){return!Ne.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function zn(n,i={}){n=Y(n);const e=i.withNested!==!1,t=new Set;for(const s of n)for(const r of _t(s,{higherIndent:e}))t.add(r);return ni(t)}function R5(n){n=Y(n);const i=new Set;for(const e of n)for(const t of Gh(e))i.add(t);return ni(i)}function ya(n,i){const e=Mt(n,{direction:"forward"}),t=Mi.next();for(const s of e)i.setAttribute("listItemId",t,s);return e}function ko(n,i,e){const t={};for(const[r,o]of i.getAttributes())r.startsWith("list")&&(t[r]=o);const s=Mt(n,{direction:"forward"});for(const r of s)e.setAttributes(t,r);return s}function Co(n,i,{expand:e,indentBy:t=1}={}){n=Y(n);const s=e?zn(n):n;for(const r of s){const o=r.getAttribute("listIndent")+t;o<0?er(r,i):i.setAttribute("listIndent",o,r)}return s}function V5(n,i){n=Y(n);const e=zn(n),t=new Set,s=Math.min(...e.map(o=>o.getAttribute("listIndent"))),r=new Map;for(const o of e)r.set(o,Ne.first(o,{lowerIndent:!0}));for(const o of e){if(t.has(o))continue;t.add(o);const a=o.getAttribute("listIndent")-1;if(a<0){er(o,i);continue}if(o.getAttribute("listIndent")==s){const l=F5(o,r.get(o),i);for(const c of l)t.add(c);if(l.length)continue}i.setAttribute("listIndent",a,o)}return ni(t)}function er(n,i){n=Y(n);for(const e of n)e.is("element","listItem")&&i.rename(e,"paragraph");for(const e of n)for(const t of e.getAttributeKeys())t.startsWith("list")&&i.removeAttribute(t,e);return n}function On(n){if(!n.length)return!1;const i=n[0].getAttribute("listItemId");return i?!n.some(e=>e.getAttribute("listItemId")!=i):!1}function B5(n,i){const e=[];let t=Number.POSITIVE_INFINITY;for(const{node:s}of new Dn(n.nextSibling)){const r=s.getAttribute("listIndent");if(r==0)break;r<t&&(t=r);const o=r-t;i.setAttribute("listIndent",o,s),e.push(s)}return e}function ni(n){return Array.from(n).filter(i=>i.root.rootName!=="$graveyard").sort((i,e)=>i.index-e.index)}function Mn(n){const i=n.document.selection.getSelectedElement();return i&&n.schema.isObject(i)&&n.schema.isBlock(i)?i:null}function Fr(n,i){return i.checkChild(n.parent,"listItem")&&i.checkChild(n,"$text")&&!i.isObject(n)}function L5(n){return n=="numbered"||n=="customNumbered"}function F5(n,i,e){return Mt(i,{direction:"forward"}).pop().index>n.index?ko(n,i,e):[]}class nu extends j{constructor(e,t){super(e);u(this,"_direction");this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=su(e.document.selection);e.change(s=>{const r=[];On(t)&&!rt(t[0])?(this._direction=="forward"&&r.push(...Co(t,s)),r.push(...ya(t[0],s)
266)):this._direction=="forward"?r.push(...Co(t,s,{expand:!0})):r.push(...V5(t,s));for(const o of r){if(!o.hasAttribute("listType"))continue;const a=Ne.first(o,{sameIndent:!0});a&&s.setAttribute("listType",a.getAttribute("listType"),o)}this._fireAfterExecute(r)})}_fireAfterExecute(e){this.fire("afterExecute",ni(new Set(e)))}_checkEnabled(){let e=su(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction=="backward"||On(e)&&!rt(e[0]))return!0;e=zn(e),t=e[0];const s=Ne.first(t,{sameIndent:!0});return s?s.getAttribute("listType")==t.getAttribute("listType"):!1}}function su(n){const i=Array.from(n.getSelectedBlocks()),e=i.findIndex(t=>!D(t));return e!=-1&&(i.length=e),i}class tn extends j{constructor(e,t,s={}){super(e);u(this,"type");u(this,"_listWalkerOptions");this.type=t,this._listWalkerOptions=s.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,s=t.document,r=Mn(t),o=Array.from(s.selection.getSelectedBlocks()).filter(l=>t.schema.checkAttribute(l,"listType")||Fr(l,t.schema)),a=e.forceValue!==void 0?!e.forceValue:this.value;t.change(l=>{if(a){const c=o[o.length-1],d=Mt(c,{direction:"forward"}),h=[];d.length>1&&h.push(...ya(d[1],l)),h.push(...er(o,l)),h.push(...B5(c,l)),this._fireAfterExecute(h)}else if((r||s.selection.isCollapsed)&&D(o[0])){const c=Gh(r||o[0],this._listWalkerOptions);for(const d of c)l.setAttributes({...e.additionalAttributes,listType:this.type},d);this._fireAfterExecute(c)}else{const c=[];for(const d of o)if(!d.hasAttribute("listType"))!d.is("element","listItem")&&Fr(d,t.schema)&&l.rename(d,"listItem"),l.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:Mi.next(),listType:this.type},d),c.push(d);else for(const h of zn(d,{withNested:!1}))h.getAttribute("listType")!=this.type&&(l.setAttributes({...e.additionalAttributes,listType:this.type},h),c.push(h));this._fireAfterExecute(c)}})}_fireAfterExecute(e){this.fire("afterExecute",ni(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const s of t)if(s.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,s=e.document.selection,r=Array.from(s.getSelectedBlocks());if(!r.length)return!1;if(this.value)return!0;for(const o of r)if(t.checkAttribute(o,"listType")||Fr(o,t))return!0;return!1}}class ru extends j{constructor(e,t){super(e);u(this,"_direction");this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,s=t.document.selection,r=[];t.change(o=>{const{firstElement:a,lastElement:l}=this._getMergeSubjectElements(s,e),c=a.getAttribute("listIndent")||0,d=l.getAttribute("listIndent"),h=l.getAttribute("listItemId");if(c!=d){const f=M5(l);r.push(...Co([l,...f],o,{indentBy:c-d,expand:c<d}))}if(e){let f=s;s.isCollapsed&&(f=o.createSelection(o.createRange(o.createPositionAt(a,"end"),o.createPositionAt(l,0)))),t.deleteContent(f,{doNotResetEntireContent:s.isCollapsed});const m=f.getLastPosition().parent,g=m.nextSibling;r.push(m),g&&g!==l&&g.getAttribute("listItemId")==h&&r.push(...ko(g,m,o))}else r.push(...ko(l,a,o));this._fireAfterExecute(r)})}_fireAfterExecute(e){this.fire("afterExecute",ni(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,s=Mn(e);if(t.isCollapsed||s){const r=s||t.getFirstPosition().parent;if(!D(r))return!1;const o=this._direction=="backward"?r.previousSibling:r.nextSibling;if(!o||On([r,o]))return!1}else{const r=t.getLastPosition(),o=t.getFirstPosition();if(r.parent===o.parent||!D(r.parent))return!1}return!0}_getMergeSubjectElements(e,t){const s=this.editor.model,r=Mn(s);let o,a;if(e.isCollapsed||r){const l=r||e.getFirstPosition().parent,c=rt(l);this._direction=="backward"?(a=l,c&&!t?o=Ne.first(l,{sameIndent:!0,lowerIndent:!0}):o=l.previousSibling):(o=l,a=l.nextSibling)}else o=e.getFirstPosition().parent,a=e.getLastPosition().parent;return{firstElement:o,lastElement:a}}}class ou extends j{constructor(e,t){super(e);u(this,"_direction");this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(t=>{const s=ya(this._getStartBlock(),t);this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",ni(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&D(t)&&!rt(t)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?t:t.nextSibling}}class N5 extends y{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[xe]}init(){const i=this.editor,e=i.plugins.get("ListFormatting"),t=i.plugins.get(xe);!i.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("bold","listItemBold"),t.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(s,r,o,a){r&&(s.addClass("ck-list-marker-bold",o),P.isSafari&&!(a&&a.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-bold","0",o))}}))}afterInit(){const i=this.editor,e=i.model;!i.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemBold"}),e.schema.setAttributeProperties("listItemBold",{isFormatting:!0}),e.schema.addAttributeCheck(t=>{if(!t.last.getAttribute("listItemId"))return!1},"listItemBold"),i.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}))}}class D5 extends y{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[xe]}init(){const i=this.editor,e=i.plugins.get("ListFormatting"),t=i.plugins.get(xe);!i.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("italic","listItemItalic"),t.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(s,r,o,a){r&&(s.addClass("ck-list-marker-italic",o),P.isSafari&&!(a&&a.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-italic","0",o))}}))}afterInit(){const i=this.editor,e=i.model;!i.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),e.schema.setAttributeProperties("listItemItalic",{isFormatting:!0}),e.schema.addAttributeCheck(t=>{if(!t.last.getAttribute("listItemId"))return!1},"listItemItalic"),i.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}))}}class z5 extends y{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[xe]}init(){const i=this.editor,e=i.plugins.get("ListFormatting"),t=i.plugins.get(xe);
266if(!i.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;const s=In(i.config.get("fontSize.options"));e.registerFormatAttribute("fontSize","listItemFontSize"),t.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(r,o,a,l){if(o){const c=s.find(d=>d.model==o);c&&c.view&&typeof c.view!="string"?c.view.styles?(r.addClass("ck-list-marker-font-size",a),r.setStyle("--ck-content-list-marker-font-size",c.view.styles["font-size"],a)):c.view.classes&&(r.addClass(`ck-list-marker-font-size-${o}`,a),P.isSafari&&!(l&&l.dataPipeline)&&r.setStyle("--ck-content-list-marker-dummy-font-size","0",a)):(r.addClass("ck-list-marker-font-size",a),r.setStyle("--ck-content-list-marker-font-size",o,a))}}})}afterInit(){const i=this.editor,e=i.model;if(!i.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;e.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),e.schema.setAttributeProperties("listItemFontSize",{isFormatting:!0}),e.schema.addAttributeCheck(s=>{if(!s.last.getAttribute("listItemId"))return!1},"listItemFontSize"),i.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s=>s.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});const t=In(i.config.get("fontSize.options"));for(const s of t)s.model&&s.view&&i.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s.model},view:{name:"li",classes:`ck-list-marker-font-size-${s.model}`}})}}class H5 extends y{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[xe]}init(){const i=this.editor,e=i.plugins.get("ListFormatting"),t=i.plugins.get(xe);!i.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontColor","listItemFontColor"),t.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-color",o),s.setStyle("--ck-content-list-marker-color",r,o))}}))}afterInit(){const i=this.editor,e=i.model;!i.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),e.schema.setAttributeProperties("listItemFontColor",{isFormatting:!0}),e.schema.addAttributeCheck(t=>{if(!t.last.getAttribute("listItemId"))return!1},"listItemFontColor"),i.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:t=>t.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}))}}class W5 extends y{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[xe]}init(){const i=this.editor,e=i.plugins.get("ListFormatting"),t=i.plugins.get(xe);!i.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.registerFormatAttribute("fontFamily","listItemFontFamily"),t.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(s,r,o){r&&(s.addClass("ck-list-marker-font-family",o),s.setStyle("--ck-content-list-marker-font-family",r,o))}}))}afterInit(){const i=this.editor,e=i.model;!i.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(e.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),e.schema.setAttributeProperties("listItemFontFamily",{isFormatting:!0}),e.schema.addAttributeCheck(t=>{if(!t.last.getAttribute("listItemId"))return!1},"listItemFontFamily"),i.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:t=>t.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}))}}class $5 extends y{constructor(e){super(e);u(this,"_loadedFormatting",{});e.config.define("list.enableListItemMarkerFormatting",!0)}static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[N5,D5,z5,H5,W5]}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){const e=this.editor.model;e.document.registerPostFixer(t=>{const s=e.document.differ.getChanges(),r=new Set;let o=!1;for(const a of s)if(a.type==="attribute")(a.attributeKey=="listItemId"||a.attributeKey=="listType"||this._isInlineOrSelectionFormatting(a.attributeKey)||Object.values(this._loadedFormatting).includes(a.attributeKey))&&(D(a.range.start.nodeAfter)?r.add(a.range.start.nodeAfter):D(a.range.start.parent)&&r.add(a.range.start.parent));else if(D(a.position.nodeAfter)&&r.add(a.position.nodeAfter),D(a.position.nodeBefore)&&r.add(a.position.nodeBefore),D(a.position.parent)&&r.add(a.position.parent),a.type=="insert"&&a.name!="$text"){const l=t.createRangeIn(a.position.nodeAfter);for(const c of l.getItems())D(c)&&r.add(c)}for(const a of r){const l=U5(e,a,Object.keys(this._loadedFormatting));for(const[c,d]of Object.entries(l)){const h=this._loadedFormatting[c];(d&&q5(t,a,h,d)||!d&&K5(t,a,h))&&(o=!0)}}return o}
266)}registerFormatAttribute(e,t){this._loadedFormatting[e]=t}_isInlineOrSelectionFormatting(e){return e.replace(/^selection:/,"")in this._loadedFormatting}}function U5(n,i,e){if(rt(i))return au(n,i,e);const t=_t(i);return au(n,t[0],e)}function au(n,i,e){if(!G5(i)||n.schema.isLimit(i))return Object.fromEntries(e.map(a=>[a]));if(i.isEmpty)return Object.fromEntries(e.map(a=>[a,i.getAttribute(`selection:${a}`)]));const t=new Set(e),s={},o=n.createRangeIn(i).getWalker({ignoreElementEnd:!0});for(const{item:a}of o){for(const l of t)if(n.schema.checkAttribute(a,l)){const c=a.getAttribute(l);c===void 0?(t.delete(l),s[l]=void 0):s[l]===void 0?s[l]=c:s[l]!==c&&(t.delete(l),s[l]=void 0)}else l in s||(s[l]=void 0);if(!t.size)break;n.schema.isLimit(a)&&o.jumpTo(n.createPositionAfter(a))}return s}function q5(n,i,e,t){const s=_t(i);let r=!1;for(const o of s)(!o.hasAttribute(e)||o.getAttribute(e)!==t)&&(n.setAttribute(e,t,o),r=!0);return r}function K5(n,i,e){const t=_t(i);let s=!1;for(const r of t)r.hasAttribute(e)&&(n.removeAttribute(e,r),s=!0);return s}function G5(n){return["numbered","bulleted","customNumbered","customBulleted"].includes(n.getAttribute("listType"))}class j5 extends y{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(i){return R5(i)}isFirstBlockOfListItem(i){return rt(i)}isListItemBlock(i){return D(i)}expandListBlocksToCompleteItems(i,e={}){return zn(i,e)}isNumberedListType(i){return L5(i)}}/**
267 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
268 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
269 */function J5(n){return n.is("element","ol")||n.is("element","ul")}function Eo(n){return n.is("element","li")}function Q5(n){let i=0,e=n.parent;for(;e;){if(Eo(e))i++;else{const t=e.previousSibling;t&&Eo(t)&&i++}e=e.parent}return i}function Y5(n,i,e,t=Jh(e,i)){return n.createAttributeElement(jh(e),null,{priority:2*i/100-100,id:t})}function X5(n,i,e){return n.createAttributeElement("li",null,{priority:(2*i+1)/100-100,id:e})}function jh(n){return n=="numbered"||n=="customNumbered"?"ol":"ul"}function Jh(n,i){return`list-${n}-${i}`}function qe(n,i,e){const t=n.nodeBefore;if(D(t)){let s=t;for(const{node:r}of new Dn(s,"backward"))if(s=r,e.has(s)||(e.add(s),i.has(t)))return;i.add(s)}else{const s=n.nodeAfter;D(s)&&i.add(s)}}function Z5(n,i){let e=0,t=-1,s=null,r=!1;for(const{node:o}of n){const a=o.getAttribute("listIndent");if(a>e){let l;s===null?(s=a-e,l=e):(s>a&&(s=a),l=a-s),l>t+1&&(l=t+1),i.setAttribute("listIndent",l,o),r=!0,t=l}else s=null,e=a+1,t=a}return r}function e2(n,i,e){const t=new Set;let s=!1;for(const{node:r}of n){if(t.has(r))continue;let o=r.getAttribute("listType"),a=r.getAttribute("listItemId");if(i.has(a)&&(a=Mi.next()),i.add(a),r.is("element","listItem")){r.getAttribute("listItemId")!=a&&(e.setAttribute("listItemId",a,r),s=!0);continue}for(const l of Mt(r,{direction:"forward"}))t.add(l),l.getAttribute("listType")!=o&&(a=Mi.next(),o=l.getAttribute("listType")),l.getAttribute("listItemId")!=a&&(e.setAttribute("listItemId",a,l),s=!0)}return s}function t2(){return(n,i,e)=>{const{writer:t,schema:s}=e;if(!i.modelRange)return;const r=Array.from(i.modelRange.getItems({shallow:!0})).filter(h=>s.checkAttribute(h,"listItemId"));if(!r.length)return;const o=i.viewItem.getAttribute("data-list-item-id")||Mi.next();e.consumable.consume(i.viewItem,{attributes:"data-list-item-id"});const a=Q5(i.viewItem);let l=i.viewItem.parent&&i.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=r[0].getAttribute("listType");c&&(l=c);const d={listItemId:o,listIndent:a,listType:l};for(const h of r)h.hasAttribute("listItemId")||t.setAttributes(d,h);r.length>1&&r[1].getAttribute("listItemId")!=d.listItemId&&e.keepEmptyElement(r[0])}}function i2(n,i,e,t){return()=>{const a=n.document.differ.getChanges(),l=[],c=new Set,d=new Set,h=new Set;for(const f of a)if(f.type=="insert"&&f.name!="$text")qe(f.position,c,h),f.attributes.has("listItemId")?d.add(f.position.nodeAfter):qe(f.position.getShiftedBy(f.length),c,h);else if(f.type=="remove"&&f.attributes.has("listItemId"))qe(f.position,c,h);else if(f.type=="attribute"){const m=f.range.start.nodeAfter;e.includes(f.attributeKey)?(qe(f.range.start,c,h),f.attributeNewValue===null?(qe(f.range.start.getShiftedBy(1),c,h),r(m)&&l.push(m)):d.add(m)):D(m)&&r(m)&&l.push(m)}for(const f of c.values())l.push(...s(f,d));for(const f of new Set(l))i.reconvertItem(f)};function s(a,l){const c=[],d=new Set,h=[];for(const{node:f,previous:m}of new Dn(a)){if(d.has(f))continue;const g=f.getAttribute("listIndent");m&&g<m.getAttribute("listIndent")&&(h.length=g+1),h[g]={modelAttributes:Object.fromEntries(Array.from(f.getAttributes()).filter(([v])=>e.includes(v))),modelElement:f};const w=Mt(f,{direction:"forward"});for(const v of w)d.add(v),(r(v,w)||o(v,h,l))&&c.push(v)}return c}function r(a,l){const c=i.mapper.toViewElement(a);if(!c)return!1;if(t.fire("checkElement",{modelElement:a,viewElement:c}))return!0;
269if(!a.is("element","paragraph")&&!a.is("element","listItem"))return!1;const h=Yh(a,e,l);return h&&c.is("element","p")?!0:!!(!h&&c.is("element","span"))}function o(a,l,c){if(c.has(a))return!1;const d=i.mapper.toViewElement(a);let h=l.length-1;for(let f=d.parent;!f.is("editableElement");f=f.parent){const m=Eo(f),g=J5(f);if(!g&&!m)continue;const w=`checkAttributes:${m?"item":"list"}`;if(t.fire(w,{viewElement:f,modelAttributes:l[h].modelAttributes,modelReferenceElement:l[h].modelElement}))break;if(g&&(h--,h<0))return!1}return!0}}function lu(n,i,e,{dataPipeline:t}={}){const s=c2(n);return(r,o,a)=>{const{writer:l,mapper:c,consumable:d}=a,h=o.item;if(!n.includes(o.attributeKey)||!s(h,d))return;const f={...a.options,dataPipeline:t},m=s2(h,c,e);Qh(m,l,c),a2(m,l);const g=o2(h,m,i,l,f);l2(h,g,i,l,f)}}function n2(n){return(i,e,t)=>{const{writer:s,mapper:r}=t,o=i.name.split(":")[1];if(!n.checkAttribute(o,"listItemId"))return;const a=r.toViewPosition(e.position),l=e.position.getShiftedBy(e.length),c=r.toViewPosition(l,{isPhantom:!0}),h=s.createRange(a,c).getTrimmed().end.nodeBefore;/* istanbul ignore next -- @preserve */h&&Qh(h,s,r)}}function cu(n,{dataPipeline:i}={}){return(e,{writer:t})=>{if(!Yh(e,n))return null;if(!i)return t.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function s2(n,i,e){const t=e.createRangeOn(n);return i.toViewRange(t).getTrimmed().end.nodeBefore}function r2(n,i){return(e,t)=>{if(t.modelPosition.offset>0)return;const s=t.modelPosition.parent;if(!D(s)||!n.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(s)))return;const r=t.mapper.toViewElement(s),o=i.createRangeIn(r),a=o.getWalker();let l=o.start;for(const{item:c}of a){if(c.is("element")&&t.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(l=i.createPositionAfter(c),a.skip(({previousPosition:d})=>!d.isEqual(l)))}t.viewPosition=l}}function Qh(n,i,e){for(;n.parent.is("attributeElement")&&n.parent.getCustomProperty("listItemWrapper");)i.unwrap(i.createRangeOn(n),n.parent);const t=[];s(i.createPositionBefore(n).getWalker({direction:"backward"})),s(i.createRangeIn(n).getWalker());for(const r of t)i.remove(r);function s(r){for(const{item:o}of r){if(o.is("element")&&e.toModelElement(o))break;o.is("element")&&o.getCustomProperty("listItemMarker")&&t.push(o)}}}function o2(n,i,e,t,{dataPipeline:s}){let r=t.createRangeOn(i);if(!rt(n))return r;for(const o of e){if(o.scope!="itemMarker")continue;const a=o.createElement(t,n,{dataPipeline:s});if(!a||(t.setCustomProperty("listItemMarker",!0,a),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(n)?t.insert(t.createPositionAt(i,0),a):(t.insert(r.start,a),r=t.createRange(t.createPositionBefore(a),t.createPositionAfter(i))),!o.createWrapperElement||!o.canWrapElement))continue;const l=o.createWrapperElement(t,n,{dataPipeline:s});t.setCustomProperty("listItemWrapper",!0,l),o.canWrapElement(n)?r=t.wrap(r,l):(r=t.wrap(t.createRangeOn(a),l),r=t.createRange(r.start,t.createPositionAfter(i)))}return r}function a2(n,i){let e=n.parent;for(;e.is("attributeElement")&&["ul","ol","li"].includes(e.name);){const t=e.parent;i.unwrap(i.createRangeOn(n),e),e=t}}function l2(n,i,e,t,s){if(!n.hasAttribute("listIndent"))return;const r=n.getAttribute("listIndent");let o=n;for(let a=r;a>=0;a--){const l=X5(t,a,o.getAttribute("listItemId")),c=Y5(t,a,o.getAttribute("listType"));for(const d of e)(d.scope=="list"||d.scope=="item")&&o.hasAttribute(d.attributeName)&&d.setAttributeOnDowncast(t,o.getAttribute(d.attributeName),d.scope=="list"?c:l,s);if(i=t.wrap(i,l),i=t.wrap(i,c),a==0||(o=Ne.first(o,{lowerIndent:!0}),!o))break}}function c2(n){return(i,e)=>{const t=[];for(const s of n)i.hasAttribute(s)&&t.push(`attribute:${s}`);return t.every(s=>e.test(i,s)!==!1)?(t.forEach(s=>e.consume(i,s)),!0):!1}}function Yh(n,i,e=_t(n)){if(!D(n))return!1;for(const t of n.getAttributeKeys())if(!(t.startsWith("selection:")||t=="htmlEmptyBlock")&&!i.includes(t))return!1;return e.length<2}const fs=["listType","listIndent","listItemId"];class xe extends y{constructor(e){super(e);u(this,"_downcastStrategies",[]);e.config.define("list.multiBlock",!0)}static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}
269static get requires(){return[Xs,Fi,j5,Ot,$5]}init(){const e=this.editor,t=e.model,s=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new p("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:fs}),s?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const r of fs)t.schema.setAttributeProperties(r,{copyOnReplace:!0});e.commands.add("numberedList",new tn(e,"numbered")),e.commands.add("bulletedList",new tn(e,"bulleted")),e.commands.add("customNumberedList",new tn(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new tn(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new nu(e,"forward")),e.commands.add("outdentList",new nu(e,"backward")),e.commands.add("splitListItemBefore",new ou(e,"before")),e.commands.add("splitListItemAfter",new ou(e,"after")),s&&(e.commands.add("mergeListItemBackward",new ru(e,"backward")),e.commands.add("mergeListItemForward",new ru(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){const t=this.editor.commands,s=t.get("indent"),r=t.get("outdent");s&&s.registerChildCommand(t.get("indentList"),{priority:"high"}),r&&r.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...fs,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),s=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(r,o)=>{const a=e.model.document.selection;Mn(e.model)||e.model.change(()=>{const l=a.getFirstPosition();if(a.isCollapsed&&o.direction=="backward"){if(!l.isAtStart)return;const c=l.parent;if(!D(c))return;if(!Ne.first(c,{sameAttributes:"listType",sameIndent:!0})&&c.getAttribute("listIndent")===0)iu(c)||e.execute("splitListItemAfter"),e.execute("outdentList");else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:uu(e.model,"backward")})}o.preventDefault(),r.stop()}else{if(a.isCollapsed&&!a.getLastPosition().isAtEnd||!s||!s.isEnabled)return;s.execute({shouldMergeOnBlocksContentLevel:uu(e.model,"forward")}),o.preventDefault(),r.stop()}})},{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,s=e.commands,r=s.get("enter");this.listenTo(e.editing.view.document,"enter",(o,a)=>{const l=t.document,c=l.selection.getFirstPosition().parent;if(l.selection.isCollapsed&&D(c)&&c.isEmpty&&!a.isSoft){const d=rt(c),h=iu(c);d&&h?(e.execute("outdentList"),a.preventDefault(),o.stop()):d&&!h?(e.execute("splitListItemAfter"),a.preventDefault(),o.stop()):h&&(e.execute("splitListItemBefore"),a.preventDefault(),o.stop())}},{context:"li"}),this.listenTo(r,"afterExecute",()=>{const o=s.get("splitListItemBefore");if(o.refresh(),!o.isEnabled)return;const l=e.model.document.selection.getLastPosition().parent;_t(l).length===2&&o.execute()})}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,s)=>{const r=s.shiftKey?"outdentList":"indentList";this.editor.commands.get(r).isEnabled&&(e.execute(r),s.stopPropagation(),s.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,s=this.getListAttributeNames(),r=e.config.get("list.multiBlock"),o=r?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(l,{writer:c})=>c.createElement(o,{listType:""})}).elementToElement({view:"p",model:(l,{writer:c})=>l.parent&&l.parent.is("element","li")?c.createElement(o,{listType:""}):null,converterPriority:"high"}).add(l=>{l.on("element:li",t2())}),r||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:cu(s),converterPriority:"high"}).add(l=>{l.on("attribute",lu(s,this._downcastStrategies,t)),l.on("remove",n2(t.schema))}),e.conversion.for("dataDowncast").elementToElement({model:o,view:cu(s,{dataPipeline:!0}),converterPriority:"high"}).add(l=>{l.on("attribute",lu(s,this._downcastStrategies,t,{dataPipeline:!0}))});const a=r2(this._downcastStrategies,e.editing.view);e.editing.mapper.on("modelToViewPosition",a),e.data.mapper.on("modelToViewPosition",a),this.listenTo(t.document,"change:data",i2(t,e.editing,s,this),{priority:"high"}),this.on("checkAttributes:item",(l,{viewElement:c,modelAttributes:d})=>{c.id!=d.listItemId&&(l.return=!0,l.stop())}),this.on("checkAttributes:list",(l,{viewElement:c,modelAttributes:d})=>{(c.name!=jh(d.listType)||c.id!=Jh(d.listType,d.listIndent))&&(l.return=!0,l.stop())})}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(s=>u2(e,s,t,this)),this.on("postFixer",(s,{listNodes:r,writer:o})=>{s.return=Z5(r,o)||s.return},{priority:"high"}),this.on("postFixer",(s,{listNodes:r,writer:o,seenIds:a})=>{s.return=e2(r,a,o)||s.return},{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",d2(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(s,r)=>{e.change(o=>{const a=Array.from(r.content.getChildren()),l=a[a.length-1];if(a.length>1&&l.is("element")&&l.isEmpty&&a.slice(0,-1).every(D)&&o.remove(l),r.method=="copy"||r.method=="cut"){const c=Array.from(r.content.getChildren());On(c)&&er(c,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"}]})}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(e,t,s,r){r&&(r.skipListItemIds||r.isClipboardPipeline)||e.setAttribute("data-list-item-id",t,s)}})}}function u2(n,i,e,t){const s=n.document.differ.getChanges(),r=new Set,o=new Set,a=t.editor.config.get("list.multiBlock");let l=!1;for(const d of s){if(d.type=="insert"&&d.name!="$text"){const h=d.position.nodeAfter;if(!n.schema.checkAttribute(h,"listItemId"))for(const f of Array.from(h.getAttributeKeys()))e.includes(f)&&(i.removeAttribute(f,h),l=!0);qe(d.position,o,r),d.attributes.has("listItemId")||qe(d.position.getShiftedBy(d.length),o,r);for(const{item:f,previousPosition:m}of n.createRangeIn(h))D(f)&&qe(m,o,r)}else d.type=="remove"?qe(d.position,o,r):d.type=="attribute"&&e.includes(d.attributeKey)&&
269(qe(d.range.start,o,r),d.attributeNewValue===null&&qe(d.range.start.getShiftedBy(1),o,r));if(!a&&d.type=="attribute"&&fs.includes(d.attributeKey)){const h=d.range.start.nodeAfter;d.attributeNewValue===null&&h&&h.is("element","listItem")?(i.rename(h,"paragraph"),l=!0):d.attributeOldValue===null&&h&&h.is("element")&&h.name!="listItem"&&(i.rename(h,"listItem"),l=!0)}}const c=new Set;for(const d of o.values())l=t.fire("postFixer",{listNodes:new O5(d),listHead:d,writer:i,seenIds:c})||l;return l}function d2(n){return(i,[e,t])=>{const s=e.is("documentFragment")?Array.from(e.getChildren()):[e];if(!s.length)return;const o=(t?n.createSelection(t):n.document.selection).getFirstPosition();let a;if(D(o.parent))a=o.parent;else if(D(o.nodeBefore)&&D(o.nodeAfter))a=o.nodeBefore;else return;n.change(l=>{const c=a.getAttribute("listType"),d=a.getAttribute("listIndent"),h=s[0].getAttribute("listIndent")||0,f=Math.max(d-h,0);for(const m of s){const g=D(m);a.is("element","listItem")&&m.is("element","paragraph")&&l.rename(m,"listItem"),l.setAttributes({listIndent:(g?m.getAttribute("listIndent"):0)+f,listItemId:g?m.getAttribute("listItemId"):Mi.next(),listType:c},m)}})}}function uu(n,i){const e=n.document.selection;if(!e.isCollapsed)return!Mn(n);if(i==="forward")return!0;const s=e.getFirstPosition().parent,r=s.previousSibling;return n.schema.isObject(r)?!1:r.isEmpty?!0:On([s,r])}function To(n,i,e,t){n.ui.componentFactory.add(i,()=>{const s=du(B,n,i,e,t);return s.set({tooltip:!0,isToggleable:!0}),s}),n.ui.componentFactory.add(`menuBar:${i}`,()=>{const s=du(Z,n,i,e,t);return s.set({role:"menuitemcheckbox",isToggleable:!0}),s})}function du(n,i,e,t,s){const r=i.commands.get(e),o=new n(i.locale);return o.set({label:t,icon:s}),o.bind("isOn","isEnabled").to(r,"value","isEnabled"),o.on("execute",()=>{i.execute(e),i.editing.view.focus()}),o}class h2 extends y{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||To(this.editor,"numberedList",i("Numbered List"),C0),this.editor.ui.componentFactory.has("bulletedList")||To(this.editor,"bulletedList",i("Bulleted List"),d0)}}class cP extends y{static get requires(){return[xe,h2]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}const f2=[{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:n,typeAttribute:i,listType:e}of f2);class m2 extends j{constructor(i){super(i),this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){const i=this._getSelectedItems();this.value=this._getValue(i),this.isEnabled=!!i.length}execute(i={}){this.editor.model.change(e=>{const t=this._getSelectedItems(),s=i.forceValue===void 0?!this._getValue(t):i.forceValue;for(const r of t)s?e.setAttribute("todoListChecked",!0,r):e.removeAttribute("todoListChecked",r)})}_getValue(i){return i.every(e=>e.getAttribute("todoListChecked"))}_getSelectedItems(){const i=this.editor.model,e=i.schema,t=i.document.selection.getFirstRange(),s=t.start.parent,r=[];e.checkAttribute(s,"todoListChecked")&&r.push(..._t(s));for(const o of t.getItems({shallow:!0}))e.checkAttribute(o,"todoListChecked")&&!r.includes(o)&&r.push(..._t(o));return r}}class g2 extends ot{constructor(){super(...arguments);u(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
269stor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e)}}}const p2=zs("Ctrl+Enter");class w2 extends y{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[xe]}init(){const i=this.editor,e=i.model,t=i.editing,s=i.plugins.get(xe),o=i.config.get("list.multiBlock")?"paragraph":"listItem";i.commands.add("todoList",new tn(i,"todo")),i.commands.add("checkTodoList",new m2(i)),t.view.addObserver(g2),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck(a=>{const l=a.last;if(!l.getAttribute("listItemId")||l.getAttribute("listType")!="todo")return!1},"todoListChecked"),i.conversion.for("upcast").add(a=>{a.on("element:input",_2()),a.on("element:li",b2(),{priority:"low"}),a.on("element:label",Nr({name:"label",classes:"todo-list__label"})),a.on("element:label",Nr({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),a.on("element:span",Nr({name:"span",classes:"todo-list__label__description"})),a.on("element:ul",y2({name:"ul",classes:"todo-list"}))}),i.conversion.for("downcast").elementToElement({model:o,view:(a,{writer:l})=>{if(ns(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 d=a.createUIElement("input",{type:"checkbox",...l.getAttribute("todoListChecked")?{checked:"checked"}:null,...c?{disabled:"disabled"}:{tabindex:"-1"}});if(c)return d;const h=a.createContainerElement("span",{contenteditable:"false"},d);return h.getFillerOffset=()=>null,h},canWrapElement(a){return ns(a,s.getListAttributeNames())},createWrapperElement(a,l,{dataPipeline:c}){const d=["todo-list__label"];return ns(l,s.getListAttributeNames())||d.push("todo-list__label_without-description"),a.createAttributeElement(c?"label":"span",{class:d.join(" ")})}}),s.on("checkElement",(a,{modelElement:l,viewElement:c})=>{const d=ns(l,s.getListAttributeNames());c.hasClass("todo-list__label__description")!=d&&(a.return=!0,a.stop())}),s.on("checkElement",(a,{modelElement:l,viewElement:c})=>{const d=l.getAttribute("listType")=="todo"&&rt(l);let h=!1;const f=i.editing.view.createPositionBefore(c).getWalker({direction:"backward"});for(const{item:m}of f){if(m.is("element")&&i.editing.mapper.toModelElement(m))break;m.is("element","input")&&m.getAttribute("type")=="checkbox"&&(h=!0)}h!=d&&(a.return=!0,a.stop())}),s.on("postFixer",(a,{listNodes:l,writer:c})=>{for(const{node:d,previousNodeInList:h}of l){if(!h||h.getAttribute("listItemId")!=d.getAttribute("listItemId"))continue;const f=h.hasAttribute("todoListChecked"),m=d.hasAttribute("todoListChecked");m&&!f?(c.removeAttribute("todoListChecked",d),a.return=!0):!m&&f&&(c.setAttribute("todoListChecked",!0,d),a.return=!0)}}),e.document.registerPostFixer(a=>{const l=e.document.differ.getChanges();let c=!1;for(const d of l)if(d.type=="attribute"&&d.attributeKey=="listType"){const h=d.range.start.nodeAfter;d.attributeOldValue=="todo"&&h.hasAttribute("todoListChecked")&&(a.removeAttribute("todoListChecked",h),c=!0)}else if(d.type=="insert"&&d.name!="$text")for(const{item:h}of a.createRangeOn(d.position.nodeAfter))h.is("element")&&h.getAttribute("listType")!="todo"&&h.hasAttribute("todoListChecked")&&(a.removeAttribute("todoListChecked",h),c=!0);return c}),this.listenTo(t.view.document,"keydown",(a,l)=>{Kt(l)===p2&&(i.execute("checkTodoList"),a.stop())},{priority:"high"}),this.listenTo(t.view.document,"todoCheckboxChange",(a,l)=>{const c=l.target;if(!c||!c.is("element","input"))return;const d=t.view.createPositionAfter(c),f=t.mapper.toModelPosition(d).parent;f&&D(f)&&f.getAttribute("listType")=="todo"&&this._handleCheckmarkChange(f)}),this.listenTo(t.view.document,"arrowKey",k2(e,i.locale),{context:"$text"}),this.listenTo(t.mapper,"viewToModelPosition",(a,l)=>{const c=l.viewPosition.parent,d=c.is("attributeElement","li")&&l.viewPosition.offset==0,h=hu(c)&&l.viewPosition.offset<=1,f=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&hu(c.parent);if(!d&&!h&&!f)return;const m=l.modelPosition.nodeAfter;m&&m.getAttribute("listType")=="todo"&&(l.modelPosition=e.createPositionAt(m,0))},{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(i){const e=this.editor,t=e.model,s=Array.from(t.document.selection.getRanges());t.change(r=>{r.setSelection(i,"end"),e.execute("checkTodoList"),r.setSelection(s)})}_initAriaAnnouncements(){const{model:i,ui:e,t}=this.editor;let s=null;e&&i.document.selection.on("change:range",()=>{const r=i.document.selection.focus.parent,o=fu(s),a=fu(r);o&&!a?e.ariaLiveAnnouncer.announce(t("Leaving a to-do list")):!o&&a&&e.ariaLiveAnnouncer.announce(t("Entering a to-do list")),s=r})}}function b2(){return(n,i,e)=>{const{writer:t,schema:s}=e;if(!i.modelRange)return;const r=Array.from(i.modelRange.getItems({shallow:!0})).filter(o=>o.getAttribute("listType")==="todo"&&s.checkAttribute(o,"listItemId")).reduce((o,a)=>{const l=a.getAttribute("listItemId");return o.has(l)||o.set(l,_t(a)),o},new Map);for(const[,o]of r.entries())if(o.some(a=>a.getAttribute("todoListChecked")))for(const a of o)t.setAttribute("todoListChecked",!0,a)}}function _2(){return(n,i,e)=>{const t=i.modelCursor,s=t.parent,r=i.viewItem;if(!e.consumable.test(r,{name:!0})||r.getAttribute("type")!="checkbox"||!t.isAtStart||!s.hasAttribute("listType"))return;e.consumable.consume(r,{name:!0});const o=e.writer;o.setAttribute("listType","todo",s),i.viewItem.hasAttribute("checked")&&o.setAttribute("todoListChecked",!0,s),i.modelRange=o.createRange(t)}}function Nr(n){const i=new Pe(n);return(e,t,s)=>{const r=i.match(t.viewItem);r&&s.consumable.consume(t.viewItem,r.match)&&Object.assign(t,s.convertChildren(t.viewItem,t.modelCursor))}}function y2(n){const i=new Pe(n);return(e,t,s)=>{const r=i.match(t.viewItem);if(!r)return;const o=r.match;
269o.name=!1,s.consumable.consume(t.viewItem,o)}}function ns(n,i){return(n.is("element","paragraph")||n.is("element","listItem"))&&n.getAttribute("listType")=="todo"&&rt(n)&&v2(n,i)}function v2(n,i){for(const e of n.getAttributeKeys())if(!e.startsWith("selection:")&&!i.includes(e))return!1;return!0}function k2(n,i){return(e,t)=>{const s=Ko(t.keyCode,i.contentLanguageDirection),r=n.schema,o=n.document.selection;if(!o.isCollapsed)return;const a=o.getFirstPosition(),l=a.parent;if(s=="right"&&a.isAtEnd){const c=r.getNearestSelectionRange(n.createPositionAfter(l),"forward");if(!c)return;const d=c.start.parent;d&&D(d)&&d.getAttribute("listType")=="todo"&&(n.change(h=>h.setSelection(c)),t.preventDefault(),t.stopPropagation(),e.stop())}else if(s=="left"&&a.isAtStart&&D(l)&&l.getAttribute("listType")=="todo"){const c=r.getNearestSelectionRange(n.createPositionBefore(l),"backward");if(!c)return;n.change(d=>d.setSelection(c)),t.preventDefault(),t.stopPropagation(),e.stop()}}}function hu(n){return!!n&&n.is("attributeElement")&&n.hasClass("todo-list__label")}function fu(n){return!n||!n.is("element","paragraph")&&!n.is("element","listItem")?!1:n.getAttribute("listType")=="todo"}class C2 extends y{static get pluginName(){return"TodoListUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor.t;To(this.editor,"todoList",i("To-do List"),N0)}}class uP extends y{static get requires(){return[w2,C2]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}}/**
270 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
271 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
272 */const mu={"(":")","[":"]","{":"}"};class E2 extends j{constructor(i){super(i),this._isEnabledBasedOnSelection=!1}refresh(){const i=this.editor.model,e=i.document;this.isEnabled=i.schema.checkAttributeInSelection(e.selection,"mention")}execute(i){const e=this.editor.model,s=e.document.selection,r=typeof i.mention=="string"?{id:i.mention}:i.mention,o=r.id,a=i.range||s.getFirstRange();if(!e.canEditAt(a))return;const l=i.text||o,c=Xh({_text:l,id:o},r);if(!o.startsWith(i.marker))throw new p("mentioncommand-incorrect-id",this);e.change(d=>{const h=je(s.getAttributes()),f=new Map(h.entries());f.set("mention",c);const m=e.insertContent(d.createText(l,f),a),g=m.start.nodeBefore,w=m.end.nodeAfter,v=w&&w.is("$text")&&w.data.startsWith(" ");let O=!1;if(g&&w&&g.is("$text")&&w.is("$text")){const M=g.data.slice(-1),W=M in mu,ie=W&&w.data.startsWith(mu[M]);O=W&&ie}!O&&!v&&e.insertContent(d.createText(" ",h),a.start.getShiftedBy(l.length))})}}class T2 extends y{static get pluginName(){return"MentionEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor,e=i.model,t=e.document;e.schema.extend("$text",{allowAttributes:"mention"}),i.conversion.for("upcast").elementToAttribute({view:{name:"span",attributes:"data-mention",classes:"mention"},model:{key:"mention",value:s=>Zh(s)}}),i.conversion.for("downcast").attributeToElement({model:"mention",view:A2}),i.conversion.for("downcast").add(P2),t.registerPostFixer(s=>I2(s,t,e.schema)),t.registerPostFixer(s=>O2(s,t)),t.registerPostFixer(s=>x2(s,t)),i.commands.add("mention",new E2(i))}}function Xh(n,i){return Object.assign({uid:me()},n,i||{})}function Zh(n,i){const e=n.getAttribute("data-mention"),t=n.getChild(0);if(!t)return;const s={id:e,_text:t.data};return Xh(s,i)}function P2(n){n.on("attribute:mention",(i,e,t)=>{const s=e.attributeNewValue;if(!e.item.is("$textProxy")||!s)return;const r=e.range.start;(r.textNode||r.nodeAfter).data!=s._text&&t.consumable.consume(e.item,i.name)},{priority:"highest"})}function A2(n,{writer:i}){if(!n)return;const e={class:"mention","data-mention":n.id},t={id:n.uid,priority:20};return i.createAttributeElement("span",e,t)}function x2(n,i){const e=i.selection,t=e.focus;return e.isCollapsed&&e.hasAttribute("mention")&&S2(t)?(n.removeSelectionAttribute("mention"),!0):!1}function S2(n){const i=n.isAtStart;return n.nodeBefore&&n.nodeBefore.is("$text")||i}function I2(n,i,e){const t=i.differ.getChanges();let s=!1;for(const r of t){if(r.type=="attribute")continue;const o=r.position;if(r.name=="$text"){const a=o.textNode&&o.textNode.nextSibling;s=Dt(o.textNode,n)||s,s=Dt(a,n)||s,s=Dt(o.nodeBefore,n)||s,s=Dt(o.nodeAfter,n)||s}if(r.name!="$text"&&r.type=="insert"){const a=o.nodeAfter;for(const l of n.createRangeIn(a).getItems())s=Dt(l,n)||s}if(r.type=="insert"&&e.isInline(r.name)){const a=o.nodeAfter&&o.nodeAfter.nextSibling;s=Dt(o.nodeBefore,n)||s,s=Dt(a,n)||s}}return s}function O2(n,i){const e=i.differ.getChanges();let t=!1;for(const s of e)if(s.type==="attribute"&&s.attributeKey!="mention"){const r=s.range.start.nodeBefore,o=s.range.end.nodeAfter;for(const a of[r,o])ef(a)&&a.getAttribute(s.attributeKey)!=s.attributeNewValue&&(n.setAttribute(s.attributeKey,s.attributeNewValue,a),t=!0)}return t}function ef(n){if(!n||!(n.is("$text")||n.is("$textProxy"))||!n.hasAttribute("mention"))return!1;const i=n.data,t=n.getAttribute("mention")._text;return i!=t}function Dt(n,i){return ef(n)?(i.removeAttribute("mention",n),!0):!1}class M2 extends Zt{constructor(e){super(e);u(this,"selected");u(this,"position");this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);const s=this.items.get(t);this.selected!==s&&(this.selected&&this.selected.removeHighlight(),s.highlight(),this.selected=s,this._isItemVisibleInScrolledArea(s)||(this.element.scrollTop=s.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new R(this.element).contains(new R(e.element))}}class R2 extends T{constructor(e,t){super(e);u(this,"domElement");this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",(s,r,o)=>{o?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))}),this.listenTo(this.domElement,"click",()=>{this.fire("execute")})}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}}class V2 extends Fe{constructor(){super(...arguments);u(this,"item");u(this,"marker")}highlight(){const e=this.children.first;e.isOn=!0}removeHighlight(){const e=this.children.first;e.isOn=!1}}const ss=3,B2=[V.arrowup,V.arrowdown,V.esc],L2=[V.enter,V.tab];class F2 extends y{constructor(e){super(e);u(this,"_mentionsView");u(this,"_mentionsConfigurations");u(this,"_balloon");u(this,"_items",new Se);u(this,"_lastRequested");u(this,"_requestFeedDebounced");this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=pt(this._requestFeed,100),e.config.define("mention",{feeds:[]})}static get pluginName(){return"MentionUI"}static get isOfficialPlugin(){return!0}static get requires(){return[An]}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||L2,s=B2.concat(t);
272this._balloon=e.plugins.get(An),e.editing.view.document.on("keydown",(a,l)=>{o(l.keyCode)&&this._isUIVisible&&(l.preventDefault(),a.stop(),l.keyCode==V.arrowdown&&this._mentionsView.selectNext(),l.keyCode==V.arrowup&&this._mentionsView.selectPrevious(),t.includes(l.keyCode)&&this._mentionsView.executeSelected(),l.keyCode==V.esc&&this._hideUIAndRemoveMarker())},{priority:"highest"}),Gs({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const r=e.config.get("mention.feeds");for(const a of r){const{feed:l,marker:c,dropdownLimit:d}=a;if(!U2(c))throw new p("mentionconfig-incorrect-marker",null,{marker:c});const h=typeof l=="function"?l.bind(this.editor):H2(l),f=a.itemRenderer,m={marker:c,feedCallback:h,itemRenderer:f,dropdownLimit:d};this._mentionsConfigurations.set(c,m)}this._setupTextWatcher(r),this.listenTo(e,"change:isReadOnly",()=>{this._hideUIAndRemoveMarker()}),this.on("requestFeed:response",(a,l)=>this._handleFeedResponse(l)),this.on("requestFeed:error",()=>this._hideUIAndRemoveMarker());function o(a){return s.includes(a)}}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new M2(e);return t.items.bindTo(this._items).using(s=>{const{item:r,marker:o}=s,{dropdownLimit:a}=this._mentionsConfigurations.get(o),l=a||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=l)return null;const c=new V2(e),d=this._renderItem(r,o);return d.delegate("execute").to(c),c.children.add(d),c.item=r,c.marker=o,c.on("execute",()=>{t.fire("execute",{item:r,marker:o})}),c}),t.on("execute",(s,r)=>{const o=this.editor,a=o.model,l=r.item,c=r.marker,d=o.model.markers.get("mention"),h=a.createPositionAt(a.document.selection.focus),f=a.createPositionAt(d.getStart()),m=a.createRange(f,h);this._hideUIAndRemoveMarker(),o.execute("mention",{mention:l,text:l.text,marker:c,range:m}),o.editing.view.focus()}),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:s}=this._mentionsConfigurations.get(e),r=s(t);if(!(r instanceof Promise)){this.fire("requestFeed:response",{feed:r,marker:e,feedText:t});return}r.then(a=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:a,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:a,marker:e,feedText:t})}).catch(a=>{this.fire("requestFeed:error",{error:a})})}_setupTextWatcher(e){const t=this.editor,s=e.map(a=>({...a,pattern:nf(a.marker,a.minimumCharacters||0)})),r=new ba(t.model,D2(s));r.on("matched",(a,l)=>{const c=tf(s,l.text),h=t.model.document.selection.focus,f=t.model.createPositionAt(h.parent,c.position);if(W2(h)||$2(f)){this._hideUIAndRemoveMarker();return}const m=z2(c,l.text),g=c.marker.length+m.length,w=h.getShiftedBy(-g),v=h.getShiftedBy(-m.length),O=t.model.createRange(w,v);if(Dr(t)){const M=t.model.markers.get("mention");t.model.change(W=>{W.updateMarker(M,{range:O})})}else t.model.change(M=>{M.addMarker("mention",{range:O,usingOperation:!1,affectsData:!1})});this._requestFeedDebounced(c.marker,m)}),r.on("unmatched",()=>{this._hideUIAndRemoveMarker()});const o=t.commands.get("mention");return r.bind("isEnabled").to(o),r}_handleFeedResponse(e){const{feed:t,marker:s}=e;if(!Dr(this.editor))return;this._items.clear();for(const o of t){const a=typeof o!="object"?{id:o,text:o}:o;this._items.add({item:a,marker:s})}const r=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(r):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0,balloonClassName:"ck-mention-balloon"}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),Dr(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0}_renderItem(e,t){const s=this.editor;let r,o=e.id;const a=this._getItemRenderer(t);if(a){const l=a(e);typeof l!="string"?r=new R2(s.locale,l):o=l}if(!r){const l=new B(s.locale);l.label=o,l.withText=!0,r=l}return r}_getBalloonPanelPositionData(e,t){const s=this.editor,r=s.editing,o=r.view.domConverter,a=r.mapper,l=s.locale.uiLanguageDirection;return{target:()=>{let c=e.getRange();c.start.root.rootName=="$graveyard"&&(c=s.model.document.selection.getFirstRange());const d=a.toViewRange(c);return R.getDomRangeRects(o.viewRangeToDom(d)).pop()},limiter:()=>{const c=this.editor.editing.view,h=c.document.selection.editableElement;return h?c.domConverter.mapViewToDom(h.root):null},positions:N2(t,l)}}}function N2(n,i){const e={caret_se:t=>({top:t.bottom+ss,left:t.right,name:"caret_se",config:{withArrow:!1}
272}),caret_ne:(t,s)=>({top:t.top-s.height-ss,left:t.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(t,s)=>({top:t.bottom+ss,left:t.right-s.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(t,s)=>({top:t.top-s.height-ss,left:t.right-s.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(e,n)?[e[n]]:i!=="rtl"?[e.caret_se,e.caret_sw,e.caret_ne,e.caret_nw]:[e.caret_sw,e.caret_se,e.caret_nw,e.caret_ne]}function tf(n,i){let e;for(const t of n){const s=i.lastIndexOf(t.marker);s>0&&!i.substring(s-1).match(t.pattern)||(!e||s>=e.position)&&(e={marker:t.marker,position:s,minimumCharacters:t.minimumCharacters,pattern:t.pattern})}return e}function nf(n,i){const e=i==0?"*":`{${i},}`,t=P.features.isRegExpUnicodePropertySupported?`\\p{Ps}\\p{Pi}"'`:`\\(\\[{"'`,s=".";n=n.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&");const r=`(?:^|[ ${t}])(${n})(${s}${e})$`;return new RegExp(r,"u")}function D2(n){return e=>{const t=tf(n,e);if(!t)return!1;let s=0;t.position!==0&&(s=t.position-1);const r=e.substring(s);return t.pattern.test(r)}}function z2(n,i){let e=0;n.position!==0&&(e=n.position-1);const t=nf(n.marker,0);return i.substring(e).match(t)[2]}function H2(n){return i=>n.filter(t=>(typeof t=="string"?t:String(t.id)).toLowerCase().includes(i.toLowerCase()))}function W2(n){const i=n.textNode&&n.textNode.hasAttribute("mention"),e=n.nodeBefore;return i||e&&e.is("$text")&&e.hasAttribute("mention")}function $2(n){const i=n.nodeAfter;return i&&i.is("$text")&&i.hasAttribute("mention")}function U2(n){return!!n}function Dr(n){return n.model.markers.has("mention")}class dP extends y{toMentionAttribute(i,e){return Zh(i,e)}static get pluginName(){return"Mention"}static get isOfficialPlugin(){return!0}static get requires(){return[T2,F2]}}/**
273 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
274 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
275 *//**
276 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
277 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
278 */function q2(n,i){const e=[];for(const t of i.createRangeIn(n)){const s=t.item;s.is("element","a")&&!s.hasAttribute("href")&&(s.hasAttribute("id")||s.hasAttribute("name"))&&e.push(s)}for(const t of e){const s=t.parent.getChildIndex(t)+1,r=t.getChildren();i.insertChild(s,r,t.parent)}}/**
279 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
280 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
281 */function sf(n){const i=parseFloat(n);return n.endsWith("pt")?wi(i*96/72):n.endsWith("pc")?wi(i*12*96/72):n.endsWith("in")?wi(i*96):n.endsWith("cm")?wi(i*96/2.54):n.endsWith("mm")?wi(i/10*96/2.54):n}function gu(n){return n!==void 0&&n.endsWith("px")}function wi(n){return Math.round(n)+"px"}function K2(n,i,e){if(!n.childCount)return;const t=new Vi(n.document),s=j2(n,t);if(!s.length)return;const r={},o=[];for(const a of s)if(a.indent!==void 0){J2(a)||(o.length=0);const l=`${a.id}:${a.indent}`,c=Math.min(a.indent-1,o.length);if(c<o.length&&o[c].id!==a.id&&(o.length=c),c<o.length-1)o.length=c+1;else{const h=Q2(a,i);if(c>o.length-1||o[c].listElement.name!=h.type){c==0&&h.type=="ol"&&a.id!==void 0&&r[l]&&(h.startIndex=r[l]);const f=eE(h,t,e);if(gu(a.marginLeft)&&(c==0||gu(o[c-1].marginLeft))){let m=a.marginLeft;c>0&&(m=wi(parseFloat(m)-parseFloat(o[c-1].marginLeft))),t.setStyle("padding-left",m,f)}if(o.length==0){const m=a.element.parent,g=m.getChildIndex(a.element)+1;t.insertChild(g,f,m)}else{const m=o[c-1].listItemElements;t.appendChild(f,m[m.length-1])}o[c]={...a,listElement:f,listItemElements:[]},c==0&&a.id!==void 0&&(r[l]=h.startIndex||1)}}const d=a.element.name=="li"?a.element:t.createElement("li");t.appendChild(d,o[c].listElement),o[c].listItemElements.push(d),c==0&&a.id!==void 0&&r[l]++,a.element!=d&&t.appendChild(a.element,d),iE(a.element,t),t.removeStyle("text-indent",a.element),t.removeStyle("margin-left",a.element)}else{const l=o.find(c=>c.marginLeft==a.marginLeft);if(l){const c=l.listItemElements;t.appendChild(a.element,c[c.length-1]),t.removeStyle("margin-left",a.element)}else o.length=0}}function G2(n,i){for(const e of i.createRangeIn(n)){const t=e.item;if(t.is("element","li")){const s=t.getChild(0);s&&s.is("element","p")&&i.unwrapElement(s)}}}function j2(n,i){const e=i.createRangeIn(n),t=[],s=new Set;for(const r of e.getItems()){if(!r.is("element")||!r.name.match(/^(p|h\d+|li|div)$/))continue;let o=nE(r);if(o!==void 0&&parseFloat(o)==0&&!Array.from(r.getClassNames()).find(a=>a.startsWith("MsoList"))&&(o=void 0),r.hasStyle("mso-list")||o!==void 0&&s.has(o)){const a=tE(r);t.push({element:r,id:a.id,order:a.order,indent:a.indent,marginLeft:o}),o!==void 0&&s.add(o)}else s.clear()}return t}function J2(n){const i=n.element.previousSibling;if(!i){const e=n.element.parent;return zr(e)&&(!e.previousSibling||zr(e.previousSibling))}return zr(i)}function zr(n){return n.is("element","ol")||n.is("element","ul")}function Q2(n,i){const e=new RegExp(`@list l${n.id}:level${n.indent}\\s*({[^}]*)`,"gi"),t=/mso-level-number-format:([^;]{0,100});/gi,s=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=new RegExp(`@list\\s+l${n.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),o=new RegExp(`@list l${n.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=r.exec(i),l=o.exec(i),c=a&&!l,d=e.exec(i);let h="decimal",f="ol",m=null;if(d&&d[1]){const g=t.exec(d[1]);if(g&&g[1]&&(h=g[1].trim(),f=h!=="bullet"&&h!=="image"?"ol":"ul"),h==="bullet"){const w=Y2(n.element);w&&(h=w)}else{const w=s.exec(d[1]);w&&w[1]&&(m=parseInt(w[1]))}c&&(f="ol")}return{type:f,startIndex:m,style:Z2(h),isLegalStyleList:c}}function Y2(n){if(n.name=="li"&&n.parent.name=="ul"&&n.parent.hasAttribute("type"))return n.parent.getAttribute("type");const i=X2(n);if(!i)return null;const e=i._data;return e==="o"?"circle":e==="·"?"disc":e==="§"?"square":null}function X2(n){if(n.getChild(0).is("$text"))return null;for(const i of n.getChildren()){if(!i.is("element","span"))continue;const e=i.getChild(0);if(e)return e.is("$text")?e:e.getChild(0)}/* istanbul ignore next -- @preserve */return null}function Z2(n){if(n.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(n){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 n;default:return null}}function eE(n,i,e){const t=i.createElement(n.type);return n.style&&i.setStyle("list-style-type",n.style,t),n.startIndex&&n.startIndex>1&&i.setAttribute("start",n.startIndex,t),n.isLegalStyleList&&e&&i.addClass("legal-list",t),t}function tE(n){const i=n.getStyle("mso-list");if(i===void 0)return{};const e=i.match(/(^|\s{1,100})l(\d+)/i),t=i.match(/\s{0,100}lfo(\d+)/i),s=i.match(/\s{0,100}level(\d+)/i);return e&&t&&s?{id:e[2],order:t[1],indent:parseInt(s[1])}:{indent:1}}function iE(n,i){const e=new Pe({name:"span",styles:{"mso-list":"Ignore"}}),t=i.createRangeIn(n);for(const s of t)s.type==="elementStart"&&e.match(s.item)&&i.remove(s.item)}function nE(n){const i=n.getStyle("margin-left");return i===void 0||i.endsWith("px")?i:sf(i)}
281function sE(n,i){if(!n.childCount)return;const e=new Vi(n.document),t=oE(n,e);aE(t,n,e),cE(t,n,e),lE(n,e);const s=uE(n,e);s.length&&hE(s,dE(i),e)}function rE(n){return btoa(n.match(/\w{2}/g).map(i=>String.fromCharCode(parseInt(i,16))).join(""))}function oE(n,i){const e=i.createRangeIn(n),t=new Pe({name:/v:(.+)/}),s=[];for(const r of e){if(r.type!="elementStart")continue;const o=r.item,a=o.previousSibling,l=a&&a.is("element")?a.name:null,c=["Chart"],d=t.match(o),h=o.getAttribute("o:gfxdata"),f=l==="v:shapetype",m=h&&c.some(g=>o.getAttribute("id").includes(g));d&&h&&!f&&!m&&s.push(r.item.getAttribute("id"))}return s}function aE(n,i,e){const t=e.createRangeIn(i),s=new Pe({name:"img"}),r=[];for(const o of t)if(o.item.is("element")&&s.match(o.item)){const a=o.item,l=a.getAttribute("v:shapes")?a.getAttribute("v:shapes").split(" "):[];l.length&&l.every(c=>n.indexOf(c)>-1)?r.push(a):a.getAttribute("src")||r.push(a)}for(const o of r)e.remove(o)}function lE(n,i){const e=i.createRangeIn(n),t=new Pe({name:/v:(.+)/}),s=[];for(const r of e)r.type=="elementStart"&&t.match(r.item)&&s.push(r.item);for(const r of s)i.remove(r)}function cE(n,i,e){const t=e.createRangeIn(i),s=[];for(const a of t)if(a.type=="elementStart"&&a.item.is("element","v:shape")){const l=a.item.getAttribute("id");if(n.includes(l))continue;r(a.item.parent.getChildren(),l)||s.push(a.item)}for(const a of s){const l={src:o(a)};a.hasAttribute("alt")&&(l.alt=a.getAttribute("alt"));const c=e.createElement("img",l);e.insertChild(a.index+1,c,a.parent)}function r(a,l){for(const c of a){/* istanbul ignore else -- @preserve */if(c.is("element")&&(c.name=="img"&&c.getAttribute("v:shapes")==l||r(c.getChildren(),l)))return!0}return!1}function o(a){for(const l of a.getChildren()){/* istanbul ignore else -- @preserve */if(l.is("element")&&l.getAttribute("src"))return l.getAttribute("src")}}}function uE(n,i){const e=i.createRangeIn(n),t=new Pe({name:"img"}),s=[];let r=0;for(const o of e)o.item.is("element")&&t.match(o.item)&&(o.item.getAttribute("src").startsWith("file://")&&s.push({element:o.item,imageIndex:r}),r++);return s}function dE(n){if(!n)return[];const i=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,e=new RegExp("(?:("+i.source+"))([\\da-fA-F\\s]+)\\}","g"),t=n.match(e),s=[];if(t)for(const r of t){let o=!1;r.includes("\\pngblip")?o="image/png":r.includes("\\jpegblip")&&(o="image/jpeg"),o&&s.push({hex:r.replace(i,"").replace(/[^\da-fA-F]/g,""),type:o})}return s}function hE(n,i,e){for(let t=0;t<n.length;t++){const{element:s,imageIndex:r}=n[t],o=i[r];if(o){const a=`data:${o.type};base64,${rE(o.hex)}`;e.setAttribute("src",a,s)}}}function fE(n){const i=[],e=new Vi(n.document);for(const{item:t}of e.createRangeIn(n))if(t.is("element")){for(const s of t.getClassNames())/\bmso/gi.exec(s)&&e.removeClass(s,t);for(const s of t.getStyleNames())/\bmso/gi.exec(s)&&e.removeStyle(s,t);(t.is("element","w:sdt")||t.is("element","w:sdtpr")&&t.isEmpty||t.is("element","o:p")&&t.isEmpty)&&i.push(t)}for(const t of i){const s=t.parent,r=s.getChildIndex(t);e.insertChild(r,t.getChildren(),s),e.remove(t)}}function mE(n,i){for(const e of i.createRangeIn(n).getItems()){if(!e.is("element","table")&&!e.is("element","td")&&!e.is("element","th"))continue;const t=["left","top","right","bottom"];if(t.every(r=>!e.hasStyle(`border-${r}-style`)))i.setStyle("border-style","none",e);else for(const r of t)e.hasStyle(`border-${r}-style`)||i.setStyle(`border-${r}-style`,"none",e);const s=["width","height",...t.map(r=>`border-${r}-width`),...t.map(r=>`padding-${r}`)];for(const r of s)e.hasStyle(r)&&i.setStyle(r,sf(e.getStyle(r)),e)}}/**
282 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
283 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
284 */function rf(n,i){for(const e of i.createRangeIn(n).getItems())e.is("element","table")&&(e.getStyle("width")==="0px"&&i.removeStyle("width",e),e.getAttribute("width")==="0"&&i.removeAttribute("width",e))}const gE=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>
284/i,pE=/xmlns:o="urn:schemas-microsoft-com/i;class wE{constructor(i,e=!1){u(this,"document");u(this,"hasMultiLevelListPlugin");this.document=i,this.hasMultiLevelListPlugin=e}isActive(i){return gE.test(i)||pE.test(i)}execute(i){const e=new Vi(this.document),{body:t,stylesString:s}=i._parsedData;q2(t,e),K2(t,s,this.hasMultiLevelListPlugin),sE(t,i.dataTransfer.getData("text/rtf")),mE(t,e),rf(t,e),fE(t),i.content=t}}/**
285 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
286 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
287 */function bE(n,i){for(const e of n.getChildren())if(e.is("element","b")&&e.getStyle("font-weight")==="normal"){const t=n.getChildIndex(e);i.remove(e),i.insertChild(t,e.getChildren(),n)}}function _E(n,i){const e=new Ws(i.document.stylesProcessor),t=new Us(e,{renderingMode:"data"}),s=t.blockElements,r=t.inlineObjectElements,o=[];for(const a of i.createRangeIn(n)){const l=a.item;if(l.is("element","br")){const c=pu(l,"forward",i,{blockElements:s,inlineObjectElements:r}),d=pu(l,"backward",i,{blockElements:s,inlineObjectElements:r}),h=wu(c,s);(wu(d,s)||h)&&o.push(l)}}for(const a of o)a.hasClass("Apple-interchange-newline")?i.remove(a):i.replace(a,i.createElement("p"))}function pu(n,i,e,{blockElements:t,inlineObjectElements:s}){let r=e.createPositionAt(n,i=="forward"?"after":"before");return r=r.getLastMatchingPosition(({item:o})=>o.is("element")&&!t.includes(o.name)&&!s.includes(o.name),{direction:i}),i=="forward"?r.nodeAfter:r.nodeBefore}function wu(n,i){return!!n&&n.is("element")&&i.includes(n.name)}/**
288 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
289 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
290 */function yE(n,i,e){const t=new Set;for(const s of i.createRangeIn(n).getItems())!s.is("view:$textProxy")||!s.data.includes("	")||vE(s.parent)&&t.add(s.textNode);for(const s of t)kE(s,i,e)}function vE(n){var e;let i=n;for(;i;){if(i.is("element")&&((e=i.getStyle)==null?void 0:e.call(i,"white-space"))==="pre-wrap")return!0;i=i.parent}return!1}function kE(n,i,e){const{parent:t,data:s}=n,r=s.replaceAll("	"," ".repeat(e)),o=t.getChildIndex(n);i.remove(n),i.insertChild(o,i.createText(r),t)}const CE=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class EE{constructor(i){u(this,"document");this.document=i}isActive(i){return CE.test(i)}execute(i){const e=new Vi(this.document),{body:t}=i._parsedData;bE(t,e),G2(t,e),_E(t,e),yE(t,e,8),i.content=t}}/**
291 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
292 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
293 */function TE(n,i){for(const e of n.getChildren())e.is("element","table")&&e.hasAttribute("xmlns")&&i.removeAttribute("xmlns",e)}/**
294 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
295 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
296 */function PE(n,i){for(const e of n.getChildren())if(e.is("element","google-sheets-html-origin")){const t=n.getChildIndex(e);i.remove(e),i.insertChild(t,e.getChildren(),n)}}/**
297 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
298 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
299 */function AE(n,i){for(const e of Array.from(n.getChildren()))e.is("element","style")&&i.remove(e)}const xE=/<google-sheets-html-origin/i;class SE{constructor(i){u(this,"document");this.document=i}isActive(i){return xE.test(i)}execute(i){const e=new Vi(this.document),{body:t}=i._parsedData;PE(t,e),TE(t,e),rf(t,e),AE(t,e),i.content=t}}/**
300 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
301 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
302 */function IE(n){return bu(bu(n)).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 OE(n){n.querySelectorAll("span[style*=spacerun]").forEach(i=>
302{const e=i,t=e.innerText.length||0;e.innerText=Array(t+1).join("  ").substr(0,t)})}function bu(n){return n.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(i,e)=>e.length===1?" ":Array(e.length+1).join("  ").substr(0,e.length))}function ME(n,i){const e=new DOMParser;n=n.replace(/<!--\[if gte vml 1]>/g,""),n=n.replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,"");const t=IE(BE(n)),s=e.parseFromString(t,"text/html");OE(s);const r=s.body.innerHTML,o=RE(s,i),a=VE(s);return{body:o,bodyString:r,styles:a.styles,stylesString:a.stylesString}}function RE(n,i){const e=new Ws(i),t=new Us(e,{renderingMode:"data"}),s=n.createDocumentFragment(),r=n.body.childNodes;for(;r.length>0;)s.appendChild(r[0]);return t.domToView(s,{skipComments:!0})}function VE(n){const i=[],e=[],t=Array.from(n.getElementsByTagName("style"));for(const s of t)s.sheet&&s.sheet.cssRules&&s.sheet.cssRules.length&&(i.push(s.sheet),e.push(s.innerHTML));return{styles:i,stylesString:e.join(" ")}}function BE(n){const i="</body>",e="</html>",t=n.indexOf(i);if(t<0)return n;const s=n.indexOf(e,t+i.length);return n.substring(0,t+i.length)+(s>=0?n.substring(s):"")}class hP extends y{static get pluginName(){return"PasteFromOffice"}static get isOfficialPlugin(){return!0}static get requires(){return[Ot]}init(){const i=this.editor,e=i.plugins.get("ClipboardPipeline"),t=i.editing.view.document,s=[],r=this.editor.plugins.has("MultiLevelList");s.push(new wE(t,r)),s.push(new EE(t)),s.push(new SE(t)),e.on("inputTransformation",(o,a)=>{if(a._isTransformedWithPasteFromOffice||i.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const c=a.dataTransfer.getData("text/html"),d=s.find(h=>h.isActive(c));d&&(a._parsedData||(a._parsedData=ME(c,t.stylesProcessor)),d.execute(a),a._isTransformedWithPasteFromOffice=!0)},{priority:"high"})}}/**
303 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
304 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
305 */const rs="removeFormat";class LE extends y{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.ui.componentFactory.add(rs,()=>{const e=this._createButton(B);return e.set({tooltip:!0}),e}),i.ui.componentFactory.add(`menuBar:${rs}`,()=>this._createButton(Z))}_createButton(i){const e=this.editor,t=e.locale,s=e.commands.get(rs),r=new i(e.locale),o=t.t;return r.set({label:o("Remove Format"),icon:I0}),r.bind("isEnabled").to(s,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute(rs),e.editing.view.focus()}),r}}class FE extends j{constructor(){super(...arguments);u(this,"_customAttributesHandlers",[])}refresh(){const e=this.editor.model;this.isEnabled=!!ye(this._getFormattingItems(e.document.selection))}execute(){const e=this.editor.model;e.change(t=>{for(const s of this._getFormattingItems(e.document.selection))if(s.is("selection"))for(const r of this._getFormattingAttributes(s))t.removeSelectionAttribute(r);else{const r=t.createRangeOn(s);for(const o of this._getFormattingAttributes(s))this._removeFormatting(o,s,r,t)}})}registerCustomAttribute(e,t){this._customAttributesHandlers.push({isFormatting:e,removeFormatting:t})}_removeFormatting(e,t,s,r){let o=!1;for(const{isFormatting:a,removeFormatting:l}of this._customAttributesHandlers)a(e,t)&&(l(e,s,r),o=!0);o||r.removeAttribute(e,s)}*_getFormattingItems(e){const t=this.editor.model,s=t.schema,r=o=>
305!!ye(this._getFormattingAttributes(o));for(const o of e.getRanges())for(const a of o.getItems())s.isBlock(a)&&o.end.isTouching(t.createPositionAt(a,0))||r(a)&&(yield a);for(const o of e.getSelectedBlocks())r(o)&&(yield o);r(e)&&(yield e)}*_getFormattingAttributes(e){const t=this.editor.model.schema;for(const[s]of e.getAttributes()){for(const{isFormatting:o}of this._customAttributesHandlers)o(s,e)&&(yield s);const r=t.getAttributeProperties(s);r&&r.isFormatting&&(yield s)}}}class NE extends y{static get pluginName(){return"RemoveFormatEditing"}static get isOfficialPlugin(){return!0}init(){const i=this.editor;i.commands.add("removeFormat",new FE(i))}}class fP extends y{static get requires(){return[NE,LE]}static get pluginName(){return"RemoveFormat"}static get isOfficialPlugin(){return!0}}new Array(256).fill("").map((n,i)=>("0"+i.toString(16)).slice(-2));function va(n){return!!n&&/^\d+\.\d+\.\d+/.test(n)}function Po(n){if(!va(n))throw new Error(`Invalid semantic version: ${n||"<blank>"}.`);const[i,e,t]=n.split(".");return{major:Number.parseInt(i,10),minor:Number.parseInt(e,10),patch:Number.parseInt(t,10)}}function DE(n,i){const e=Po(n),t=Po(i);return Math.sign(e.major-t.major||e.minor-t.minor||e.patch-t.patch)}function of(n){return n?["nightly","alpha","internal","nightly-","staging"].some(i=>n.includes(i)):!1}function _u(n){return!!(n!=null&&n.startsWith("0.0.0-"))}function zE(n){return va(n)||of(n)}function HE(n,i){const e=n.extraPlugins||[];return{...n,extraPlugins:[...e,...i.filter(t=>!e.includes(t))]}}function WE(n){if(of(n))return 3;const{major:i}=Po(n);switch(!0){case i>=44:return 3;case i>=38:return 2;default:return 1}}function af(){const{CKEDITOR_VERSION:n,CKEDITOR:i}=window;return zE(n)?{source:i?"cdn":"npm",version:n}:null}function $E(){const n=af();return n?WE(n.version):null}function lf(n,i){switch(i||(i=$E()||void 0),i){case 1:case 2:return n===void 0;case 3:return n==="GPL";default:return!1}}function UE(n,i){return function(t){lf(t.config.get("licenseKey"))||t.on("collectUsageData",(s,{setUsageData:r})=>{r(`integration.${n}`,i)})}}function cf(n){var e;const i=(e=af())==null?void 0:e.version;return i?_u(n)?-1:!va(i)||_u(i)?1:DE(i,n):null}function ka(){const n=cf("48.0.0"),i=n!==null&&n>=0;return{rootsConfigEntry:i,elementConfigAttachment:i}}function qE(n,i,e){var s;if(!n.editorName||n.editorName==="ClassicEditor")return{...e,attachTo:i};const t={...e,roots:{...e.roots,main:{...e.root,...(s=e.roots)==null?void 0:s.main,element:i}}};return delete t.root,t}function KE(n){var e,t,s;return ka().rootsConfigEntry&&(((t=(e=n.roots)==null?void 0:e.main)==null?void 0:t.initialData)||((s=n.root)==null?void 0:s.initialData))||n.initialData}function GE(n,i,e){var r;const t=ka(),s=e?null:KE(n);if(t.rootsConfigEntry){const o={...n,roots:{...n.roots,main:{...n.root,...(r=n.roots)==null?void 0:r.main,initialData:s||i||""}}};return delete o.root,delete o.initialData,o}return{...n,initialData:s||i||""}}/**
306* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
307* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
308*/var jE=UE("vue",{version:"7.4.2",frameworkVersion:yu});/**
309* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
310* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
311*/function JE(n){return lf(n.licenseKey)?n:HE(n,[jE])}var Hr="Lock from Vue integration (@ckeditor/ckeditor5-vue)",QE=300,mP=ff({name:"CKEditor",__name:"ckeditor",props:Ta({editor:{},config:{default:()=>({})},tagName:{default:"div"},disabled:{type:Boolean,default:!1},disableTwoWayDataBinding:{type:Boolean,default:!1}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:Ta(["ready","destroy","blur","focus","input","update:modelValue"],["update:modelValue"]),setup(n,{expose:i,emit:e}){const t=mf(n,"modelValue"),s=n,r=e,o=tr(),a=tr(),l=tr();i({instance:a,lastEditorData:l}),Ea(t,h=>{a.value&&h!==l.value&&a.value.data.set(h)}),Ea(()=>s.disabled,h=>{h?a.value.enableReadOnlyMode(Hr):a.value.disableReadOnlyMode(Hr)});function c(){switch(cf("42.0.0")){case null:break;case-1:break}}function d(h){const f=vf(m=>{if(s.disableTwoWayDataBinding)return;const g=l.value=h.data.get();r("update:modelValue",g,m,h),r("input",g,m,h)},QE,{leading:!0});h.model.document.on("change:data",f),h.editing.view.document.on("focus",m=>{r("focus",m,h)}),h.editing.view.document.on("blur",m=>{r("blur",m,h)})}return c(),gf(()=>{const{editor:h}=s,f=ka();let m=JE(Object.assign({},s.config)),g=t.value;t.value&&(m=GE(m,t.value,!0)),(f.elementConfigAttachment?h.create(qE(h,o.value,m)):h.create(o.value,m)).then(w=>
311{a.value=pf(w),d(w),t.value!==g&&w.data.set(t.value),s.disabled&&w.enableReadOnlyMode(Hr),r("ready",w)}).catch(w=>{})}),wf(()=>{a.value&&(a.value.destroy(),a.value=void 0),r("destroy")}),(h,f)=>(bf(),_f(yf(n.tagName),{ref_key:"element",ref:o},null,512))}});/**
312* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
313* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
314*//* istanbul ignore if -- @preserve */if(!yu.startsWith("3."))throw new Error("The CKEditor plugin works only with Vue 3+. For more information, please refer to https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs-v3.html");export{T0 as $,xT as A,zT as B,Ot as C,lo as D,l0 as E,dv as F,co as G,ST as H,Ky as I,We as J,T as K,ma as L,gt as M,ho as N,DT as O,y as P,de as Q,R,Nv as S,Qs as T,wa as U,Vi as V,Ie as W,S1 as X,C as Y,vt as Z,aP as _,hy as a,LT as a$,qd as a0,_o as a1,hP as a2,$T as a3,qT as a4,JT as a5,KT as a6,GT as a7,jT as a8,cP as a9,fm as aA,qv as aB,it as aC,ln as aD,ng as aE,_e as aF,XT as aG,De as aH,ee as aI,Le as aJ,YT as aK,$ as aL,uT as aM,ZT as aN,An as aO,rc as aP,Gs as aQ,hT as aR,yt as aS,It as aT,Zv as aU,ay as aV,ET as aW,CT as aX,TT as aY,PT as aZ,AT as a_,v5 as aa,nP as ab,tP as ac,fP as ad,rP as ae,uP as af,oP as ag,WT as ah,iP as ai,sP as aj,QT as ak,mP as al,eP as am,dP as an,Ho as ao,ZE as ap,u0 as aq,lT as ar,rT as as,oT as at,Pe as au,Ih as av,Tt as aw,Xs as ax,xa as ay,Y as az,dT as b,Ye as b0,FT as b1,x1 as b2,Qv as b3,_c as b4,Ks as b5,Js as b6,mo as b7,_T as b8,pT as b9,L_ as bA,RT as bB,Q1 as bC,J1 as bD,pt as bE,nT as bF,IT as bG,ot as bH,Ud as bI,$d as bJ,v_ as bK,Bd as bL,P_ as bM,sT as bN,aT as bO,cT as bP,sy as bQ,gh as bR,UT as bS,lP as bT,kT as ba,vT as bb,bT as bc,yT as bd,wT as be,NT as bf,gT as bg,Dk as bh,Fi as bi,tC as bj,oe as bk,Be as bl,st as bm,mT as bn,Ee as bo,Ys as bp,xc as bq,js as br,BT as bs,OT as bt,VT as bu,MT as bv,fa as bw,Ko as bx,Vh as by,iT as bz,ei as c,ga as d,xn as e,Nn as f,Z as g,Se as h,j as i,ye as j,p as k,o0 as l,xt as m,eg as n,HT as o,Zy as p,Uy as q,uh as r,eT as s,Vg as t,gi as u,w0 as v,B as w,dh as x,ch as y,fT as z};

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.