1import{a4 as e,ap as t,J as n,f as i,dJ as s,a7 as o,o as r,B as a,dM as l,at as c,s as h,b9 as u,gi as d,cS as f,gj as m,cy as g,bA as p,r as w,c as b,g as _,w as y,j as v,i as k,z as C,t as x,C as A}from"./DSVLAynu.js";/* empty css */function T(e,t){for(var n=0;n<t.length;n++){const i=t[n];if("string"!=typeof i&&!Array.isArray(i))for(const t in i)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(i,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function E(e){return!!e&&/^\d+\.\d+\.\d+/.test(e)}function P(e){return!!e&&["nightly","alpha","internal","nightly-","staging"].some(t=>e.includes(t))}function S(e){if(P(e))return 3;const{major:t}=function(e){if(!E(e))throw new Error(`Invalid semantic version: ${e||"<blank>"}.`);const[t,n,i]=e.split(".");return{major:Number.parseInt(t,10),minor:Number.parseInt(n,10),patch:Number.parseInt(i,10)}}(e);switch(!0){case t>=44:return 3;case t>=38:return 2;default:return 1}}function R(){const{CKEDITOR_VERSION:e,CKEDITOR:t}=window;return E(n=e)||P(n)?{source:t?"cdn":"npm",version:e}:null;var n}function O(e,t){switch(t||=function(){const e=R();return e?S(e.version):null}()||void 0,t){case 1:case 2:return void 0===e;case 3:return"GPL"===e;default:return!1}}new Array(256).fill("").map((e,t)=>("0"+t.toString(16)).slice(-2));const I=(M="vue",V={version:"7.3.1",frameworkVersion:d},function(e){O(e.config.get("licenseKey"))||e.on("collectUsageData",(e,{setUsageData:t})=>{t(`integration.${M}`,V)})});var M,V;const B="Lock from Vue integration (@ckeditor/ckeditor5-vue)",D=e({name:"CKEditor",__name:"ckeditor",props:c({editor:{},config:{default:()=>({})},tagName:{default:"div"},disabled:{type:Boolean,default:!1},disableTwoWayDataBinding:{type:Boolean,default:!1}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:c(["ready","destroy","blur","focus","input","update:modelValue"],["update:modelValue"]),setup(e,{expose:c,emit:d}){const f=t(e,"modelValue"),m=e,g=d,p=h(),w=h(),b=h();return c({instance:w,lastEditorData:b}),n(f,e=>{w.value&&e!==b.value&&w.value.data.set(e)}),n(()=>m.disabled,e=>{e?w.value.enableReadOnlyMode(B):w.value.disableReadOnlyMode(B)}),function(){const e=window.CKEDITOR_VERSION;if(!e)return console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.');const[t]=e.split(".").map(Number);t>=42||e.startsWith("0.0.0")||console.warn("The <CKEditor> component requires using CKEditor 5 in version 42+ or nightly build.")}(),i(()=>{const e=function(e){return O(e.licenseKey)?e:function(e,t){const n=e.extraPlugins||[];return{...e,extraPlugins:[...n,...t.filter(e=>!n.includes(e))]}}(e,[I])}(Object.assign({},m.config));f.value&&(e.initialData=f.value),m.editor.create(p.value,e).then(t=>{w.value=s(t),function(e){const t=u(t=>{if(m.disableTwoWayDataBinding)return;const n=b.value=e.data.get();g("update:modelValue",n,t,e),g("input",n,t,e)},300,{leading:!0});e.model.document.on("change:data",t),e.editing.view.document.on("focus",t=>{g("focus",t,e)}),e.editing.view.document.on("blur",t=>{g("blur",t,e)})}(t),f.value!==e.initialData&&t.data.set(f.value),m.disabled&&t.enableReadOnlyMode(B),g("ready",t)}).catch(e=>{console.error(e)})}),o(()=>{w.value&&(w.value.destroy(),w.value=void 0),g("destroy")}),(t,n)=>(r(),a(l(e.tagName),{ref_key:"element",ref:p},null,512))}});if(!d.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");var N="object"==typeof global&&global&&global.Object===Object&&global,F="object"==typeof self&&self&&self.Object===Object&&self,L=N||F||Function("return this")(),$=L.Symbol,z=Object.prototype,j=z.hasOwnProperty,H=z.toString,W=$?$.toStringTag:void 0;var U=Object.prototype.toString;var q=$?$.toStringTag:void 0;function K(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?function(e){var t=j.call(e,W),n=e[W];try{e[W]=void 0;var i=!0}catch(o){}var s=H.call(e);return i&&(t?e[W]=n:delete e[W]),s}(e):function(e){return U.call(e)}(e)}function G(e){return null!=e&&"object"==typeof e}function J(e){return"symbol"==typeof e||G(e)&&"[object Symbol]"==K(e)}var Z=Array.isArray,Q=$?$.prototype:void 0,Y=Q?Q.toString:void 0;function X(e){if("string"==typeof e)return e;if(Z(e))return function(e,t){for(var n=-1,i=null==e?0:e.length,s=Array(i);++n<i;)s[n]=t(e[n],n,e);return s}(e,X)+"";if(J(e))return Y?Y.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}var ee=/\s/;var te=/^\s+/;function ne(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&ee.test(e.charAt(t)););return t}(e)+1).replace(te,""):e}function ie(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var se=/^[-+]0x[0-9a-f]+$/i,oe=/^0b[01]+$/i,re=/^0o[0-7]+$/i,ae=parseInt;function le(e){if("number"==typeof e)return e;if(J(e))return NaN;if(ie(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ie(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=ne(e);var n=oe.test(e);return n||re.test(e)?ae(e.slice(2),n?2:8):se.test(e)?NaN:+e}function ce(e){return e}function he(e){if(!ie(e))return!1;var t=K(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var ue,de=L["__core-js_shared__"],fe=(ue=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||""))?"Symbol(sr
1c)_1."+ue:"";var me=Function.prototype.toString;function ge(e){if(null!=e){try{return me.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var pe=/^\[object .+?Constructor\]$/,we=Function.prototype,be=Object.prototype,_e=we.toString,ye=be.hasOwnProperty,ve=RegExp("^"+_e.call(ye).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ke(e){return!(!ie(e)||(t=e,fe&&fe in t))&&(he(e)?ve:pe).test(ge(e));var t}function Ce(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(n)?n:void 0}var xe=Ce(L,"WeakMap"),Ae=Object.create,Te=function(){function e(){}return function(t){if(!ie(t))return{};if(Ae)return Ae(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Ee(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}var Pe=Date.now;var Se,Re,Oe,Ie=function(){try{var e=Ce(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Me=Ie?function(e,t){return Ie(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:ce,Ve=(Se=Me,Re=0,Oe=0,function(){var e=Pe(),t=16-(e-Oe);if(Oe=e,t>0){if(++Re>=800)return arguments[0]}else Re=0;return Se.apply(void 0,arguments)});var Be=/^(?:0|[1-9]\d*)$/;function De(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Be.test(e))&&e>-1&&e%1==0&&e<t}function Ne(e,t,n){"__proto__"==t&&Ie?Ie(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Fe(e,t){return e===t||e!=e&&t!=t}var Le=Object.prototype.hasOwnProperty;function $e(e,t,n){var i=e[t];Le.call(e,t)&&Fe(i,n)&&(void 0!==n||t in e)||Ne(e,t,n)}function ze(e,t,n,i){var s=!n;n||(n={});for(var o=-1,r=t.length;++o<r;){var a=t[o],l=void 0;void 0===l&&(l=e[a]),s?Ne(n,a,l):$e(n,a,l)}return n}var je=Math.max;function He(e,t){return Ve(function(e,t,n){return t=je(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,o=je(i.length-t,0),r=Array(o);++s<o;)r[s]=i[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=i[s];return a[t]=n(r),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,ce),e+"")}function We(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ue(e){return null!=e&&We(e.length)&&!he(e)}function qe(e){return He(function(t,n){var i=-1,s=n.length,o=s>1?n[s-1]:void 0,r=s>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(s--,o):void 0,r&&function(e,t,n){if(!ie(n))return!1;var i=typeof t;return!!("number"==i?Ue(n)&&De(t,n.length):"string"==i&&t in n)&&Fe(n[t],e)}(n[0],n[1],r)&&(o=s<3?void 0:o,s=1),t=Object(t);++i<s;){var a=n[i];a&&e(t,a,i,o)}return t})}var Ke=Object.prototype;function Ge(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ke)}function Je(e){return G(e)&&"[object Arguments]"==K(e)}var Ze=Object.prototype,Qe=Ze.hasOwnProperty,Ye=Ze.propertyIsEnumerable,Xe=Je(function(){return arguments}())?Je:function(e){return G(e)&&Qe.call(e,"callee")&&!Ye.call(e,"callee")};var et="object"==typeof exports&&exports&&!exports.nodeType&&exports,tt=et&&"object"==typeof module&&module&&!module.nodeType&&module,nt=tt&&tt.exports===et?L.Buffer:void 0,it=(nt?nt.isBuffer:void 0)||function(){return!1},st={};function ot(e){return function(t){return e(t)}}st["[object Float32Array]"]=st["[object Float64Array]"]=st["[object Int8Array]"]=st["[object Int16Array]"]=st["[object Int32Array]"]=st["[object Uint8Array]"]=st["[object Uint8ClampedArray]"]=st["[object Uint16Array]"]=st["[object Uint32Array]"]=!0,st["[object Arguments]"]=st["[object Array]"]=st["[object ArrayBuffer]"]=st["[object Boolean]"]=st["[object DataView]"]=st["[object Date]"]=st["[object Error]"]=st["[object Function]"]=st["[object Map]"]=st["[object Number]"]=st["[object Object]"]=st["[object RegExp]"]=st["[object Set]"]=st["[object String]"]=st["[object WeakMap]"]=!1;var rt="object"==typeof exports&&exports&&!exports.nodeType&&exports,at=rt&&"object"==typeof module&&module&&!module.nodeType&&module,lt=at&&at.exports===rt&&N.process,ct=function(){try{var e=at&&at.require&&at.require("util").t
1ypes;return e||lt&<.binding&<.binding("util")}catch(t){}}(),ht=ct&&ct.isTypedArray,ut=ht?ot(ht):function(e){return G(e)&&We(e.length)&&!!st[K(e)]},dt=Object.prototype.hasOwnProperty;function ft(e,t){var n=Z(e),i=!n&&Xe(e),s=!n&&!i&&it(e),o=!n&&!i&&!s&&ut(e),r=n||i||s||o,a=r?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],l=a.length;for(var c in e)!t&&!dt.call(e,c)||r&&("length"==c||s&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||De(c,l))||a.push(c);return a}function mt(e,t){return function(n){return e(t(n))}}var gt=mt(Object.keys,Object),pt=Object.prototype.hasOwnProperty;function wt(e){return Ue(e)?ft(e):function(e){if(!Ge(e))return gt(e);var t=[];for(var n in Object(e))pt.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var bt=Object.prototype.hasOwnProperty;function _t(e){if(!ie(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Ge(e),n=[];for(var i in e)("constructor"!=i||!t&&bt.call(e,i))&&n.push(i);return n}function yt(e){return Ue(e)?ft(e,!0):_t(e)}var vt=qe(function(e,t){ze(t,yt(t),e)}),kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/;function xt(e,t){if(Z(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!J(e))||(Ct.test(e)||!kt.test(e)||null!=t&&e in Object(t))}var At=Ce(Object,"create");var Tt=Object.prototype.hasOwnProperty;var Et=Object.prototype.hasOwnProperty;function Pt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function St(e,t){for(var n=e.length;n--;)if(Fe(e[n][0],t))return n;return-1}Pt.prototype.clear=function(){this.__data__=At?At(null):{},this.size=0},Pt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pt.prototype.get=function(e){var t=this.__data__;if(At){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Tt.call(t,e)?t[e]:void 0},Pt.prototype.has=function(e){var t=this.__data__;return At?void 0!==t[e]:Et.call(t,e)},Pt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=At&&void 0===t?"__lodash_hash_undefined__":t,this};var Rt=Array.prototype.splice;function Ot(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(e){var t=this.__data__,n=St(t,e);return!(n<0)&&(n==t.length-1?t.pop():Rt.call(t,n,1),--this.size,!0)},Ot.prototype.get=function(e){var t=this.__data__,n=St(t,e);return n<0?void 0:t[n][1]},Ot.prototype.has=function(e){return St(this.__data__,e)>-1},Ot.prototype.set=function(e,t){var n=this.__data__,i=St(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var It=Ce(L,"Map");function Mt(e,t){var n,i,s=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function Vt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Vt.prototype.clear=function(){this.size=0,this.__data__={hash:new Pt,map:new(It||Ot),string:new Pt}},Vt.prototype.delete=function(e){var t=Mt(this,e).delete(e);return this.size-=t?1:0,t},Vt.prototype.get=function(e){return Mt(this,e).get(e)},Vt.prototype.has=function(e){return Mt(this,e).has(e)},Vt.prototype.set=function(e,t){var n=Mt(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Bt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,s=t?t.apply(this,i):i[0],o=n.cache;if(o.has(s))return o.get(s);var r=e.apply(this,i);return n.cache=o.set(s,r)||o,r};return n.cache=new(Bt.Cache||Vt),n}Bt.Cache=Vt;var Dt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nt=/\\(\\)?/g,Ft=function(e){var t=Bt(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Dt,function(e,n,i,s){t.push(i?s.replace(Nt,"$1"):n||e)}),t});function Lt(e){return null==e?"":X(e)}function $t(e,t){return Z(e)?e:xt(e,t)?[e]:Ft(Lt(e))}function zt(e){if("string"==typeof e||J(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function jt(e,t){for(var n=0,i=(t=$t(t,e)).length;null!=e&&n<i;)e=e[zt(t[n++])];return n&&n==i?e:void 0}function Ht(e,t,n){var i=null==e?void 0:jt(e,t);return void 0===i?n:i}function Wt(e,t){for(var n=-1,i=t.length,s=e.length;++n<i;)e[s+n]=t[n];return e}var Ut=mt(Object.getPrototypeOf,Object),qt=Function.prototype,Kt=Object.prototype,Gt=qt.toString,Jt=Kt.hasOwnProperty,Zt=Gt.call(Object);function Qt(e){if(!G(e)||"[object Object]"!=K(e))return!1;var t=Ut(e);if(null===t)return!0;var n=Jt.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Gt.call(n)==Zt}function Yt(e,t,n){var i=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(n=n>s?s:n)<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(s);++i<s;)o[i]=e[i+t];return o}var Xt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function en(e){return Xt.test(e)}var tn="\\ud800-\\udfff",nn="["+tn+"]",sn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",on="\\ud83c[\\udffb-\\udfff]",rn="[^"+tn+"]",an="(?:\\ud83c[\\udde6-\\uddff]){2}",ln="[\\ud800-\\udbff][\\udc00-\\udfff]",cn="(?:"+sn+"|"+on+")"+"?",hn="[\\ufe0e\\ufe0f]?",un=hn+cn+("(?:\\u200d(?:"+[rn,an,ln].join("|")+")"+hn+cn+")*"),dn="(?:"+[rn+sn+"?",sn,an,ln,nn].join("|")+")",fn=RegExp(on+"(?="+on+")|"+dn+un,"g");function mn(e){return en(e)?function(e){return e.match(fn)||[]}(e):function(e){return e.split("")}(e)}var gn,pn=(gn="toUpperCase",function(e){var t,n,i,s,o=en(e=Lt(e))?mn(e):void 0,r=o?o[0]:e.charAt(0),a=o?(t=o,n=1,s=t.length,i=void 0===i?s:i,!n&&i>=s?t:Yt(t,n,i)).join(""):e.slice(1);return r[gn]()+a});function wn(e){var t=this.__data__=new Ot(e);this.size=t.size}wn.prototype.clear=function(){this.__data__=new Ot,this.size=0},wn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},wn.prototype.get=function(e){return this.__data__.get(e)},wn.prototype.has=function(e){return this.__data__.has(e)},wn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ot){var i=n.__data__;if(!It||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vt(i)}return n.set(e,t),this.size=n.size,this};var bn="object"==typeof exports&&exports&&!exports.nodeType&&exports,_n=bn&&"object"==typeof module&&module&&!module.nodeType&&module,yn=_n&&_n.exports===bn?L.Buffer:void 0,vn=yn?yn.allocUnsafe:void 0;function kn(e,t){if(t)return e.slice();var n=e.length,i=vn?vn(n):new e.constructor(n);return e.copy(i),i}function Cn(){return[]}var xn=Object.prototype.propertyIsEnumerable,An=Object.getOwnPropertySymbols,Tn=An?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,s=0,o=[];++n<i;){var r=e[n];t(r,n,e)&&(o[s++]=r)}return o}(An(e),function(t){return xn.call(e,t)}))}:Cn;var En=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Wt(t,Tn(e)),e=Ut(e);return t}:Cn;function Pn(e,t,n){var i=t(e);return Z(e)?i:Wt(i,n(e))}function Sn(e){return Pn(e,wt,Tn)}function Rn(e){return Pn(e,yt,En)}var On=Ce(L,"DataView"),In=Ce(L,"Promise"),Mn=Ce(L,"Set"),Vn="[object Map]",Bn="[object Promise]",Dn="[object Set]",Nn="[object WeakMap]",Fn="[object DataView]",Ln=ge(On),$n=ge(It),zn=ge(In),jn=ge(Mn),Hn=ge(xe),Wn=K;(On&&Wn(new On(new ArrayBuffer(1)))!=Fn||It&&Wn(new It)!=Vn||In&&Wn(In.resolve())!=Bn||Mn&&Wn(new Mn)!=Dn||xe&&Wn(new xe)!=Nn)&&(Wn=function(e){var t=K(e),n="[object Object]"==t?e.constructor:void 0,i=n?ge(n):"";if(i)switch(i){case Ln:return Fn;case $n:return Vn;case zn:return Bn;case jn:return Dn;case Hn:return Nn}return t});var Un=Object.prototype.hasOwnProperty;var qn=L.Uint8Array;function Kn(e){var t=new e.constructor(e.byteLength);return new qn(t).set(new qn(e)),t}var Gn=/\w*$/;
1var Jn=$?$.prototype:void 0,Zn=Jn?Jn.valueOf:void 0;function Qn(e,t){var n=t?Kn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Yn(e,t,n){var i,s,o,r=e.constructor;switch(t){case"[object ArrayBuffer]":return Kn(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return function(e,t){var n=t?Kn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Qn(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return(o=new(s=e).constructor(s.source,Gn.exec(s))).lastIndex=s.lastIndex,o;case"[object Symbol]":return i=e,Zn?Object(Zn.call(i)):{}}}function Xn(e){return"function"!=typeof e.constructor||Ge(e)?{}:Te(Ut(e))}var ei=ct&&ct.isMap,ti=ei?ot(ei):function(e){return G(e)&&"[object Map]"==Wn(e)};var ni=ct&&ct.isSet,ii=ni?ot(ni):function(e){return G(e)&&"[object Set]"==Wn(e)},si="[object Arguments]",oi="[object Function]",ri="[object Object]",ai={};function li(e,t,n,i,s,o){var r,a=1&t,l=2&t,c=4&t;if(n&&(r=s?n(e,i,s,o):n(e)),void 0!==r)return r;if(!ie(e))return e;var h=Z(e);if(h){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Un.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!a)return Ee(e,r)}else{var u=Wn(e),d=u==oi||"[object GeneratorFunction]"==u;if(it(e))return kn(e,a);if(u==ri||u==si||d&&!s){if(r=l||d?{}:Xn(e),!a)return l?function(e,t){return ze(e,En(e),t)}(e,function(e,t){return e&&ze(t,yt(t),e)}(r,e)):function(e,t){return ze(e,Tn(e),t)}(e,function(e,t){return e&&ze(t,wt(t),e)}(r,e))}else{if(!ai[u])return s?e:{};r=Yn(e,u,a)}}o||(o=new wn);var f=o.get(e);if(f)return f;o.set(e,r),ii(e)?e.forEach(function(i){r.add(li(i,t,n,i,e,o))}):ti(e)&&e.forEach(function(i,s){r.set(s,li(i,t,n,s,e,o))});var m=h?void 0:(c?l?Rn:Sn:l?yt:wt)(e);return function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););}(m||e,function(i,s){m&&(i=e[s=i]),$e(r,s,li(i,t,n,s,e,o))}),r}ai[si]=ai["[object Array]"]=ai["[object ArrayBuffer]"]=ai["[object DataView]"]=ai["[object Boolean]"]=ai["[object Date]"]=ai["[object Float32Array]"]=ai["[object Float64Array]"]=ai["[object Int8Array]"]=ai["[object Int16Array]"]=ai["[object Int32Array]"]=ai["[object Map]"]=ai["[object Number]"]=ai[ri]=ai["[object RegExp]"]=ai["[object Set]"]=ai["[object String]"]=ai["[object Symbol]"]=ai["[object Uint8Array]"]=ai["[object Uint8ClampedArray]"]=ai["[object Uint16Array]"]=ai["[object Uint32Array]"]=!0,ai["[object Error]"]=ai[oi]=ai["[object WeakMap]"]=!1;function ci(e){return li(e,4)}function hi(e){return li(e,5)}function ui(e,t){return li(e,5,t="function"==typeof t?t:void 0)}function di(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Vt;++t<n;)this.add(e[t])}function fi(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}di.prototype.add=di.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},di.prototype.has=function(e){return this.__data__.has(e)};function mi(e,t,n,i,s,o){var r=1&n,a=e.length,l=t.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(e),h=o.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,f=2&n?new di:void 0;for(o.set(e,t),o.set(t,e);++u<a;){var m=e[u],g=t[u];if(i)var p=r?i(g,m,u,t,e,o):i(m,g,u,e,t,o);if(void 0!==p){if(p)continue;d=!1;break}if(f){if(!fi(t,function(e,t){if(r=t,!f.has(r)&&(m===e||s(m,e,n,i,o)))return f.push(t);var r})){d=!1;break}}else if(m!==g&&!s(m,g,n,i,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function gi(e){var t=-1,n=Array(e.size);return e.forEach(function(e,i){n[++t]=[i,e]}),n}function pi(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var wi=$?$.prototype:void 0,bi=wi?wi.valueOf:void 0;var _i=Object.prototype.hasOwnProperty;var yi="[object Arguments]",vi="[object Array]",ki="[object Object]",Ci=Object.prototype.hasOwnProperty;function xi(e,t,n,i,s,o){var r=Z(e),a=Z(t),l=r?vi:Wn(e),c=a?vi:Wn(t),h=(l=l==yi?ki:l)==ki,u=(c=c==yi?ki:c)==ki,d=l==c;if(d&&it(e)){if(!it(t))return!1;r=!0,h=!1}if(d&&!h)return o||(o=new wn),r||ut(e)?mi(e,t,n,i,s,o):function(e,t,n,i,s,o,r){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new qn(e),new qn(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Fe(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=gi;case"[object Set]":var l=1&i;if(a||(a=pi),e.size!=t.size&&!l)return!1;var c=r.get(e);if(c)return c==t;i|=2,r.set(e,t);var h=mi(a(e),a(t),i,s,o,r);return r.delete(e),h;case"[object Symbol]":if(bi)return bi.call(e)==bi.call(t)}return!1}(e,t,l,n,i,s,o);if(!(1&n)){var f=h&&Ci.call(e,"__wrapped__"),m=u&&Ci.call(t,"__wrapped__");
1if(f||m){var g=f?e.value():e,p=m?t.value():t;return o||(o=new wn),s(g,p,n,i,o)}}return!!d&&(o||(o=new wn),function(e,t,n,i,s,o){var r=1&n,a=Sn(e),l=a.length;if(l!=Sn(t).length&&!r)return!1;for(var c=l;c--;){var h=a[c];if(!(r?h in t:_i.call(t,h)))return!1}var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var f=!0;o.set(e,t),o.set(t,e);for(var m=r;++c<l;){var g=e[h=a[c]],p=t[h];if(i)var w=r?i(p,g,h,t,e,o):i(g,p,h,e,t,o);if(!(void 0===w?g===p||s(g,p,n,i,o):w)){f=!1;break}m||(m="constructor"==h)}if(f&&!m){var b=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(f=!1)}return o.delete(e),o.delete(t),f}(e,t,n,i,s,o))}function Ai(e,t,n,i,s){return e===t||(null==e||null==t||!G(e)&&!G(t)?e!=e&&t!=t:xi(e,t,n,i,Ai,s))}function Ti(e){return e==e&&!ie(e)}function Ei(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Pi(e){var t=function(e){for(var t=wt(e),n=t.length;n--;){var i=t[n],s=e[i];t[n]=[i,s,Ti(s)]}return t}(e);return 1==t.length&&t[0][2]?Ei(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,i){var s=n.length,o=s;if(null==e)return!o;for(e=Object(e);s--;){var r=n[s];if(r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++s<o;){var a=(r=n[s])[0],l=e[a],c=r[1];if(r[2]){if(void 0===l&&!(a in e))return!1}else if(!Ai(c,l,3,i,new wn))return!1}return!0}(n,0,t)}}function Si(e,t){return null!=e&&t in Object(e)}function Ri(e,t){return null!=e&&function(e,t,n){for(var i=-1,s=(t=$t(t,e)).length,o=!1;++i<s;){var r=zt(t[i]);if(!(o=null!=e&&n(e,r)))break;e=e[r]}return o||++i!=s?o:!!(s=null==e?0:e.length)&&We(s)&&De(r,s)&&(Z(e)||Xe(e))}(e,t,Si)}function Oi(e){return xt(e)?(t=zt(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return jt(t,e)}}(e);var t}function Ii(e){return"function"==typeof e?e:null==e?ce:"object"==typeof e?Z(e)?(t=e[0],n=e[1],xt(t)&&Ti(n)?Ei(zt(t),n):function(e){var i=Ht(e,t);return void 0===i&&i===n?Ri(e,t):Ai(n,i,3)}):Pi(e):Oi(e);var t,n}var Mi=function(e,t,n){for(var i=-1,s=Object(e),o=n(e),r=o.length;r--;){var a=o[++i];if(!1===t(s[a],a,s))break}return e};var Vi=function(){return L.Date.now()},Bi=Math.max,Di=Math.min;function Ni(e,t,n){var i,s,o,r,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=i,o=s;return i=s=void 0,c=t,r=e.apply(o,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=o}function g(){var e=Vi();if(m(e))return p(e);a=setTimeout(g,function(e){var n=t-(e-l);return u?Di(n,o-(e-c)):n}(e))}function p(e){return a=void 0,d&&i?f(e):(i=s=void 0,r)}function w(){var e=Vi(),n=m(e);if(i=arguments,s=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(g,t),h?f(e):r}(l);if(u)return clearTimeout(a),a=setTimeout(g,t),f(l)}return void 0===a&&(a=setTimeout(g,t)),r}return t=le(t)||0,ie(n)&&(h=!!n.leading,o=(u="maxWait"in n)?Bi(le(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=s=a=void 0},w.flush=function(){return void 0===a?r:p(Vi())},w}function Fi(e,t,n){(void 0!==n&&!Fe(e[t],n)||void 0===n&&!(t in e))&&Ne(e,t,n)}function Li(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function $i(e,t,n,i,s,o,r){var a=Li(e,n),l=Li(t,n),c=r.get(l);if(c)Fi(e,n,c);else{var h,u=o?o(a,l,n+"",e,t,r):void 0,d=void 0===u;if(d){var f=Z(l),m=!f&&it(l),g=!f&&!m&&ut(l);u=l,f||m||g?Z(a)?u=a:G(h=a)&&Ue(h)?u=Ee(a):m?(d=!1,u=kn(l,!0)):g?(d=!1,u=Qn(l,!0)):u=[]:Qt(l)||Xe(l)?(u=a,Xe(a)?u=function(e){return ze(e,yt(e))}(a):ie(a)&&!he(a)||(u=Xn(l))):d=!1}d&&(r.set(l,u),s(u,l,i,o,r),r.delete(l)),Fi(e,n,u)}}function zi(e,t,n,i,s){e!==t&&Mi(t,function(o,r){if(s||(s=new wn),ie(o))$i(e,t,r,n,zi,i,s);else{var a=i?i(Li(e,r),o,r+"",e,t,s):void 0;void 0===a&&(a=o),Fi(e,r,a)}},yt)}function ji(e){return"string"==typeof e||!Z(e)&&G(e)&&"[object String]"==K(e)}function Hi(e){return G(e)&&1===e.nodeType&&!Qt(e)}function Wi(e,t){return Ai(e,t)}function Ui(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?Ai(e,t,void 0,n):!!i}function qi(e,t){var n={};return t=Ii(t),function(e,t){e&&Mi(e,t,wt)}(e,function(e,i,s){Ne(n,i,t(e,i,s))}),n}var Ki=qe(function(e,t,n){zi(e,t,n)});function Gi(e,t){return null==(e=function(e,t){return t.length<2?e:jt(e,Yt(t,0,-1))}(e,t=$t(t,e)))||delete e[zt((n=t,i=null==n?0:n.length,i?n[i-1]:void 0))];var n,i}
1function Ji(e,t,n){return null==e?e:function(e,t,n){if(!ie(e))return e;for(var i=-1,s=(t=$t(t,e)).length,o=s-1,r=e;null!=r&&++i<s;){var a=zt(t[i]),l=n;if("__proto__"===a||"constructor"===a||"prototype"===a)return e;if(i!=o){var c=r[a];void 0===(l=void 0)&&(l=ie(c)?c:De(t[i+1])?[]:{})}$e(r,a,l),r=r[a]}return e}(e,t,n)}function Zi(e,t,n){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return ie(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),Ni(e,t,{leading:i,maxWait:t,trailing:s})}let Qi;try{Qi={window:window,document:document}}catch(bC){Qi={window:{},document:{}}}var Yi=Qi;function Xi(){try{return navigator.userAgent.toLowerCase()}catch(bC){return""}}const es=Xi(),ts={isMac:ns(es),isGecko:is(es),isSafari:ss(es),isiOS:os(es),isAndroid:rs(es),isBlink:as(es),get isMediaForcedColors(){return!!Yi.window.matchMedia&&Yi.window.matchMedia("(forced-colors: active)").matches},features:{isRegExpUnicodePropertySupported:ls()}};function ns(e){return e.indexOf("macintosh")>-1}function is(e){return!!e.match(/gecko\/\d+/)}function ss(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}function os(e){return!!e.match(/iphone|ipad/i)||ns(e)&&navigator.maxTouchPoints>0}function rs(e){return e.indexOf("android")>-1}function as(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function ls(){let e=!1;try{e=0==="Ä".search(new RegExp("[\\p{L}]","u"))}catch(t){}return e}function cs(e,t,n,i){n=n||function(e,t){return e===t};const s=Array.isArray(e)?e:Array.prototype.slice.call(e),o=Array.isArray(t)?t:Array.prototype.slice.call(t),r=function(e,t,n){const i=hs(e,t,n);if(-1===i)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=us(e,i),o=us(t,i),r=hs(s,o,n),a=e.length-r,l=t.length-r;return{firstIndex:i,lastIndexOld:a,lastIndexNew:l}}(s,o,n),a=i?function(e,t){const{firstIndex:n,lastIndexOld:i,lastIndexNew:s}=e;if(-1===n)return Array(t).fill("equal");let o=[];n>0&&(o=o.concat(Array(n).fill("equal")));s-n>0&&(o=o.concat(Array(s-n).fill("insert")));i-n>0&&(o=o.concat(Array(i-n).fill("delete")));s<t&&(o=o.concat(Array(t-s).fill("equal")));return o}(r,o.length):function(e,t){const n=[],{firstIndex:i,lastIndexOld:s,lastIndexNew:o}=t;o-i>0&&n.push({index:i,type:"insert",values:e.slice(i,o)});s-i>0&&n.push({index:i+(o-i),type:"delete",howMany:s-i});return n}(o,r);return a}function hs(e,t,n){for(let i=0;i<Math.max(e.length,t.length);i++)if(void 0===e[i]||void 0===t[i]||!n(e[i],t[i]))return i;return-1}function us(e,t){return e.slice(t).reverse()}function ds(e,t,n){n=n||function(e,t){return e===t};const i=e.length,s=t.length;if(i>200||s>200||i+s>300)return ds.fastDiff(e,t,n,!0);let o,r;if(s<i){const n=e;e=t,t=n,o="delete",r="insert"}else o="insert",r="delete";const a=e.length,l=t.length,c=l-a,h={},u={};function d(i){const s=(void 0!==u[i-1]?u[i-1]:-1)+1,c=void 0!==u[i+1]?u[i+1]:-1,d=s>c?-1:1;h[i+d]&&(h[i]=h[i+d].slice(0)),h[i]||(h[i]=[]),h[i].push(s>c?o:r);let f=Math.max(s,c),m=f-i;for(;m<a&&f<l&&n(e[m],t[f]);)m++,f++,h[i].push("equal");return f}let f,m=0;do{for(f=-m;f<c;f++)u[f]=d(f);for(f=c+m;f>c;f--)u[f]=d(f);u[c]=d(c),m++}while(u[c]!==l);return h[c].slice(1)}ds.fastDiff=cs;class fs{source;name;path;stop;off;return;constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=function e(){e.called=!0},this.off=function e(){e.called=!0}}}const ms=new Array(256).fill("").map((e,t)=>("0"+t.toString(16)).slice(-2));function gs(){const[e,t,n,i]=crypto.getRandomValues(new Uint32Array(4));return"e"+ms[255&e]+ms[e>>8&255]+ms[e>>16&255]+ms[e>>24&255]+ms[255&t]+ms[t>>8&255]+ms[t>>16&255]+ms[t>>24&255]+ms[255&n]+ms[n>>8&255]+ms[n>>16&255]+ms[n>>24&255]+ms[255&i]+ms[i>>8&255]+ms[i>>16&255]+ms[i>>24&255]}const ps={get(e="normal"){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function ws(e,t){const n=ps.get(t.priority);for(let i=0;i<e.length;i++)if(ps.get(e[i].priority)<n)return void e.splice(i,0,t);e.push(t)}class bs extends Error{context;data;constructor(e,t,n){super(function(e,t){const n=new WeakSet,i=(e,t)=>{if("object"==typeof t&&null!==t){if(n.has(t))return`[object ${t.constructor.name}]`;n.add(t)}return t},s=t?` ${JSON.stringify(t,i)}`:"",o=ys(e);return e+s+o}(e,n)),this.name="CKEditorError",this.context=t,this.data=n}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const n=new bs(e.message,t);throw n.stack=e.stack,n}}function _s(e,t){console.warn(...function(e,t){const n=ys(e);return t?[e,t,n]:[e,n]}(e,t))}function ys(e){return`\nRead more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-${e}`}const vs=new Date(2024,10,6);if(globalThis.CKEDITOR_VERSION)throw new bs("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION="43.3.1";
1const ks=Symbol("listeningTo"),Cs=Symbol("emitterId"),xs=Symbol("delegations"),As=Ts(Object);function Ts(e){if(!e)return As;return class extends e{on(e,t,n){this.listenTo(this,e,t,n)}once(e,t,n){let i=!1;this.listenTo(this,e,(e,...n)=>{i||(i=!0,e.off(),t.call(this,e,...n))},n)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,n,i={}){let s,o;this[ks]||(this[ks]={});const r=this[ks];Ps(e)||Es(e);const a=Ps(e);(s=r[a])||(s=r[a]={emitter:e,callbacks:{}}),(o=s.callbacks[t])||(o=s.callbacks[t]=[]),o.push(n),function(e,t,n,i,s){t._addEventListener?t._addEventListener(n,i,s):e._addEventListener.call(t,n,i,s)}(this,e,t,n,i)}stopListening(e,t,n){const i=this[ks];let s=e&&Ps(e);const o=i&&s?i[s]:void 0,r=o&&t?o.callbacks[t]:void 0;if(!(!i||e&&!o||t&&!r))if(n){Vs(this,e,t,n);-1!==r.indexOf(n)&&(1===r.length?delete o.callbacks[t]:Vs(this,e,t,n))}else if(r){for(;n=r.pop();)Vs(this,e,t,n);delete o.callbacks[t]}else if(o){for(t in o.callbacks)this.stopListening(e,t);delete i[s]}else{for(s in i)this.stopListening(i[s].emitter);delete this[ks]}}fire(e,...t){try{const n=e instanceof fs?e:new fs(this,e),i=n.name;let s=Is(this,i);if(n.path.push(this),s){const e=[n,...t];s=Array.from(s);for(let t=0;t<s.length&&(s[t].callback.apply(this,e),n.off.called&&(delete n.off.called,this._removeEventListener(i,s[t].callback)),!n.stop.called);t++);}const o=this[xs];if(o){const e=o.get(i),s=o.get("*");e&&Ms(e,n,t),s&&Ms(s,n,t)}return n.return}catch(n){bs.rethrowUnexpectedError(n,this)}}delegate(...e){return{to:(t,n)=>{this[xs]||(this[xs]=new Map),e.forEach(e=>{const i=this[xs].get(e);i?i.set(t,n):this[xs].set(e,new Map([[t,n]]))})}}}stopDelegating(e,t){if(this[xs])if(e)if(t){const n=this[xs].get(e);n&&n.delete(t)}else this[xs].delete(e);else this[xs].clear()}_addEventListener(e,t,n){!function(e,t){const n=Ss(e);if(n[t])return;let i=t,s=null;const o=[];for(;""!==i&&!n[i];)n[i]=Rs(),o.push(n[i]),s&&n[i].childEvents.push(s),s=i,i=i.substr(0,i.lastIndexOf(":"));if(""!==i){for(const e of o)e.callbacks=n[i].callbacks.slice();n[i].childEvents.push(s)}}(this,e);const i=Os(this,e),s={callback:t,priority:ps.get(n.priority)};for(const o of i)ws(o,s)}_removeEventListener(e,t){const n=Os(this,e);for(const i of n)for(let e=0;e<i.length;e++)i[e].callback==t&&(i.splice(e,1),e--)}}}function Es(e,t){e[Cs]||(e[Cs]=t||gs())}function Ps(e){return e[Cs]}function Ss(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function Rs(){return{callbacks:[],childEvents:[]}}function Os(e,t){const n=Ss(e)[t];if(!n)return[];let i=[n.callbacks];for(let s=0;s<n.childEvents.length;s++){const t=Os(e,n.childEvents[s]);i=i.concat(t)}return i}function Is(e,t){let n;return e._events&&(n=e._events[t])&&n.callbacks.length?n.callbacks:t.indexOf(":")>-1?Is(e,t.substr(0,t.lastIndexOf(":"))):null}function Ms(e,t,n){for(let[i,s]of e){s?"function"==typeof s&&(s=s(t.name)):s=t.name;const e=new fs(t.source,s);e.path=[...t.path],i.fire(e,...n)}}function Vs(e,t,n,i){t._removeEventListener?t._removeEventListener(n,i):e._removeEventListener.call(t,n,i)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(e=>{Ts[e]=As.prototype[e]});const Bs=Symbol("observableProperties"),Ds=Symbol("boundObservables"),Ns=Symbol("boundProperties"),Fs=Symbol("decoratedMethods"),Ls=Symbol("decoratedOriginal"),$s=zs(Ts());function zs(e){if(!e)return $s;return class extends e{set(e,t){if(ie(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);js(this);const n=this[Bs];if(e in this&&!n.has(e))throw new bs("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>n.get(e),set(t){const i=n.get(e);let s=this.fire(`set:${e}`,e,t,i);void 0===s&&(s=t),i===s&&n.has(e)||(n.set(e,s),this.fire(`change:${e}`,e,s,i))}}),this[e]=t}bind(...e){if(!e.length||!Us(e))throw new bs("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new bs("observable-bind-duplicate-properties",this);js(this);const t=this[Ns];e.forEach(e=>{if(t.has(e))throw new bs("observable-bind-rebind",this)});const n=new Map;
1return e.forEach(e=>{const i={property:e,to:[]};t.set(e,i),n.set(e,i)}),{to:Hs,toMany:Ws,_observable:this,_bindProperties:e,_to:[],_bindings:n}}unbind(...e){if(!this[Bs])return;const t=this[Ns],n=this[Ds];if(e.length){if(!Us(e))throw new bs("observable-unbind-wrong-properties",this);e.forEach(e=>{const i=t.get(e);i&&(i.to.forEach(([e,t])=>{const s=n.get(e),o=s[t];o.delete(i),o.size||delete s[t],Object.keys(s).length||(n.delete(e),this.stopListening(e,"change"))}),t.delete(e))})}else n.forEach((e,t)=>{this.stopListening(t,"change")}),n.clear(),t.clear()}decorate(e){js(this);const t=this[e];if(!t)throw new bs("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(e,n)=>{e.return=t.apply(this,n)}),this[e]=function(...t){return this.fire(e,t)},this[e][Ls]=t,this[Fs]||(this[Fs]=[]),this[Fs].push(e)}stopListening(e,t,n){if(!e&&this[Fs]){for(const e of this[Fs])this[e]=this[e][Ls];delete this[Fs]}super.stopListening(e,t,n)}[Bs];[Fs];[Ns];[Ds]}}function js(e){e[Bs]||(Object.defineProperty(e,Bs,{value:new Map}),Object.defineProperty(e,Ds,{value:new Map}),Object.defineProperty(e,Ns,{value:new Map}))}function Hs(...e){const t=function(...e){if(!e.length)throw new bs("observable-bind-to-parse-error",null);const t={to:[]};let n;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)n.properties.push(e);else{if("object"!=typeof e)throw new bs("observable-bind-to-parse-error",null);n={observable:e,properties:[]},t.to.push(n)}}),t}(...e),n=Array.from(this._bindings.keys()),i=n.length;if(!t.callback&&t.to.length>1)throw new bs("observable-bind-to-no-callback",this);if(i>1&&t.callback)throw new bs("observable-bind-to-extra-callback",this);var s;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==i)throw new bs("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(n[0]).callback=t.callback),s=this._observable,this._to.forEach(e=>{const t=s[Ds];let n;t.get(e.observable)||s.listenTo(e.observable,"change",(i,o)=>{n=t.get(e.observable)[o],n&&n.forEach(e=>{qs(s,e.property)})})}),function(e){let t;
1e._bindings.forEach((n,i)=>{e._to.forEach(s=>{t=s.properties[n.callback?0:e._bindProperties.indexOf(i)],n.to.push([s.observable,t]),function(e,t,n,i){const s=e[Ds],o=s.get(n),r=o||{};r[i]||(r[i]=new Set);r[i].add(t),o||s.set(n,r)}(e._observable,n,s.observable,t)})})}(this),this._bindProperties.forEach(e=>{qs(this._observable,e)})}function Ws(e,t,n){if(this._bindings.size>1)throw new bs("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const n=e.map(e=>[e,t]);return Array.prototype.concat.apply([],n)}(e,t),n)}function Us(e){return e.every(e=>"string"==typeof e)}function qs(e,t){const n=e[Ns].get(t);let i;n.callback?i=n.callback.apply(e,n.to.map(e=>e[0][e[1]])):(i=n.to[0],i=i[0][i[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=i:e.set(t,i)}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(e=>{zs[e]=$s.prototype[e]});class Ks{_replacedElements;constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach(({element:e,newElement:t})=>{e.style.display="",t&&t.remove()}),this._replacedElements=[]}}function Gs(e){let t=0;for(const n of e)t++;return t}function Js(e,t){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)if(e[i]!=t[i])return i;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}function Zs(e){return!(!e||!e[Symbol.iterator])}function Qs(e,t,n={},i=[]){const s=n&&n.xmlns,o=s?e.createElementNS(s,t):e.createElement(t);for(const r in n)o.setAttribute(r,n[r]);!ji(i)&&Zs(i)||(i=[i]);for(let r of i)ji(r)&&(r=e.createTextNode(r)),o.appendChild(r);return o}class Ys{_config;constructor(e,t){this._config=Object.create(null),t&&this.define(Xs(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,n,i=!1){if(Qt(t))return void this._setObjectToTarget(e,t,i);const s=t.split(".");t=s.pop();for(const o of s)Qt(e[o])||(e[o]=Object.create(null)),e=e[o];if(Qt(n))return Qt(e[t])||(e[t]=Object.create(null)),e=e[t],void this._setObjectToTarget(e,n,i);i&&void 0!==e[t]||(e[t]=n)}_getFromSource(e,t){const n=t.split(".");t=n.pop();for(const i of n){if(!Qt(e[i])){e=null;break}e=e[i]}return e?Xs(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach(i=>{this._setToTarget(e,i,t[i],n)})}}function Xs(e){return ui(e,eo)}function eo(e){return Hi(e)||"function"==typeof e?e:void 0}function to(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}function no(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}const io=so(Ts());function so(e){if(!e)return io;return class extends e{listenTo(e,t,n,i={}){if(to(e)||no(e)){const s={capture:!!i.useCapture,passive:!!i.usePassive},o=this._getProxyEmitter(e,s)||new oo(e,s);this.listenTo(o,t,n,i)}else super.listenTo(e,t,n,i)}stopListening(e,t,n){if(to(e)||no(e)){const i=this._getAllProxyEmitters(e);for(const e of i)this.stopListening(e,t,n)}else super.stopListening(e,t,n)}_getProxyEmitter(e,t){return function(e,t){const n=e[ks];return n&&n[t]?n[t].emitter:null}(this,ro(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(t=>this._getProxyEmitter(e,t)).filter(e=>!!e)}}}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(e=>{so[e]=io.prototype[e]});class oo extends(Ts()){_domNode;_options;constructor(e,t){super(),Es(this,ro(e,t)),this._domNode=e,this._options=t}_domListeners;attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);
1this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()}_addEventListener(e,t,n){this.attach(e),Ts().prototype._addEventListener.call(this,e,t,n)}_removeEventListener(e,t){Ts().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=t=>{this.fire(e,t)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function ro(e,t){let n=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=gs())}(e);for(const i of Object.keys(t).sort())t[i]&&(n+="-"+i);return n}function ao(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function lo(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}function co(e){if(!e.target)return null;const t=e.target.ownerDocument,n=e.clientX,i=e.clientY;let s=null;return t.caretRangeFromPoint&&t.caretRangeFromPoint(n,i)?s=t.caretRangeFromPoint(n,i):e.rangeParent&&(s=t.createRange(),s.setStart(e.rangeParent,e.rangeOffset),s.collapse(!0)),s}function ho(e){return"[object Text]"==Object.prototype.toString.call(e)}function uo(e){return"[object Range]"==Object.prototype.toString.apply(e)}function fo(e){return e&&e.parentNode?e.offsetParent===Yi.document.body?null:e.offsetParent:null}const mo=["top","right","bottom","left","width","height"];class go{top;right;bottom;left;width;height;_source;constructor(e){const t=uo(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),bo(e)||t)if(t){const t=go.getDomRangeRects(e);po(this,go.getBoundingRect(t))}else po(this,e.getBoundingClientRect());else if(no(e)){const{innerWidth:t,innerHeight:n}=e;po(this,{top:0,right:t,bottom:n,left:0,width:t,height:n})}else po(this,e)}clone(){return new go(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const e=new go(t);return e._source=this._source,e}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(wo(e))return t;let n,i=e,s=e.parentNode||e.commonAncestorContainer;for(;s&&!wo(s);){const e="visible"===yo(s);i instanceof HTMLElement&&"absolute"===_o(i)&&(n=i);const o=_o(s);if(e||n&&("relative"===o&&e||"relative"!==o)){i=s,s=s.parentNode;continue}const r=new go(s),a=t.getIntersection(r);if(!a)return null;a.getArea()<t.getArea()&&(t=a),i=s,s=s.parentNode}return t}isEqual(e){for(const t of mo)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=Yi.window,n=this.clone().moveBy(e,t);if(bo(n._source)){const e=fo(n._source);e&&function(e,t){const n=new go(t),i=lo(t);let s=0,o=0;s-=n.left,o-=n.top,s+=t.scrollLeft,o+=t.scrollTop,s-=i.left,o-=i.top,e.moveBy(s,o)}(n,e)}return n}excludeScrollbarsAndBorders(){const e=this._source;let t,n,i;if(no(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHeight-e.document.documentElement.clientHeight,i=e.getComputedStyle(e.document.documentElement).direction;else{const s=lo(e);t=e.offsetWidth-e.clientWidth-s.left-s.right,n=e.offsetHeight-e.clientHeight-s.top-s.bottom,i=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=s.left,this.top+=s.top,this.right-=s.right,this.bottom-=s.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===i?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(e){const t=[],n=Array.from(e.getClientRects());if(n.length)for(const i of n)t.push(new go(i));else{let n=e.startContainer;ho(n)&&(n=n.parentNode);const i=new go(n.getBoundingClientRect());i.right=i.left,i.width=0,t.push(i)}return t}
1static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let n=0;for(const i of e)n++,t.left=Math.min(t.left,i.left),t.top=Math.min(t.top,i.top),t.right=Math.max(t.right,i.right),t.bottom=Math.max(t.bottom,i.bottom);return 0==n?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new go(t))}}function po(e,t){for(const n of mo)e[n]=t[n]}function wo(e){return!!bo(e)&&e===e.ownerDocument.body}function bo(e){return null!==e&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.getBoundingClientRect}function _o(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).position:"static"}function yo(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).overflow:"visible"}class vo{_element;_callback;static _observerInstance=null;static _elementCallbacks=null;constructor(e,t){vo._observerInstance||vo._createObserver(),this._element=e,this._callback=t,vo._addElementCallback(e,t),vo._observerInstance.observe(e)}get element(){return this._element}destroy(){vo._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){vo._elementCallbacks||(vo._elementCallbacks=new Map);let n=vo._elementCallbacks.get(e);n||(n=new Set,vo._elementCallbacks.set(e,n)),n.add(t)}static _deleteElementCallback(e,t){const n=vo._getElementCallbacks(e);n&&(n.delete(t),n.size||(vo._elementCallbacks.delete(e),vo._observerInstance.unobserve(e))),vo._elementCallbacks&&!vo._elementCallbacks.size&&(vo._observerInstance=null,vo._elementCallbacks=null)}static _getElementCallbacks(e){return vo._elementCallbacks?vo._elementCallbacks.get(e):null}static _createObserver(){vo._observerInstance=new Yi.window.ResizeObserver(e=>{for(const t of e){const e=vo._getElementCallbacks(t.target);if(e)for(const n of e)n(t)}})}}function ko(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function Co(e){return t=>t+e}function xo(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Ao(e,t,n){e.insertBefore(n,e.childNodes[t]||null)}function To(e){return e&&e.nodeType===Node.COMMENT_NODE}function Eo(e){return!!e&&(ho(e)?Eo(e.parentElement):!!e.getClientRects&&!!e.getClientRects().length)}function Po({element:e,target:t,positions:n,limiter:i,fitInViewport:s,viewportOffsetConfig:o}){he(t)&&(t=t()),he(i)&&(i=i());const r=fo(e),a=function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new go(Yi.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t}(o),l=new go(e),c=So(t,a);let h;if(!c||!a.getIntersection(c))return null;const u={targetRect:c,elementRect:l,positionedElementAncestor:r,viewportRect:a};if(i||s){if(i){const e=So(i,a);e&&(u.limiterRect=e)}h=function(e,t){const{elementRect:n}=t,i=n.getArea(),s=e.map(e=>new Ro(e,t)).filter(e=>!!e.name);let o=0,r=null;for(const a of s){const{limiterIntersectionArea:e,viewportIntersectionArea:t}=a;if(e===i)return a;const n=t**2+e**2;n>o&&(o=n,r=a)}return r}(n,u)}else h=new Ro(n[0],u);return h}function So(e,t){const n=new go(e).getVisible();return n?n.getIntersection(t):null}class Ro{name;config;_positioningFunctionCoordinates;_options;_cachedRect;_cachedAbsoluteRect;constructor(e,t){const n=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!n)return;const{left:i,top:s,name:o,config:r}=n;this.name=o,this.config=r,this._positioningFunctionCoordinates={left:i,top:s},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=this._rect.toAbsoluteRect()),this._cachedAbsoluteRect}}function Oo(e){const t=e.parentNode;t&&t.removeChild(e)}
1function Io({window:e,rect:t,alignToTop:n,forceScroll:i,viewportOffset:s}){const o=t.clone().moveBy(0,s.bottom),r=t.clone().moveBy(0,-s.top),a=new go(e).excludeScrollbarsAndBorders(),l=n&&i,c=[r,o].every(e=>a.contains(e));let{scrollX:h,scrollY:u}=e;const d=h,f=u;l?u-=a.top-t.top+s.top:c||(Bo(r,a)?u-=a.top-t.top+s.top:Vo(o,a)&&(u+=n?t.top-a.top-s.top:t.bottom-a.bottom+s.bottom)),c||(Do(t,a)?h-=a.left-t.left+s.left:No(t,a)&&(h+=t.right-a.right+s.right)),h==d&&u===f||e.scrollTo(h,u)}function Mo({parent:e,getRect:t,alignToTop:n,forceScroll:i,ancestorOffset:s=0,limiterElement:o}){const r=Fo(e),a=n&&i;let l,c,h;const u=o||r.document.body;for(;e!=u;)c=t(),l=new go(e).excludeScrollbarsAndBorders(),h=l.contains(c),a?e.scrollTop-=l.top-c.top+s:h||(Bo(c,l)?e.scrollTop-=l.top-c.top+s:Vo(c,l)&&(e.scrollTop+=n?c.top-l.top-s:c.bottom-l.bottom+s)),h||(Do(c,l)?e.scrollLeft-=l.left-c.left+s:No(c,l)&&(e.scrollLeft+=c.right-l.right+s)),e=e.parentNode}function Vo(e,t){return e.bottom>t.bottom}function Bo(e,t){return e.top<t.top}function Do(e,t){return e.left<t.left}function No(e,t){return e.right>t.right}function Fo(e){return uo(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function Lo(e){if(uo(e)){let t=e.commonAncestorContainer;return ho(t)&&(t=t.parentNode),t}return e.parentNode}function $o(e,t){const n=Fo(e),i=new go(e);if(n===t)return i;{let e=n;for(;e!=t;){const t=e.frameElement,n=new go(t).excludeScrollbarsAndBorders();i.moveBy(n.left,n.top),e=e.parent}}return i}const zo={ctrl:"â",cmd:"â",alt:"â¥",shift:"â§"},jo={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},Ho={37:"â",38:"â",39:"â",40:"â",9:"â¥",33:"Page Up",34:"Page Down"},Wo=Zo(),Uo=Object.fromEntries(Object.entries(Wo).map(([e,t])=>{let n;return n=t in Ho?Ho[t]:e.charAt(0).toUpperCase()+e.slice(1),[t,n]}));function qo(e){let t;if("string"==typeof e){if(t=Wo[e.toLowerCase()],!t)throw new bs("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?Wo.alt:0)+(e.ctrlKey?Wo.ctrl:0)+(e.shiftKey?Wo.shift:0)+(e.metaKey?Wo.cmd:0);return t}function Ko(e){return"string"==typeof e&&(e=function(e){return e.split("+").map(e=>e.trim())}(e)),e.map(e=>"string"==typeof e?function(e){if(e.endsWith("!"))return qo(e.slice(0,-1));const t=qo(e);return(ts.isMac||ts.isiOS)&&t==Wo.ctrl?Wo.cmd:t}(e):e).reduce((e,t)=>t+e,0)}function Go(e){let t=Ko(e);return Object.entries(ts.isMac||ts.isiOS?zo:jo).reduce((e,[n,i])=>(0!=(t&Wo[n])&&(t&=~Wo[n],e+=i),e),"")+(t?Uo[t]:"")}function Jo(e,t){const n="ltr"===t;switch(e){case Wo.arrowleft:return n?"left":"right";case Wo.arrowright:return n?"right":"left";case Wo.arrowup:return"up";case Wo.arrowdown:return"down"}}function Zo(){const e={pageup:33,pagedown:34,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let t=65;t<=90;t++){e[String.fromCharCode(t).toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return Object.assign(e,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),e}const Qo=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig"];function Yo(e){return Qo.includes(e)?"rtl":"ltr"}function Xo(e){return Array.isArray(e)?e:[e]}function er(e,t,n=1,i){if("number"!=typeof n)throw new bs("translation-service-quantity-not-a-number",null,{quantity:n});const s=i||Yi.window.CKEDITOR_TRANSLATIONS,o=function(e){return Object.keys(e).length}(s);1===o&&(e=Object.keys(s)[0]);const r=t.id||t.string;if(0===o||!function(e,t,n){return!!n[e]&&!!n[e].dictionary[t]}(e,r,s))return 1!==n?t.plural:t.string;const a=s[e].dictionary,l=s[e].getPluralForm||(e=>1===e?0:1),c=a[r];if("string"==typeof c)return c;return c[Number(l(n))]}Yi.window.CKEDITOR_TRANSLATIONS||(Yi.window.CKEDITOR_TRANSLATIONS={});class tr{uiLanguage;uiLanguageDirection;contentLanguage;contentLanguageDirection;t;translations;constructor({uiLanguage:e="en",contentLanguage:t,translations:n}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=Yo(this.uiLanguage),this.contentLanguageDirection=Yo(this.contentLanguage),this.translations=function(e){return Array.isArray(e)?e.reduce((e,t)=>
1Ki(e,t)):e}(n),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=Xo(t),"string"==typeof e&&(e={string:e});const n=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,n)=>n<t.length?t[n]:e)}(er(this.uiLanguage,e,n,this.translations),t)}}class nr extends(Ts()){_items;_itemMap;_idProperty;_bindToCollection;_bindToExternalToInternalMap;_bindToInternalToExternalMap;_skippedIndexesFromExternal;constructor(e={},t={}){super();const n=Zs(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(const i of e)this._items.push(i),this._itemMap.set(this._getItemIdBeforeAdding(i),i)}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(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new bs("collection-add-item-invalid-index",this);let n=0;for(const i of e){const e=this._getItemIdBeforeAdding(i),s=t+n;this._items.splice(s,0,i),this._itemMap.set(e,i),this.fire("add",i,s),n++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new bs("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){const[t,n]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:n}),t}map(e,t){return this._items.map(e,t)}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 bs("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(e):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,n=(n,i,s)=>{const o=t._bindToCollection==this,r=t._bindToInternalToExternalMap.get(i);if(o&&r)this._bindToExternalToInternalMap.set(i,r),this._bindToInternalToExternalMap.set(r,i);else{const n=e(i);if(!n)return void this._skippedIndexesFromExternal.push(s);let o=s;for(const e of this._skippedIndexesFromExternal)s>e&&o--;for(const e of t._skippedIndexesFromExternal)o>=e&&o++;this._bindToExternalToInternalMap.set(i,n),this._bindToInternalToExternalMap.set(n,i),this.add(n,o);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)o<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const i of t)n(0,i,t.getIndex(i));this.listenTo(t,"add",n),this.listenTo(t,"remove",(e,t,n)=>{const i=this._bindToExternalToInternalMap.get(t);i&&this.remove(i),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(n<t&&e.push(t-1),n>t&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let n;if(t in e){if(n=e[t],"string"!=typeof n)throw new bs("collection-add-invalid-id",this);if(this.get(n))throw new bs("collection-add-item-already-exists",this)}else e[t]=n=gs();return n}_remove(e){let t,n,i,s=!1;const o=this._idProperty;if("string"==typeof e?(n=e,i=this._itemMap.get(n),s=!i,i&&(t=this._items.indexOf(i))):"number"==typeof e?(t=e,i=this._items[t],s=!i,i&&(n=i[o])):(i=e,n=i[o],t=this._items.indexOf(i),s=-1==t||!this._itemMap.get(n)),s)throw new bs("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(n);const r=this._bindToInternalToExternalMap.get(i);return this._bindToInternalToExternalMap.delete(i),this._bindToExternalToInternalMap.delete(r),this.fire("remove",i,t),[i,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function ir(e){const t=e.next();return t.done?null:t.value}class sr extends(so(zs())){_elements=new Set;_externalViews=new Set;_blurTimeout=null;constructor(){super(),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(rr(e))this._addElement(e);else if(or(e))this._addView(e);else{if(!e.element)throw new bs("focustracker-add-view-missing-element",{focusTracker:this,view:e});this._addElement(e.element)}}remove(e){rr(e)?this._removeElement(e):or(e)?this._removeView(e):this._removeElement(e.element)}_addElement(e){if(this._elements.has(e))throw new bs("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>{const t=this.externalViews.find(t=>function(e,t){if(ar(e,t))return!0;return!!t.focusTracker.externalViews.find(t=>ar(e,t))}(e,t));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(){if(this.elements.find(e=>e.contains(document.activeElement)))return;this.externalViews.find(e=>
1e.focusTracker.isFocused&&!e.focusTracker._blurTimeout)||(this._clearBlurTimeout(),this._blurTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0))}_clearBlurTimeout(){clearTimeout(this._blurTimeout),this._blurTimeout=null}}function or(e){return"focusTracker"in e&&e.focusTracker instanceof sr}function rr(e){return Hi(e)}function ar(e,t){return!!t.element&&t.element.contains(document.activeElement)&&e.contains(t.element)}class lr{_listener;constructor(){this._listener=new(so())}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+qo(t),t)})}set(e,t,n={}){const i=Ko(e),s=n.priority;this._listener.listenTo(this._listener,"_keydown:"+i,(e,i)=>{n.filter&&!n.filter(i)||(t(i,()=>{i.preventDefault(),i.stopPropagation(),e.stop()}),e.return=!0)},{priority:s})}press(e){return!!this._listener.fire("_keydown:"+qo(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function cr(e){return Zs(e)?new Map(e):function(e){const t=new Map;for(const n in e)t.set(n,e[n]);return t}(e)}function hr(e,t,n,i){if(Math.max(t.length,e.length)>1e4)return e.slice(0,n).concat(t).concat(e.slice(n+i,e.length));{const s=Array.from(e);return s.splice(n,i,...t),s}}function ur(e,t){let n;function i(...s){i.cancel(),n=setTimeout(()=>e(...s),t)}return i.cancel=()=>{clearTimeout(n)},i}function dr(e,t){return!!(n=e.charAt(t-1))&&1==n.length&&/[\ud800-\udbff]/.test(n)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var n}function fr(e,t){return!!(n=e.charAt(t))&&1==n.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n);var n}const mr=pr();function gr(e,t){const n=String(e).matchAll(mr);return Array.from(n).some(e=>e.index<t&&t<e.index+e[0].length)}function pr(){const e=[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")],t=new RegExp("\\p{Regional_Indicator}{2}","u").source,n="(?:"+e.map(e=>e.source).join("|")+")";return new RegExp(`${t}|${n}(?:â${n})*`,"ug")}const wr=new WeakMap;let br=!1;function _r({view:e,element:t,text:n,isDirectHost:i=!0,keepOnFocus:s=!1}){const o=e.document;function r(n){wr.get(o).set(t,{text:n,isDirectHost:i,keepOnFocus:s,hostElement:i?t:null}),e.change(e=>yr(o,e))}wr.has(o)||(wr.set(o,new Map),o.registerPostFixer(e=>yr(o,e)),o.on("change:isComposing",()=>{e.change(e=>yr(o,e))},{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",(e,t,n)=>{r(n)}),t.placeholder?r(t.placeholder):n&&r(n),n&&function(){br||_s("enableplaceholder-deprecated-text-option");br=!0}()}function yr(e,t){const n=wr.get(e),i=[];let s=!1;for(const[o,r]of n)r.isDirectHost&&(i.push(o),vr(t,o,r)&&(s=!0));for(const[o,r]of n){if(r.isDirectHost)continue;const e=kr(o);e&&(i.includes(e)||(r.hostElement=e,vr(t,o,r)&&(s=!0)))}return s}function vr(e,t,n){const{text:i,isDirectHost:s,hostElement:o}=n;let r=!1;o.getAttribute("data-placeholder")!==i&&(e.setAttribute("data-placeholder",i,o),r=!0);return(s||1==t.childCount)&&function(e,t){if(!e.isAttached())return!1;if(Array.from(e.getChildren()).some(e=>!e.is("uiElement")))return!1;const n=e.document,i=n.selection.anchor;return!(n.isComposing&&i&&i.parent===e||!t&&n.isFocused&&(!i||i.parent===e))}(o,n.keepOnFocus)?function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,o)&&(r=!0):function(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}(e,o)&&(r=!0),r}function kr(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}let Cr=class{ 2/* istanbul ignore next -- @preserve */ 3is(){throw new Error("is() method is abstract")}},xr=class extends(Ts(Cr)){document;parent;constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new bs("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let s=0;for(;n[s]==i[s]&&n[s];)s++;return 0===s?null:n[s-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=Js(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}_remove(){this.parent._removeChildren(this.index)}
3_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=ci(this);return delete e.parent,e}};xr.prototype.is=function(e){return"node"===e||"view:node"===e};let Ar=class e extends xr{_textData;constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(t){return t instanceof e&&(this===t||this.data===t.data)}_clone(){return new e(this.document,this.data)}};Ar.prototype.is=function(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e};let Tr=class extends Cr{textNode;data;offsetInText;constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.data.length)throw new bs("view-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.data.length)throw new bs("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let n=e.includeSelf?this.textNode:this.parent;for(;null!==n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}};Tr.prototype.is=function(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e};class Er{_patterns=[];constructor(...e){this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const n=Pr(t,e);if(n)return{element:t,pattern:e,match:n}}return null}matchAll(...e){const t=[];for(const n of e)for(const e of this._patterns){const i=Pr(n,e);i&&t.push({element:n,pattern:e,match:i})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function Pr(e,t){if("function"==typeof t)return t(e);const n={};return t.name&&(n.name=function(e,t){if(e instanceof RegExp)return!!t.match(e);return e===t}(t.name,e.name),!n.name)||t.attributes&&(n.attributes=function(e,t){const n=new Set(t.getAttributeKeys());Qt(e)?(void 0!==e.style&&_s("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&_s("matcher-pattern-deprecated-attributes-class-key",e)):(n.delete("style"),n.delete("class"));return Sr(e,n,e=>t.getAttribute(e))}(t.attributes,e),!n.attributes)||t.classes&&(n.classes=function(e,t){return Sr(e,t.getClassNames(), 4/* istanbul ignore next -- @preserve */ 5()=>{})}(t.classes,e),!n.classes)||t.styles&&(n.styles=function(e,t){return Sr(e,t.getStyleNames(!0),e=>t.getStyle(e))}(t.styles,e),!n.styles)?null:n}function Sr(e,t,n){const i=function(e){if(Array.isArray(e))return e.map(e=>
5Qt(e)?(void 0!==e.key&&void 0!==e.value||_s("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]);if(Qt(e))return Object.entries(e);return[[e,!0]]}(e),s=Array.from(t),o=[];if(i.forEach(([e,t])=>{s.forEach(i=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&t.match(e)})(e,i)&&function(e,t,n){if(!0===e)return!0;const i=n(t);return e===i||e instanceof RegExp&&!!String(i).match(e)}(t,i,n)&&o.push(i)})}),i.length&&!(o.length<i.length))return o}class Rr{_styles;_styleProcessor;constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=function(e){let t=null,n=0,i=0,s=null;const o=new Map;if(""===e)return o;";"!=e.charAt(e.length-1)&&(e+=";");for(let r=0;r<e.length;r++){const a=e.charAt(r);if(null===t)switch(a){case":":s||(s=e.substr(n,r-n),i=r+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(i,r-i);s&&o.set(s.trim(),t.trim()),s=null,n=r+1;break}}else a===t&&(t=null)}return o}(e);for(const[n,i]of t)this._styleProcessor.toNormalizedForm(n,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)}set(e,t){if(ie(e))for(const[n,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(n,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=Ir(e);!function(e,t){null==e||Gi(e,t)}(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!ie(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){if(this.isEmpty)return[];if(e)return this._styleProcessor.getStyleNames(this._styles);return this.getStylesEntries().map(([e])=>e)}clear(){this._styles={}}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const n=t.splice(0,t.length-1).join("."),i=Ht(this._styles,n);if(!i)return;!Object.keys(i).length&&this.remove(n)}}class Or{_normalizers;_extractors;_reducers;_consumables;constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(ie(t))Mr(n,Ir(e),t);else if(this._normalizers.has(e)){const i=this._normalizers.get(e),{path:s,value:o}=i(t);Mr(n,s,o)}else Mr(n,e,t)}getNormalized(e,t){if(!e)return Ki({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if("string"==typeof n)return Ht(t,n);const i=n(e,t);if(i)return i}return Ht(t,Ir(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);if(void 0===n)return[];if(this._reducers.has(e)){return this._reducers.get(e)(n)}return[[e,n]]}getStyleNames(e){const t=new Set;for(const n of this._consumables.keys()){const i=this.getNormalized(n,e);i&&("object"!=typeof i||Object.keys(i).length)&&t.add(n)}for(const n of Object.keys(e))t.add(n);return Array.from(t)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function Ir(e){return e.replace("-",".")}function Mr(e,t,n){let i=n;ie(n)&&(i=Ki({},Ht(e,t),n)),Ji(e,t,i)}let Vr=class e extends xr{name;_unsafeAttributesToRender=[];_attrs;_children;_classes;_styles;_customProperties=new Map;constructor(e,t,n,i){if(super(e),this.name=t,this._attrs=function(e){const t=cr(e);for(const[n,i]of t)null===i?t.delete(n):"string"!=typeof i&&t.set(n,String(i));return t}(n),this._children=[],i&&this._insertChild(0,i),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");Br(this._classes,e),this._attrs.delete("class")}this._styles=new Rr(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>
50&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(t){if(!(t instanceof e))return!1;if(this===t)return!0;if(this.name!=t.name)return!1;if(this._attrs.size!==t._attrs.size||this._classes.size!==t._classes.size||this._styles.size!==t._styles.size)return!1;for(const[e,n]of this._attrs)if(!t._attrs.has(e)||t._attrs.get(e)!==n)return!1;for(const e of this._classes)if(!t._classes.has(e))return!1;for(const e of this._styles.getStyleNames())if(!t._styles.has(e)||t._styles.getAsString(e)!==this._styles.getAsString(e))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Er(...e);let n=this.parent;for(;n&&!n.is("documentFragment");){if(t.match(n))return n;n=n.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),n=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==n?"":` ${n}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n._unsafeAttributesToRender=this._unsafeAttributesToRender,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let n=0;const i=function(e,t){if("string"==typeof t)return[new Ar(e,t)];Zs(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Ar(e,t):t instanceof Tr?new Ar(e,t.data):t)}(this.document,t);for(const s of i)null!==s.parent&&s._remove(),s.parent=this,s.document=this.document,this._children.splice(e,0,s),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const n=String(t);this._fireChange("attributes",this),"class"==e?Br(this._classes,n):"style"==e?this._styles.setTo(n):this._attrs.set(e,n)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of Xo(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of Xo(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),"string"!=typeof e?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of Xo(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};function Br(e,t){const n=t.split(/\s+/);e.clear(),n.forEach(t=>e.add(t))}Vr.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e};class Dr extends Vr{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=Nr}}function Nr(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const n of e)if(!n.is("uiElement"))return null;return this.childCount}Dr.prototype.is=function(e,t){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class Fr extends(zs(Dr)){constructor(e,t,n,i){super(e,t,n,i),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}Fr.prototype.is=function(e,t){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};const Lr=Symbol("rootName");class $r extends Fr{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Lr)}set rootName(e){this._setCustomProperty(Lr,e)}set _name(e){this.name=e}}$r.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};let zr=class{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new bs("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new bs("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=jr._createAt(e.startPosition):this._position=jr._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n;do{n=this.position,t=this.next()}while(!t.done&&e(t.value));t.done||(this._position=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&e.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let i;if(n instanceof Ar){if(e.isAtEnd)return this._position=jr._createAfter(n),this._next();i=n.data[e.offset]}else i=n.getChild(e.offset);if(i instanceof Vr){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}else e=new jr(i,0);return this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}if(i instanceof Ar){if(this.singleCharacters)return e=new jr(i,0),this._position=e,this._next();let n,s=i.data.length;return i==this._boundaryEndParent?(s=this.boundaries.end.offset,n=new Tr(i,0,s),e=jr._createAfter(n)):(n=new Tr(i,0,i.data.length),e.offset++),this._position=e,this._formatReturnValue("text",n,t,e,s)}if("string"==typeof i){let i;if(this.singleCharacters)i=1;else{i=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset}const s=new Tr(n,e.offset,i);return e.offset+=i,this._position=e,this._formatReturnValue("text",s,t,e,i)}return e=jr._createAfter(n),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&0===e.offset)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let i;if(n instanceof Ar){if(e.isAtStart)return this._position=jr._createBefore(n),this._previous();i=n.data[e.offset-1]}else i=n.getChild(e.offset-1);if(i instanceof Vr)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",i,t,e,1)):(e=new jr(i,i.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",i,t,e));if(i instanceof Ar){if(this.singleCharacters)return e=new jr(i,i.data.length),this._position=e,this._previous();let n,s=i.data.length;if(i==this._boundaryStartParent){const t=this.boundaries.start.offset;n=new Tr(i,t,i.data.length-t),s=n.data.length,e=jr._createBefore(n)}else n=new Tr(i,0,i.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",n,t,e,s)}if("string"==typeof i){let i;if(this.singleCharacters)i=1;else{const t=n===this._boundaryStartParent?this.boundaries.start.offset:0;i=e.offset-t}e.offset-=i;const s=new Tr(n,e.offset,i);return this._position=e,this._formatReturnValue("text",s,t,e,i)}return e=jr._createBefore(n),this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,i,s){return t instanceof Tr&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=jr._createAfter(t.textNode):(i=jr._createAfter(t.textNode),this._position=i)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=jr._createBefore(t.textNode):(i=jr._createBefore(t.textNode),this._position=i))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:i,length:s}}}},jr=class e extends Cr{parent;offset;constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}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 Fr);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(t){const n=e._createAt(this),i=n.offset+t;return n.offset=i<0?0:i,n}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new zr(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return 0===i?null:t[i-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const i=Js(t,n);switch(i){case"prefix":return"before";case"extension":return"after";default:return t[i]<n[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new zr(e)}clone(){return new e(this.parent,this.offset)}static _createAt(t,n){if(t instanceof e)return new this(t.parent,t.offset);{const i=t;if("end"==n)n=i.is("$text")?i.data.length:i.childCount;else{if("before"==n)return this._createBefore(i);if("after"==n)return this._createAfter(i);if(0!==n&&!n)throw new bs("view-createpositionat-offset-required",i)}return new e(i,n)}}static _createAfter(t){if(t.is("$textProxy"))return new e(t.textNode,t.offsetInText+t.data.length);if(!t.parent)throw new bs("view-position-after-root",t,{root:t});return new e(t.parent,t.index+1)}static _createBefore(t){if(t.is("$textProxy"))return new e(t.textNode,t.offsetInText);if(!t.parent)throw new bs("view-position-before-root",t,{root:t});return new e(t.parent,t.index)}};jr.prototype.is=function(e){return"position"===e||"view:position"===e};let Hr=class e extends Cr{start;end;constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new zr({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 t=this.start.getLastMatchingPosition(Wr,{direction:"backward"}),n=this.end.getLastMatchingPosition(Wr);return t.parent.is("$text")&&t.isAtStart&&(t=jr._createBefore(t.parent)),n.parent.is("$text")&&n.isAtEnd&&(n=jr._createAfter(n.parent)),new e(t,n)}getTrimmed(){let t=this.start.getLastMatchingPosition(Wr);if(t.isAfter(this.end)||t.isEqual(this.end))return new e(t,t);let n=this.end.getLastMatchingPosition(Wr,{direction:"backward"});const i=t.nodeAfter,s=n.nodeBefore;return i&&i.is("$text")&&(t=new jr(i,0)),s&&s.is("$text")&&(n=new jr(s,s.data.length)),new e(t,n)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}getDifference(t){const n=[];return this.isIntersecting(t)?(this.containsPosition(t.start)&&n.push(new e(this.start,t.start)),this.containsPosition(t.end)&&n.push(new e(t.end,this.end))):n.push(this.clone()),n}getIntersection(t){if(this.isIntersecting(t)){let n=this.start,i=this.end;return this.containsPosition(t.start)&&(n=t.start),this.containsPosition(t.end)&&(i=t.end),new e(n,i)}return null}getWalker(e={}
5){return e.boundaries=this,new zr(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 e(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new zr(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new zr(e);yield t.position;for(const n of t)yield n.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,n,i){return new this(new jr(e,t),new jr(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(jr._createBefore(e),t)}};function Wr(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}Hr.prototype.is=function(e){return"range"===e||"view:range"===e};let Ur=class e extends(Ts(Cr)){_ranges;_lastRangeBackward;_isFake;_fakeSelectionLabel;constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&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)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=Gs(this.getRanges());if(t!=Gs(e.getRanges()))return!1;if(0==t)return!0;for(let n of this.getRanges()){n=n.getTrimmed();let t=!1;for(let i of e.getRanges())if(i=i.getTrimmed(),n.start.isEqual(i.start)&&n.end.isEqual(i.end)){t=!0;break}if(!t)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(...t){let[n,i,s]=t;if("object"==typeof i&&(s=i,i=void 0),null===n)this._setRanges([]),this._setFakeOptions(s);else if(n instanceof e||n instanceof qr)this._setRanges(n.getRanges(),n.isBackward),this._setFakeOptions({fake:n.isFake,label:n.fakeSelectionLabel});else if(n instanceof Hr)this._setRanges([n],s&&s.backward),this._setFakeOptions(s);else if(n instanceof jr)this._setRanges([new Hr(n)]),this._setFakeOptions(s);else if(n instanceof xr){const e=!!s&&!!s.backward;let t;if(void 0===i)throw new bs("view-selection-setto-required-second-parameter",this);t="in"==i?Hr._createIn(n):"on"==i?Hr._createOn(n):new Hr(jr._createAt(n,i)),this._setRanges([t],e),this._setFakeOptions(s)}else{if(!Zs(n))throw new bs("view-selection-setto-not-selectable",this);this._setRanges(n,s&&s.backward),this._setFakeOptions(s)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new bs("view-selection-setfocus-no-ranges",this);const n=jr._createAt(e,t);if("same"==n.compareWith(this.focus))return;const i=this.anchor;this._ranges.pop(),"before"==n.compareWith(i)?this._addRange(new Hr(n,i),!0):this._addRange(new Hr(i,n)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const n of e)this._addRange(n);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof Hr))throw new bs("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 bs("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new Hr(e.start,e.end))}};Ur.prototype.is=function(e){return"selection"===e||"view:selection"===e};let qr=class extends(Ts(Cr)){_selection;constructor(...e){super(),this._selection=new Ur,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};qr.prototype.is=function(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e};class Kr extends fs{startRange;_eventPhase;_currentTarget;constructor(e,t,n){super(e,t),this.startRange=n,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const Gr=Symbol("bubbling contexts");function Jr(e){return class extends e{fire(e,...t){try{const n=e instanceof fs?e:new fs(this,e),i=Xr(this);if(!i.size)return;if(Zr(n,"capturing",this),Qr(i,"$capture",n,...t))return n.return;const s=n.startRange||this.selection.getFirstRange(),o=s?s.getContainedElement():null,r=!!o&&Boolean(Yr(i,o));let a=o||function(e){if(!e)return null;const t=e.start.parent,n=e.end.parent,i=t.getPath(),s=n.getPath();return i.length>s.length?t:n}(s);if(Zr(n,"atTarget",a),!r){if(Qr(i,"$text",n,...t))return n.return;Zr(n,"bubbling",a)}for(;a;){if(a.is("rootElement")){if(Qr(i,"$root",n,...t))return n.return}else if(a.is("element")&&Qr(i,a.name,n,...t))return n.return;if(Qr(i,a,n,...t))return n.return;a=a.parent,Zr(n,"bubbling",a)}return Zr(n,"bubbling",this),Qr(i,"$document",n,...t),n.return}catch(n){bs.rethrowUnexpectedError(n,this)}}_addEventListener(e,t,n){const i=Xo(n.context||"$document"),s=Xr(this);for(const o of i){let i=s.get(o);i||(i=new(Ts()),s.set(o,i)),this.listenTo(i,e,t,n)}}_removeEventListener(e,t){const n=Xr(this);for(const i of n.values())this.stopListening(i,e,t)}}}{const e=Jr(Object);["fire","_addEventListener","_removeEventListener"].forEach(t=>{Jr[t]=e.prototype[t]})}function Zr(e,t,n){e instanceof Kr&&(e._eventPhase=t,e._currentTarget=n)}function Qr(e,t,n,...i){const s="string"==typeof t?e.get(t):Yr(e,t);return!!s&&(s.fire(n,...i),n.stop.called)}function Yr(e,t){for(const[n,i]of e)if("function"==typeof n&&n(t))return i;return null}function Xr(e){return e[Gr]||(e[Gr]=new Map),e[Gr]}let ea=class extends(Jr(zs())){selection;roots;stylesProcessor;_postFixers=new Set;constructor(e){super(),this.selection=new qr,this.roots=new nr({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)}
5destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(t=n(e),t)break}while(t)}};class ta extends Vr{static DEFAULT_PRIORITY=10;_priority=10;_id=null;_clonesGroup=null;constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=na}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new bs("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function na(){if(ia(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(ia(e)>1)return null;e=e.parent}return!e||ia(e)>1?null:this.childCount}function ia(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}ta.prototype.is=function(e,t){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class sa extends Vr{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=oa}_insertChild(e,t){if(t&&(t instanceof xr||Array.from(t).length>0))throw new bs("view-emptyelement-cannot-add",[this,t]);return 0}}function oa(){return null}sa.prototype.is=function(e,t){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class ra extends Vr{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=la}_insertChild(e,t){if(t&&(t instanceof xr||Array.from(t).length>0))throw new bs("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const n of this.getAttributeKeys())t.setAttribute(n,this.getAttribute(n));return t}}function aa(e){e.document.on("arrowKey",(t,n)=>function(e,t,n){if(t.keyCode==Wo.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),i=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(i||t.shiftKey){const t=e.focusNode,s=e.focusOffset,o=n.domPositionToView(t,s);if(null===o)return;let r=!1;const a=o.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(r=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(r){const t=n.viewPositionToDom(a);i?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,n,e.domConverter),{priority:"low"})}function la(){return null}ra.prototype.is=function(e,t){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class ca extends Vr{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=ha}_insertChild(e,t){if(t&&(t instanceof xr||Array.from(t).length>0))throw new bs("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function ha(){return null}ca.prototype.is=function(e,t){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e};let ua=class extends(Ts(Cr)){document;_children=[];_customProperties=new Map;constructor(e,t){super(),this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let n=0;const i=function(e,t){if("string"==typeof t)return[new Ar(e,t)];Zs(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Ar(e,t):t instanceof Tr?new Ar(e,t.data):t)}(this.document,t);for(const s of i)null!==s.parent&&s._remove(),s.parent=this,this._children.splice(e,0,s),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};ua.prototype.is=function(e){return"documentFragment"===e||"view:documentFragment"===e};class da{document;_cloneGroups=new Map;_slotFactory=null;constructor(e){this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new ua(this.document,e)}createText(e){return new Ar(this.document,e)}createAttributeElement(e,t,n={}){const i=new ta(this.document,e,t);return"number"==typeof n.priority&&(i._priority=n.priority),n.id&&(i._id=n.id),n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createContainerElement(e,t,n={},i={}){let s=null;Qt(n)?i=n:s=n;const o=new Dr(this.document,e,t,s);return i.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),o}createEditableElement(e,t,n={}){const i=new Fr(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createEmptyElement(e,t,n={}){const i=new sa(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createUIElement(e,t,n){const i=new ra(this.document,e,t);return n&&(i.render=n),i}createRawElement(e,t,n,i={}){const s=new ca(this.document,e,t);return n&&(s.render=n),i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Qt(e)&&void 0===n?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof jr?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new bs("view-writer-break-non-container-element",this.document);if(!t.parent)throw new bs("view-writer-break-root",this.document);if(e.isAtStart)return jr._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(jr._createAfter(t),n);const i=new Hr(e,jr._createAt(t,"end")),s=new jr(n,0);this.move(i,s)}return jr._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("$text"))return e;if(n.is("attributeElement")&&0===n.childCount){const e=n.parent,t=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new jr(e,t))}const i=n.getChild(t-1),s=n.getChild(t);if(!i||!s)return e;if(i.is("$text")&&s.is("$text"))return wa(i,s);if(i.is("attributeElement")&&s.is("attributeElement")&&i.isSimilar(s)){const e=i.childCount;return i._appendChild(s.getChildren()),s._remove(),this._removeFromClonedElementsGroup(s),this.mergeAttributes(new jr(i,e))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!(t&&n&&t.is("containerElement")&&n.is("containerElement")))throw new bs("view-writer-merge-containers-invalid-position",this.document);const i=t.getChild(t.childCount-1),s=i instanceof Ar?jr._createAt(i,"end"):jr._createAt(t,"end");return this.move(Hr._createIn(n),jr._createAt(t,"end")),this.remove(Hr._createOn(n)),s}insert(e,t){_a(t=Zs(t)?[...t]:[t],this.document);const n=t.reduce((e,t)=>
5{const n=e[e.length-1],i=!t.is("uiElement");return n&&n.breakAttributes==i?n.nodes.push(t):e.push({breakAttributes:i,nodes:[t]}),e},[]);let i=null,s=e;for(const{nodes:o,breakAttributes:r}of n){const e=this._insertNodes(s,o,r);i||(i=e.start),s=e.end}return i?new Hr(i,s):new Hr(e)}remove(e){const t=e instanceof Hr?e:Hr._createOn(e);if(va(t,this.document),t.isCollapsed)return new ua(this.document);const{start:n,end:i}=this._breakAttributesRange(t,!0),s=n.parent,o=i.offset-n.offset,r=s._removeChildren(n.offset,o);for(const l of r)this._removeFromClonedElementsGroup(l);const a=this.mergeAttributes(n);return t.start=a,t.end=a.clone(),new ua(this.document,r)}clear(e,t){va(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const i of n){const n=i.item;let s;if(n.is("element")&&t.isSimilar(n))s=Hr._createOn(n);else if(!i.nextPosition.isAfter(e.start)&&n.is("$textProxy")){const e=n.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(s=Hr._createIn(e))}s&&(s.end.isAfter(e.end)&&(s.end=e.end),s.start.isBefore(e.start)&&(s.start=e.start),this.remove(s))}}move(e,t){let n;if(t.isAfter(e.end)){const i=(t=this._breakAttributes(t,!0)).parent,s=i.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=i.childCount-s}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof ta))throw new bs("view-writer-wrap-invalid-attribute",this.document);if(va(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&(n=i.parent,!Array.from(n.getChildren()).some(e=>!e.is("uiElement")))&&(i=i.getLastMatchingPosition(e=>e.item.is("uiElement"))),i=this._wrapPosition(i,t);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new Hr(i)}return this._wrapRange(e,t);var n}unwrap(e,t){if(!(t instanceof ta))throw new bs("view-writer-unwrap-invalid-attribute",this.document);if(va(e,this.document),e.isCollapsed)return e;const{start:n,end:i}=this._breakAttributesRange(e,!0),s=n.parent,o=this._unwrapChildren(s,n.offset,i.offset,t),r=this.mergeAttributes(o.start);r.isEqual(o.start)||o.end.offset--;const a=this.mergeAttributes(o.end);return new Hr(r,a)}rename(e,t){const n=new Dr(this.document,e,t.getAttributes());return this.insert(jr._createAfter(t),n),this.move(Hr._createIn(t),jr._createAt(n,0)),this.remove(Hr._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return jr._createAt(e,t)}createPositionAfter(e){return jr._createAfter(e)}createPositionBefore(e){return jr._createBefore(e)}createRange(e,t){return new Hr(e,t)}createRangeOn(e){return Hr._createOn(e)}createRangeIn(e){return Hr._createIn(e)}createSelection(...e){return new Ur(...e)}createSlot(e="children"){if(!this._slotFactory)throw new bs("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,n){let i,s;if(i=n?fa(e):e.parent.is("$text")?e.parent.parent:e.parent,!i)throw new bs("view-writer-invalid-position-container",this.document);s=n?this._breakAttributes(e,!0):e.parent.is("$text")?pa(e):e;const o=i._insertChild(s.offset,t);for(const c of t)this._addToClonedElementsGroup(c);const r=s.getShiftedBy(o),a=this.mergeAttributes(s);a.isEqual(s)||r.offset--;const l=this.mergeAttributes(r);return new Hr(a,l)}_wrapChildren(e,t,n,i){let s=t;const o=[];for(;s<n;){const t=e.getChild(s),n=t.is("$text"),r=t.is("attributeElement");if(r&&this._wrapAttributeElement(i,t))o.push(new jr(e,s));else if(n||!r||ma(i,t)){const n=i._clone();t._remove(),n._appendChild(t),e._insertChild(s,n),this._addToClonedElementsGroup(n),o.push(new jr(e,s))}else this._wrapChildren(t,0,t.childCount,i);s++}let r=0;for(const a of o){if(a.offset-=r,a.offset==t)continue;this.mergeAttributes(a).isEqual(a)||(r++,n--)}return Hr._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,i){let s=t;const o=[];for(;s<n;){const t=e.getChild(s);if(t.is("attributeElement")){if(t.isSimilar(i)){const i=t.getChildren(),r=t.childCount;t._remove(),e._insertChild(s,i),this._removeFromClonedElementsGroup(t),o.push(new jr(e,s),new jr(e,s+r)),s+=r,n+=r-1;continue}this._unwrapAttributeElement(i,t)?(o.push(new jr(e,s),new jr(e,s+1)),s++):(this._unwrapChildren(t,0,t.childCount,i),s++)}else s++}
5let r=0;for(const a of o){if(a.offset-=r,a.offset==t||a.offset==n)continue;this.mergeAttributes(a).isEqual(a)||(r++,n--)}return Hr._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){const{start:n,end:i}=this._breakAttributesRange(e,!0),s=n.parent,o=this._wrapChildren(s,n.offset,i.offset,t),r=this.mergeAttributes(o.start);r.isEqual(o.start)||o.end.offset--;const a=this.mergeAttributes(o.end);return new Hr(r,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return ga(e.clone());e.parent.is("$text")&&(e=pa(e));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);const i=new Hr(e,e.getShiftedBy(1));this.wrap(i,t);const s=new jr(n.parent,n.index);n._remove();const o=s.nodeBefore,r=s.nodeAfter;return o instanceof Ar&&r instanceof Ar?wa(o,r):ga(s)}_wrapAttributeElement(e,t){if(!ka(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&(t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t));for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!ka(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,i=e.end;if(va(e,this.document),e.isCollapsed){const n=this._breakAttributes(e.start,t);return new Hr(n,n)}const s=this._breakAttributes(i,t),o=s.parent.childCount,r=this._breakAttributes(n,t);return s.offset+=s.parent.childCount-o,new Hr(r,s)}_breakAttributes(e,t=!1){const n=e.offset,i=e.parent;if(e.parent.is("emptyElement"))throw new bs("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new bs("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new bs("view-writer-cannot-break-raw-element",this.document);if(!t&&i.is("$text")&&ya(i.parent))return e.clone();if(ya(i))return e.clone();if(i.is("$text"))return this._breakAttributes(pa(e),t);if(n==i.childCount){const e=new jr(i.parent,i.index+1);return this._breakAttributes(e,t)}if(0===n){const e=new jr(i.parent,i.index);return this._breakAttributes(e,t)}{const e=i.index+1,s=i._clone();i.parent._insertChild(e,s),this._addToClonedElementsGroup(s);const o=i.childCount-n,r=i._removeChildren(n,o);s._appendChild(r);const a=new jr(i.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const i of e.getChildren())this._addToClonedElementsGroup(i);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const i of e.getChildren())this._removeFromClonedElementsGroup(i);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function fa(e){let t=e.parent;for(;!ya(t);){if(!t)return;t=t.parent}return t}function ma(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function ga(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new jr(t,t.data.length);const n=e.nodeAfter;return n&&n.is("$text")?new jr(n,0):e}function pa(e){if(e.offset==e.parent.data.length)return new jr(e.parent.parent,e.parent.index+1);if(0===e.offset)return new jr(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new Ar(e.root.document,t)),new jr(e.parent.parent,e.parent.index+1)}function wa(e,t){const n=e.data.length;return e._data+=t.data,t._remove(),new jr(e,n)}const ba=[Ar,ta,Dr,sa,ca,ra];function _a(e,t){for(const n of e){if(!ba.some(e=>n instanceof e))throw new bs("view-writer-insert-invalid-node-type",t);n.is("$text")||_a(n.getChildren(),t)}}function ya(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function va(e,t){const n=fa(e.start),i=fa(e.end);if(!n||!i||n!==i)throw new bs("view-writer-invalid-range-container",t)}function ka(e,t){return null===e.id&&null===t.id}const Ca=e=>e.createTextNode("Â "),xa=e=>{const t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText="Â ",t},Aa=e=>{const t=e.createElement("br");return t.dataset.ckeFiller="true",t},Ta="â ".repeat(7);function Ea(e){return"string"==typeof e?e.substr(0,7)===Ta:ho(e)&&e.data.substr(0,7)===Ta}function Pa(e){return 7==e.data.length&&Ea(e)}function Sa(e){const t="string"==typeof e?e:e.data;return Ea(e)?t.slice(7):t}function Ra(e,t){if(t.keyCode==Wo.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,n=e.getRangeAt(0).startOffset;Ea(t)&&n<=7&&e.collapse(t,0)}}}let Oa=class extends(zs()){domDocuments=new Set;domConverter;markedAttributes=new Set;markedChildren=new Set;markedTexts=new Set;selection;_inlineFiller=null;_fakeSelectionContainer=null;constructor(e,t){super(),this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),ts.isBlink&&!ts.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()})}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new bs("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}
5render(){if(this.isComposing&&!ts.isAndroid)return;let e=null;const t=!(ts.isBlink&&!ts.isAndroid)||!this.isSelecting;for(const n of this.markedChildren)this._updateChildrenMappings(n);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=jr._createBefore(e.parent)));for(const n of this.markedAttributes)this._updateAttrs(n);for(const n of this.markedChildren)this._updateChildren(n,{inlineFillerPosition:e});for(const n of this.markedTexts)!this.markedChildren.has(n.parent)&&this.domConverter.mapViewToDom(n.parent)&&this._updateText(n,{inlineFillerPosition:e});if(t)if(e){const t=this.domConverter.viewPositionToDom(e),n=t.parent.ownerDocument;Ea(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=Ia(n,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.childNodes),i=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),s=this._diffNodeLists(n,i),o=this._findUpdateActions(s,n,i,Ma);if(-1!==o.indexOf("update")){const t={equal:0,insert:0,delete:0};for(const s of o)if("update"===s){const s=t.equal+t.insert,o=t.equal+t.delete,r=e.getChild(s);!r||r.is("uiElement")||r.is("rawElement")||this._updateElementMappings(r,n[o]),Oo(i[s]),t.equal++}else t[s]++}}_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")?jr._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&ho(t.parent)&&Ea(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Ea(e))throw new bs("view-renderer-filler-was-lost",this);Pa(e)?e.remove():e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;const i=e.nodeBefore,s=e.nodeAfter;return!(i instanceof Ar||s instanceof Ar)&&(!!(n!==t.getFillerOffset()||i&&i.is("element","br"))&&(!ts.isAndroid||!i&&!s))}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e);let i=this.domConverter.viewToDom(e).data;const s=t.inlineFillerPosition;s&&s.parent==e.parent&&s.offset==e.index&&(i=Ta+i),this._updateTextNode(n,i)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(t){for(const n of t.attributes){const i=n.name;e.hasAttribute(i)||this.domConverter.removeDomElementAttribute(t,i)}for(const n of e.getAttributeKeys())this.domConverter.setDomElementAttribute(t,n,e.getAttribute(n),e)}}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;if(ts.isAndroid){let e=null;for(const t of Array.from(n.childNodes)){if(e&&ho(e)&&ho(t)){n.normalize();break}e=t}}const i=t.inlineFillerPosition,s=n.childNodes,o=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));i&&i.parent===e&&Ia(n.ownerDocument,o,i.offset);const r=this._diffNodeLists(s,o),a=this._findUpdateActions(r,s,o,Va);let l=0;const c=new Set;for(const h of a)"delete"===h?(c.add(s[l]),Oo(s[l])):"equal"!==h&&"update"!==h||l++;l=0;for(const h of a)"insert"===h?(Ao(n,l,o[l]),l++):"update"===h?(this._updateTextNode(s[l],o[l].data),l++):"equal"===h&&(this._markDescendantTextToSync(this.domConverter.domToView(o[l])),l++);
5for(const h of c)h.parentNode||this.domConverter.unbindDomElement(h)}_diffNodeLists(e,t){return ds(e=function(e,t){const n=Array.from(e);if(0==n.length||!t)return n;n[n.length-1]==t&&n.pop();return n}(e,this._fakeSelectionContainer),t,Ba.bind(null,this.domConverter))}_findUpdateActions(e,t,n,i){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let s=[],o=[],r=[];const a={equal:0,insert:0,delete:0};for(const l of e)"insert"===l?r.push(n[a.equal+a.insert]):"delete"===l?o.push(t[a.equal+a.delete]):(s=s.concat(ds(o,r,i).map(e=>"equal"===e?"update":e)),s.push("equal"),o=[],r=[]),a[l]++;return s.concat(ds(o,r,i).map(e=>"equal"===e?"update":e))}_updateTextNode(e,t){const n=e.data;n!=t&&(ts.isAndroid&&this.isComposing&&n.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){const n=cs(e.data,t);for(const i of n)"insert"===i.type?e.insertData(i.index,i.values.join("")):e.deleteData(i.index,i.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(ts.isBlink&&!ts.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&ts.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent="Â ",t}(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;n.parentElement&&n.parentElement==e||e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||"Â ";const i=t.getSelection(),s=t.createRange();i.removeAllRanges(),s.selectNodeContents(n),i.addRange(s)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(n.parent,n.offset,i.parent,i.offset),ts.isGecko&&function(e,t){let n=e.parent,i=e.offset;ho(n)&&Pa(n)&&(i=xo(n)+1,n=n.parentNode);if(n.nodeType!=Node.ELEMENT_NODE||i!=n.childNodes.length-1)return;const s=n.childNodes[i];s&&"BR"==s.tagName&&t.addRange(t.getRangeAt(0))}(i,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(n.anchorNode!==t&&!t.contains(n.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const n=e.activeElement,i=this.domConverter.mapDomToView(n);n&&i&&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 Ia(e,t,n){const i=t instanceof Array?t:t.childNodes,s=i[n];if(ho(s))return s.data=Ta+s.data,s;{const s=e.createTextNode(Ta);return Array.isArray(t)?i.splice(n,0,s):Ao(t,n,s),s}}function Ma(e,t){return to(e)&&to(t)&&!ho(e)&&!ho(t)&&!To(e)&&!To(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function Va(e,t){return to(e)&&to(t)&&ho(e)&&ho(t)}function Ba(e,t,n){return t===n||(ho(t)&&ho(n)?t.data===n.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(n)))}const Da=Aa(Yi.document),Na=Ca(Yi.document),Fa=xa(Yi.document),La="data-ck-unsafe-attribute-",$a="data-ck-unsafe-element";class za{document;renderingMode;blockFillerMode;preElements;blockElements;inlineObjectElements;unsafeElements;_domDocument;_domToViewMapping=new WeakMap;_viewToDomMapping=new WeakMap;_fakeSelectionMapping=new WeakMap;_rawContentElementMatcher=new Er;_inlineObjectElementMatcher=new Er;_elementsWithTemporaryCustomProperties=new Set;constructor(e,{blockFillerMode:t,renderingMode:n="editing"}={}){this.document=e,this.renderingMode=n,this.blockFillerMode=t||("editing"===n?"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="editing"===this.renderingMode?Yi.document:Yi.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new Ur(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of e.children)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,n){return"data"===this.renderingMode||!(e=e.toLowerCase()).startsWith("on")&&(("srcdoc"!==e||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&("img"===n&&("src"===e||"srcset"===e)||("source"===n&&"srcset"===e||!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))))}setContentOf(e,t){if("data"===this.renderingMode)return void(e.innerHTML=t);const n=(new DOMParser).parseFromString(t,"text/html"),i=n.createDocumentFragment(),s=n.body.childNodes;for(;s.length>0;)i.appendChild(s[0]);const o=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),r=[];let a;for(;a=o.nextNode();)r.push(a);for(const l of r){for(const t of l.getAttributeNames())this.setDomElementAttribute(l,t,l.getAttribute(t));const e=l.tagName.toLowerCase();this._shouldRenameElement(e)&&(Wa(e),l.replaceWith(this._createReplacementDomElement(e,l)))}for(;e.firstChild;)e.firstChild.remove();e.append(i)}viewToDom(e,t={}){if(e.is("$text")){const t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}{const n=e;if(this.mapViewToDom(n)){if(!n.getCustomProperty("editingPipeline:doNotReuseOnce"))return this.mapViewToDom(n);this._elementsWithTemporaryCustomProperties.add(n)}let i;if(n.is("documentFragment"))i=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(i,n);else{if(n.is("uiElement"))return i="$comment"===n.name?this._domDocument.createComment(n.getCustomProperty("$rawContent")):n.render(this._domDocument,this),t.bind&&this.bindElements(i,n),i;this._shouldRenameElement(n.name)?(Wa(n.name),i=this._createReplacementDomElement(n.name)):i=n.hasAttribute("xmlns")?this._domDocument.createElementNS(n.getAttribute("xmlns"),n.name):this._domDocument.createElement(n.name),n.is("rawElement")&&n.render(i,this),t.bind&&this.bindElements(i,n);for(const e of n.getAttributeKeys())this.setDomElementAttribute(i,e,
5n.getAttribute(e),n)}if(!1!==t.withChildren)for(const e of this.viewChildrenToDom(n,t))i instanceof HTMLTemplateElement?i.content.appendChild(e):i.appendChild(e);return i}}setDomElementAttribute(e,t,n,i){const s=this.shouldRenderAttribute(t,n,e.tagName.toLowerCase())||i&&i.shouldRenderUnsafeAttribute(t);s||_s("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:n}),function(e){try{Yi.document.createAttribute(e)}catch(t){return!1}return!0}(t)?(e.hasAttribute(t)&&!s?e.removeAttribute(t):e.hasAttribute(La+t)&&s&&e.removeAttribute(La+t),e.setAttribute(s?t:La+t,n)):_s("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:n})}removeDomElementAttribute(e,t){t!=$a&&(e.removeAttribute(t),e.removeAttribute(La+t))}*viewChildrenToDom(e,t={}){const n=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const s of e.getChildren()){n===i&&(yield this._getBlockFiller());const e=s.is("element")&&!!s.getCustomProperty("dataPipeline:transparentRendering")&&!ir(s.getAttributes());if(e&&"data"==this.renderingMode)if(s.is("rawElement")){const e=this._domDocument.createElement(s.name);s.render(e,this),yield*[...e.childNodes]}else yield*this.viewChildrenToDom(s,t);else e&&_s("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:s}),yield this.viewToDom(s,t);i++}n===i&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),i=this._domDocument.createRange();return i.setStart(t.parent,t.offset),i.setEnd(n.parent,n.offset),i}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let i=e.offset;return Ea(n)&&(i+=7),{parent:n,offset:i}}{let n,i,s;if(0===e.offset){if(n=this.mapViewToDom(t),!n)return null;s=n.childNodes[0]}else{const t=e.nodeBefore;if(i=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(t),!i)return null;n=i.parentNode,s=i.nextSibling}if(ho(s)&&Ea(s))return{parent:s,offset:7};return{parent:n,offset:i?xo(i)+1:0}}}domToView(e,t={}){const n=[],i=this._domToView(e,t,n),s=i.next().value;return s?(i.next(),this._processDomInlineNodes(null,n,t),s.is("$text")&&0==s.data.length?null:s):null}*domChildrenToView(e,t={},n=[]){let i=[];i=e instanceof HTMLTemplateElement?[...e.content.childNodes]:[...e.childNodes];for(let s=0;s<i.length;s++){const o=i[s],r=this._domToView(o,t,n),a=r.next().value;null!==a&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,n,t),yield a,r.next())}this._processDomInlineNodes(e,n,t)}domSelectionToView(e){if(function(e){if(!ts.isGecko)return!1;if(!e.rangeCount)return!1;const t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch(n){return!0}return!1}(e))return new Ur([]);if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;ho(t)&&(t=t.parentNode);const n=this.fakeSelectionToView(t);if(n)return n}const t=this.isDomSelectionBackward(e),n=[];for(let i=0;i<e.rangeCount;i++){const t=e.getRangeAt(i),s=this.domRangeToView(t);s&&n.push(s)}return new Ur(n,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new Hr(t,n):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,xo(e));const n=this.mapDomToView(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return jr._createBefore(n);if(ho(e)){if(Pa(e))return this.domPositionToView(e.parentNode,xo(e));const n=this.findCorrespondingViewText(e);let i=t;return n?(Ea(e)&&(i-=7,i=i<0?0:i),new jr(n,i)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new jr(t,0)}else{const n=e.childNodes[t-1];if(ho(n)&&Pa(n)||n&&this.isBlockFiller(n))return this.domPositionToView(n.parentNode,xo(n));const i=ho(n)?this.findCorrespondingViewText(n):this.mapDomToView(n);if(i&&i.parent)return new jr(i.parent,i.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Pa(e))return null;const t=this.getHostViewElement(e);if(t)return t;const n=e.previousSibling;if(n){if(!this.isElement(n))return null;const e=this.mapDomToView(n);if(e){const t=e.nextSibling;return t instanceof Ar?t:null}}else{const t=this.mapDomToView(e.parentNode);
5if(t){const e=t.getChild(0);return e instanceof Ar?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:n}=Yi.window,i=[];ja(t,e=>{const{scrollLeft:t,scrollTop:n}=e;i.push([t,n])}),t.focus(),ja(t,e=>{const[t,n]=i.shift();e.scrollLeft=t,e.scrollTop=n}),Yi.window.scrollTo(e,n)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),n=this.domSelectionToView(t);n&&n.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(Da):!("BR"!==e.tagName||!Ha(e,this.blockElements)||1!==e.parentNode.childNodes.length)||(e.isEqualNode(Fa)||function(e,t){const n=e.isEqualNode(Na);return n&&Ha(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements))}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch(bC){return!1}const n=t.collapsed;return t.detach(),n}getHostViewElement(e){const t=function(e){const t=[];let n=e;for(;n&&n.nodeType!=Node.DOCUMENT_NODE;)t.unshift(n),n=n.parentNode;return t}(e);for(t.pop();t.length;){const e=t.pop(),n=this._domToViewMapping.get(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return n}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Ca(this._domDocument);case"markedNbsp":return xa(this._domDocument);case"br":return Aa(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(ho(e)&&Ea(e)&&t<7)return!1;if(this.isElement(e)&&Ea(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!n||!n.is("uiElement")&&!n.is("rawElement")}*_domToView(e,t,n){if(this.isBlockFiller(e))return null;const i=this.getHostViewElement(e);if(i)return i;if(To(e)&&t.skipComments)return null;if(ho(e)){if(Pa(e))return null;{const t=e.data;if(""===t)return null;const i=new Ar(this.document,t);return n.push(i),i}}{let i=this.mapDomToView(e);if(i)return this._isInlineObjectElement(i)&&n.push(i),i;if(this.isDocumentFragment(e))i=new ua(this.document),t.bind&&this.bindDocumentFragments(e,i);else{i=this._createViewElement(e,t),t.bind&&this.bindElements(e,i);const s=e.attributes;if(s)for(let e=s.length,t=0;t<e;t++)i._setAttribute(s[t].name,s[t].value);if(this._isViewElementWithRawContent(i,t))return i._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(i)||n.push(i),i;if(To(e))return i._setCustomProperty("$rawContent",e.data),i}yield i;const s=[];if(!1!==t.withChildren)for(const n of this.domChildrenToView(e,t,s))i._appendChild(n);if(this._isInlineObjectElement(i))n.push(i),this._processDomInlineNodes(null,s,t);else for(const e of s)n.push(e)}}_processDomInlineNodes(e,t,n){if(!t.length)return;if(e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let i=!1;for(let s=0;s<t.length;s++){const e=t[s];if(!e.is("$text")){i=!1;continue}let o,r=!1;if(this._isPreFormatted(e))o=Sa(e.data);else{o=e.data.replace(/[ \n\t\r]{1,}/g," "),r=/[^\S\u00A0]/.test(o.charAt(o.length-1));const a=s>0?t[s-1]:null,l=s+1<t.length?t[s+1]:null,c=!a||a.is("element")&&"br"==a.name||i,h=!l&&!Ea(e.data);!1!==n.withChildren&&(c&&(o=o.replace(/^ /,"")),h&&(o=o.replace(/ $/,""))),o=Sa(o),o=o.replace(/ \u00A0/g," ");const u=l&&l.is("element")&&"br"!=l.name,d=l&&l.is("$text")&&" "==l.data.charAt(0);(/[ \u00A0]\u00A0$/.test(o)||!l||u||d)&&(o=o.replace(/\u00A0$/," ")),(c||a&&a.is("element")&&"br"!=a.name)&&(o=o.replace(/^\u00A0/," "))}0==o.length&&e.parent?(e._remove(),t.splice(s,1),s--):(e._data=o,i=r)}t.length=0}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(" "==t.charAt(0)){const n=this._getTouchingInlineViewNode(e,!1);!(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n))&&n||(t="Â "+t.substr(1))}if(" "==t.charAt(t.length-1)){const n=this._getTouchingInlineViewNode(e,!0),i=n&&n.is("$textProxy")&&" "==n.data.charAt(0);
5" "!=t.charAt(t.length-2)&&n&&!i||(t=t.substr(0,t.length-1)+"Â ")}return t.replace(/ {2}/g," Â ")}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_isPreFormatted(e){if(function(e,t){return e.getAncestors().some(e=>e.is("element")&&t.includes(e.name))}(e,this.preElements))return!0;for(const t of e.getAncestors({parentFirst:!0}))if(t.is("element")&&t.hasStyle("white-space")&&"inherit"!==t.getStyle("white-space"))return["pre","pre-wrap","break-spaces"].includes(t.getStyle("white-space"));return!1}_getTouchingInlineViewNode(e,t){const n=new zr({startPosition:t?jr._createAfter(e):jr._createBefore(e),direction:t?"forward":"backward"});for(const{item:i}of n){if(i.is("$textProxy"))return i;if(!i.is("element")||!i.getCustomProperty("dataPipeline:transparentRendering")){if(i.is("element","br"))return null;if(this._isInlineObjectElement(i))return i;if(i.is("containerElement"))return null}}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return!!e.is("element")&&("br"==e.name||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e))}_createViewElement(e,t){if(To(e))return new ra(this.document,"$comment");const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new Vr(this.document,n)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return"editing"===this.renderingMode&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const n=this._domDocument.createElement("span");if(n.setAttribute($a,e),t){for(;t.firstChild;)n.appendChild(t.firstChild);for(const e of t.getAttributeNames())n.setAttribute(e,t.getAttribute(e))}return n}}function ja(e,t){let n=e;for(;n;)t(n),n=n.parentElement}function Ha(e,t){const n=e.parentNode;return!!n&&!!n.tagName&&t.includes(n.tagName.toLowerCase())}function Wa(e){"script"===e&&_s("domconverter-unsafe-script-element-detected"),"style"===e&&_s("domconverter-unsafe-style-element-detected")}class Ua extends(so()){view;document;_isEnabled=!1;constructor(e){super(),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&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}class qa{view;document;domEvent;domTarget;constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,vt(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Ka extends Ua{useCapture=!1;usePassive=!1;observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)},{useCapture:this.useCapture,usePassive:this.usePassive})})}stopObserving(e){this.stopListening(e)}fire(e,t,n){this.isEnabled&&this.document.fire(e,new qa(this.view,t,n))}}
5class Ga extends Ka{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 qo(this)}};this.fire(e.type,e,t)}}class Ja extends Ua{_fireSelectionChangeDoneDebounced;constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Ni(e=>{this.document.fire("selectionChangeDone",e)},200)}observe(){const e=this.document;e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&n.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new Ur(t.getRanges(),{backward:t.isBackward,fake:!1});e!=Wo.arrowleft&&e!=Wo.arrowup||n.setTo(n.getFirstPosition()),e!=Wo.arrowright&&e!=Wo.arrowdown||n.setTo(n.getLastPosition());const i={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}let Za=class extends Ua{domConverter;_config;_domElements;_mutationObserver;constructor(e){super(e),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 e of this._domElements)this._mutationObserver.observe(e,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(0===e.length)return;const t=this.domConverter,n=new Set,i=new Set;for(const o of e){const e=t.mapDomToView(o.target);e&&(e.is("uiElement")||e.is("rawElement")||"childList"!==o.type||this._isBogusBrMutation(o)||i.add(e))}for(const o of e){const e=t.mapDomToView(o.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===o.type){const e=t.findCorrespondingViewText(o.target);e&&!i.has(e.parent)?n.add(e):!e&&Ea(o.target)&&i.add(t.mapDomToView(o.target.parentNode))}}const s=[];for(const o of n)s.push({type:"text",node:o});for(const o of i){const e=t.mapViewToDom(o);Ui(Array.from(o.getChildren()),Array.from(t.domChildrenToView(e,{withChildren:!1})),Qa)||s.push({type:"children",node:o})}s.length&&this.document.fire("mutations",{mutations:s})}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}};function Qa(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}class Ya extends Ka{_renderTimeoutId=null;_isFocusChanging=!1;domEventType=["focus","blur"];constructor(e){super(e),this.useCapture=!0;const t=this.document;t.on("focus",()=>this._handleFocus()),t.on("blur",(e,t)=>this._handleBlur(t)),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;null!==t&&t!==e.target||(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change(()=>{}))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class Xa extends Ua{mutationObserver;focusObserver;selection;domConverter;_documents;_fireSelectionChangeDoneDebounced;_clearInfiniteLoopInterval;_documentIsSelectingInactivityTimeoutDebounced;_loopbackCounter;constructor(e){super(e),this.mutationObserver=e.getObserver(Za),this.focusObserver=e.getObserver(Ya),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Ni(e=>{this.document.fire("selectionChangeDone",e)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=Ni(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,n=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},{priority:"highest"}),this.listenTo(e,"keydown",n,{priority:"highest",useCapture:!0}
5),this.listenTo(e,"keyup",n,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",n,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",()=>{this.document.isComposing&&!ts.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()} 6/* istanbul ignore next -- @preserve */_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();const n=this.domConverter.domSelectionToView(t);if(0!=n.rangeCount){if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.selection.isEqual(n)||!this.domConverter.isDomSelectionCorrect(t))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.selection.isSimilar(n))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:n,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class el extends Ka{domEventType=["compositionstart","compositionupdate","compositionend"];constructor(e){super(e);const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}class tl{_files;_native;constructor(e,t={}){this._files=t.cacheFiles?nl(e):null,this._native=e}get files(){return this._files||(this._files=nl(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,n){this._native.setDragImage(e,t,n)}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}function nl(e){const t=Array.from(e.files||[]),n=Array.from(e.items||[]);return t.length?t:n.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}class il extends Ka{domEventType="beforeinput";onDomEvent(e){const t=e.getTargetRanges(),n=this.view,i=n.document;let s=null,o=null,r=[];if(e.dataTransfer&&(s=new tl(e.dataTransfer)),null!==e.data?o=e.data:s&&(o=s.getData("text/plain")),i.selection.isFake)r=Array.from(i.selection.getRanges());else if(t.length)r=t.map(e=>{const t=n.domConverter.domPositionToView(e.startContainer,e.startOffset),i=n.domConverter.domPositionToView(e.endContainer,e.endOffset);return t?n.createRange(t,i):i?n.createRange(i):void 0}).filter(e=>!!e);else if(ts.isAndroid){const t=e.target.ownerDocument.defaultView.getSelection();r=Array.from(n.domConverter.domSelectionToView(t).getRanges())}if(ts.isAndroid&&"insertCompositionText"==e.inputType&&o&&o.endsWith("\n"))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[n.createRange(r[0].end)]});else{if("insertText"==e.inputType&&o&&o.includes("\n")){const t=o.split(/\n{1,2}/g);let n=r;for(let o=0;o<t.length;o++){const r=t[o];""!=r&&(this.fire(e.type,e,{data:r,dataTransfer:s,targetRanges:n,inputType:e.inputType,isComposing:e.isComposing}),n=[i.selection.getFirstRange()]),o+1<t.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:n}),n=[i.selection.getFirstRange()])}return}this.fire(e.type,e,{data:o,dataTransfer:s,targetRanges:r,inputType:e.inputType,isComposing:e.isComposing})}}}class sl extends Ua{constructor(e){super(e),this.document.on("keydown",(e,t)=>{if(this.isEnabled&&((n=t.keyCode)==Wo.arrowright||n==Wo.arrowleft||n==Wo.arrowup||n==Wo.arrowdown)){const n=new Kr(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(n,t),n.stop.called&&e.stop()}var n})}observe(){}stopObserving(){}}class ol extends Ua{constructor(e){super(e);const t=this.document;
6t.on("keydown",(e,n)=>{if(!this.isEnabled||n.keyCode!=Wo.tab||n.ctrlKey)return;const i=new Kr(t,"tab",t.selection.getFirstRange());t.fire(i,n),i.stop.called&&e.stop()})}observe(){}stopObserving(){}}let rl=class extends(zs()){document;domConverter;domRoots=new Map;_renderer;_initialDomRootAttributes=new WeakMap;_observers=new Map;_writer;_ongoingChange=!1;_postFixersInProgress=!1;_renderingDisabled=!1;_hasChangedSinceTheLastRendering=!1;constructor(e){super(),this.document=new ea(e),this.domConverter=new za(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new Oa(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new da(this.document),this.addObserver(Za),this.addObserver(Ya),this.addObserver(Xa),this.addObserver(Ga),this.addObserver(Ja),this.addObserver(el),this.addObserver(sl),this.addObserver(il),this.addObserver(ol),this.document.on("arrowKey",Ra,{priority:"low"}),aa(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}),ts.isiOS&&this.listenTo(this.document,"blur",(e,t)=>{this.domConverter.mapDomToView(t.domEvent.relatedTarget)||this.domConverter._clearDomSelection()}),this.listenTo(this.document,"mutations",(e,{mutations:t})=>{t.forEach(e=>this._renderer.markToSync(e.type,e.node))},{priority:"low"}),this.listenTo(this.document,"mutations",()=>{this.forceRender()},{priority:"lowest"})}attachDomRoot(e,t="main"){const n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const i={};for(const{name:o,value:r}of Array.from(e.attributes))i[o]=r,"class"===o?this._writer.addClass(r.split(" "),n):n.hasAttribute(o)||this._writer.setAttribute(o,r,n);this._initialDomRootAttributes.set(e,i);const s=()=>{this._writer.setAttribute("contenteditable",(!n.isReadOnly).toString(),n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};s(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),n.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),n.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),n.on("change:isReadOnly",()=>this.change(s)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const n=this._initialDomRootAttributes.get(t);for(const i in n)t.setAttribute(i,n[i]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const i of this._observers.values())i.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[n,i]of this.domRoots)t.observe(i,n);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:n=20,ancestorOffset:i=20}={}){const s=this.document.selection.getFirstRange();if(!s)return;const o=hi({alignToTop:e,forceScroll:t,viewportOffset:n,ancestorOffset:i});"number"==typeof n&&(n={top:n,bottom:n,left:n,right:n});const r={target:this.domConverter.viewRangeToDom(s),viewportOffset:n,ancestorOffset:i,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",r,o),function({target:e,viewportOffset:t=0,ancestorOffset:n=0,alignToTop:i,forceScroll:s}){const o=Fo(e);let r=o,a=null;for(t=function(e){return"number"==typeof e?{top:e,bottom:e,left:e,right:e}:e}(t);r;){let l;l=Lo(r==o?e:a),Mo({parent:l,getRect:()=>
6$o(e,r),alignToTop:i,ancestorOffset:n,forceScroll:s});const c=$o(e,r);if(Io({window:r,rect:c,viewportOffset:t,alignToTop:i,forceScroll:s}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null}}(r)}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 bs("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){bs.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(Ya).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return jr._createAt(e,t)}createPositionAfter(e){return jr._createAfter(e)}createPositionBefore(e){return jr._createBefore(e)}createRange(e,t){return new Hr(e,t)}createRangeOn(e){return Hr._createOn(e)}createRangeIn(e){return Hr._createIn(e)}createSelection(...e){return new Ur(...e)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}};class al{ 7/* istanbul ignore next -- @preserve */ 8is(){throw new Error("is() method is abstract")}}let ll=class extends al{parent=null;_attrs;_index=null;_startOffset=null;constructor(e){super(),this._attrs=cr(e)}get document(){return null}get index(){return this._index}get startOffset(){return this._startOffset}get offsetSize(){return 1}get endOffset(){return null===this.startOffset?null:this.startOffset+this.offsetSize}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return null!==this.parent&&this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let s=0;for(;n[s]==i[s]&&n[s];)s++;return 0===s?null:n[s-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=Js(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}isAfter(e){return this!=e&&(this.root===e.root&&!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((e,t)=>(e[t[0]]=t[1],e),{})),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=cr(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};ll.prototype.is=function(e){return"node"===e||"model:node"===e};class cl{_nodes=[];_offsetToNode=[];constructor(e){e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._offsetToNode.length}getNode(e){return this._nodes[e]||null}getNodeAtOffset(e){return this._offsetToNode[e]||null}getNodeIndex(e){return e.index}getNodeStartOffset(e){return e.startOffset}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new bs("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){if(e==this._offsetToNode.length)return this._nodes.length;const t=this._offsetToNode[e];if(!t)throw new bs("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.getNodeIndex(t)}
8_insertNodes(e,t){for(const o of t)if(!(o instanceof ll))throw new bs("model-nodelist-insertnodes-not-node",this);const n=Array.from(t),i=function(e){const t=[];for(const n of e){const e=t.length;t.length+=n.offsetSize,t.fill(n,e)}return t}(n);let s=this.indexToOffset(e);this._nodes=hr(this._nodes,n,e,0),this._offsetToNode=hr(this._offsetToNode,i,s,0);for(let o=e;o<this._nodes.length;o++)this._nodes[o]._index=o,this._nodes[o]._startOffset=s,s+=this._nodes[o].offsetSize}_removeNodes(e,t=1){if(0==t)return[];let n=this.indexToOffset(e);const i=this._nodes.splice(e,t),s=i[i.length-1],o=s.startOffset+s.offsetSize-n;this._offsetToNode.splice(n,o);for(const r of i)r._index=null,r._startOffset=null;for(let r=e;r<this._nodes.length;r++)this._nodes[r]._index=r,this._nodes[r]._startOffset=n,n+=this._nodes[r].offsetSize;return i}toJSON(){return this._nodes.map(e=>e.toJSON())}}class hl extends ll{_data;constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new hl(this.data,this.getAttributes())}static fromJSON(e){return new hl(e.data,e.attributes)}}hl.prototype.is=function(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e};class ul extends al{textNode;data;offsetInText;constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new bs("model-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.offsetSize)throw new bs("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}ul.prototype.is=function(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e};class dl extends ll{name;_children=new cl;constructor(e,t,n){super(t),this.name=e,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}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 n of e)t=t.getChildAtOffset(n);return t}findAncestor(e,t={}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(e=>e._clone(!0)):void 0;return new dl(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new hl(e)];Zs(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new hl(e):e instanceof ul?new hl(e.data,e.getAttributes()):e)}(t);for(const i of n)null!==i.parent&&i._remove(),i.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const i of n)i.parent=null;return n}static fromJSON(e){let t;if(e.children){t=[];for(const n of e.children)n.name?t.push(dl.fromJSON(n)):t.push(hl.fromJSON(n))}return new dl(e.name,e.attributes,t)}}dl.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e};class fl{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;_visitedParent;constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new bs("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new bs("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=gl._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n,i,s;do{i=this.position,s=this._visitedParent,({done:t,value:n}=this.next())}while(!t&&e(n));t||(this._position=i,this._visitedParent=s)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&t.offset===n.maxOffset)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const i=pl(t,n),s=i||wl(t,n,i);if(s instanceof dl){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}else t.path.push(0),this._visitedParent=s;return this._position=t,ml("elementStart",s,e,t,1)}if(s instanceof hl){let i;if(this.singleCharacters)i=1;else{let e=s.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),i=e-t.offset}const o=t.offset-s.startOffset,r=new ul(s,o,i);return t.offset+=i,this._position=t,ml("text",r,e,t,i)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():ml("elementEnd",n,e,t)}_previous(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&0===t.offset)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const i=t.parent,s=pl(t,i),o=s||bl(t,i,s);if(o instanceof dl)return t.offset--,this.shallow?(this._position=t,ml("elementStart",o,e,t,1)):(t.path.push(o.maxOffset),this._position=t,this._visitedParent=o,this.ignoreElementEnd?this._previous():ml("elementEnd",o,e,t));if(o instanceof hl){let i;if(this.singleCharacters)i=1;else{let e=o.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),i=t.offset-e}const s=t.offset-o.startOffset,r=new ul(o,s-i,i);return t.offset-=i,this._position=t,ml("text",r,e,t,i)}return t.path.pop(),this._position=t,this._visitedParent=n.parent,ml("elementStart",n,e,t,1)}}function ml(e,t,n,i,s){return{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:i,length:s}}}class gl extends al{root;path;stickiness;constructor(e,t,n="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new bs("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new bs("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=n}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)throw new bs("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new bs("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return pl(this,this.parent)}get nodeAfter(){const e=this.parent;return wl(this,e,pl(this,e))}get nodeBefore(){const e=this.parent;return bl(this,e,pl(this,e))}get isAtStart(){return 0===this.offset}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=Js(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"}}
8getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new fl(t);return n.skip(e),n.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=Js(this.path,e.path),n="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return 0===i?null:t[i-1]}getShiftedBy(e){const t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let n=0;n<t;n++){const t=this.path[n]-e.path[n];if(t<-1||t>1)return!1;if(1===t)return _l(e,this,n);if(-1===t)return _l(this,e,n)}return this.path.length===e.path.length||(this.path.length>e.path.length?yl(this.path,t):yl(e.path,t))}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==Js(this.getParentPath(),e.getParentPath())}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=gl._createAt(this)}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)&&"toNext"==this.stickiness?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;let n;return t.containsPosition(this)||t.start.isEqual(this)?(n=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(n=n._getTransformedByDeletion(e.deletionPosition,1))):n=this.isEqual(e.deletionPosition)?gl._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),n}_getTransformedByDeletion(e,t){const n=gl._createAt(this);if(this.root!=e.root)return n;if("same"==Js(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;n.offset-=t}}else if("prefix"==Js(e.getParentPath(),this.getParentPath())){const i=e.path.length-1;if(e.offset<=this.path[i]){if(e.offset+t>this.path[i])return null;n.path[i]-=t}}return n}_getTransformedByInsertion(e,t){const n=gl._createAt(this);if(this.root!=e.root)return n;if("same"==Js(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(n.offset+=t);else if("prefix"==Js(e.getParentPath(),this.getParentPath())){const i=e.path.length-1;e.offset<=this.path[i]&&(n.path[i]+=t)}return n}_getTransformedByMove(e,t,n){if(t=t._getTransformedByDeletion(e,n),e.isEqual(t))return gl._createAt(this);const i=this._getTransformedByDeletion(e,n);return null===i||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(n).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):i._getTransformedByInsertion(t,n)}_getCombined(e,t){const n=e.path.length-1,i=gl._createAt(t);return i.stickiness=this.stickiness,i.offset=i.offset+this.path[n]-e.offset,i.path=[...i.path,...this.path.slice(n+1)],i}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,n="toNone"){if(e instanceof gl)return new gl(e.root,e.path,e.stickiness);{const i=e;if("end"==t)t=i.maxOffset;else{if("before"==t)return this._createBefore(i,n);if("after"==t)return this._createAfter(i,n);if(0!==t&&!t)throw new bs("model-createpositionat-offset-required",[this,e])}if(!i.is("element")&&!i.is("documentFragment"))throw new bs("model-position-parent-incorrect",[this,e]);const s=i.getPath();return s.push(t),new this(i.root,s,n)}}static _createAfter(e,t){if(!e.parent)throw new bs("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 bs("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const n=new gl(t.graveyard,e.path);return n.stickiness=e.stickiness,n}if(!t.getRoot(e.root))throw new bs("model-position-fromjson-no-root",t,{rootName:e.root});return new gl(t.getRoot(e.root),e.path,e.stickiness)}}function pl(e,t){const n=t.getChildAtOffset(e.offset);return n&&n.is("$text")&&n.startOffset<e.offset?n:null}function wl(e,t,n){return null!==n?null:t.getChildAtOffset(e.offset)}function bl(e,t,n){return null!==n?null:t.getChild(t.offsetToIndex(e.offset)-1)}function _l(e,t,n){return n+1!==e.path.length&&(!!yl(t.path,n+1)&&!!function(e,t){let n=e.parent,i=e.path.length-1,s=0;for(;i>=t;){if(e.path[i]+s!==n.maxOffset)return!1;s=1,i--,n=n.parent}return!0}(e,n+1))}function yl(e,t){for(;t<e.length;){if(0!==e[t])return!1;t++}return!0}gl.prototype.is=function(e){return"position"===e||"model:position"===e};class vl extends al{start;end;constructor(e,t){super(),this.start=gl._createAt(e),this.end=t?gl._createAt(t):gl._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new fl({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==Js(this.start.getParentPath(),this.end.getParentPath())}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}containsItem(e){const t=gl._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 vl(this.start,e.start)),this.containsPosition(e.end)&&t.pu
8sh(new vl(e.end,this.end))):t.push(new vl(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new vl(t,n)}return null}getJoined(e,t=!1){let n=this.isIntersecting(e);if(n||(n=this.start.isBefore(e.start)?t?this.end.isTouching(e.start):this.end.isEqual(e.start):t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!n)return null;let i=this.start,s=this.end;return e.start.isBefore(i)&&(i=e.start),e.end.isAfter(s)&&(s=e.end),new vl(i,s)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,n=gl._createAt(this.start);let i=n.parent;for(;n.path.length>t+1;){const t=i.maxOffset-n.offset;0!==t&&e.push(new vl(n,n.getShiftedBy(t))),n.path=n.path.slice(0,-1),n.offset++,i=i.parent}for(;n.path.length<=this.end.path.length;){const t=this.end.path[n.path.length-1],i=t-n.offset;0!==i&&e.push(new vl(n,n.getShiftedBy(i))),n.offset=t,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new fl(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new fl(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new fl(e);yield t.position;for(const n of t)yield n.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new vl(this.start,this.end)]}getTransformedByOperations(e){const t=[new vl(this.start,this.end)];for(const n of e)for(let e=0;e<t.length;e++){const i=t[e].getTransformedByOperation(n);t.splice(e,1,...i),e+=i.length-1}for(let n=0;n<t.length;n++){const e=t[n];for(let i=n+1;i<t.length;i++){const n=t[i];(e.containsRange(n)||n.containsRange(e)||e.isEqual(n))&&t.splice(i,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const n=e.sourcePosition,i=e.howMany,s=e.targetPosition;return this._getTransformedByMove(n,s,i,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let n=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(n=this.end.getShiftedBy(1)),t.root!=n.root&&(n=this.end.getShiftedBy(-1)),new vl(t,n)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new vl(this.start);let t=this.start._getTransformedByMergeOperation(e),n=this.end._getTransformedByMergeOperation(e);return t.root!=n.root&&(n=this.end.getShiftedBy(-1)),t.isAfter(n)?(e.sourcePosition.isBefore(e.targetPosition)?(t=gl._createAt(n),t.offset=0):(e.deletionPosition.isEqual(t)||(n=e.deletionPosition),t=e.targetPosition),new vl(t,n)):new vl(t,n)}_getTransformedByInsertion(e,t,n=!1){if(n&&this.containsPosition(e))return[new vl(this.start,e),new vl(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const n=new vl(this.start,this.end);return n.start=n.start._getTransformedByInsertion(e,t),n.end=n.end._getTransformedByInsertion(e,t),[n]}}_getTransformedByMove(e,t,n,i=!1){if(this.isCollapsed){const i=this.start._getTransformedByMove(e,t,n);return[new vl(i)]}const s=vl._createFromPositionAndShift(e,n),o=t._getTransformedByDeletion(e,n);if(this.containsPosition(t)&&!i&&(s.containsPosition(this.start)||s.containsPosition(this.end))){const i=this.start._getTransformedByMove(e,t,n),s=this.end._getTransformedByMove(e,t,n);return[new vl(i,s)]}let r;const a=this.getDifference(s);let l=null;const c=this.getIntersection(s);if(1==a.length?l=new vl(a[0].start._getTransformedByDeletion(e,n),a[0].end._getTransformedByDeletion(e,n)):2==a.length&&(l=new vl(this.start,this.end._getTransformedByDeletion(e,n))),r=l?l._getTransformedByInsertion(o,n,null!==c||i):[],c){const e=new vl(c.start._getCombined(s.start,o),c.end._getCombined(s.start,o));2==r.length?r.splice(1,0,e):r.push(e)}return r}_getTransformedByDeletion(e,t){let n=this.start._getTransformedByDeletion(e,t),i=this.end._getTransformedByDeletion(e,t);return null==n&&null==i?null:(null==n&&(n=e),null==i&&(i=e),new vl(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}static _createIn(e){return new this(gl._createAt(e,0),gl._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(gl._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new bs("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>
8e.start.isAfter(t.start)?1:-1);const n=e.indexOf(t),i=new this(t.start,t.end);for(let s=n-1;s>=0&&e[s].end.isEqual(i.start);s--)i.start=gl._createAt(e[s].start);for(let s=n+1;s<e.length&&e[s].start.isEqual(i.end);s++)i.end=gl._createAt(e[s].end);return i}static fromJSON(e,t){return new this(gl.fromJSON(e.start,t),gl.fromJSON(e.end,t))}}vl.prototype.is=function(e){return"range"===e||"model:range"===e};class kl extends(Ts()){_modelToViewMapping=new WeakMap;_viewToModelMapping=new WeakMap;_viewToModelLengthCallbacks=new Map;_markerNameToElements=new Map;_elementToMarkerNames=new Map;_deferredBindingRemovals=new Map;_unboundMarkerNames=new Set;constructor(){super(),this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);if(!n)throw new bs("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),i=this._viewToModelMapping.get(n),s=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=gl._createAt(i,s)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const n=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const i of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(i);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(n)==e&&this._modelToViewMapping.delete(n))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const n=this._markerNameToElements.get(t)||new Set;n.add(e);const i=this._elementToMarkerNames.get(e)||new Set;i.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,i)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),0==n.size&&this._markerNameToElements.delete(t));const i=this._elementToMarkerNames.get(e);i&&(i.delete(t),0==i.size&&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 vl(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new Hr(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const i of t)if(i.is("attributeElement"))for(const e of i.getElementsWithSameId())n.add(e);else n.add(i);return n}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,n){if(n!=e){return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let i=0;for(let s=0;s<t;s++)i+=this.getModelLength(e.getChild(s));return i}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name)){return this._viewToModelLengthCallbacks.get(e.name)(e)}if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const n of e.getChildren())t+=this.getModelLength(n);return t}}findPositionIn(e,t){let n,i=0,s=0,o=0;if(e.is("$text"))return new jr(e,t);for(;s<t;)n=e.getChild(o),i=this.getModelLength(n),s+=i,o++;return s==t?this._moveViewPositionToTextNode(new jr(e,o)):this.findPositionIn(n,t-(s-i))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,n=e.nodeAfter;return t instanceof Ar?new jr(t,t.data.length):n instanceof Ar?new jr(n,0):e}}class Cl{_consumable=new Map;_textProxyRegistry=new Map;
8add(e,t){t=xl(t),e instanceof ul&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=xl(t),e instanceof ul&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=xl(t),e instanceof ul&&(e=this._getSymbolForTextProxy(e));const n=this._consumable.get(e);if(void 0===n)return null;const i=n.get(t);return void 0===i?null:i}revert(e,t){t=xl(t),e instanceof ul&&(e=this._getSymbolForTextProxy(e));const n=this.test(e,t);return!1===n?(this._consumable.get(e).set(t,!0),!0):!0!==n&&null}verifyAllConsumed(e){const t=[];for(const[n,i]of this._consumable)for(const[s,o]of i){const i=s.split(":")[0];o&&e==i&&t.push({event:s,item:n.name||n.description})}if(t.length)throw new bs("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const n=this._textProxyRegistry.get(e.startOffset);if(n){const i=n.get(e.endOffset);i&&(t=i.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,n=e.endOffset,i=e.parent,s=Symbol("$textProxy:"+e.data);let o,r;return o=this._textProxyRegistry.get(t),o||(o=new Map,this._textProxyRegistry.set(t,o)),r=o.get(n),r||(r=new Map,o.set(n,r)),r.set(i,s),s}}function xl(e){const t=e.split(":");return"insert"==t[0]?t[0]:"addMarker"==t[0]||"removeMarker"==t[0]?e:t.length>1?t[0]+":"+t[1]:t[0]}class Al extends(Ts()){_conversionApi;_firedEventsMap;constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,n){const i=this._createConversionApi(n,e.getRefreshedItems());for(const o of e.getMarkersToRemove())this._convertMarkerRemove(o.name,o.range,i);const s=this._reduceChanges(e.getChanges());for(const o of s)"insert"===o.type?this._convertInsert(vl._createFromPositionAndShift(o.position,o.length),i):"reinsert"===o.type?this._convertReinsert(vl._createFromPositionAndShift(o.position,o.length),i):"remove"===o.type?this._convertRemove(o.position,o.length,o.name,i):this._convertAttribute(o.range,o.attributeKey,o.attributeOldValue,o.attributeNewValue,i);i.mapper.flushDeferredBindings();for(const o of i.mapper.flushUnboundMarkerNames()){const e=t.get(o).getRange();this._convertMarkerRemove(o,e,i),this._convertMarkerAdd(o,e,i)}for(const o of e.getMarkersToAdd())this._convertMarkerAdd(o.name,o.range,i);i.consumable.verifyAllConsumed("insert")}convert(e,t,n,i={}){const s=this._createConversionApi(n,void 0,i);this._convertInsert(e,s);for(const[o,r]of t)this._convertMarkerAdd(o,r,s);s.consumable.verifyAllConsumed("insert")}convertSelection(e,t,n){const i=this._createConversionApi(n);this.fire("cleanSelection",{selection:e},i);const s=e.getFirstPosition().root;if(!i.mapper.toViewElement(s))return;const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(i.consumable,e,o),this.fire("selection",{selection:e},i),e.isCollapsed){for(const t of o)if(i.consumable.test(e,"addMarker:"+t.name)){const n=t.getRange();if(!Tl(e.getFirstPosition(),t,i.mapper))continue;const s={item:e,markerName:t.name,markerRange:n};this.fire(`addMarker:${t.name}`,s,i)}for(const t of e.getAttributeKeys())if(i.consumable.test(e,"attribute:"+t)){const n={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.fire(`attribute:${t}:$text`,n,i)}}}_convertInsert(e,t,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const i of Array.from(e.getWalker({shallow:!0})).map(El))this._testAndFire("insert",i,t)}_convertRemove(e,t,n,i){this.fire(`remove:${n}`,{position:e,length:t},i)}_convertAttribute(e,t,n,i,s){this._addConsumablesForRange(s.consumable,e,`attribute:${t}`);for(const o of e){const e={item:o.item,range:vl._createFromPositionAndShift(o.previousPosition,o.length),attributeKey:t,attributeOldValue:n,attributeNewValue:i};this._testAndFire(`attribute:${t}`,e,s)}}_convertReinsert(e,t){const n=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,n);for(const i of n.map(El))this._testAndFire("insert",{...i,reconversion:!0},t)}
8_convertMarkerAdd(e,t,n){if("$graveyard"==t.root.rootName)return;const i=`addMarker:${e}`;if(n.consumable.add(t,i),this.fire(i,{markerName:e,markerRange:t},n),n.consumable.consume(t,i)){this._addConsumablesForRange(n.consumable,t,i);for(const s of t.getItems()){if(!n.consumable.test(s,i))continue;const o={item:s,range:vl._createOn(s),markerName:e,markerRange:t};this.fire(i,o,n)}}}_convertMarkerRemove(e,t,n){"$graveyard"!=t.root.rootName&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},n)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const n of t){const t=n.item;if(null===e.test(t,"insert")){e.add(t,"insert");for(const n of t.getAttributeKeys())e.add(t,"attribute:"+n)}}return e}_addConsumablesForRange(e,t,n){for(const i of t.getItems())e.add(i,n);return e}_addConsumablesForSelection(e,t,n){e.add(t,"selection");for(const i of n)e.add(t,"addMarker:"+i.name);for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);return e}_testAndFire(e,t,n){const i=function(e,t){const n=t.item.is("element")?t.item.name:"$text";return`${e}:${n}`}(e,t),s=t.item.is("$textProxy")?n.consumable._getSymbolForTextProxy(t.item):t.item,o=this._firedEventsMap.get(n),r=o.get(s);if(r){if(r.has(i))return;r.add(i)}else o.set(s,new Set([i]));this.fire(i,t,n)}_testAndFireAddAttributes(e,t){const n={item:e,range:vl._createOn(e)};for(const i of n.item.getAttributeKeys())n.attributeKey=i,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(i),this._testAndFire(`attribute:${i}`,n,t)}_createConversionApi(e,t=new Set,n={}){const i={...this._conversionApi,consumable:new Cl,writer:e,options:n,convertItem:e=>this._convertInsert(vl._createOn(e),i),convertChildren:e=>this._convertInsert(vl._createIn(e),i,{doNotAddConsumables:!0}),convertAttributes:e=>this._testAndFireAddAttributes(e,i),canReuseView:e=>!t.has(i.mapper.toModelElement(e))};return this._firedEventsMap.set(i,new Map),i}}function Tl(e,t,n){const i=t.getRange(),s=Array.from(e.getAncestors());s.shift(),s.reverse();return!s.some(e=>{if(i.containsItem(e)){return!!n.toViewElement(e).getCustomProperty("addHighlight")}})}function El(e){return{item:e.item,range:vl._createFromPositionAndShift(e.previousPosition,e.length)}}class Pl extends(Ts(al)){_lastRangeBackward=!1;_attrs=new Map;_ranges=[];constructor(...e){super(),e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new vl(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 vl(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 vl(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,n,i]=e;if("object"==typeof n&&(i=n,n=void 0),null===t)this._setRanges([]);else if(t instanceof Pl)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof vl)this._setRanges([t],!!i&&!!i.backward);else if(t instanceof gl)this._setRanges([new vl(t)]);else if(t instanceof ll){const e=!!i&&!!i.backward;let s;if("in"==n)s=vl._createIn(t);else if("on"==n)s=vl._createOn(t);else{if(void 0===n)throw new bs("model-selection-setto-required-second-parameter",[this,t]);s=new vl(gl._createAt(t,n))}this._setRanges([s],e)}else{if(!Zs(t))throw new bs("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,i&&!!i.backward)}}_setRanges(e,t=!1){const n=Array.from(e),i=n.some(t=>{if(!(t instanceof vl))throw new bs("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});(n.length!==this._ranges.length||i)&&(this._replaceAllRanges(n),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(null===this.anchor)throw new bs("model-selection-setfocus-no-ranges",[this,e]);const n=gl._createAt(e,t);if("same"==n.compareWith(this.focus))return;const i=this.anchor;this._ranges.length&&this._popRange(),"before"==n.compareWith(i)?(this._pushRange(new vl(n,i)),this._lastRangeBackward=!0):(this._pushRange(new vl(i,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const n=Ol(t.start,e);Ml(n,t)&&(yield n);for(const s of t.getWalker()){const n=s.item;"elementEnd"==s.type&&Rl(n,e,t)&&(yield n)}const i=Ol(t.end,e);Vl(i,t)&&(yield i)}}containsEntireContent(e=this.anchor.root){const t=gl._createAt(e,0),n=gl._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new vl(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new bs("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}
8_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function Sl(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Rl(e,t,n){return Sl(e,t)&&Il(e,n)}function Ol(e,t){const n=e.parent.root.document.model.schema,i=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let s=!1;const o=i.find(e=>!s&&(s=n.isLimit(e),!s&&Sl(e,t)));return i.forEach(e=>t.add(e)),o}function Il(e,t){const n=function(e){const t=e.root.document.model.schema;let n=e.parent;for(;n;){if(t.isBlock(n))return n;n=n.parent}}(e);if(!n)return!0;return!t.containsRange(vl._createOn(n),!0)}function Ml(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.start.isTouching(gl._createAt(e,e.maxOffset))&&Il(e,t))}function Vl(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.end.isTouching(gl._createAt(e,0))&&Il(e,t))}Pl.prototype.is=function(e){return"selection"===e||"model:selection"===e};class Bl extends(Ts(vl)){constructor(e,t){super(e,t),Dl.call(this)}detach(){this.stopListening()}toRange(){return new vl(this.start,this.end)}static fromRange(e){return new Bl(e.start,e.end)}}function Dl(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&Nl.call(this,n)},{priority:"low"})}function Nl(e){const t=this.getTransformedByOperation(e),n=vl._createFromRanges(t),i=!n.isEqual(this),s=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let o=null;if(i){"$graveyard"==n.root.rootName&&(o="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=n.start,this.end=n.end,this.fire("change:range",t,{deletionPosition:o})}else s&&this.fire("change:content",this.toRange(),{deletionPosition:o})}Bl.prototype.is=function(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e};const Fl="selection:";class Ll extends(Ts(al)){_selection;constructor(e){super(),this._selection=new $l(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Fl+e}static _isStoreAttributeKey(e){return e.startsWith(Fl)}}Ll.prototype.is=function(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e};class $l extends Pl{markers=new nr({idProperty:"name"});_model;_document;_attributePriority=new Map;_selectionRestorePosition=null;_hasChangedRange=!1;_overriddenGravityRegister=new Set;_observedMarkers=new Set;constructor(e){super(),this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&"marker"!=n.type&&"rename"!=n.type&&"noop"!=n.type&&(0==this._ranges.length&&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",()=>
8{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(e,t,n,i)=>{this._updateMarker(t,i)}),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const n=e.document.differ;for(const i of n.getChanges()){if("insert"!=i.type)continue;const n=i.position.parent;i.length===n.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(n.getAttributeKeys()).filter(e=>e.startsWith(Fl));for(const i of t)e.removeAttribute(i,n)})}}(this._model,t)})}get isCollapsed(){return 0===this._ranges.length?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 t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=gs();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new bs("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new bs("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Bl.fromRange(e);return t.on("change:range",(e,n,i)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=i.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const i of this._model.markers){const t=i.name.split(":",1)[0];if(!this._observedMarkers.has(t))continue;const n=i.getRange();for(const s of this.getRanges())n.containsRange(s,!s.isCollapsed)&&e.push(i)}const n=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=!0);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=!0);t&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateMarker(e,t){const n=e.name.split(":",1)[0];if(!this._observedMarkers.has(n))return;let i=!1;const s=Array.from(this.markers),o=this.markers.has(e);if(t){let n=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){n=!0;break}n&&!o?(this.markers.add(e),i=!0):!n&&o&&(this.markers.remove(e),i=!0)}else o&&(this.markers.remove(e),i=!0);i&&this.fire("change:marker",{oldMarkers:s,directChange:!1})}_updateAttributes(e){const t=cr(this._getSurroundingAttributes()),n=cr(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[s,o]of this._attributePriority)"low"==o&&(this._attrs.delete(s),this._attributePriority.delete(s));this._setAttributesTo(t);const i=[];for(const[s,o]of this.getAttributes())n.has(s)&&n.get(s)===o||i.push(s);for(const[s]of n)this.hasAttribute(s)||i.push(s);i.length>0&&this.fire("change:attribute",{attributeKeys:i,directChange:!1})}_setAttribute(e,t,n=!0){const i=n?"normal":"low";if("low"==i&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,i),!0)}
8_removeAttribute(e,t=!0){const n=t?"normal":"low";return("low"!=n||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,n),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[n,i]of this.getAttributes())e.get(n)!==i&&this._removeAttribute(n,!1);for(const[n,i]of e){this._setAttribute(n,i,!1)&&t.add(n)}return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith(Fl)){const n=t.substr(10);yield[n,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if("$graveyard"==e.root.rootName)return null;let n=null;if(this.isCollapsed){const i=e.textNode?e.textNode:e.nodeBefore,s=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=zl(i,t)),n||(n=zl(s,t)),!this.isGravityOverridden&&!n){let e=i;for(;e&&!n;)e=e.previousSibling,n=zl(e,t)}if(!n){let e=s;for(;e&&!n;)e=e.nextSibling,n=zl(e,t)}n||(n=this.getStoredAttributes())}else{const e=this.getFirstRange();for(const i of e){if(i.item.is("element")&&t.isObject(i.item)){n=zl(i.item,t);break}if("text"==i.type){n=i.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function zl(e,t){if(!e)return null;if(e instanceof ul||e instanceof hl)return e.getAttributes();if(!t.isInline(e))return null;if(!t.isObject(e))return[];const n=[];for(const[i,s]of e.getAttributes())t.checkAttribute("$text",i)&&!1!==t.getAttributeProperties(i).copyFromObject&&n.push([i,s]);return n}class jl{_dispatchers;constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}class Hl extends jl{elementToElement(e){return this.add(function(e){const t=ql(e.model),n=Kl(e.view,"container");t.attributes.length&&(t.children=!0);return i=>{i.on(`insert:${t.name}`,function(e,t=tc){return(n,i,s)=>{if(!t(i.item,s.consumable,{preflight:!0}))return;const o=e(i.item,s,i);if(!o)return;t(i.item,s.consumable);const r=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,o),s.writer.insert(r,o),s.convertAttributes(i.item),Xl(o,i.item.getChildren(),s,{reconversion:i.reconversion})}}(n,Yl(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&i.on("reduceChanges",Ql(t),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(e){const t=ql(e.model),n=Kl(e.view,"container");return t.children=!0,i=>{if(i._conversionApi.schema.checkChild(t.name,"$text"))throw new bs("conversion-element-to-structure-disallowed-text",i,{elementName:t.name});var s,o;i.on(`insert:${t.name}`,(s=n,o=Yl(t),(e,t,n)=>{if(!o(t.item,n.consumable,{preflight:!0}))return;const i=new Map;n.writer._registerSlotFactory(function(e,t,n){return(i,s)=>{const o=i.createContainerElement("$slot");let r=null;if("children"===s)r=Array.from(e.getChildren());else{if("function"!=typeof s)throw new bs("conversion-slot-mode-unknown",n.dispatcher,{modeOrFilter:s});r=Array.from(e.getChildren()).filter(e=>s(e))}return t.set(o,r),o}}(t.item,i,n));const r=s(t.item,n,t);if(n.writer._clearSlotFactory(),!r)return;!function(e,t,n){const i=Array.from(t.values()).flat(),s=new Set(i);if(s.size!=i.length)throw new bs("conversion-slot-filter-overlap",n.dispatcher,{element:e});if(s.size!=e.childCount)throw new bs("conversion-slot-filter-incomplete",n.dispatcher,{element:e})}(t.item,i,n),o(t.item,n.consumable);const a=n.mapper.toViewPosition(t.range.start);n.mapper.bindElements(t.item,r),n.writer.insert(a,r),n.convertAttributes(t.item),function(e,t,n,i){n.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of t)Xl(e,o,n,i),n.writer.move(n.writer.createRangeIn(s),n.writer.createPositionBefore(s)),n.writer.remove(s);function r(e,t){const n=t.modelPosition.nodeAfter,i=o.indexOf(n);i<0||(t.viewPosition=t.mapper.findPositionIn(s,i))}n.mapper.off("modelToViewPosition",r)}(r,i,n,{reconversion:t.reconversion})}),{priority:e.converterPriority||"normal"}),i.on("reduceChanges",Ql(t),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(e){e=hi(e);let t=e.model;"string"==typeof t&&(t={key:t});let n=`attribute:${t.key}`;t.name&&(n+=":"+t.name);if(t.values)for(const s of t.values)e.view[s]=Kl(e.view[s],"attribute");else e.view=Kl(e.view,"attribute");const i=Gl(e);return t=>{t.on(n,function(e){return(t,n,i)=>{if(!i.consumable.test(n.item,t.name))return;const s=e(n.attributeOldValue,i,n),o=e(n.attributeNewValue,i,n);if(!s&&!o)return;i.consumable.consume(n.item,t.name);const r=i.writer,a=r.document.selection;if(n.item instanceof Pl||n.item instanceof Ll)r.wrap(a.getFirstRange(),o);else{let e=i.mapper.toViewRange(n.range);null!==n.attributeOldValue&&s&&(e=r.unwrap(e,s)),null!==n.attributeNewValue&&o&&r.wrap(e,o)}}}(i),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=hi(e);let t=e.model;"string"==typeof t&&(t={key:t});let n=`attribute:${t.key}`;t.name&&(n+=":"+t.name);if(t.values)for(const s of t.values)e.view[s]=Jl(e.view[s]);else e.view=Jl(e.view);const i=Gl(e);return t=>{var s;t.on(n,(s=i,(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;const i=s(t.attributeOldValue,n,t),o=s(t.attributeNewValue,n,t);if(!i&&!o)return;n.consumable.consume(t.item,e.name);const r=n.mapper.toViewElement(t.item),a=n.writer;if(!r)throw new bs("conversion-attribute-to-attribute-on-text",n.dispatcher,t);if(null!==t.attributeOldValue&&i)if("class"==i.key){const e="string"==typeof i.value?i.value.split(/\s+/):i.value;for(const t of e)a.removeClass(t,r)}else if("style"==i.key)if("string"==typeof i.value){const e=new Rr(a.document.stylesProcessor);e.setTo(i.value);for(const[t]of e.getStylesEntries())a.removeStyle(t,r)}else{const e=Object.keys(i.value);for(const t of e)a.removeStyle(t,r)}else a.removeAttribute(i.key,r);if(null!==t.attributeNewValue&&o)if("class"==o.key){const e="string"==typeof o.value?o.value.split(/\s+/):o.value;for(const t of e)a.addClass(t,r)}else if("style"==o.key)if("string"==typeof o.value){const e=new Rr(a.document.stylesProcessor);e.setTo(o.value);for(const[t,n]of e.getStylesEntries())a.setStyle(t,n,r)}else{const e=Object.keys(o.value);for(const t of e)a.setStyle(t,o.value[t],r)}else a.setAttribute(o.key,o.value,r)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){const t=Kl(e.view,"ui");return n=>{var i;n.on(`addMarker:${e.model}`,(i=t,(e,t,n)=>{t.isOpening=!0;const s=i(t,n);t.isOpening=!1;const o=i(t,n);if(!s||!o)return;const r=t.markerRange;if(r.isCollapsed&&!n.consumable.consume(r,e.name))return;for(const i of r)if(!n.consumable.consume(i.item,e.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(r.start),s),n.mapper.bindElementToMarker(s,t.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),o),n.mapper.bindElementToMarker(o,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),n.on(`removeMarker:${e.model}`,(e,t,n)=>{const i=n.mapper.markerNameToElements(t.markerName);if(i){for(const e of i)n.mapper.unbindElementFromMarkerName(e,t.markerName),n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(t.markerName),e.stop()}},{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var n;t.on(`addMarker:${e.model}`,(n=e.view,(e,t,i)=>{if(!t.item)return;if(!(t.item instanceof Pl||t.item instanceof Ll||t.item.is("$textProxy")))return;
8const s=Zl(n,t,i);if(!s)return;if(!i.consumable.consume(t.item,e.name))return;const o=i.writer,r=Wl(o,s),a=o.document.selection;if(t.item instanceof Pl||t.item instanceof Ll)o.wrap(a.getFirstRange(),r);else{const e=i.mapper.toViewRange(t.range),n=o.wrap(e,r);for(const s of n.getItems())if(s.is("attributeElement")&&s.isSimilar(r)){i.mapper.bindElementToMarker(s,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,function(e){return(t,n,i)=>{if(!n.item)return;if(!(n.item instanceof dl))return;const s=Zl(e,n,i);if(!s)return;if(!i.consumable.test(n.item,t.name))return;const o=i.mapper.toViewElement(n.item);if(o&&o.getCustomProperty("addHighlight")){i.consumable.consume(n.item,t.name);for(const e of vl._createIn(n.item))i.consumable.consume(e.item,t.name);o.getCustomProperty("addHighlight")(o,s,i.writer),i.mapper.bindElementToMarker(o,n.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,function(e){return(t,n,i)=>{if(n.markerRange.isCollapsed)return;const s=Zl(e,n,i);if(!s)return;const o=Wl(i.writer,s),r=i.mapper.markerNameToElements(n.markerName);if(r){for(const e of r)if(i.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("attributeElement"))i.writer.unwrap(i.writer.createRangeOn(e),o);else{e.getCustomProperty("removeHighlight")(e,s.id,i.writer)}i.writer.clearClonedElementsGroup(n.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){e=hi(e);const t=e.model;let n=e.view;n||(n=n=>({group:t,name:n.substr(e.model.length+1)}));return i=>{var s;i.on(`addMarker:${t}`,(s=n,(e,t,n)=>{const i=s(t.markerName,n);if(!i)return;const o=t.markerRange;n.consumable.consume(o,e.name)&&(Ul(o,!1,n,t,i),Ul(o,!0,n,t,i),e.stop())}),{priority:e.converterPriority||"normal"}),i.on(`removeMarker:${t}`,function(e){return(t,n,i)=>{const s=e(n.markerName,i);if(!s)return;const o=i.mapper.markerNameToElements(n.markerName);if(o){for(const e of o)i.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("containerElement")?(r(`data-${s.group}-start-before`,e),r(`data-${s.group}-start-after`,e),r(`data-${s.group}-end-before`,e),r(`data-${s.group}-end-after`,e)):i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(n.markerName),t.stop()}function r(e,t){if(t.hasAttribute(e)){const n=new Set(t.getAttribute(e).split(","));n.delete(s.name),0==n.size?i.writer.removeAttribute(e,t):i.writer.setAttribute(e,Array.from(n).join(","),t)}}}}(n),{priority:e.converterPriority||"normal"})}}(e))}}function Wl(e,t){const n=e.createAttributeElement("span",t.attributes);return t.classes&&n._addClass(t.classes),"number"==typeof t.priority&&(n._priority=t.priority),n._id=t.id,n}function Ul(e,t,n,i,s){const o=t?e.start:e.end,r=o.nodeAfter&&o.nodeAfter.is("element")?o.nodeAfter:null,a=o.nodeBefore&&o.nodeBefore.is("element")?o.nodeBefore:null;if(r||a){let e,o;t&&r||!t&&!a?(e=r,o=!0):(e=a,o=!1);const l=n.mapper.toViewElement(e);if(l)return void function(e,t,n,i,s,o){const r=`data-${o.group}-${t?"start":"end"}-${n?"before":"after"}`,a=e.hasAttribute(r)?e.getAttribute(r).split(","):[];a.unshift(o.name),i.writer.setAttribute(r,a.join(","),e),i.mapper.bindElementToMarker(e,s.markerName)}(l,t,o,n,i,s)}!function(e,t,n,i,s){const o=`${s.group}-${t?"start":"end"}`,r=s.name?{name:s.name}:null,a=n.writer.createUIElement(o,r);n.writer.insert(e,a),n.mapper.bindElementToMarker(a,i.markerName)}(n.mapper.toViewPosition(o),t,n,i,s)}function ql(e){return"string"==typeof e&&(e={name:e}),{name:e.name,attributes:e.attributes?Xo(e.attributes):[],children:!!e.children}}function Kl(e,t){return"function"==typeof e?e:(n,i)=>function(e,t,n){"string"==typeof e&&(e={name:e});let i;const s=t.writer,o=Object.assign({},e.attributes);if("container"==n)i=s.createContainerElement(e.name,o);else if("attribute"==n){const t={priority:e.priority||ta.DEFAULT_PRIORITY};i=s.createAttributeElement(e.name,o,t)}else i=s.createUIElement(e.name,o);if(e.styles){const t=Object.keys(e.styles);for(const n of t)s.setStyle(n,e.styles[n],i)}if(e.classes){const t=e.classes;if("string"==typeof t)s.addClass(t,i);else for(const e of t)s.addClass(e,i)}return i}(e,i,t)}function Gl(e){return e.model.values?(t,n,i)=>{const s=e.view[t];return s?s(t,n,i):null}:e.view}function Jl(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function Zl(e,t,n){const i="function"==typeof e?e(t,n):e;return i?(i.priority||(i.priority=10),i.id||(i.id=t.markerName),i):null}function Ql(e){const t=function(e){return(t,n)=>{if(!t.is("element",e.name))return!1;if("attribute"==n.type){if(e.attributes.includes(n.attributeKey))return!0}else if(e.children)return!0;return!1}}(e);return(e,n)=>{const i=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const s of n.changes){const e="attribute"==s.type?s.range.start.nodeAfter:s.position.parent;if(e&&t(e,s)){if(!n.reconvertedElements.has(e)){n.reconvertedElements.add(e);const t=gl._createBefore(e);let s=i.length;for(let e=i.length-1;e>=0;e--){const n=i[e],o=("attribute"==n.type?n.range.start:n.position).c
8ompareWith(t);if("before"==o||"remove"==n.type&&"same"==o)break;s=e}i.splice(s,0,{type:"remove",name:e.name,position:t,length:1},{type:"reinsert",name:e.name,position:t,length:1})}}else i.push(s)}n.changes=i}}function Yl(e){return(t,n,i={})=>{const s=["insert"];for(const o of e.attributes)t.hasAttribute(o)&&s.push(`attribute:${o}`);return!!s.every(e=>n.test(t,e))&&(i.preflight||s.forEach(e=>n.consume(t,e)),!0)}}function Xl(e,t,n,i){for(const s of t)ec(e.root,s,n,i)||n.convertItem(s)}function ec(e,t,n,i){const{writer:s,mapper:o}=n;if(!i.reconversion)return!1;const r=o.toViewElement(t);return!(!r||r.root==e)&&(!!n.canReuseView(r)&&(s.move(s.createRangeOn(r),o.toViewPosition(gl._createBefore(t))),!0))}function tc(e,t,{preflight:n}={}){return n?t.test(e,"insert"):t.consume(e,"insert")}function nc(e){const{schema:t,document:n}=e.model;for(const i of n.getRoots())if(i.isEmpty&&!t.checkChild(i,"$text")&&t.checkChild(i,"paragraph"))return e.insertElement("paragraph",i),!0;return!1}function ic(e,t,n){const i=n.createContext(e);return!!n.checkChild(i,"paragraph")&&!!n.checkChild(i.push("paragraph"),t)}function sc(e,t){const n=t.createElement("paragraph");return t.insert(n,e),t.createPositionAt(n,0)}class oc extends jl{elementToElement(e){return this.add(rc(e))}elementToAttribute(e){return this.add(function(e){e=hi(e),cc(e);const t=hc(e,!1),n=ac(e.view),i=n?`element:${n}`:"element";return n=>{n.on(i,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=hi(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key,n=void 0===e.view.value?/[\s\S]*/:e.view.value;let i;if("class"==t||"style"==t){const e="class"==t?"classes":"styles";i={[e]:n}}else i={attributes:{[t]:n}};e.view.name&&(i.name=e.view.name);return e.view=i,t}(e));cc(e,t);const n=hc(e,!0);return t=>{t.on("element",n,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){const t=function(e){return(t,n)=>{const i="string"==typeof e?e:e(t,n);return n.writer.createElement("$marker",{"data-name":i})}}(e.model);return rc({...e,model:t})}(e))}dataToMarker(e){return this.add(function(e){e=hi(e),e.model||(e.model=t=>t?e.view+":"+t:e.view);const t={view:e.view,model:e.model},n=lc(uc(t,"start")),i=lc(uc(t,"end"));return s=>{s.on(`element:${e.view}-start`,n,{priority:e.converterPriority||"normal"}),s.on(`element:${e.view}-end`,i,{priority:e.converterPriority||"normal"});const o=ps.low,r=ps.highest,a=ps.get(e.converterPriority)/r;s.on("element",function(e){return(t,n,i)=>{const s=`data-${e.view}`;function o(t,s){for(const o of s){const s=e.model(o,i),r=i.writer.createElement("$marker",{"data-name":s});i.writer.insert(r,t),n.modelCursor.isEqual(t)?n.modelCursor=n.modelCursor.getShiftedBy(1):n.modelCursor=n.modelCursor._getTransformedByInsertion(t,1),n.modelRange=n.modelRange._getTransformedByInsertion(t,1)[0]}}(i.consumable.test(n.viewItem,{attributes:s+"-end-after"})||i.consumable.test(n.viewItem,{attributes:s+"-start-after"})||i.consumable.test(n.viewItem,{attributes:s+"-end-before"})||i.consumable.test(n.viewItem,{attributes:s+"-start-before"}))&&(n.modelRange||Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor)),i.consumable.consume(n.viewItem,{attributes:s+"-end-after"})&&o(n.modelRange.end,n.viewItem.getAttribute(s+"-end-after").split(",")),i.consumable.consume(n.viewItem,{attributes:s+"-start-after"})&&o(n.modelRange.end,n.viewItem.getAttribute(s+"-start-after").split(",")),i.consumable.consume(n.viewItem,{attributes:s+"-end-before"})&&o(n.modelRange.start,n.viewItem.getAttribute(s+"-end-before").split(",")),i.consumable.consume(n.viewItem,{attributes:s+"-start-before"})&&o(n.modelRange.start,n.viewItem.getAttribute(s+"-start-before").split(",")))}}(t),{priority:o+a})}}(e))}}function rc(e){const t=lc(e=hi(e)),n=ac(e.view),i=n?`element:${n}`:"element";return n=>{n.on(i,t,{priority:e.converterPriority||"normal"})}}function ac(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function lc(e){const t=new Er(e.view);return(n,i,s)=>{const o=t.match(i.viewItem);if(!o)return;const r=o.match;if(r.name=!0,!s.consumable.test(i.viewItem,r))return;const a=function(e,t,n){return e instanceof Function?e(t,n):n.writer.createElement(e)}(e.model,i.viewItem,s);a&&s.safeInsert(a,i.modelCursor)&&(s.consumable.consume(i.viewItem,r),s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i)
8)}}function cc(e,t=null){const n=null===t||(e=>e.getAttribute(t)),i="object"!=typeof e.model?e.model:e.model.key,s="object"!=typeof e.model||void 0===e.model.value?n:e.model.value;e.model={key:i,value:s}}function hc(e,t){const n=new Er(e.view);return(i,s,o)=>{if(!s.modelRange&&t)return;const r=n.match(s.viewItem);if(!r)return;if(!function(e,t){const n="function"==typeof e?e(t):e;if("object"==typeof n&&!ac(n))return!1;return!n.classes&&!n.attributes&&!n.styles}(e.view,s.viewItem)?delete r.match.name:r.match.name=!0,!o.consumable.test(s.viewItem,r.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(s.viewItem,o):e.model.value;if(null===l)return;s.modelRange||Object.assign(s,o.convertChildren(s.viewItem,s.modelCursor));const c=function(e,t,n,i){let s=!1;for(const o of Array.from(e.getItems({shallow:n})))i.schema.checkAttribute(o,t.key)&&(s=!0,o.hasAttribute(t.key)||i.writer.setAttribute(t.key,t.value,o));return s}(s.modelRange,{key:a,value:l},t,o);c&&(o.consumable.test(s.viewItem,{name:!0})&&(r.match.name=!0),o.consumable.consume(s.viewItem,r.match))}}function uc(e,t){return{view:`${e.view}-${t}`,model:(t,n)=>{const i=t.getAttribute("name"),s=e.model(i,n);return n.writer.createElement("$marker",{"data-name":s})}}}function dc(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.selection,i=t.schema,s=[];let o=!1;for(const r of n.getRanges()){const e=fc(r,i);e&&!e.isEqual(r)?(s.push(e),o=!0):s.push(r)}o&&e.setSelection(function(e){const t=[...e],n=new Set;let i=1;for(;i<t.length;){const e=t[i],s=t.slice(0,i);for(const[o,r]of s.entries())if(!n.has(o))if(e.isEqual(r))n.add(o);else if(e.isIntersecting(r)){n.add(o),n.add(i);const s=e.getJoined(r);t.push(s)}i++}return t.filter((e,t)=>!n.has(t))}(s),{backward:n.isBackward});return!1}(t,e))}function fc(e,t){return e.isCollapsed?function(e,t){const n=e.start,i=t.getNearestSelectionRange(n);if(!i){const e=n.getAncestors().reverse().find(e=>t.isObject(e));return e?vl._createOn(e):null}if(!i.isCollapsed)return i;const s=i.start;if(n.isEqual(s))return null;return new vl(s)}(e,t):function(e,t){const{start:n,end:i}=e,s=t.checkChild(n,"$text"),o=t.checkChild(i,"$text"),r=t.getLimitElement(n),a=t.getLimitElement(i);if(r===a){if(s&&o)return null;if(function(e,t,n){const i=e.nodeAfter&&!n.isLimit(e.nodeAfter)||n.checkChild(e,"$text"),s=t.nodeBefore&&!n.isLimit(t.nodeBefore)||n.checkChild(t,"$text");return i||s}(n,i,t)){const e=n.nodeAfter&&t.isSelectable(n.nodeAfter)?null:t.getNearestSelectionRange(n,"forward"),s=i.nodeBefore&&t.isSelectable(i.nodeBefore)?null:t.getNearestSelectionRange(i,"backward"),o=e?e.start:n,r=s?s.end:i;return new vl(o,r)}}
8const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=n.nodeAfter&&i.nodeBefore&&n.nodeAfter.parent===i.nodeBefore.parent,s=l&&(!e||!gc(n.nodeAfter,t)),o=c&&(!e||!gc(i.nodeBefore,t));let h=n,u=i;return s&&(h=gl._createBefore(mc(r,t))),o&&(u=gl._createAfter(mc(a,t))),new vl(h,u)}return null}(e,t)}function mc(e,t){let n=e,i=n;for(;t.isLimit(i)&&i.parent;)n=i,i=i.parent;return n}function gc(e,t){return e&&t.isSelectable(e)}class pc extends(zs()){model;view;mapper;downcastDispatcher;constructor(e,t){super(),this.model=e,this.view=new rl(t),this.mapper=new kl,this.downcastDispatcher=new Al({mapper:this.mapper,schema:e.schema});const n=this.model.document,i=n.selection,s=this.model.markers;var o,r,a;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(n,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(n.differ,s,e),this.downcastDispatcher.convertSelection(i,s,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(n,i)=>{const s=i.newSelection,o=[];for(const e of s.getRanges())o.push(t.toModelRange(e));const r=e.createSelection(o,{backward:s.isBackward});r.isEqual(e.document.selection)||e.change(e=>{e.setSelection(r)})}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(o=this.mapper,r=this.model.schema,a=this.view,(e,t)=>{if(!a.document.isComposing||ts.isAndroid)for(let n=0;n<t.targetRanges.length;n++){const e=t.targetRanges[n],i=o.toModelRange(e),s=fc(i,r);s&&!s.isEqual(i)&&(t.targetRanges[n]=o.toViewRange(s))}}),{priority:"high"}),this.downcastDispatcher.on("insert:$text",(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const i=n.writer,s=n.mapper.toViewPosition(t.range.start),o=i.createText(t.item.data);i.insert(s,o)},{priority:"lowest"}),this.downcastDispatcher.on("insert",(e,t,n)=>{n.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||n.convertChildren(t.item)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,n)=>{const i=n.mapper.toViewPosition(t.position),s=t.position.getShiftedBy(t.length),o=n.mapper.toViewPosition(s,{isPhantom:!0}),r=n.writer.createRange(i,o),a=n.writer.remove(r.getTrimmed());for(const l of n.writer.createRangeIn(a).getItems())n.mapper.unbindViewElement(l,{defer:!0})},{priority:"low"}),this.downcastDispatcher.on("cleanSelection",(e,t,n)=>{const i=n.writer,s=i.document.selection;for(const o of s.getRanges())o.isCollapsed&&o.end.parent.isAttached()&&n.writer.mergeAttributes(o.start);i.setSelection(null)}),this.downcastDispatcher.on("selection",(e,t,n)=>{const i=t.selection;if(i.isCollapsed)return;if(!n.consumable.consume(i,"selection"))return;const s=[];for(const o of i.getRanges())s.push(n.mapper.toViewRange(o));n.writer.setSelection(s,{backward:i.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const i=t.selection;if(!i.isCollapsed)return;if(!n.consumable.consume(i,"selection"))return;const s=n.writer,o=i.getFirstPosition(),r=n.mapper.toViewPosition(o),a=s.breakAttributes(r);s.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new $r(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t="string"==typeof e?e:e.name,n=this.model.markers.get(t);if(!n)throw new bs("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(n)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}class wc{_consumables=new Map;add(e,t){let n;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?n=this._consumables.get(e):(n=new _c(e),this._consumables.set(e,n)),n.add(t))}test(e,t){const n=this._consumables.get(e);return void 0===n?null:e.is("$text")||e.is("documentFragment")?n:n.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).
8consume(t),!0)}revert(e,t){const n=this._consumables.get(e);void 0!==n&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const o of n)"style"!=o&&"class"!=o&&t.attributes.push(o);const i=e.getClassNames();for(const o of i)t.classes.push(o);const s=e.getStyleNames();for(const o of s)t.styles.push(o);return t}static createFrom(e,t){if(t||(t=new wc),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,wc.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=wc.createFrom(n,t);return t}}const bc=["attributes","classes","styles"];class _c{element;_canConsumeName;_consumables;constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of bc)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of bc)if(t in e){const n=this._test(t,e[t]);if(!0!==n)return n}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of bc)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of bc)t in e&&this._revert(t,e[t])}_add(e,t){const n=Xo(t),i=this._consumables[e];for(const s of n){if("attributes"===e&&("class"===s||"style"===s))throw new bs("viewconsumable-invalid-attribute",this);if(i.set(s,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(s))i.set(e,!0)}}_test(e,t){const n=Xo(t),i=this._consumables[e];for(const s of n)if("attributes"!==e||"class"!==s&&"style"!==s){const e=i.get(s);if(void 0===e)return null;if(!e)return!1}else{const e="class"==s?"classes":"styles",t=this._test(e,[...this._consumables[e].keys()]);if(!0!==t)return t}return!0}_consume(e,t){const n=Xo(t),i=this._consumables[e];for(const s of n)if("attributes"!==e||"class"!==s&&"style"!==s){if(i.set(s,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(s))i.set(e,!1)}else{const e="class"==s?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const n=Xo(t),i=this._consumables[e];for(const s of n)if("attributes"!==e||"class"!==s&&"style"!==s){!1===i.get(s)&&i.set(s,!0)}else{const e="class"==s?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class yc extends(zs()){_sourceDefinitions={};_attributeProperties=Object.create(null);_customChildChecks=new Map;_customAttributeChecks=new Map;_genericCheckSymbol=Symbol("$generic");_compiledDefinitions;constructor(){super(),this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new vc(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new vc(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new bs("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 bs("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 t="string"==typeof e?e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?"$text":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)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!!t&&!(!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!!t&&!(!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(e,t)}checkAttribute(e,t){const n=this.getDefinition(e.last);if(!n)return!1;const i=this._evaluateAttributeChecks(e,t);return void 0!==i?i:n.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof gl){const t=e.nodeBefore,n=e.nodeAfter;if(!(t instanceof dl))throw new bs("schema-check-merge-no-element-before",this);if(!(n instanceof dl))throw new bs("schema-check-merge-no-element-after",this);return this.checkMerge(t,n)}if(this.isLimit(e)||this.isLimit(t))return!1;for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e,t){const n=void 0!==t?t:this._genericCheckSymbol,i=this._customChildChecks.get(n)||[];
8i.push(e),this._customChildChecks.set(n,i)}addAttributeCheck(e,t){const n=void 0!==t?t:this._genericCheckSymbol,i=this._customAttributeChecks.get(n)||[];i.push(e),this._customAttributeChecks.set(n,i)}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;if(e instanceof gl)t=e.parent;else{t=(e instanceof vl?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const n=t.getCommonAncestor();return e?e.getCommonAncestor(n,{includeSelf:!0}):n},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const n=[...e.getFirstPosition().getAncestors(),new hl("",e.getAttributes())];return this.checkAttribute(n,t)}{const n=e.getRanges();for(const e of n)for(const n of e)if(this.checkAttribute(n.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if("$graveyard"==e.root.rootName)return null;if(this.checkChild(e,"$text"))return new vl(e);let n,i;const s=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(n=new fl({boundaries:vl._createIn(s),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(i=new fl({boundaries:vl._createIn(s),startPosition:e}));for(const o of function*(e,t){let n=!1;for(;!n;){if(n=!0,e){const t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}}}(n,i)){const e=o.walker==n?"elementEnd":"elementStart",t=o.value;if(t.type==e&&this.isObject(t.item))return vl._createOn(t.item);if(this.checkChild(t.nextPosition,"$text"))return new vl(t.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}setAllowedAttributes(e,t,n){const i=n.model;for(const[s,o]of Object.entries(t))i.schema.checkAttribute(e,s)&&n.setAttribute(s,o,e)}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("$text"))Vc(this,n,t);else{const e=vl._createIn(n).getPositions();for(const n of e){Vc(this,n.nodeBefore||n.parent,t)}}}getAttributesWithProperty(e,t,n){const i={};for(const[s,o]of e.getAttributes()){const e=this.getAttributeProperties(s);void 0!==e[t]&&(void 0!==n&&n!==e[t]||(i[s]=o))}return i}createContext(e){return new vc(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const s of n)e[s]=kc(t[s],s);const i=Object.values(e);for(const s of i)Cc(e,s),xc(e,s),Ac(e,s),Tc(e,s);for(const s of i)Ec(e,s);for(const s of i)Pc(e,s);for(const s of i)Sc(e,s);for(const s of i)Rc(e,s);for(const s of i)Oc(e,s);this._compiledDefinitions=function(e){const t={};for(const n of Object.values(e))t[n.name]={name:n.name,isBlock:!!n.isBlock,isContent:!!n.isContent,isInline:!!n.isInline,isLimit:!!n.isLimit,isObject:!!n.isObject,isSelectable:!!n.isSelectable,allowIn:Array.from(n.allowIn).filter(t=>!!e[t]),allowChildren:Array.from(n.allowChildren).filter(t=>!!e[t]),allowAttributes:Array.from(n.allowAttributes)};return t}(e)}_checkContextMatch(e,t){const n=e.last;let i=this._evaluateChildChecks(e,t);if(i=void 0!==i?i:t.allowIn.includes(n.name),!i)return!1;const s=this.getDefinition(n),o=e.trimLast();return!!s&&(0==o.length||this._checkContextMatch(o,s))}_evaluateChildChecks(e,t){const n=this._customChildChecks.get(this._genericCheckSymbol)||[],i=this._customChildChecks.get(t.name)||[];for(const s of[...n,...i]){const n=s(e,t);if(void 0!==n)return n}}_evaluateAttributeChecks(e,t){const n=this._customAttributeChecks.get(this._genericCheckSymbol)||[],i=this._customAttributeChecks.get(t)||[];for(const s of[...n,...i]){const n=s(e,t);if(void 0!==n)return n}}*_getValidRangesForRange(e,t){let n=e.start,i=e.start;for(const s of e.getItems({shallow:!0}))s.is("element")&&(yield*this._getValidRangesForRange(vl._createIn(s),t)),this.checkAttribute(s,t)||(n.isEqual(i)||(yield new vl(n,i)),n=gl._createAfter(s)),i=gl._createAfter(s);n.isEqual(i)||(yield new vl(n,i))}findOptimalInsertionRange(e,t){const n=e.getSelectedElement();if(n&&this.isObject(n)&&!this.isInline(n))return"before"==t||"after"==t?new vl(gl._createAt(n,t)):vl._createOn(n);
8const i=ir(e.getSelectedBlocks());if(!i)return new vl(e.focus);if(i.isEmpty)return new vl(gl._createAt(i,0));const s=gl._createAfter(i);return e.focus.isTouching(s)?new vl(s):new vl(gl._createBefore(i))}}class vc{_items;constructor(e){if(e instanceof vc)return e;let t;t="string"==typeof e?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map(Mc)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new vc([e]);return t._items=[...this._items,...t._items],t}trimLast(){const e=new vc([]);return e._items=this._items.slice(0,-1),e}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function kc(e,t){const n={name:t,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 function(e,t){for(const n of e){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const i of e)t[i]=!!n[i]}}(e,n),Ic(e,n,"allowIn"),Ic(e,n,"allowChildren"),Ic(e,n,"disallowIn"),Ic(e,n,"disallowChildren"),Ic(e,n,"allowContentOf"),Ic(e,n,"allowWhere"),Ic(e,n,"allowAttributes"),Ic(e,n,"disallowAttributes"),Ic(e,n,"allowAttributesOf"),Ic(e,n,"inheritTypesFrom"),function(e,t){for(const n of e){const e=n.inheritAllFrom;e&&(t.allowContentOf.add(e),t.allowWhere.add(e),t.allowAttributesOf.add(e),t.inheritTypesFrom.add(e))}}(e,n),n}function Cc(e,t){for(const n of t.allowIn){const i=e[n];i?i.allowChildren.add(t.name):t.allowIn.delete(n)}}function xc(e,t){for(const n of t.allowChildren){const i=e[n];i?i.allowIn.add(t.name):t.allowChildren.delete(n)}}function Ac(e,t){for(const n of t.disallowIn){const i=e[n];i?i.disallowChildren.add(t.name):t.disallowIn.delete(n)}}function Tc(e,t){for(const n of t.disallowChildren){const i=e[n];i?i.disallowIn.add(t.name):t.disallowChildren.delete(n)}}function Ec(e,t){for(const n of t.disallowChildren)t.allowChildren.delete(n);for(const n of t.disallowIn)t.allowIn.delete(n);for(const n of t.disallowAttributes)t.allowAttributes.delete(n)}function Pc(e,t){for(const n of t.allowContentOf){const i=e[n];i&&(i.disallowChildren.forEach(n=>{t.allowChildren.has(n)||(t.disallowChildren.add(n),e[n].disallowIn.add(t.name))}),i.allowChildren.forEach(n=>{t.disallowChildren.has(n)||(t.allowChildren.add(n),e[n].allowIn.add(t.name))}))}}function Sc(e,t){for(const n of t.allowWhere){const i=e[n];i&&(i.disallowIn.forEach(n=>{t.allowIn.has(n)||(t.disallowIn.add(n),e[n].disallowChildren.add(t.name))}),i.allowIn.forEach(n=>{t.disallowIn.has(n)||(t.allowIn.add(n),e[n].allowChildren.add(t.name))}))}}function Rc(e,t){for(const n of t.allowAttributesOf){const i=e[n];if(!i)return;i.allowAttributes.forEach(e=>{t.disallowAttributes.has(e)||t.allowAttributes.add(e)})}}function Oc(e,t){for(const n of t.inheritTypesFrom){const i=e[n];if(i){const e=Object.keys(i).filter(e=>e.startsWith("is"));for(const n of e)n in t||(t[n]=i[n])}}}function Ic(e,t,n){for(const i of e){let e=i[n];"string"==typeof e&&(e=[e]),Array.isArray(e)&&e.forEach(e=>t[n].add(e))}}function Mc(e){return"string"==typeof e||e.is("documentFragment")?{name:"string"==typeof e?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function Vc(e,t,n){for(const i of t.getAttributeKeys())e.checkAttribute(t,i)||n.removeAttribute(i,t)}class Bc extends(Ts()){conversionApi;_splitParts=new Map;_cursorParents=new Map;_modelCursor=null;_emptyElementsToKeep=new Set;constructor(e){super(),this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(e,t)=>this._convertItem(e,t),convertChildren:(e,t)=>this._convertChildren(e,t),safeInsert:(e,t)=>this._safeInsert(e,t),updateConversionResult:(e,t)=>this._updateConversionResult(e,t),splitToAllowedParent:(e,t)=>
8this._splitToAllowedParent(e,t),getSplitParts:e=>this._getSplitParts(e),keepEmptyElement:e=>this._keepEmptyElement(e)}}convert(e,t,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let n;for(const i of new vc(e)){const e={};for(const t of i.getAttributeKeys())e[t]=i.getAttribute(t);const s=t.createElement(i.name,e);n&&t.insert(s,n),n=gl._createAt(s,0)}return n}(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=wc.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),s=t.createDocumentFragment();if(i){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,s);s.markers=function(e,t){const n=new Set,i=new Map,s=vl._createIn(e).getItems();for(const o of s)o.is("element","$marker")&&n.add(o);for(const o of n){const e=o.getAttribute("data-name"),n=t.createPositionBefore(o);i.has(e)?i.get(e).end=n.clone():i.set(e,new vl(n.clone())),t.remove(o)}return i}(s,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,s}_convertItem(e,t){const n={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,n,this.conversionApi):e.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof vl))throw new bs("view-conversion-dispatcher-incorrect-result",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is("position")?t:gl._createAt(t,0);const i=new vl(n);for(const s of Array.from(e.getChildren())){const e=this._convertItem(s,n);e.modelRange instanceof vl&&(i.end=e.modelRange.end,n=e.modelCursor)}return{modelRange:i,modelCursor:n}}_safeInsert(e,t){const n=this._splitToAllowedParent(e,t);return!!n&&(this.conversionApi.writer.insert(e,n.position),!0)}_updateConversionResult(e,t){const n=this._getSplitParts(e),i=this.conversionApi.writer;t.modelRange||(t.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(n[n.length-1])));const s=this._cursorParents.get(e);t.modelCursor=s?i.createPositionAt(s,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:n,writer:i}=this.conversionApi;let s=n.findAllowedParent(t,e);if(s){if(s===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(s)&&(s=null)}if(!s)return ic(t,e,n)?{position:sc(t,i)}:null;const o=this.conversionApi.writer.split(t,s),r=[];for(const l of o.range.getWalker())if("elementEnd"==l.type)r.push(l.item);else{const e=r.pop(),t=l.item;this._registerSplitPair(e,t)}const a=o.range.end.parent;return this._cursorParents.set(e,a),{position:o.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}class Dc{getHtml(e){const t=Yi.document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Nc{domParser;domConverter;htmlWriter;skipComments=!0;constructor(e){this.domParser=new DOMParser,this.domConverter=new za(e,{renderingMode:"data"}),this.htmlWriter=new Dc}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4))||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),i=t.body.childNodes;for(;i.length>0;)n.appendChild(i[0]);return n}}class Fc extends(Ts()){model;mapper;downcastDispatcher;upcastDispatcher;viewDocument;stylesProcessor;htmlProcessor;processor;_viewWriter;constructor(e,t){super(),this.model=e,this.mapper=new kl,this.downcastDispatcher=new Al({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const i=n.writer,s=n.mapper.toViewPosition(t.range.start),o=i.createText(t.item.data);i.insert(s,o)},{priority:"lowest"}),this.downcastDispatcher.on("insert",(e,t,n)=>{n.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||n.convertChildren(t.item)},{priority:"lowest"}),this.upcastDispatcher=new Bc({schema:e.schema}),this.viewDocument=new ea(t),this.stylesProcessor=t,this.htmlProcessor=new Nc(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new da(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:n,consumable:i,writer:s})=>{let o=t.modelCursor;if(!i.test(t.viewItem))return;if(!n.checkChild(o,"$text")){if(!ic(o,"$text",n))return;if(0==t.viewItem.data.trim().length)return;o=sc(o,s)}i.consume(t.viewItem);const r=s.createText(t.viewItem.data);s.insert(r,o),t.modelRange=s.createRange(o,o.getShiftedBy(r.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:i}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=i}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:i}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=i}},{priority:"lowest"}),zs().prototype.decorate.call(this,"init"),zs().prototype.decorate.call(this,"set"),zs().prototype.decorate.call(this,"get"),zs().prototype.decorate.call(this,"toView"),zs().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},nc)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:n="empty"}=e;if(!this._checkIfRootsExists([t]))throw new bs("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(t);return i.isAttached()||_s("datacontroller-get-detached-root",this),"empty"!==n||this.model.hasContent(i,{ignoreWhitespace
8s:!0})?this.stringify(i,e):""}stringify(e,t={}){const n=this.toView(e,t);return this.processor.toData(n)}toView(e,t={}){const n=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const s=vl._createIn(e),o=new ua(n);this.mapper.bindElements(e,o);const r=e.is("documentFragment")?e.markers:function(e){const t=[],n=e.root.document;if(!n)return new Map;const i=vl._createIn(e);for(const s of n.model.markers){const e=s.getRange(),n=e.isCollapsed,o=e.start.isEqual(i.start)||e.end.isEqual(i.end);if(n&&o)t.push([s.name,e]);else{const n=i.getIntersection(e);n&&t.push([s.name,n])}}return t.sort(([e,t],[n,i])=>{if("after"!==t.end.compareWith(i.start))return 1;if("before"!==t.start.compareWith(i.end))return-1;switch(t.start.compareWith(i.start)){case"before":return 1;case"after":return-1;default:switch(t.end.compareWith(i.end)){case"before":return 1;case"after":return-1;default:return n.localeCompare(e)}}}),new Map(t)}(e);return this.downcastDispatcher.convert(s,r,i,t),o}init(e){if(this.model.document.version)throw new bs("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new bs("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},e=>{for(const n of Object.keys(t)){const i=this.model.document.getRoot(n);e.insert(this.parse(t[n],i),i,0)}}),Promise.resolve()}set(e,t={}){let n={};if("string"==typeof e?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new bs("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const t of Object.keys(n)){const i=this.model.document.getRoot(t);e.remove(e.createRangeIn(i)),e.insert(this.parse(n[t],i),i,0)}})}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change(n=>this.upcastDispatcher.convert(e,n,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}class Lc{_helpers=new Map;_downcast;_upcast;constructor(e,t){this._downcast=Xo(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Xo(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new bs("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new bs("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of $c(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of $c(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of $c(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new bs("conversion-group-exists",this);const i=n?new Hl(t):new oc(t);this._helpers.set(e,i)}}function*$c(e){if(e.model.values)for(const t of e.model.values){const n={key:e.model.key,value:t},i=e.view[t],s=e.upcastAlso?e.upcastAlso[t]:void 0;yield*zc(n,i,s)}else yield*zc(e.model,e.view,e.upcastAlso)}function*zc(e,t,n){if(yield{model:e,view:t},n)for(const i of Xo(n))yield{model:e,view:i}}class jc{baseVersion;isDocumentOperation;batch;constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}function Hc(e,t){const n=qc(t),i=n.reduce((e,t)=>
8e+t.offsetSize,0),s=e.parent;Gc(e);const o=e.index;return s._insertChild(o,n),Kc(s,o+n.length),Kc(s,o),new vl(e,e.getShiftedBy(i))}function Wc(e){if(!e.isFlat)throw new bs("operation-utils-remove-range-not-flat",this);const t=e.start.parent;Gc(e.start),Gc(e.end);const n=t._removeChildren(e.start.index,e.end.index-e.start.index);return Kc(t,e.start.index),n}function Uc(e,t){if(!e.isFlat)throw new bs("operation-utils-move-range-not-flat",this);const n=Wc(e);return Hc(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),n)}function qc(e){const t=[];!function e(n){if("string"==typeof n)t.push(new hl(n));else if(n instanceof ul)t.push(new hl(n.data,n.getAttributes()));else if(n instanceof ll)t.push(n);else if(Zs(n))for(const t of n)e(t)}(e);for(let n=1;n<t.length;n++){const e=t[n],i=t[n-1];e instanceof hl&&i instanceof hl&&Jc(e,i)&&(t.splice(n-1,2,new hl(i.data+e.data,i.getAttributes())),n--)}return t}function Kc(e,t){const n=e.getChild(t-1),i=e.getChild(t);if(n&&i&&n.is("$text")&&i.is("$text")&&Jc(n,i)){const s=new hl(n.data+i.data,n.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,s)}}function Gc(e){const t=e.textNode,n=e.parent;if(t){const i=e.offset-t.startOffset,s=t.index;n._removeChildren(s,1);const o=new hl(t.data.substr(0,i),t.getAttributes()),r=new hl(t.data.substr(i),t.getAttributes());n._insertChild(s,[o,r])}}function Jc(e,t){const n=e.getAttributes(),i=t.getAttributes();for(const s of n){if(s[1]!==t.getAttribute(s[0]))return!1;i.next()}return i.next().done}class Zc extends jc{sourcePosition;howMany;targetPosition;constructor(e,t,n,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}get affectedSelectable(){return[vl._createFromPositionAndShift(this.sourcePosition,this.howMany),vl._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new Zc(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 Zc(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,i=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new bs("move-operation-nodes-do-not-exist",this);if(e===t&&n<i&&i<n+this.howMany)throw new bs("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==Js(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=n&&this.targetPosition.path[e]<n+this.howMany)throw new bs("move-operation-node-into-itself",this)}}_execute(){Uc(vl._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const n=gl.fromJSON(e.sourcePosition,t),i=gl.fromJSON(e.targetPosition,t);return new this(n,e.howMany,i,e.baseVersion)}}class Qc extends jc{position;nodes;shouldReceiveAttributes;constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new cl(qc(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new cl([...this.nodes].map(e=>e._clone(!0))),t=new Qc(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new gl(e,[0]);return new Zc(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new bs("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new cl([...e].map(e=>e._clone(!0))),Hc(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const n=[];for(const s of e.nodes)s.name?n.push(dl.fromJSON(s)):n.push(hl.fromJSON(s));const i=new Qc(gl.fromJSON(e.position,t),n,e.baseVersion);return i.shouldReceiveAttributes=e.shouldReceiveAttributes,i}}class Yc extends jc{splitPosition;howMany;insertionPosition;graveyardPosition;constructor(e,t,n,i,s){super(s),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=n,this.graveyardPosition=i?i.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 gl(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new vl(this.splitPosition,e)}get affectedSelectable(){const e=[vl._createFromPositionAndShift(this.splitPosition,0),vl._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(vl._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new Yc(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new gl(e,[0]);return new Xc(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 bs("split-operation-position-invalid",this);if(!e.parent)throw new bs("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new bs("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new bs("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Uc(vl._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();Hc(this.insertionPosition,t)}Uc(new vl(gl._createAt(e,this.splitPosition.offset),gl._createAt(e,e.maxOffset)),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 gl(e.root,t,"toPrevious")}static fromJSON(e,t){const n=gl.fromJSON(e.splitPosition,t),i=gl.fromJSON(e.insertionPosition,t),s=e.graveyardPosition?gl.fromJSON(e.graveyardPosition,t):null;return new this(n,e.howMany,i,s,e.baseVersion)}}class Xc extends jc{sourcePosition;howMany;targetPosition;graveyardPosition;constructor(e,t,n,i,s){super(s),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=i.clone()}get type(){return"merge"}get deletionPosition(){return new gl(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new vl(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[vl._createOn(e),vl._createFromPositionAndShift(this.targetPosition,0),vl._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new Xc(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new gl(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new Yc(e,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new bs("merge-operation-source-position-invalid",this);if(!t.parent)throw new bs("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new bs("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;Uc(vl._createIn(e),this.targetPosition),Uc(vl._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const n=gl.fromJSON(e.sourcePosition,t),i=gl.fromJSON(e.targetPosition,t),s=gl.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,i,s,e.baseVersion)}}class eh extends jc{name;oldRange;newRange;affectsData;_markers;constructor(e,t,n,i,s,o){super(o),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=s,this._markers=i}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 eh(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new eh(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 eh(e.name,e.oldRange?vl.fromJSON(e.oldRange,t):null,e.newRange?vl.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class th extends jc{range;key;oldValue;newValue;constructor(e,t,n,i,s){super(s),this.range=e.clone(),this.key=t,this.oldValue=void 0===n?null:n,this.newValue=void 0===i?null:i}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new th(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new th(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 bs("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!Wi(e.getAttribute(this.key),this.oldValue))throw new bs("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new bs("attribute-operation-attribute-exists",this,{node:e,ke
8y:this.key})}}_execute(){Wi(this.oldValue,this.newValue)||function(e,t,n){Gc(e.start),Gc(e.end);for(const i of e.getItems({shallow:!0})){const e=i.is("$textProxy")?i.textNode:i;null!==n?e._setAttribute(t,n):e._removeAttribute(t),Kc(e.parent,e.index)}Kc(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new th(vl.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class nh extends jc{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new nh(this.baseVersion)}getReversed(){return new nh(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class ih extends jc{position;oldName;newName;constructor(e,t,n,i){super(i),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new ih(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new ih(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof dl))throw new bs("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new bs("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.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 ih(gl.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class sh extends jc{root;key;oldValue;newValue;constructor(e,t,n,i,s){super(s),this.root=e,this.key=t,this.oldValue=void 0===n?null:n,this.newValue=void 0===i?null:i}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new sh(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new sh(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new bs("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new bs("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new bs("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?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 bs("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new sh(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class oh extends jc{rootName;elementName;isAdd;_document;constructor(e,t,n,i,s){if(super(s),this.rootName=e,this.elementName=t,this.isAdd=n,this._document=i,!this._document.getRoot(this.rootName)){this._document.createRoot(this.elementName,this.rootName)._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new oh(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new oh(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 oh(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const rh={};rh[th.className]=th,rh[Qc.className]=Qc,rh[eh.className]=eh,rh[Zc.className]=Zc,rh[nh.className]=nh,rh[jc.className]=jc,rh[ih.className]=ih,rh[sh.className]=sh,rh[oh.className]=oh,rh[Yc.className]=Yc,rh[Xc.className]=Xc;class ah{static fromJSON(e,t){return rh[e.__className].fromJSON(e,t)}}const lh=new Map;
8function ch(e,t,n){let i=lh.get(e);i||(i=new Map,lh.set(e,i)),i.set(t,n)}function hh(e){return[e]}function uh(e,t,n={}){const i=function(e,t){const n=lh.get(e);return n&&n.has(t)?n.get(t):hh}(e.constructor,t.constructor);try{return i(e=e.clone(),t,n)}catch(bC){throw bC}}function dh(e,t,n){e=e.slice(),t=t.slice();const i=new fh(n.document,n.useRelations,n.forceWeakRemove);i.setOriginalOperations(e),i.setOriginalOperations(t);const s=i.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:s};const o=new WeakMap;for(const l of e)o.set(l,0);const r={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const n=e[a],s=o.get(n);if(s==t.length){a++;continue}const r=t[s],l=uh(n,r,i.getContext(n,r,!0)),c=uh(r,n,i.getContext(r,n,!1));i.updateRelation(n,r),i.setOriginalOperations(l,n),i.setOriginalOperations(c,r);for(const e of l)o.set(e,s+c.length);e.splice(a,1,...l),t.splice(s,1,...c)}return gh(e),gh(t),mh(e,r.nextBaseVersionB),mh(t,r.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:s}}class fh{originalOperations;_history;_useRelations;_forceWeakRemove;_relations;constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){const n=t?this.originalOperations.get(t):null;for(const i of e)this.originalOperations.set(i,n||i)}updateRelation(e,t){if(e instanceof Zc)t instanceof Xc?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof Zc&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof Yc){if(t instanceof Xc)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof Zc)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const n=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=n.end.offset-e.splitPosition.offset,s=e.splitPosition.offset-n.start.offset;this._setRelation(e,t,{howMany:i,offset:s})}}}else if(e instanceof Xc)t instanceof Xc?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof Yc?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof Zc&&t.howMany>0&&(e.sourcePosition.isEqual(t.sourcePosition.getShiftedBy(t.howMany))&&this._setRelation(e,t,"mergeSourceAffected"),e.targetPosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeTargetWasBefore"));else if(e instanceof eh){const n=e.newRange;if(!n)return;if(t instanceof Xc){const i=n.start.isEqual(t.targetPosition),s=n.start.isEqual(t.deletionPosition),o=n.end.isEqual(t.deletionPosition),r=n.end.isEqual(t.sourcePosition);(i||s||o||r)&&this._setRelation(e,t,{wasInLeftElement:i,wasStartBeforeMergedElement:s,wasEndBeforeMergedElement:o,wasInRightElement:r})}}}getContext(e,t,n){return{aIsStrong:n,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const n=this.originalOperations.get(t),i=this._history.getUndoneOperation(n);if(!i)return null;const s=this.originalOperations.get(e),o=this._relations.get(s);return o&&o.get(i)||null}_setRelation(e,t,n){const i=this.originalOperations.get(e),s=this.originalOperations.get(t);let o=this._relations.get(i);o||(o=new Map,this._relations.set(i,o)),o.set(s,n)}}function mh(e,t){for(const n of e)n.baseVersion=t++}function gh(e){const t=new Map;for(let n=0;n<e.length;n++){const i=e[n];i instanceof eh&&(-1!==i.baseVersion?t.set(i.name,{op:i,ranges:i.newRange?[i.newRange]:[]}):(i.newRange&&t.get(i.name).ranges.push(i.newRange),e.splice(n,1),n--))}for(const{op:n,ranges:i}of t.values())i.length?n.newRange=vl._createFromRanges(i):n.newRange=null}function ph(e,t,n){const i=e.nodes.getNode(0).getAttribute(t);if(i==n)return null;const s=new vl(e.position,e.position.getShiftedBy(e.howMany));return new th(s,t,i,n,0)}function wh(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function bh(e,t){const n=[];for(let i=0;i<e.length;i++){const s=e[i],o=new Zc(s.start,s.end.offset-s.start.offset,t,0);n.push(o);for(let t=i+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)[0];t=t._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)}return n}ch(th,th,(e,t,n)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const i=e.range.getDifference(t.range).map(t=>new th(t,e.key,e.oldValue,e.newValue,0)),s=e.range.getIntersection(t.range);return s&&n.aIsStrong&&i.push(new th(s,t.key,t.newValue,e.newValue,0)),0==i.length?[new nh(0)]:i}return[e]}),ch(th,Qc,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const n=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new th(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const i=ph(t,e.key,e.oldValue);i&&n.unshift(i)}return n}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),ch(th,Xc,(e,t)=>{const n=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&n.push(vl._createFromPositionAndShift(t.graveyardPosition,1));const i=e.range._getTransformedByMergeOperation(t);return i.isCollapsed||n.push(i),n.map(t=>new th(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),ch(th,Zc,(e,t)=>function(e,t){const n=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);let i=null,s=[];n.containsRange(e,!0)?i=e:e.start.hasSameParentAs(n.start)?(s=e.getDifference(n),i=e.getIntersection(n)):s=[e];const o=[];for(let r of s){r=r._getTransformedByDeletion(t.sourcePosition,t.howMany);const e=t.getMovedRangeStart(),n=r.start.hasSameParentAs(e),i=r._getTransformedByInsertion(e,t.howMany,n);o.push(...i)}i&&o.push(i._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return o}(e.range,t).map(t=>new th(t,e.key,e.oldValue,e.newValue,e.baseVersion))),ch(th,Yc,(e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const n=e.clone();return n.range=new vl(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,n]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),ch(Qc,th,(e,t)=>{const n=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const i=ph(e,t.key,t.newValue);i&&n.push(i)}return n}),ch(Qc,Qc,(e,t,n)=>(e.position.isEqual(t.position)&&n.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),ch(Qc,Zc,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),ch(Qc,Yc,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),ch(Qc,Xc,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),ch(eh,Qc,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),ch(eh,eh,(e,t,n)=>{if(e.name==t.name){if(!n.aIsStrong)return[new nh(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),ch(eh,Xc,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),ch(eh,Zc,(e,t)=>{const n=[e];if(e.oldRange&&(e.oldRange=vl._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){const i=e.newRange._getTransformedByMoveOperation(t);e.newRange=i[0];for(let t=1;t<i.length;t++){const s=e.clone();s.oldRange=null,s.newRange=i[t],s.baseVersion=-1,n.push(s)}}return n}),ch(eh,Yc,(e,t,n)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(n.abRelation){const i=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&n.abRelation.wasStartBeforeMergedElement?e.newRange.start=gl._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!n.abRelation.wasInLeftElement?e.newRange.start=gl._createAt(t.moveTargetPosition):e.newRange.start=i.start,e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasInRightElement?e.newRange.end=gl._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?e.newRange.end=gl._createAt(t.insertionPosition):e.newRange.end=i.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),ch(Xc,Qc,(e,t)=>
8(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),ch(Xc,Xc,(e,t,n)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(n.bWasUndone){const n=t.graveyardPosition.path.slice();return n.push(0),e.sourcePosition=new gl(t.graveyardPosition.root,n),e.howMany=0,[e]}return[new nh(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!n.bWasUndone&&"splitAtSource"!=n.abRelation){const i="$graveyard"==e.targetPosition.root.rootName,s="$graveyard"==t.targetPosition.root.rootName;if(s&&!i||!(i&&!s)&&n.aIsStrong){const n=t.targetPosition._getTransformedByMergeOperation(t),i=e.targetPosition._getTransformedByMergeOperation(t);return[new Zc(n,e.howMany,i,0)]}return[new nh(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&n.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),ch(Xc,Zc,(e,t,n)=>{const i=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!n.bWasUndone&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.sourcePosition)?[new nh(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(e.sourcePosition)&&"mergeSourceAffected"==n.abRelation?e.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness="toNone",e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&"mergeTargetWasBefore"==n.abRelation?(e.targetPosition.stickiness="toPrevious",e.howMany+=t.howMany):(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany)),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.sourcePosition.stickiness="toPrevious",e.targetPosition.stickiness="toNext",e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])}),ch(Xc,Yc,(e,t,n)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){if(t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition)||"mergeTargetNotMoved"==n.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==n.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==n.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}),ch(Zc,Qc,(e,t)=>{const n=vl._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),ch(Zc,Zc,(e,t,n)=>{const i=vl._createFromPositionAndShift(e.sourcePosition,e.howMany),s=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);let o,r=n.aIsStrong,a=!n.aIsStrong;if("insertBefore"==n.abRelation||"insertAfter"==n.baRelation?a=!0:"insertAfter"!=n.abRelation&&"insertBefore"!=n.baRelation||(a=!1),o=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),wh(e,t)&&wh(t,e))return[t.getReversed()];if(i.containsPosition(t.targetPosition)&&i.containsRange(s,!0))return i.start=i.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),i.end=i.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),bh([i],o);if(s.containsPosition(e.targetPosition)&&s.containsRange(i,!0))return i.start=i.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),i.end=i.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),bh([i],o);const l=Js(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return i.start=i.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),i.end=i.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),bh([i],o);"remove"!=e.type||"remove"==t.type||n.aWasUndone||n.forceWeakRemove?"remove"==e.type||"remove"!=t.type||n.bWasUndone||n.forceWeakRemove||(r=!1):r=!0;const c=[],h=i.getDifference(s);for(const d of h){d.start=d.start._getTransformedByDeletion(t.sourcePosition,t.howMany),d.end=d.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const e="same"==Js(d.start.getParentPath(),t.getMovedRangeStart().getParentPath()),n=d._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,e);c.push(...n)}const u=i.getIntersection(s);return null!==u&&r&&(u.start=u.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),u.end=u.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(u):1==c.length?s.start.isBefore(i.start)||s.start.isEqual(i.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),0===c.length?[new nh(e.baseVersion)]:bh(c,o)}),ch(Zc,Yc,(e,t,n)=>{let i=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=n.abRelation||(i=e.targetPosition._getTransformedBySplitOperation(t));const s=vl._createFromPositionAndShift(e.sourcePosition,e.howMany);if(s.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=i,[e];if(s.start.hasSameParentAs(t.splitPosition)&&s.containsPosition(t.splitPosition)){let e=new vl(t.splitPosition,s.end);e=e._getTransformedBySplitOperation(t);return bh([new vl(s.start,t.splitPosition),e],i)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==n.abRelation&&(i=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==n.abRelation&&(i=e.targetPosition);const o=[s._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const i=s.start.isEqual(t.graveyardPosition)||s.containsPosition(t.graveyardPosition);e.howMany>1&&i&&!n.aWasUndone&&o.push(vl._createFromPositionAndShift(t.insertionPosition,1))}return bh(o,i)}),ch(Zc,Xc,(e,t,n)=>{const i=vl._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(t.sourcePosition))if("remove"!=e.type||n.forceWeakRemove){if(1==e.howMany)return n.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new nh(0)]}else if(!n.aWasUndone){const n=[];let i=t.graveyardPosition.clone(),s=t.targetPosition._getTransformedByMergeOperation(t);const o=e.targetPosition.getTransformedByOperation(t);e.howMany>1&&(n.push(new Zc(e.sourcePosition,e.howMany-1,o,0)),i=i._getTransformedByMove(e.sourcePosition,o,e.howMany-1),s=s._getTransformedByMove(e.sourcePosition,o,e.howMany-1));const r=t.deletionPosition._getCombined(e.sourcePosition,o),a=new Zc(i,1,r,0),l=a.getMovedRangeStart().path.slice();l.push(0);const c=new gl(a.targetPosition.root,l);s=s._getTransformedByMove(i,r,1);const h=new Zc(s,t.howMany,c,0);return n.push(a),n.push(h),n}const s=vl._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=s.start,e.howMany=s.end.offset-s.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),ch(ih,Qc,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),ch(ih,Xc,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),ch(ih,Zc,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),ch(ih,ih,(e,t,n)=>
8{if(e.position.isEqual(t.position)){if(!n.aIsStrong)return[new nh(0)];e.oldName=t.newName}return[e]}),ch(ih,Yc,(e,t)=>{if("same"==Js(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new ih(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),ch(sh,sh,(e,t,n)=>{if(e.root===t.root&&e.key===t.key){if(!n.aIsStrong||e.newValue===t.newValue)return[new nh(0)];e.oldValue=t.newValue}return[e]}),ch(oh,oh,(e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new nh(0)]:[e]),ch(Yc,Qc,(e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e])),ch(Yc,Xc,(e,t,n)=>{if(!e.graveyardPosition&&!n.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const n=t.graveyardPosition.path.slice();n.push(0);const i=new gl(t.graveyardPosition.root,n),s=Yc.getInsertionPosition(new gl(t.graveyardPosition.root,n)),o=new Yc(i,0,s,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Yc.getInsertionPosition(e.splitPosition),e.graveyardPosition=o.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[o,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Yc.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),ch(Yc,Zc,(e,t,n)=>{const i=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const s=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);if(!n.bWasUndone&&s){const n=e.splitPosition._getTransformedByMoveOperation(t),i=e.graveyardPosition._getTransformedByMoveOperation(t),s=i.path.slice();s.push(0);const o=new gl(i.root,s);return[new Zc(n,e.howMany,o,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const s=e.splitPosition.isEqual(t.targetPosition);if(s&&("insertAtSource"==n.baRelation||"splitBefore"==n.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=Yc.getInsertionPosition(e.splitPosition),[e];if(s&&n.abRelation&&n.abRelation.howMany){const{howMany:t,offset:i}=n.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(i),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const n=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=n,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.
8insertionPosition=Yc.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=Yc.getInsertionPosition(e.splitPosition),[e]}),ch(Yc,Yc,(e,t,n)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new nh(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new nh(0)];if("splitBefore"==n.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const i="$graveyard"==e.splitPosition.root.rootName,s="$graveyard"==t.splitPosition.root.rootName;if(s&&!i||!(i&&!s)&&n.aIsStrong){const n=[];return t.howMany&&n.push(new Zc(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&n.push(new Zc(e.splitPosition,e.howMany,e.moveTargetPosition,0)),n}return[new nh(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==n.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==n.baRelation){const n=t.insertionPosition.path.slice();n.push(0);const i=new gl(t.insertionPosition.root,n);return[e,new Zc(e.insertionPosition,1,i,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=Yc.getInsertionPosition(e.splitPosition),[e]});class _h extends(Ts(gl)){constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new bs("model-liveposition-root-not-rootelement",e);yh.call(this)}detach(){this.stopListening()}toPosition(){return new gl(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function yh(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&vh.call(this,n)},{priority:"low"})}function vh(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}_h.prototype.is=function(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e};class kh{operations;isUndoable;isLocal;isUndo;isTyping;constructor(e={}){"string"==typeof e&&(e="transparent"===e?{isUndoable:!1}:{},_s("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:n=!0,isUndo:i=!1,isTyping:s=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=n,this.isUndo=i,this.isTyping=s}get type(){return _s("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class Ch{static _statesPriority=[void 0,"refresh","rename","move"];_markerCollection;_changesInElement=new Map;_elementsSnapshots=new Map;_elementChildrenSnapshots=new Map;_elementState=new Map;_changedMarkers=new Map;_changedRoots=new Map;_changeCount=0;_cachedChanges=null;_cachedChangesWithGraveyard=null;_refreshedItems=new Set;constructor(e){this._markerCollection=e}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size&&0==this._changedRoots.size}bufferOperation(e){const t=e;switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const e of t.range.getItems({shallow:!0}))this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const e=this._isInInsertedElement(t.sourcePosition.parent),n=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),n||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);const i=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const t of i.getItems({shallow:!0}))this._setElementState(t,"move");break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const e=vl._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}this._setElementState(t.position.nodeAfter,"rename");break}case"split":{const e=t.splitPosition.parent;if(!this._isInInsertedElement(e)){this._markRemove(e,t.splitPosition.offset,t.howMany);const n=vl._createFromPositionAndShift(t.splitPosition,t.howMany);for(const e of n.getItems({shallow:!0}))this._setElementState(e,"move")}this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&(this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1),this._setElementState(t.graveyardPosition.nodeAfter,"move"));break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);const n=t.graveyardPosition.parent;this._markInsert(n,t.graveyardPosition.offset,1),this._setElementState(e,"move");const i=t.targetPosition.parent;if(!this._isInInsertedElement(i)){this._markInsert(i,t.targetPosition.offset,e.maxOffset);const n=vl._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of n.getItems({shallow:!0}))this._setElementState(e,"move")}break}case"detachRoot":case"addRoot":{const e=t.affectedSelectable;if(!e._isLoaded)return;if(e.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const e=t.root.rootName;
8this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),n.range&&n.range.root.is("rootElement")&&!n.range.root._isLoaded&&(n.range=null);let i=this._changedMarkers.get(e);i?i.newMarkerData=n:(i={newMarkerData:n,oldMarkerData:t},this._changedMarkers.set(e,i)),null==i.oldMarkerData.range&&null==n.range&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.oldMarkerData.range&&e.push({name:t,range:n.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.newMarkerData.range&&e.push({name:t,range:n.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this.getChanges().length)return!0;if(this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const n=e.range&&!t.range,i=!e.range&&t.range,s=e.range&&t.range&&!e.range.isEqual(t.range);if(n||i||s)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const n of this._changesInElement.keys()){const e=this._changesInElement.get(n).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1),i=this._elementChildrenSnapshots.get(n),s=Ah(n.getChildren()),o=Th(i.length,e);let r=0,a=0;for(const l of o)if("i"===l){const e=this._getDiffActionForNode(s[r].node,"insert"),i=this._elementsSnapshots.get(s[r].node),o=this._getInsertDiff(n,r,e,s[r],i);t.push(o),r++}else if("r"===l){const e=this._getDiffActionForNode(i[a].node,"remove"),s=this._getRemoveDiff(n,r,e,i[a]);t.push(s),a++}else if("a"===l){const e=i[a].attributes,o=s[r].attributes;let l;if("$text"==s[r].name)l=new vl(gl._createAt(n,r),gl._createAt(n,r+1));else{const e=n.offsetToIndex(r);
8l=new vl(gl._createAt(n,r),gl._createAt(n.getChild(e),0))}const c=this._getAttributesDiff(l,e,o);t.push(...c),r++,a++}else r++,a++}t.sort((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1);for(let n=1,i=0;n<t.length;n++){const e=t[i],s=t[n],o="remove"==e.type&&"remove"==s.type&&"$text"==e.name&&"$text"==s.name&&e.position.isEqual(s.position),r="insert"==e.type&&"insert"==s.type&&"$text"==e.name&&"$text"==s.name&&e.position.parent==s.position.parent&&e.position.offset+e.length==s.position.offset,a="attribute"==e.type&&"attribute"==s.type&&e.position.parent==s.position.parent&&e.range.isFlat&&s.range.isFlat&&e.position.offset+e.length==s.position.offset&&e.attributeKey==s.attributeKey&&e.attributeOldValue==s.attributeOldValue&&e.attributeNewValue==s.attributeNewValue;o||r||a?(e.length++,a&&(e.range.end=e.range.end.getShiftedBy(1)),t[n]=null):i=n}t=t.filter(e=>e);for(const n of t)delete n.changeCount,"attribute"==n.type&&(delete n.position,delete n.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(Eh),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}
8getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t={...e};return void 0!==t.state&&delete t.attributes,t})}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(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e),this._setElementState(e,"refresh");const t=vl._createOn(e);for(const n of this._markerCollection.getMarkersIntersectingRange(t)){const e=n.getData();this.bufferMarkerChange(n.name,e,e)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const e=t.getData();this.bufferMarkerChange(t.name,{...e,range:null},e)}}}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const n=this._changedRoots.get(e);void 0!==n.state?(delete n.state,void 0===n.attributes&&this._changedRoots.delete(e)):n.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,n,i){const s=this._changedRoots.get(e)||{name:e},o=s.attributes||{};if(o[t]){const e=o[t];
8i===e.oldValue?delete o[t]:e.newValue=i}else o[t]={oldValue:n,newValue:i};0===Object.entries(o).length?(delete s.attributes,void 0===s.state&&this._changedRoots.delete(e)):(s.attributes=o,this._changedRoots.set(e,s))}_markInsert(e,t,n){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const i={type:"insert",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i)}_markRemove(e,t,n){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const i={type:"remove",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i),this._removeAllNestedChanges(e,t,n)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshots(e);const n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let i=0;i<n.length;i++)n[i].howMany<1&&(n.splice(i,1),i--)}_setElementState(e,t){if(!e.is("element"))return;const n=Ch._statesPriority.indexOf(this._elementState.get(e));Ch._statesPriority.indexOf(t)>n&&this._elementState.set(e,t)}_getDiffActionForNode(e,t){if(!e.is("element"))return t;if(!this._elementsSnapshots.has(e))return t;const n=this._elementState.get(e);return n&&"move"!=n?n:t}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshots(e){if(this._elementChildrenSnapshots.has(e))return;const t=Ah(e.getChildren());this._elementChildrenSnapshots.set(e,t);for(const n of t)this._elementsSnapshots.set(n.node,n)}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const n of t){const i=e.offset+e.howMany,s=n.offset+n.howMany;if("insert"==e.type&&("insert"==n.type&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<s&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==n.type&&e.offset<n.offset&&(n.offset+=e.howMany),"attribute"==n.type))if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<s){const s=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:"attribute",offset:i,howMany:s-n.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==n.type)if(i<=n.offset)n.offset-=e.howMany;else if(i<=s)if(e.offset<n.offset){const t=i-n.offset;n.offset=e.offset,n.howMany-=t,e.nodesToHandle-=t}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<s){const t=s-e.offset;n.howMany-=t,e.nodesToHandle-=t}if("remove"==n.type&&(i<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),"attribute"==n.type)if(i<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){const t=i-n.offset;n.offset=e.offset,n.howMany-=t}else if(e.offset<s)if(i<=s){const i=n.howMany;n.howMany=e.offset-n.offset;const s=i-n.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:s,count:this._changeCount++})}else n.howMany-=s-e.offset}if("attribute"==e.type){if("insert"==n.type)if(e.offset<n.offset&&i>n.offset){if(i>s){const e={type:"attribute",offset:s,howMany:i-s,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<s&&(i>s?(e.nodesToHandle=i-s,e.offset=s):e.nodesToHandle=0);if("remove"==n.type&&e.offset<n.offset&&i>n.offset){const s={type:"attribute",offset:n.offset,howMany:i-n.offset,count:this._changeCount++};this._handleChange(s,t),t.push(s),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==n.type&&(e.offset>=n.offset&&i<=s?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&i>=s&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n,i,s){const o={type:"insert",position:gl._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++,action:n};return"insert"!=n&&s&&(o.before={name:s.name,attributes:new Map(s.attributes)}),o}_getRemoveDiff(e,t,n,i){return{type:"remove",action:n,position:gl._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){const i=[];n=new Map(n);for(const[s,o]of t){const t=n.has(s)?n.get(s):null;t!==o&&i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:s,attributeOldValue:o,attributeNewValue:t,changeCount:this._changeCount++}),n.delete(s)}for(const[s,o]of n)i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:s,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return i}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),i=e.startOffset;if(n)for(const s of n)if("insert"==s.type&&i>=s.offset&&i<s.offset+s.howMany)return!0;return this._isInInsertedElement(t)}
8_removeAllNestedChanges(e,t,n){const i=new vl(gl._createAt(e,t),gl._createAt(e,t+n));for(const s of i.getItems({shallow:!0}))s.is("element")&&(this._changesInElement.delete(s),this._removeAllNestedChanges(s,0,s.maxOffset))}}function xh(e){return{node:e,name:e.is("$text")?"$text":e.name,attributes:new Map(e.getAttributes())}}function Ah(e){const t=[];for(const n of e)if(n.is("$text"))for(let e=0;e<n.data.length;++e)t.push(xh(n));else t.push(xh(n));return t}function Th(e,t){const n=[];let i=0,s=0;for(const o of t){if(o.offset>i){for(let e=0;e<o.offset-i;e++)n.push("e");s+=o.offset-i}if("insert"==o.type){for(let e=0;e<o.howMany;e++)n.push("i");i=o.offset+o.howMany}else if("remove"==o.type){for(let e=0;e<o.howMany;e++)n.push("r");i=o.offset,s+=o.howMany}else{if(o.howMany>1500)for(let e=0;e<o.howMany;e++)n.push("a");else n.push(..."a".repeat(o.howMany).split(""));i=o.offset+o.howMany,s+=o.howMany}}if(s<e)for(let o=0;o<e-s-i;o++)n.push("e");return n}function Eh(e){const t="position"in e&&"$graveyard"==e.position.root.rootName,n="range"in e&&"$graveyard"==e.range.root.rootName;return!t&&!n}class Ph{_operations=[];_undoPairs=new Map;_undoneOperations=new Set;_baseVersionToOperationIndex=new Map;_version=0;_gaps=new Map;get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new bs("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const n=this._operations[0];void 0===e&&(e=n.baseVersion);let i=t-1;for(const[r,a]of this._gaps)e>r&&e<a&&(e=a),i>r&&i<a&&(i=r-1);if(i<n.baseVersion||e>this.lastOperation.baseVersion)return[];let s=this._baseVersionToOperationIndex.get(e);void 0===s&&(s=0);let o=this._baseVersionToOperationIndex.get(i);return void 0===o&&(o=this._operations.length-1),this._operations.slice(s,o+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(void 0!==t)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class Sh extends dl{rootName;_document;_isAttached=!0;_isLoaded=!0;constructor(e,t,n="main"){super(t),this._document=e,this.rootName=n}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Sh.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e):"rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e||"node"===e||"model:node"===e};const Rh="$graveyard";class Oh extends(Ts()){model;history;selection;roots;differ;isReadOnly;_postFixers;_hasSelectionChangedFromTheLastChangeBlock;constructor(e){super(),this.model=e,this.history=new Ph,this.selection=new Ll(this),this.roots=new nr({idProperty:"rootName"}),this.differ=new Ch(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Rh),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&this.differ.bufferOperation(n)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&this.history.addOperation(n)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,n,i,s)=>{const o={...t.getData(),range:i};this.differ.bufferMarkerChange(t.name,s,o),null===n&&t.on("change",(e,n)=>{const i=t.getData();this.differ.bufferMarkerChange(t.name,{...i,range:n},i)})}),this.registerPostFixer(e=>{let t=!1;for(const n of this.roots)n.isAttached()||n.isEmpty||(e.remove(e.createRangeIn(n)),t=!0);for(const n of this.model.markers)n.getRange().root.isAttached()||(e.removeMarker(n),t=!0);return t})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(Rh)}
8createRoot(e="$root",t="main"){if(this.roots.get(t))throw new bs("model-document-createroot-name-exists",this,{name:t});const n=new Sh(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map(e=>e.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=ci(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,n=t.schema,i=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(i)||t.createRange(i)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&Ih(e.start)&&Ih(e.end)}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break}while(t)}}function Ih(e){const t=e.textNode;if(t){const n=t.data,i=e.offset-t.startOffset;return!dr(n,i)&&!fr(n,i)}return!0}class Mh extends(Ts()){_markers=new Map;[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Vh?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,i=!1){const s=e instanceof Vh?e.name:e;if(s.includes(","))throw new bs("markercollection-incorrect-marker-name",this);const o=this._markers.get(s);if(o){const e=o.getData(),r=o.getRange();let a=!1;return r.isEqual(t)||(o._attachLiveRange(Bl.fromRange(t)),a=!0),n!=o.managedUsingOperations&&(o._managedUsingOperations=n,a=!0),"boolean"==typeof i&&i!=o.affectsData&&(o._affectsData=i,a=!0),a&&this.fire(`update:${s}`,o,r,t,e),o}const r=Bl.fromRange(t),a=new Vh(s,r,n,i);return this._markers.set(s,a),this.fire(`update:${s}`,a,null,t,{...a.getData(),range:null}),a}_remove(e){const t=e instanceof Vh?e.name:e,n=this._markers.get(t);return!!n&&(this._markers.delete(t),this.fire(`update:${t}`,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0)}_refresh(e){const t=e instanceof Vh?e.name:e,n=this._markers.get(t);if(!n)throw new bs("markercollection-refresh-marker-not-exists",this);const i=n.getRange();this.fire(`update:${t}`,n,i,i,n.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(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 Vh extends(Ts(al)){name;_managedUsingOperations;_affectsData;_liveRange;constructor(e,t,n,i){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=i}get managedUsingOperations(){if(!this._liveRange)throw new bs("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new bs("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new bs("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new bs("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new bs("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Vh.prototype.is=function(e){return"marker"===e||"model:marker"===e};class Bh extends jc{sourcePosition;howMany;constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new bs("detach-operation-on-document-node",this)}_execute(){Wc(vl._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Dh extends al{markers=new Map;_children=new cl;constructor(e){super(),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 0===this.childCount}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 n of e)t=t.getChildAtOffset(n);return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const n of e)n.name?t.push(dl.fromJSON(n)):t.push(hl.fromJSON(n));return new Dh(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new hl(e)];Zs(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new hl(e):e instanceof ul?new hl(e.data,e.getAttributes()):e)}(t);for(const i of n)null!==i.parent&&i._remove(),i.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const i of n)i.parent=null;return n}}Dh.prototype.is=function(e){return"documentFragment"===e||"model:documentFragment"===e};class Nh{model;batch;constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new hl(e,t)}createElement(e,t){return new dl(e,t)}createDocumentFragment(){return new Dh}
8cloneElement(e,t=!0){return e._clone(t)}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof hl&&""==e.data)return;const i=gl._createAt(t,n);if(e.parent){if(jh(e.root,i.root))return void this.move(vl._createOn(e),i);if(e.root.document)throw new bs("model-writer-insert-forbidden-move",this);this.remove(e)}const s=i.root.document?i.root.document.version:null,o=new Qc(i,e,s);if(e instanceof hl&&(o.shouldReceiveAttributes=!0),this.batch.addOperation(o),this.model.applyOperation(o),e instanceof Dh)for(const[r,a]of e.markers){const e=gl._createAt(a.root,0),t={range:new vl(a.start._getCombined(e,i),a.end._getCombined(e,i)),usingOperation:!0,affectsData:!0};this.model.markers.has(r)?this.updateMarker(r,t):this.addMarker(r,t)}}insertText(e,t,n,i){t instanceof Dh||t instanceof dl||t instanceof gl?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,i)}insertElement(e,t,n,i){t instanceof Dh||t instanceof dl||t instanceof gl?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,i)}append(e,t){this.insert(e,t,"end")}appendText(e,t,n){t instanceof Dh||t instanceof dl?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),n,"end")}appendElement(e,t,n){t instanceof Dh||t instanceof dl?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),n,"end")}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof vl){const i=n.getMinimalFlatRanges();for(const n of i)Fh(this,e,t,n)}else Lh(this,e,t,n)}setAttributes(e,t){for(const[n,i]of cr(e))this.setAttribute(n,i,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof vl){const n=t.getMinimalFlatRanges();for(const t of n)Fh(this,e,null,t)}else Lh(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof vl)for(const n of e.getItems())t(n);else t(e)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof vl))throw new bs("writer-move-invalid-range",this);if(!e.isFlat)throw new bs("writer-move-range-not-flat",this);const i=gl._createAt(t,n);if(i.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!jh(e.root,i.root))throw new bs("writer-move-different-document",this);const s=e.root.document?e.root.document.version:null,o=new Zc(e.start,e.end.offset-e.start.offset,i,s);this.batch.addOperation(o),this.model.applyOperation(o)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof vl?e:vl._createOn(e)).getMinimalFlatRanges().reverse();for(const n of t)this._addOperationForAffectedMarkers("move",n),zh(n.start,n.end.offset-n.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof dl))throw new bs("writer-merge-no-element-before",this);if(!(n instanceof dl))throw new bs("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(vl._createIn(n),gl._createAt(t,"end")),this.remove(n)}_merge(e){const t=gl._createAt(e.nodeBefore,"end"),n=gl._createAt(e.nodeAfter,0),i=e.root.document.graveyard,s=new gl(i,[0]),o=e.root.document.version,r=new Xc(n,e.nodeAfter.maxOffset,t,s,o);this.batch.addOperation(r),this.model.applyOperation(r)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof dl))throw new bs("writer-rename-not-element-instance",this);const n=e.root.document?e.root.document.version:null,i=new ih(gl._createBefore(e),e.name,t,n);this.batch.addOperation(i),this.model.applyOperation(i)}split(e,t){this._assertWriterUsedCorrectly();let n,i,s=e.parent;if(!s.parent)throw new bs("writer-split-element-no-parent",this);if(t||(t=s.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new bs("writer-split-invalid-limit-element",this);do{const t=s.root.document?s.root.document.version:null,o=s.maxOffset-e.offset,r=Yc.getInsertionPosition(e),a=new Yc(e,o,r,null,t);this.batch.addOperation(a),this.model.applyOperation(a),n||i||(n=s,i=e.parent.nextSibling),s=(e=this.createPositionAfter(e.parent)).parent}while(s!==t);return{position:e,range:new vl(gl._createAt(n,"end"),gl._createAt(i,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new bs("writer-wrap-range-not-flat",this);const n=t instanceof dl?t:new dl(t);if(n.childCount>0)throw new bs("writer-wrap-element-not-empty",this);if(null!==n.parent)throw new bs("writer-wrap-element-attached",this);this.insert(n,e.start);const i=new vl(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(i,gl._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new bs("writer-unwrap-element-no-parent",this);this.move(vl._createIn(e),this.createPositionAfter(e)),this.remove(e)}
8addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new bs("writer-addmarker-no-usingoperation",this);const n=t.usingOperation,i=t.range,s=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new bs("writer-addmarker-marker-exists",this);if(!i)throw new bs("writer-addmarker-no-range",this);return n?($h(this,e,null,i,s),this.model.markers.get(e)):this.model.markers._set(e,i,n,s)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n="string"==typeof e?e:e.name,i=this.model.markers.get(n);if(!i)throw new bs("writer-updatemarker-marker-not-exists",this);if(!t)return _s("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),void this.model.markers._refresh(i);const s="boolean"==typeof t.usingOperation,o="boolean"==typeof t.affectsData,r=o?t.affectsData:i.affectsData;if(!s&&!t.range&&!o)throw new bs("writer-updatemarker-wrong-options",this);const a=i.getRange(),l=t.range?t.range:a;s&&t.usingOperation!==i.managedUsingOperations?t.usingOperation?$h(this,n,null,l,r):($h(this,n,a,null,r),this.model.markers._set(n,l,void 0,r)):i.managedUsingOperations?$h(this,n,a,l,r):this.model.markers._set(n,l,void 0,r)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new bs("writer-removemarker-no-marker",this);const n=this.model.markers.get(t);if(!n.managedUsingOperations)return void this.model.markers._remove(t);$h(this,t,n.getRange(),null,n.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const n=this.model.document.getRoot(e);if(n&&n.isAttached())throw new bs("writer-addroot-root-exists",this);const i=this.model.document,s=new oh(e,t,!0,i,i.version);return this.batch.addOperation(s),this.model.applyOperation(s),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new bs("writer-detachroot-no-root",this);for(const s of this.model.markers)s.getRange().root===t&&this.removeMarker(s);for(const s of t.getAttributeKeys())this.removeAttribute(s,t);this.remove(this.createRangeIn(t));const n=this.model.document,i=new oh(t.rootName,t.name,!1,n,n.version);this.batch.addOperation(i),this.model.applyOperation(i)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[n,i]of cr(e))this._setSelectionAttribute(n,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const i=Ll._getStoreAttributeKey(e);this.setAttribute(i,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=Ll._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new bs("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const i=n.getRange();let s=!1;if("move"===e){const e=t;s=e.containsPosition(i.start)||e.start.isEqual(i.start)||e.containsPosition(i.end)||e.end.isEqual(i.end)}else{const e=t,n=e.nodeBefore,o=e.nodeAfter,r=i.start.parent==n&&i.start.isAtEnd,a=i.end.parent==o&&0==i.end.offset,l=i.end.nodeAfter==o,c=i.start.nodeAfter==o;s=r||a||l||c}s&&this.updateMarker(n.name,{range:i})}}}function Fh(e,t,n,i){const s=e.model,o=s.document;let r,a,l,c=i.start;for(const u of i.getWalker({shallow:!0}))l=u.item.getAttribute(t),r&&a!=l&&(a!=n&&h(),c=r),r=u.nextPosition,a=l;function h(){const i=new vl(c,r),l=i.root.document?o.version:null,h=new th(i,t,a,n,l);e.batch.addOperation(h),s.applyOperation(h)}r instanceof gl&&r!=c&&a!=n&&h()}function Lh(e,t,n,i){const s=e.model,o=s.document,r=i.getAttribute(t);let a,l;if(r!=n){if(i.root===i){const e=i.document?o.version:null;l=new sh(i,t,r,n,e)}else{a=new vl(gl._createBefore(i),e.createPositionAfter(i));const s=a.root.document?o.version:null;l=new th(a,t,r,n,s)}e.batch.addOperation(l),s.applyOperation(l)}}function $h(e,t,n,i,s){const o=e.model,r=o.document,a=new eh(t,n,i,o.markers,!!s,r.version);e.batch.addOperation(a),o.applyOperation(a)}function zh(e,t,n,i){let s;if(e.root.document){const n=i.document,o=new gl(n.graveyard,[0]);s=new Zc(e,t,o,n.version)}else s=new Bh(e,t);n.addOperation(s),i.applyOperation(s)}function jh(e,t){return e===t||e instanceof Sh&&t instanceof Sh}function Hh(e,t,n={}){if(t.isCollapsed)return;const i=t.getFirstRange();if("$graveyard"==i.root.rootName)return;const s=e.schema;e.change(e=>{if(!n.doNotResetEntireContent&&function(e,t){const n=e.getLimitElement(t);if(!t.containsEntireContent(n))return!1;const i=t.getFirstRange();if(i.start.parent==i.end.parent)return!1;return e.checkChild(n,"paragraph")}(s,t))return void function(e,t){const n=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(n)),Kh(e,e.createPositionAt(n,0),t)}(e,t);const o={};if(!n.doNotAutoparagraph){const e=t.getSelectedElement();e&&Object.assign(o,s.getAttributesWithProperty(e,"copyOnReplace",!0))}const[r,a]=function(e){const t=e.root.document.model,n=e.start;let i=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const n=function(e){const t=e.parent,n=t.root.document.model.schema,i=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of i){if(n.isLimit(s))return null;if(n.isBlock(s))return s}}(i);if(n&&i.isTouching(t.createPositionAt(n,0))){const n=t.createSelection(e);t.modifySelection(n,{direction:"backward"});const s=n.getLastPosition(),o=t.createRange(s,i);t.hasContent(o,{ignoreMarkers:!0})||(i=s)}}return[_h.fromPosition(n,"toPrevious"),_h.fromPosition(i,"toNext")]}(i);r.isTouching(a)||e.remove(e.createRange(r,a)),n.leaveUnmerged||(!function(e,t,n){const i=e.model;if(!qh(e.model.schema,t,n))return;const[s,o]=function(e,t){const n=e.getAncestors(),i=t.getAncestors();let s=0;for(;n[s]&&n[s]==i[s];)s++;return[n[s],i[s]]}(t,n);if(!s||!o)return;!i.hasContent(s,{ignoreMarkers:!0})&&i.hasContent(o,{ignoreMarkers:!0})?Uh(e,t,n,s.parent):Wh(e,t,n,s.parent)}(e,r,a),s.removeDisallowedAttributes(r.parent.getChildren(),e)),Gh(e,t,r),!n.doNotAutoparagraph&&function(e,t){const n=e.checkChild(t,"$text"),i=e.checkChild(t,"paragraph");return!n&&i}(s,r)&&Kh(e,r,t,o),r.detach(),a.detach()})}function Wh(e,t,n,i){const s=t.parent,o=n.parent;if(s!=i&&o!=i){for(t=e.createPositionAfter(s),(n=e.createPositionBefore(o)).isEqual(t)||e.insert(o,t),e.merge(t);n.parent.isEmpty;){const t=n.parent;n=e.createPositionBefore(t),e.remove(t)}qh(e.model.schema,t,n)&&Wh(e,t,n,i)}}function Uh(e,t,n,i){const s=t.parent,o=n.parent;if(s!=i&&o!=i){for(t=e.createPositionAfter(s),(n=e.createPositionBefore(o)).isEqual(t)||e.insert(s,n);t.parent.isEmpty;){const n=t.parent;t=e.createPositionBefore(n),e.remove(n)}n=e.createPositionBefore(o),function(e,t){const n=t.nodeBefore,i=t.nodeAfter;n.name!=i.name&&e.rename(n,i.name);e.clearAttributes(n),e.setAttributes(Object.fromEntries(i.getAttributes()),n),e.merge(t)}(e,n),qh(e.model.schema,t,n)&&Uh(e,t,n,i)}}function qh(e,t,n){const i=t.parent,s=n.parent;return i!=s&&(!e.isLimit(i)&&!e.isLimit(s)&&function(e,t,n){const i=new vl(e,t);for(const s of i.getWalker())if(n.isLimit(s.item))return!1;return!0}(t,n,e))}function Kh(e,t,n,i={}){const s=e.createElement("paragraph");e.model.schema.setAllowedAttributes(s,i,e),e.insert(s,t),Gh(e,n,e.createPositionAt(s,0))}function Gh(e,t,n){t instanceof Ll?e.setSelection(n):t.setTo(n)}function Jh(e,t){const n=[];Array.from(e.getItems({direction:"backward"})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEac
8h(e=>{n.push(e.start.parent),t.remove(e)}),n.forEach(e=>{let n=e;for(;n.parent&&n.isEmpty;){const e=t.createRangeOn(n);n=n.parent,t.remove(e)}})}class Zh{model;writer;position;canMergeWith;schema;_documentFragment;_documentFragmentPosition;_firstNode=null;_lastNode=null;_lastAutoParagraph=null;_filterAttributesOf=[];_affectedStart=null;_affectedEnd=null;_nodeToSelect=null;constructor(e,t,n){this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(e);if(n.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new bs("insertcontent-invalid-insertion-position",this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?vl._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new vl(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){this._checkAndSplitToAllowedPosition(e)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this.schema.isObject(e)||this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=_h.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleDisallowedNode(e){e.is("element")&&this.handleNodes(e.getChildren())}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new bs("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=_h.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=_h.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof dl))return;if(!this._canMergeLeft(e))return;const t=_h._createBefore(e);t.stickiness="toNext";const n=_h.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=_h._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=_h._createAt(t.nodeBefore,"end","toNext")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof dl))return;if(!this._canMergeRight(e))return;const t=_h._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new bs("insertcontent-invalid-insertion-position",this);this.position=gl._createAt(t.nodeBefore,"end");const n=_h.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=_h._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=_h._createAt(t.nodeBefore,0,"toPrevious")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof dl&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof dl&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_insertAutoParagraph(){this._insertPartialFragment();const e=this.writer.createElement("paragraph");this.writer.insert(e,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=e,this.position=this.writer.createPositionAt(e,0)}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}
8else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return this.schema.checkChild(this.position.parent,e)||this._insertAutoParagraph(),!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)||this.schema.checkChild(e,"paragraph")&&this.schema.checkChild("paragraph",t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}function Qh(e,t,n,i={}){if(!e.schema.isObject(t))throw new bs("insertobject-element-not-an-object",e,{object:t});const s=n||e.document.selection;let o=s;i.findOptimalPosition&&e.schema.isBlock(t)&&(o=e.createSelection(e.schema.findOptimalInsertionRange(s,i.findOptimalPosition)));const r=ir(s.getSelectedBlocks()),a={};return r&&Object.assign(a,e.schema.getAttributesWithProperty(r,"copyOnReplace",!0)),e.change(n=>{o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0});let s=t;const r=o.anchor.parent;!e.schema.checkChild(r,t)&&e.schema.checkChild(r,"paragraph")&&e.schema.checkChild("paragraph",t)&&(s=n.createElement("paragraph"),n.insert(t,s)),e.schema.setAllowedAttributes(s,a,n);const l=e.insertContent(s,o);return l.isCollapsed||i.setSelection&&function(e,t,n,i){const s=e.model;if("on"==n)return void e.setSelection(t,"on");if("after"!=n)throw new bs("insertobject-invalid-place-parameter-value",s);let o=t.nextSibling;if(s.schema.isInline(t))return void e.setSelection(t,"after");const r=o&&s.schema.checkChild(o,"$text");!r&&s.schema.checkChild(t.parent,"paragraph")&&(o=e.createElement("paragraph"),s.schema.setAllowedAttributes(o,i,e),s.insertContent(o,e.createPositionAfter(t)));o&&e.setSelection(o,0)}(n,t,i.setSelection,a),l})}function Yh(e,t){const{isForward:n,walker:i,unit:s,schema:o,treatEmojiAsSingleUnit:r}=e,{type:a,item:l,nextPosition:c}=t;if("text"==a)return"word"===e.unit?function(e,t){let n=e.position.textNode;n||(n=t?e.position.nodeAfter:e.position.nodeBefore);for(;n&&n.is("$text");){const i=e.position.offset-n.startOffset;if(tu(n,i,t))n=t?e.position.nodeAfter:e.position.nodeBefore;else{if(eu(n.data,i,t))break;e.next()}}return e.position}(i,n):function(e,t,n){const i=e.position.textNode;if(i){const s=i.data;let o=e.position.offset-i.startOffset;for(;dr(s,o)||"character"==t&&fr(s,o)||n&&gr(s,o);)e.next(),o=e.position.offset-i.startOffset}return e.position}(i,s,r);if(a==(n?"elementStart":"elementEnd")){if(o.isSelectable(l))return gl._createAt(l,n?"after":"before");if(o.checkChild(c,"$text"))return c}else{if(o.isLimit(l))return void i.skip(()=>!0);if(o.checkChild(c,"$text"))return c}}function Xh(e,t){const n=e.root,i=gl._createAt(n,t?"end":0);return t?new vl(e,i):new vl(i,e)}function eu(e,t,n){const i=t+(n?0:-1);return' ,.?!:;"-()'.includes(e.charAt(i))}function tu(e,t,n){return t===(n?e.offsetSize:0)}let nu=class extends(zs()){markers;document;schema;_pendingChanges;_currentWriter;constructor(){super(),this.markers=new Mh,this.document=new Oh(this),this.schema=new yc,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"),dc(this),this.document.registerPostFixer(nc),this.on("insertContent",(e,[t,n])=>{e.return=function(e,t,n){return e.change(i=>{const s=n||e.document.selection;s.isCollapsed||e.deleteContent(s,{doNotAutoparagraph:!0});const o=new Zh(e,i,s.anchor),r=[];let a;if(t.is("documentFragment")){if(t.markers.size){const e=[];for(const[n,i]of t.markers){const{start:t,end:s}=i,o=t.isEqual(s);e.push({position:t,name:n,isCollapsed:o},{position:s,name:n,isCollapsed:o})}e.sort(({position:e},{position:t})=>e.isBefore(t)?1:-1);for(const{position:n,name:s,isCollapsed:o}of e){let e=null,a=null;const l=n.parent===t&&n.isAtStart,c=n.parent===t&&n.isAtEnd;l||c?o&&(a=l?"start":"end"):(e=i.createElement("$marker"),i.insert(e,n)),r.push({name:s,element:e,collapsed:a})}}a=t.getChildren()}else a=[t];o.handleNodes(a);let l=o.getSelectionRange();if(t.is("documentFragment")&&r.length){const e=l?Bl.fromRange(l):null,t={};for(let n=r.length-1;n>=0;n--){const{name:e,element:s,collapsed:a}=r[n],l=!t[e];
8if(l&&(t[e]=[]),s){const n=i.createPositionAt(s,"before");t[e].push(n),i.remove(s)}else{const n=o.getAffectedRange();if(!n){a&&t[e].push(o.position);continue}a?t[e].push(n[a]):t[e].push(l?n.start:n.end)}}for(const[n,[s,o]]of Object.entries(t))s&&o&&s.root===o.root&&s.root.document&&!i.model.markers.has(n)&&i.addMarker(n,{usingOperation:!0,affectsData:!0,range:new vl(s,o)});e&&(l=e.toRange(),e.detach())}l&&(s instanceof Ll?i.setSelection(l):s.setTo(l));const c=o.getAffectedRange()||e.createRange(s.anchor);return o.destroy(),c})}(this,t,n)}),this.on("insertObject",(e,[t,n,i])=>{e.return=Qh(this,t,n,i)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new kh,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){bs.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?"function"==typeof e?(t=e,e=new kh):e instanceof kh||(e=new kh(e)):e=new kh,this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(n){bs.rethrowUnexpectedError(n,this)}}applyOperation(e){e._execute()}insertContent(e,t,n,...i){const s=iu(t,n);return this.fire("insertContent",[e,s,n,...i])}insertObject(e,t,n,i,...s){const o=iu(t,n);return this.fire("insertObject",[e,o,i,i,...s])}deleteContent(e,t){Hh(this,e,t)}modifySelection(e,t){!function(e,t,n={}){const i=e.schema,s="backward"!=n.direction,o=n.unit?n.unit:"character",r=!!n.treatEmojiAsSingleUnit,a=t.focus,l=new fl({boundaries:Xh(a,s),singleCharacters:!0,direction:s?"forward":"backward"}),c={walker:l,schema:i,isForward:s,unit:o,treatEmojiAsSingleUnit:r};let h;for(;h=l.next();){if(h.done)return;const n=Yh(c,h.value);if(n)return void(t instanceof Ll?e.change(e=>{e.setSelectionFocus(n)}):t.setFocus(n))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const n=e.createDocumentFragment(),i=t.getFirstRange();if(!i||i.isCollapsed)return n;const s=i.start.root,o=i.start.getCommonPath(i.end),r=s.getNodeByPath(o);let a;a=i.start.parent==i.end.parent?i:e.createRange(e.createPositionAt(r,i.start.path[o.length]),e.createPositionAt(r,i.end.path[o.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),n):e.append(e.cloneElement(t,!0),n);if(a!=i){const t=i._getTransformedByMove(a.start,e.createPositionAt(n,0),l)[0],s=e.createRange(e.createPositionAt(n,0),t.start);Jh(e.createRange(t.end,e.createPositionAt(n,"end")),e),Jh(s,e)}return n})}(this,e)}hasContent(e,t={}){const n=e instanceof vl?e:vl._createIn(e);if(n.isCollapsed)return!1;const{ignoreWhitespaces:i=!1,ignoreMarkers:s=!1}=t;if(!s)for(const o of this.markers.getMarkersIntersectingRange(n))if(o.affectsData)return!0;for(const o of n.getItems())if(this.schema.isContent(o)){if(!o.is("$textProxy"))return!0;if(!i)return!0;if(-1!==o.data.search(/\S/))return!0}return!1}canEditAt(e){const t=iu(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,n){return new gl(e,t,n)}createPositionAt(e,t){return gl._createAt(e,t)}createPositionAfter(e){return gl._createAfter(e)}createPositionBefore(e){return gl._createBefore(e)}createRange(e,t){return new vl(e,t)}createRangeIn(e){return vl._createIn(e)}createRangeOn(e){return vl._createOn(e)}createSelection(...e){return new Pl(...e)}createBatch(e){return new kh(e)}createOperationFromJSON(e){return ah.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new Nh(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}
8return e}};function iu(e,t){if(e)return e instanceof Pl||e instanceof Ll?e:e instanceof ll?t||0===t?new Pl(e,t):e.is("rootElement")?new Pl(e,"in"):new Pl(e,"on"):new Pl(e)}class su extends Ka{domEventType="click";onDomEvent(e){this.fire(e.type,e)}}class ou extends Ka{domEventType=["mousedown","mouseup","mouseover","mouseout"];onDomEvent(e){this.fire(e.type,e)}}const ru=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,au=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,lu=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,cu=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,hu=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,uu=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,du=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 fu(e){return e.startsWith("#")?ru.test(e):e.startsWith("rgb")?au.test(e)||lu.test(e):e.startsWith("hsl")?cu.test(e)||hu.test(e):du.has(e.toLowerCase())}const mu=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;const gu=/^[+-]?[0-9]*([.][0-9]+)?%$/;const pu=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function wu(e){return pu.includes(e)}const bu=["center","top","bottom","left","right"];function _u(e){return bu.includes(e)}const yu=["fixed","scroll","local"];function vu(e){return yu.includes(e)}const ku=/^url\(/;function Cu(e){return ku.test(e)}function xu(e){e.setNormalizer("background",e=>{const t={},n=function(e){const t=e.trim().slice(0,1500).matchAll(uu);return Array.from(t).map(e=>e[0])}(e);for(const i of n)wu(i)?(t.repeat=t.repeat||[],t.repeat.push(i)):_u(i)?(t.position=t.position||[],t.position.push(i)):vu(i)?t.attachment=i:fu(i)?t.color=i:Cu(i)&&(t.image=i);return{path:"background",value:t}}),e.setNormalizer("background-color",e=>({path:"background.color",value:e})),e.setReducer("background",e=>{const t=[];return t.push(["background-color",e.color]),t}),e.setStyleRelation("background",["background-color"])}class Au{crashes=[];state="initializing";_crashNumberLimit;_now=Date.now;_minimumNonErrorTimePeriod;_boundErrorHandler;_listeners;constructor(e){if(this.crashes=[],this._crashNumberLimit="number"==typeof e.crashNumberLimit?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod="number"==typeof e.minimumNonErrorTimePeriod?e.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(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(e=>e!==t)}_fire(e,...t){const n=this._listeners[e]||[];for(const i of n)i.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const n=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:n}),n?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&void 0!==e.context&&null!==e.context&&"ready"===this.state&&this._isErrorComingFromThisItem(e)}
8_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;return(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function Tu(e,t=new Set){const n=[e],i=new Set;let s=0;for(;n.length>s;){const e=n[s++];if(!i.has(e)&&Eu(e)&&!t.has(e))if(i.add(e),Symbol.iterator in e)try{for(const t of e)n.push(t)}catch(o){}else for(const t in e)"defaultValue"!==t&&n.push(e[t])}return i}function Eu(e){const t=Object.prototype.toString.call(e),n=typeof e;return!("number"===n||"boolean"===n||"string"===n||"symbol"===n||"function"===n||"[object Date]"===t||"[object RegExp]"===t||"[object Module]"===t||null==e||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function Pu(e,t,n=new Set){if(e===t&&("object"==typeof(i=e)&&null!==i))return!0;var i;const s=Tu(e,n),o=Tu(t,n);for(const r of s)if(o.has(r))return!0;return!1}class Su extends Au{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_initUsingData=!0;_editables={};_config;_excludedProps;constructor(e,t={}){super(t),this._throttledSave=Zi(this._save.bind(this),"number"==typeof t.saveInterval?t.saveInterval:5e3),e&&(this._creator=(t,n)=>e.create(t,n)),this._destructor=e=>e.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{const e={},t=[],n=this._config.rootsAttributes||{},i={};for(const[o,r]of Object.entries(this._data.roots))r.isLoaded?(e[o]="",i[o]=n[o]||{}):t.push(o);const s={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:i,_watchdogInitialData:this._data};return delete s.initialData,s.extraPlugins.push(Ru),this._initUsingData?this.create(e,s,s.context):Hi(this._elementOrData)?this.create(this._elementOrData,s,s.context):this.create(this._editables,s,s.context)}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,n){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData="string"==typeof e||Object.keys(e).length>0&&"string"==typeof Object.values(e)[0],this._config=this._cloneEditorConfiguration(t)||{},this._config.context=n,this._creator(e,this._config))).then(e=>{this._editor=e,e.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=e.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")}).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.cancel();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=e}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter(e=>e.isAttached()&&"$graveyard"!=e.rootName),{plugins:n}=e,i=n.has("CommentsRepository")&&n.get("CommentsRepository"),s=n.has("TrackChanges")&&n.get("TrackChanges"),o={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(e=>{o.roots[e.rootName]={content:JSON.stringify(Array.from(e.getChildren())),attributes:JSON.stringify(Array.from(e.getAttributes())),isLoaded:e._isLoaded}});for(const r of e.model.markers)r._affectsData&&(o.markers[r.name]={rangeJSON:r.getRange().toJSON(),usingOperation:r._managedUsingOperations,affectsData:r._affectsData});return i&&(o.commentThreads=JSON.stringify(i.getCommentThreads({toJSON:!0,skipNotAttached:!0}
8))),s&&(o.suggestions=JSON.stringify(s.getSuggestions({toJSON:!0,skipNotAttached:!0}))),o}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const n=this.editor.ui.getEditableElement(t);n&&(e[t]=n)}return e}_isErrorComingFromThisItem(e){return Pu(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return ui(e,(e,t)=>Hi(e)||"context"===t?e:void 0)}}class Ru{editor;_data;constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},e=>{this._restoreCollaborationData(),this._restoreEditorData(e)}),this.editor.data.fire("ready")},{priority:999})}_createNode(e,t){if("name"in t){const n=e.createElement(t.name,t.attributes);if(t.children)for(const i of t.children)n._appendChild(this._createNode(e,i));return n}return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach(([n,{content:i,attributes:s}])=>{const o=JSON.parse(i),r=JSON.parse(s),a=t.model.document.getRoot(n);for(const[t,l]of r)e.setAttribute(t,l,a);for(const t of o){const n=this._createNode(e,t);e.insert(n,a,"end")}}),Object.entries(this._data.markers).forEach(([n,i])=>{const{document:s}=t.model,{rangeJSON:{start:o,end:r},...a}=i,l=s.getRoot(o.root),c=e.createPositionFromPath(l,o.path,o.stickiness),h=e.createPositionFromPath(l,r.path,r.stickiness),u=e.createRange(c,h);e.addMarker(n,{range:u,...a})})}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach(e=>{const t=this.editor.config.get("collaboration.channelId"),n=this.editor.plugins.get("CommentsRepository");if(n.hasCommentThread(e.threadId)){n.getCommentThread(e.threadId).remove()}n.addCommentThread({channelId:t,...e})}),t.forEach(e=>{const t=this.editor.plugins.get("TrackChangesEditing");if(t.hasSuggestion(e.id)){t.getSuggestion(e.id).attributes=e.attributes}else t.addSuggestionData(e)})}}const Ou=Symbol("MainQueueId");class Iu extends Au{_watchdogs=new Map;_watchdogConfig;_context=null;_contextProps=new Set;_actionQueues=new Mu;_contextConfig;_item;constructor(e,t={}){super(t),this._watchdogConfig=t,this._creator=t=>e.create(t),this._destructor=e=>e.destroy(),this._actionQueues.onEmpty(()=>{"initializing"===this.state&&(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(Ou,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=Vu(e);return Promise.all(t.map(e=>this._actionQueues.enqueue(e.id,()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let t;if(this._watchdogs.has(e.id))throw new Error(`Item with the given id is already added: '${e.id}'.`);if("editor"===e.type)return t=new Su(null,this._watchdogConfig),t.setCreator(e.creator),t._setExcludedProperties(this._contextProps),e.destructor&&t.setDestructor(e.destructor),this._watchdogs.set(e.id,t),t.on("error",(n,{error:i,causesRestart:s})=>{this._fire("itemError",{itemId:e.id,error:i}),s&&this._actionQueues.enqueue(e.id,()=>new Promise(n=>{const i=()=>{t.off("restart",i),this._fire("itemRestart",{itemId:e.id}),n()};t.on("restart",i)}))}),t.create(e.sourceElementOrData,e.config,this._context);throw new Error(`Not supported item type: '${e.type}'.`)})))}remove(e){const t=Vu(e);return Promise.all(t.map(e=>this._actionQueues.enqueue(e,()=>{const t=this._getWatchdog(e);return this._watchdogs.delete(e),t.destroy()})))}destroy(){return this._actionQueues.enqueue(Ou,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Ou,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(e=>{console.error("An error happened during destroying the context or items.",e)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(e=>(this._context=e,this._contextProps=Tu(this._context),Promise.all(Array.from(this._watchdogs.values()).map(e=>(e._setExcludedProperties(this._contextProps),e.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(e=>e.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 Pu(this._context,e.context)}}class Mu{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const n=e===Ou;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const i=(n?Promise.all(this._queues.values()):Promise.all([this._queues.get(Ou),this._queues.get(e)])).then(t),s=i.catch(()=>{});return this._queues.set(e,s),i.finally(()=>{this._activeActions--,this._queues.get(e)===s&&0===this._activeActions&&this._onEmptyCallbacks.forEach(e
8=>e())})}}function Vu(e){return Array.isArray(e)?e:[e]}class Bu extends(zs()){editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Du,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Du),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}function Du(e){e.return=!1,e.stop()}class Nu extends(zs()){editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{if(!this.affectsData)return;const n=e.model.document.selection,i=!("$graveyard"==n.getFirstPosition().root.rootName)&&e.model.canEditAt(n);(e.isReadOnly||this._isEnabledBasedOnSelection&&!i)&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Fu,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Fu),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Fu(e){e.return=!1,e.stop()}class Lu extends Nu{_childCommandsDefinitions=[];refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){ws(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:e})=>e.isEnabled);return e&&e.command}}class $u extends(Ts()){_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],n=[]){super(),this._context=e,this._availablePlugins=new Map;for(const i of t)i.pluginName&&this._availablePlugins.set(i.pluginName,i);this._contextPlugins=new Map;for(const[i,s]of n)this._contextPlugins.set(i,s),this._contextPlugins.set(s,i),i.pluginName&&this._availablePlugins.set(i.pluginName,i)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new bs("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],n=[]){const i=this,s=this._context;!function e(t,n=new Set){t.forEach(t=>{a(t)&&(n.has(t)||(n.add(t),t.pluginName&&!i._availablePlugins.has(t.pluginName)&&i._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,n)))})}(e),u(e);const o=[...function e(t,n=new Set){return t.map(e=>a(e)?e:i._availablePlugins.get(e)).reduce((t,i)=>n.has(i)?t:(n.add(i),i.requires&&(u(i.requires,i),e(i.requires,n).forEach(e=>t.add(e))),t.add(i)),new Set)}(e.filter(e=>!c(e,t)))];!function(e,t){for(const n of t){if("function"!=typeof n)throw new bs("plugincollection-replace-plugin-invalid-type",null,{pluginItem:n});const t=n.pluginName;if(!t)throw new bs("plugincollection-replace-plugin-missing-name",null,{pluginItem:n});if(n.requires&&n.requires.length)throw new bs("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const s=i._availablePlugins.get(t);if(!s)throw new bs("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const o=e.indexOf(s);if(-1===o){if(i._contextPlugins.has(s))return;
8throw new bs("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(s.requires&&s.requires.length)throw new bs("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(o,1,n),i._availablePlugins.set(t,n)}}(o,n);const r=o.map(e=>{let t=i._contextPlugins.get(e);return t=t||new e(s),i._add(e,t),t});return d(r,"init").then(()=>d(r,"afterInit")).then(()=>r);function a(e){return"function"==typeof e}function l(e){return a(e)&&!!e.isContextPlugin}function c(e,t){return t.some(t=>t===e||(h(e)===t||h(t)===e))}function h(e){return a(e)?e.pluginName||e.name:e}function u(e,n=null){e.map(e=>a(e)?e:i._availablePlugins.get(e)||e).forEach(e=>{!function(e,t){if(a(e))return;if(t)throw new bs("plugincollection-soft-required",s,{missingPlugin:e,requiredBy:h(t)});throw new bs("plugincollection-plugin-not-found",s,{plugin:e})}(e,n),function(e,t){if(!l(t))return;if(l(e))return;throw new bs("plugincollection-context-required",s,{plugin:h(e),requiredBy:h(t)})}(e,n),function(e,n){if(!n)return;if(!c(e,t))return;throw new bs("plugincollection-required",s,{plugin:h(e),requiredBy:h(n)})}(e,n)})}function d(e,t){return e.reduce((e,n)=>n[t]?i._contextPlugins.has(n)?e:e.then(n[t].bind(n)):e,Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const n=e.pluginName;if(n){if(this._plugins.has(n))throw new bs("plugincollection-plugin-name-conflict",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}class zu{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){const{translations:t,...n}=e||{};this.config=new Ys(n,this.constructor.defaultConfig);const i=this.constructor.builtinPlugins;this.config.define("plugins",i),this.plugins=new $u(this,i);const s=this.config.get("language")||{};this.locale=new tr({uiLanguage:"string"==typeof s?s:s.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new nr}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const n of e.concat(t)){if("function"!=typeof n)throw new bs("context-initplugins-constructor-only",null,{Plugin:n});if(!0!==n.isContextPlugin)throw new bs("context-initplugins-invalid-plugin",null,{Plugin:n})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new bs("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const n=new this(e);t(n.initPlugins().then(()=>n))})}}class ju{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new bs("commandcollection-command-not-found",this,{commandName:e});return n.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class Hu extends lr{editor;constructor(e){super(),this.editor=e}set(e,t,n={}){if("string"==typeof t){const e=t;t=(t,n)=>{this.editor.execute(e),n()}}super.set(e,t,n)}}const Wu="contentEditing",Uu="common";class qu{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;const t=e.config.get("menuBar.isVisible"),n=e.locale.t;this.addKeystrokeInfoCategory({id:Wu,label:n("Content editing keystrokes"),description:n("These keyboard shortcuts allow for quick access to content editing features.")});const i=[{label:n("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:n("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:n("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:n("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:n("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:n("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&i.push({label:n("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:n("User interface and content navigation keystrokes"),description:n("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:i}]})}addKeystrokeInfoCategory({id:e,label:t,description:n,groups:i}){this.keystrokeInfos.set(e,{id:e,label:t,description:n,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:Uu}
8),i&&i.forEach(t=>{this.addKeystrokeInfoGroup({categoryId:e,...t})})}addKeystrokeInfoGroup({categoryId:e=Wu,id:t,label:n,keystrokes:i}){const s=this.keystrokeInfos.get(e);if(!s)throw new bs("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});s.groups.set(t,{id:t,label:n,keystrokes:i||[]})}addKeystrokeInfos({categoryId:e=Wu,groupId:t=Uu,keystrokes:n}){if(!this.keystrokeInfos.has(e))throw new bs("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:n});const i=this.keystrokeInfos.get(e);if(!i.groups.has(t))throw new bs("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:n});i.groups.get(t).keystrokes.push(...n)}}class Ku extends(zs()){accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;constructor(e={}){if(super(),"sanitizeHtml"in e)throw new bs("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:n,...i}=t.defaultConfig||{},{translations:s=n,...o}=e,r=e.language||i.language;this._context=e.context||new zu({language:r,translations:s}),this._context._addEditor(this,!e.context);const a=Array.from(t.builtinPlugins||[]);this.config=new Ys(o,i),this.config.define("plugins",a),this.config.define(this._context._getEditorConfig()),this.plugins=new $u(this,a,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new ju,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new nu,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const l=new Or;this.data=new Fc(this.model,l),this.editing=new pc(this.model,l),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Lc([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 Hu(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new qu(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new bs("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new bs("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),1===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new bs("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),0===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],i=e.get("extraPlugins")||[],s=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(i),n,s)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(n){bs.rethrowUnexpectedError(n,this)}}focus(){this.editing.view.focus()} 9/* istanbul ignore next -- @preserve */static create(...e){throw new Error("This is an abstract method.")}static Context=zu;static EditorWatchdog=Su;static ContextWatchdog=Iu}function Gu(e){if(!he(e.updateSourceElement))throw new bs("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(function(e){return!!e&&"textarea"===e.tagName.toLowerCase()}(t)&&t.form){let n;const i=t.form,s=()=>e.updateSourceElement();he(i.submit)&&(n=i.submit,i.submit=()=>{s(),n.apply(i)}),i.addEventListener("submit",s),e.on("destroy",()=>{i.removeEventListener("submit",s),n&&(i.submit=n)})}}function Ju(e){return class extends e{sourceElement;updateSourceElement(e){if(!this.sourceElement)throw new bs("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),n=this.sourceElement instanceof HTMLTextAreaElement;if(!t&&!n)return void ko(this.sourceElement,"");const i="string"==typeof e?e:this.data.get();ko(this.sourceElement,i)}}}Ju.updateSourceElement=Ju(Object).prototype.updateSourceElement;const Zu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.
96 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',Qu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',Yu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',Xu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',ed='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',td='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',nd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',id='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',sd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',od='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',rd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',ad='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',ld='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',cd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',hd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',ud='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',dd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',fd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.7
95.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',md='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',gd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>',pd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',wd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',bd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',_d='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>';var yd,vd;function kd(){return vd?yd:(vd=1,yd={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],ol
9ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]})}const Cd=f(kd());var xd,Ad,Td,Ed,Pd,Sd,Rd={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Od(e){var t,n,i=[],s=1;if("string"==typeof e)if(Cd[e])i=Cd[e].slice(),n="rgb";else if("transparent"===e)s=0,n="rgb",i=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(e)){var o=e.slice(1);s=1,(l=o.length)<=4?(i=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],4===l&&(s=parseInt(o[3]+o[3],16)/255)):(i=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],8===l&&(s=parseInt(o[6]+o[7],16)/255)),i[0]||(i[0]=0),i[1]||(i[1]=0),i[2]||(i[2]=0),n="rgb"}else if(t=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(e)){var r=t[1],a="rgb"===r;n=o=r.replace(/a$/,"");var l="cmyk"===o?4:"gray"===o?1:3;i=t[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(e,t){if(/%$/.test(e))return t===l?parseFloat(e)/100:"rgb"===o?255*parseFloat(e)/100:parseFloat(e);if("h"===o[t]){if(/deg$/.test(e))return parseFloat(e);if(void 0!==Rd[e])return Rd[e]}return parseFloat(e)}),r===o&&i.push(1),s=a||void 0===i[l]?1:i[l],i=i.slice(0,l)}else e.length>10&&/[0-9](?:\s|\/)/.test(e)&&(i=e.match(/([0-9]+)/g).map(function(e){return parseFloat(e)}),n=e.match(/([a-z])/gi).join("").toLowerCase());else isNaN(e)?Array.isArray(e)||e.length?(i=[e[0],e[1],e[2]],n="rgb",s=4===e.length?e[3]:1):e instanceof Object&&(null!=e.r||null!=e.red||null!=e.R?(n="rgb",i=[e.r||e.red||e.R||0,e.g||e.green||e.G||0,e.b||e.blue||e.B||0]):(n="hsl",i=[e.h||e.hue||e.H||0,e.s||e.saturation||e.S||0,e.l||e.lightness||e.L||e.b||e.brightness]),s=e.a||e.alpha||e.opacity||1,null!=e.opacity&&(s/=100)):(n="rgb",i=[e>>>16,(65280&e)>>>8,255&e]);return{space:n,values:i,alpha:s}}function Id(){if(Ad)return xd;Ad=1;const e=kd(),t={};for(const s of Object.keys(e))t[e[s]]=s;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};xd=n;for(const s of Object.keys(n)){if(!("channels"in n[s]))throw new Error("missing channels property: "+s);if(!("labels"in n[s]))throw new Error("missing channel labels property: "+s);if(n[s].labels.length!==n[s].channels)throw new Error("channel and label counts mismatch: "+s);const{channels:e,labels:t}=n[s];delete n[s].channels,delete n[s].labels,Object.defineProperty(n[s],"channels",{value:e}),Object.defineProperty(n[s],"labels",{value:t})}function i(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}return n.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,s=Math.min(t,n,i),o=Math.max(t,n,i),r=o-s;let a,l;o===s?a=0:t===o?a=(n-i)/r:n===o?a=2+(i-t)/r:i===o&&(a=4+(t-n)/r),a=Math.min(60*a,360),a<0&&(a+=360);const c=(s+o)/2;return l=o===s?0:c<=.5?r/(o+s):r/(2-o-s),[a,100*l,100*c]},n.rgb.hsv=function(e){let t,n,i,s,o;const r=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(r,a,l),h=c-Math.min(r,a,l),u=function(e){return(c-e)/6/h+.5};return 0===h?(s=0,o=0):(o=h/c,t=u(r),n=u(a),i=u(l),r===c?s=i-n:a===c?s=1/3+t-i:l===c&&(s=2/3+n-t),s<0?s+=1:s>1&&(s-=1)),[360*s,100*o,100*c]},n.rgb.hwb=function(e){const t=e[0],i=e[1];let s=e[2];const o=n.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(i,s));return s=1-1/255*Math.max(t,Math.max(i,s)),[o,100*r,100*s]},n.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,s=Math.min(1-t,1-n,1-i);return[100*((1-t-s)/(1-s)||0),100*((1-n-s)/(1-s)||0),100*((1-i-s)/(1-s)||0),100*s]},n.rgb.keyword=function(n){const s=t[n];if(s)return s;let o,r=1/0;for(const t of Object.keys(e)){const s=i(n,e[t]);s<r&&(r=s,o=t)}return o}
9,n.keyword.rgb=function(t){return e[t]},n.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;return[100*(.4124*t+.3576*n+.1805*i),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},n.rgb.lab=function(e){const t=n.rgb.xyz(e);let i=t[0],s=t[1],o=t[2];i/=95.047,s/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*s-16,500*(i-s),200*(s-o)]},n.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;let s,o,r;if(0===n)return r=255*i,[r,r,r];s=i<.5?i*(1+n):i+n-i*n;const a=2*i-s,l=[0,0,0];for(let c=0;c<3;c++)o=t+1/3*-(c-1),o<0&&o++,o>1&&o--,r=6*o<1?a+6*(s-a)*o:2*o<1?s:3*o<2?a+(s-a)*(2/3-o)*6:a,l[c]=255*r;return l},n.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,i=e[2]/100,s=n;const o=Math.max(i,.01);i*=2,n*=i<=1?i:2-i,s*=o<=1?o:2-o;return[t,100*(0===i?2*s/(o+s):2*n/(i+n)),100*((i+n)/2)]},n.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let i=e[2]/100;const s=Math.floor(t)%6,o=t-Math.floor(t),r=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));switch(i*=255,s){case 0:return[i,l,r];case 1:return[a,i,r];case 2:return[r,i,l];case 3:return[r,a,i];case 4:return[l,r,i];case 5:return[i,r,a]}},n.hsv.hsl=function(e){const t=e[0],n=e[1]/100,i=e[2]/100,s=Math.max(i,.01);let o,r;r=(2-n)*i;const a=(2-n)*s;return o=n*s,o/=a<=1?a:2-a,o=o||0,r/=2,[t,100*o,100*r]},n.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,i=e[2]/100;const s=n+i;let o;s>1&&(n/=s,i/=s);const r=Math.floor(6*t),a=1-i;o=6*t-r,1&r&&(o=1-o);const l=n+o*(a-n);let c,h,u;switch(r){default:case 6:case 0:c=a,h=l,u=n;break;case 1:c=l,h=a,u=n;break;case 2:c=n,h=a,u=l;break;case 3:c=n,h=l,u=a;break;case 4:c=l,h=n,u=a;break;case 5:c=a,h=n,u=l}return[255*c,255*h,255*u]},n.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100,s=e[3]/100;return[255*(1-Math.min(1,t*(1-s)+s)),255*(1-Math.min(1,n*(1-s)+s)),255*(1-Math.min(1,i*(1-s)+s))]},n.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100;let s,o,r;return s=3.2406*t+-1.5372*n+-.4986*i,o=-.9689*t+1.8758*n+.0415*i,r=.0557*t+-.204*n+1.057*i,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),[255*s,255*o,255*r]},n.xyz.lab=function(e){let t=e[0],n=e[1],i=e[2];t/=95.047,n/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(t-n),200*(n-i)]},n.lab.xyz=function(e){let t,n,i;n=(e[0]+16)/116,t=e[1]/500+n,i=n-e[2]/200;const s=n**3,o=t**3,r=i**3;return n=s>.008856?s:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=r>.008856?r:(i-16/116)/7.787,t*=95.047,n*=100,i*=108.883,[t,n,i]},n.lab.lch=function(e){const t=e[0],n=e[1],i=e[2];let s;s=360*Math.atan2(i,n)/2/Math.PI,s<0&&(s+=360);return[t,Math.sqrt(n*n+i*i),s]},n.lch.lab=function(e){const t=e[0],n=e[1],i=e[2]/360*2*Math.PI;return[t,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(e,t=null){const[i,s,o]=e;let r=null===t?n.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),0===r)return 30;let a=30+(Math.round(o/255)<<2|Math.round(s/255)<<1|Math.round(i/255));return 2===r&&(a+=60),a},n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.rgb.ansi256=function(e){const t=e[0],n=e[1],i=e[2];if(t===n&&n===i)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},n.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},n.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map(e=>e+e).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,s=Math.max(Math.max(t,n),i),o=Math.min(Math.min(t,n),i),r=s-o;let a,l;return a=r<1?o/(1-r):0,l=r<=0?0:s===t?(n-i)/r%6:s===n?2+(i-t)/r:4+(t-n)/r,l/=6,l%=1,[360*l,100*r,100*a]},n.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=n<.5?2*t*n:2*t*(1-n);let s=0;return i<1&&(s=(n-.5*i)/(1-i)),[e[0],100*i,100*s]},n.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=t*n;let s=0;return i<1&&(s=(n-i)/(1-i)),[e[0],100*i,100*s]},n.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];const s=[0,0,0],o=t%1*6,r=o%1,a=1-r;let l=0;switch(Math.floor(o)){case 0:s[0]=1,s[1]=r,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=r;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=r,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-n)*i,[255*(n*s[0]+l),255*(n*s[1]+l),255*(n*s[2]+l)]},n.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},n.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},n.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},n.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,i=n-t;let s=0;return i<1&&(s=(n-i)/(1-i)),[e[0],100*i,100*s]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]},xd}function Md(){if(Ed)return Td;Ed=1;const e=Id();function t(t){const n=function(){const t={},n=Object.keys(e);for(let e=n.length,i=0;i<e;i++)t[n[i]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;){const t=i.pop(),s=Object.keys(e[t]);for(let e=s.length,o=0;o<e;o++){const e=s[o],r=n[e];-1===r.distance&&(r.distance=n[t].distance+1,r.parent=t,i.unshift(e))}}return n}function n(e,t){return function(n){return t(e(n))}}function i(t,i){const s=[i[t].parent,t];let o=e[i[t].parent][t],r=i[t].parent;for(;i[r].parent;)s.unshift(i[r].parent),o=n(e[i[r].parent][r],o),r=i[r].parent;return o.conversion=s,o}return Td=function(e){const n=t(e),s={},o=Object.keys(n);for(let t=o.length,r=0;r<t;r++){const e=o[r];null!==n[e].parent&&(s[e]=i(e,n))}return s}}var Vd=function(){if(Sd)return Pd;Sd=1;const e=Id(),t=Md(),n={};return Object.keys(e).forEach(i=>
9{n[i]={},Object.defineProperty(n[i],"channels",{value:e[i].channels}),Object.defineProperty(n[i],"labels",{value:e[i].labels});const s=t(i);Object.keys(s).forEach(e=>{const t=s[e];n[i][e]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const i=e(t);if("object"==typeof i)for(let e=i.length,s=0;s<e;s++)i[s]=Math.round(i[s]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}(t),n[i][e].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(t)})}),Pd=n}();const Bd=T({__proto__:null,default:f(Vd)},[Vd]),Dd=(e,t=0,n=1)=>e>n?n:e<t?t:e,Nd=(e,t=0,n=Math.pow(10,t))=>Math.round(n*e)/n,Fd=e=>("#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Nd(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?Nd(parseInt(e.substring(6,8),16)/255,2):1}),Ld=e=>{const{h:t,s:n,l:i}=(({h:e,s:t,v:n,a:i})=>{const s=(200-t)*n/100;return{h:Nd(e),s:Nd(s>0&&s<200?t*n/100/(s<=100?s:200-s)*100:0),l:Nd(s/2),a:Nd(i,2)}})(e);return`hsl(${t}, ${n}%, ${i}%)`},$d=({h:e,s:t,v:n,a:i})=>{e=e/360*6,t/=100,n/=100;const s=Math.floor(e),o=n*(1-t),r=n*(1-(e-s)*t),a=n*(1-(1-e+s)*t),l=s%6;return{r:Nd(255*[n,r,o,o,a,n][l]),g:Nd(255*[a,n,n,r,o,o][l]),b:Nd(255*[o,o,a,n,n,r][l]),a:Nd(i,2)}},zd=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},jd=({r:e,g:t,b:n,a:i})=>{const s=i<1?zd(Nd(255*i)):"";return"#"+zd(e)+zd(t)+zd(n)+s},Hd=({r:e,g:t,b:n,a:i})=>{const s=Math.max(e,t,n),o=s-Math.min(e,t,n),r=o?s===e?(t-n)/o:s===t?2+(n-e)/o:4+(e-t)/o:0;return{h:Nd(60*(r<0?r+6:r)),s:Nd(s?o/s*100:0),v:Nd(s/255*100),a:i}},Wd=(e,t)=>{if(e===t)return!0;for(const n in e)if(e[n]!==t[n])return!1;return!0},Ud={},qd=e=>{let t=Ud[e];return t||(t=document.createElement("template"),t.innerHTML=e,Ud[e]=t),t},Kd=(e,t,n)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))};let Gd=!1;const Jd=e=>"touches"in e,Zd=(e,t)=>{const n=Jd(t)?t.touches[0]:t,i=e.el.getBoundingClientRect();Kd(e.el,"move",e.getMove({x:Dd((n.pageX-(i.left+window.pageXOffset))/i.width),y:Dd((n.pageY-(i.top+window.pageYOffset))/i.height)}))};class Qd{constructor(e,t,n,i){const s=qd(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);e.appendChild(s.content.cloneNode(!0));const o=e.querySelector(`[part=${t}]`);o.addEventListener("mousedown",this),o.addEventListener("touchstart",this),o.addEventListener("keydown",this),this.el=o,this.xy=i,this.nodes=[o.firstChild,o]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(Gd?"touchmove":"mousemove",this),t(Gd?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(Gd&&!Jd(e)||(Gd||(Gd=Jd(e)),0)))(e)||!Gd&&0!=e.button)return;this.el.focus(),Zd(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Zd(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const n=t.keyCode;n>40||e.xy&&n<37||n<33||(t.preventDefault(),Kd(e.el,"move",e.getMove({x:39===n?.01:37===n?-.01:34===n?.05:33===n?-.05:35===n?1:36===n?-1:0,y:40===n?.01:38===n?-.01:0},!0)))})(this,e)}}style(e){e.forEach((e,t)=>{for(const n in e)this.nodes[t].style.setProperty(n,e[n])})}}class Yd extends Qd{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:Ld({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${Nd(e)}`)}getMove(e,t){return{h:t?Dd(this.h+360*e.x,0,360):360*e.x}}}class Xd extends Qd{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:Ld(e)},{"background-color":Ld({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${Nd(e.s)}%, Brightness ${Nd(e.v)}%`)}getMove(e,t){return{s:t?Dd(this.hsva.s+100*e.x,0,100):100*e.x,v:t?Dd(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const ef=Symbol("same"),tf=Symbol("color"),nf=Symbol("hsva"),sf=Symbol("update"),of=Symbol("parts"),rf=Symbol("css"),af=Symbol("sliders");class lf extends HTMLElement{static get observedAttributes(){return["color"]}get[rf](){return[':host{display:flex;flex-direction:column;position:relative;
9width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[af](){return[Xd,Yd]}get color(){return this[tf]}set color(e){if(!this[ef](e)){const t=this.colorModel.toHsva(e);this[sf](t),this[tf]=e}}constructor(){super();const e=qd(`<style>${this[rf].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[of]=this[af].map(e=>new e(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,n){const i=this.colorModel.fromAttr(n);this[ef](i)||(this.color=i)}handleEvent(e){const t=this[nf],n={...t,...e.detail};let i;this[sf](n),Wd(n,t)||this[ef](i=this.colorModel.fromHsva(n))||(this[tf]=i,Kd(this,"color-changed",{value:i}))}[ef](e){return this.color&&this.colorModel.equal(e,this.color)}[sf](e){this[nf]=e,this[of].forEach(t=>t.update(e))}}const cf={defaultColor:"#000",toHsva:e=>Hd(Fd(e)),fromHsva:({h:e,s:t,v:n})=>jd($d({h:e,s:t,v:n,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||Wd(Fd(e),Fd(t)),fromAttr:e=>e};class hf extends lf{get colorModel(){return cf}}class uf extends nr{_parentElement;constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,n)=>{this._renderViewIntoCollectionParent(t,n)}),this.on("remove",(e,t)=>{t.element&&this._parentElement&&t.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||!e.every(e=>"string"==typeof e))throw new bs("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const n of this)for(const i of e)n.delegate(i).to(t);this.on("add",(n,i)=>{for(const s of e)i.delegate(s).to(t)}),this.on("remove",(n,i)=>{for(const s of e)i.stopDelegating(s,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)}}class df extends(Ts()){ns;tag;text;attributes;children;eventListeners;_isRendered;_revertData;constructor(e){super(),Object.assign(this,kf(vf(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new bs("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const n of t.children)Pf(n)?yield n:Sf(n)&&(yield*e(n))}(this)}static bind(e,t){return{to:(n,i)=>new mf({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:i}),if:(n,i,s)=>new gf({observable:e,emitter:t,attribute:n,valueIfTrue:i,callback:s})}}static extend(e,t){if(e._isRendered)throw new bs("template-extend-render",[this,e]);Tf(e,kf(vf(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new bs("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||"http://www.w3.org/1999/xhtml",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(""),pf(this.text)?this._bindToObservable({schema:this.text,updater:bf(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,n=e.revertData;for(const i in this.attributes){const s=t.getAttribute(i),o=this.attributes[i];n&&(n.attributes[i]=s);const r=Of(o)?o[0].ns:null;if(pf(o)){const a=Of(o)?o[0].value:o;n&&Mf(i)&&a.unshift(s),this._bindToObservable({schema:a,updater:_f(t,i,r),data:e})}else if("style"==i&&"string"!=typeof o[0])this._renderStyleAttribute(o[0],e);else{n&&s&&Mf(i)&&o.unshift(s);const e=o.map(e=>e&&e.value||e).reduce((e,t)=>
9e.concat(t),[]).reduce(xf,"");Ef(e)||t.setAttributeNS(r,i,e)}}}_renderStyleAttribute(e,t){const n=t.node;for(const i in e){const s=e[i];pf(s)?this._bindToObservable({schema:[s],updater:yf(n,i),data:t}):n.style[i]=s}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,i=e.isApplying;let s=0;for(const o of this.children)if(Rf(o)){if(!i){o.setParent(t);for(const e of o)n.appendChild(e.element)}}else if(Pf(o))i||(o.isRendered||o.render(),n.appendChild(o.element));else if(to(o))n.appendChild(o);else if(i){const t=e.revertData,i=If();t.children.push(i),o._renderNode({intoFragment:!1,node:n.childNodes[s++],isApplying:!0,revertData:i})}else n.appendChild(o.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map(n=>{const[i,s]=t.split("@");return n.activateDomEventListener(i,s,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const i=n.revertData;wf(e,t,n);const s=e.filter(e=>!Ef(e)).filter(e=>e.observable).map(i=>i.activateAttributeListener(e,t,n));i&&i.bindings.push(s)}_revertTemplateFromNode(e,t){for(const i of t.bindings)for(const e of i)e();if(t.text)return void(e.textContent=t.text);const n=e;for(const i in t.attributes){const e=t.attributes[i];null===e?n.removeAttribute(i):n.setAttribute(i,e)}for(let i=0;i<t.children.length;++i)this._revertTemplateFromNode(n.childNodes[i],t.children[i])}}class ff{attribute;observable;emitter;callback;constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){const i=()=>wf(e,t,n);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,i),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,i)}}}class mf extends ff{eventNameOrFunction;constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,n){const i=(e,n)=>{t&&!n.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,e,i),()=>{this.emitter.stopListening(n.node,e,i)}}}class gf extends ff{valueIfTrue;constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!Ef(super.getValue(e))&&(this.valueIfTrue||!0)}}function pf(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(pf):e instanceof ff)}function wf(e,t,{node:n}){const i=function(e,t){return e.map(e=>e instanceof ff?e.getValue(t):e)}(e,n);let s;s=1==e.length&&e[0]instanceof gf?i[0]:i.reduce(xf,""),Ef(s)?t.remove():t.set(s)}function bf(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function _f(e,t,n){return{set(i){e.setAttributeNS(n,t,i)},remove(){e.removeAttributeNS(n,t)}}}function yf(e,t){return{set(n){e.style[t]=n},remove(){e.style[t]=null}}}function vf(e){return ui(e,e=>{if(e&&(e instanceof ff||Sf(e)||Pf(e)||Rf(e)))return e})}function kf(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=Xo(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)Cf(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=Xo(e[t].value)),Cf(e,t)}(e.attributes);const t=[];if(e.children)if(Rf(e.children))t.push(e.children);else for(const n of e.children)Sf(n)||Pf(n)||to(n)?t.push(n):t.push(new df(n));e.children=t}return e}function Cf(e,t){e[t]=Xo(e[t])}function xf(e,t){return Ef(t)?e:Ef(e)?t:`${e} ${t}`}function Af(e,t){for(const n in t)e[n]?e[n].push(...t[n]):e[n]=t[n]}function Tf(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),Af(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),Af(e.eventListeners,t.eventListeners)),t.text&&e.text.push(...t.text),t.children&&t.children.length){if(e.children.length!=t.children.length)throw new bs("ui-template-extend-children-mismatch",e);let n=0;for(const i of t.children)Tf(e.children[n++],i)}}function Ef(e){return!e&&0!==e}function Pf(e){return e instanceof Vf}function Sf(e){return e instanceof df}function Rf(e){return e instanceof uf}function Of(e){return ie(e[0])&&e[0].ns}function If(){return{children:[],bindings:[],attributes:{}}}function Mf(e){return"class"==e||"style"==e}class Vf extends(so(zs())){element;isRendered;locale;t;template;_viewCollections;_unboundChildren;_bindTemplate;constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new nr,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,n)=>{n.locale=e,n.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=df.bind(this,this)}createCollection(e){const t=new uf(e);return this._viewCollections.add(t),t}registerChild(e){Zs(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Zs(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new df(e)}extendTemplate(e){df.extend(this.template,e)}
9render(){if(this.isRendered)throw new bs("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)}}function Bf({emitter:e,activator:t,callback:n,contextElements:i,listenerOptions:s}){e.listenTo(document,"mousedown",(e,s)=>{if(!t())return;const o="function"==typeof s.composedPath?s.composedPath():[],r="function"==typeof i?i():i;for(const t of r)if(t.contains(s.target)||o.includes(t))return;n()},s)}function Df({keystrokeHandler:e,focusTracker:t,gridItems:n,numberOfColumns:i,uiLanguageDirection:s}){const o="number"==typeof i?()=>i:i;function r(e){return i=>{const s=n.find(e=>e.element===t.focusedElement),o=n.getIndex(s),r=e(o,n);n.get(r).focus(),i.stopPropagation(),i.preventDefault()}}function a(e,t){return e===t-1?0:e+1}function l(e,t){return 0===e?t-1:e-1}e.set("arrowright",r((e,t)=>"rtl"===s?l(e,t.length):a(e,t.length))),e.set("arrowleft",r((e,t)=>"rtl"===s?a(e,t.length):l(e,t.length))),e.set("arrowup",r((e,t)=>{let n=e-o();return n<0&&(n=e+o()*Math.floor(t.length/o()),n>t.length-1&&(n-=o())),n})),e.set("arrowdown",r((e,t)=>{let n=e+o();return n>t.length-1&&(n=e%o()),n}))}class Nf extends Vf{static presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",e.if("isVisible","ck-hidden",e=>!e),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");t&&(this.viewBox=t);for(const{name:n,value:i}of Array.from(e.attributes))Nf.presentationalAttributeNames.includes(n)&&this.element.setAttribute(n,i);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(e=>{e.style.fill=this.fillColor})}}class Ff extends Vf{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}}class Lf extends Vf{children;labelView;iconView;keystrokeView;_focusDelayed=null;constructor(e,t=new Ff){super(e);const n=this.bindTemplate,i=gs();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${i}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new Nf,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const s={tag:"button",attributes:{class:["ck","ck-button",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e),n.if("isVisible","ck-hidden",e=>!e),n.to("isOn",e=>e?"ck-on":"ck-off"),n.if("withText","ck-button_with-text"),n.if("withKeystroke","ck-button_with-keystroke")],role:n.to("role"),type:n.to("type",e=>e||"button"),tabindex:n.to("tabindex"),"aria-checked":n.to("_ariaChecked"),"aria-pressed":n.to("_ariaPressed"),"aria-label":n.to("ariaLabel"),"aria-labelledby":n.to("ariaLabelledBy"),"aria-disabled":n.if("isEnabled",!0,e=>!e),"data-cke-tooltip-text":n.to("_tooltipString"),"data-cke-tooltip-position":n.to("tooltipPosition")},children:this.children,on:{click:n.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",(e,t,n)=>!(!t||$f(n))&&String(!!e)),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",(e,t,n)=>!(!t||!$f(n))&&String(!!e)),ts.isSafari&&(this._focusDelayed||(this._focusDelayed=ur(()=>
9this.focus(),0)),s.on.mousedown=n.to(()=>{this._focusDelayed()}),s.on.mouseup=n.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(s)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new Vf;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>Go(e))}]}),e}_getTooltipString(e,t,n){return e?"string"==typeof e?e:(n&&(n=Go(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}function $f(e){switch(e){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}class zf extends Vf{children;iconView;constructor(e,t={}){super(e);const n=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",n.to("class")]},children:this.children}),t.icon&&(this.iconView=new Nf,this.iconView.content=t.icon,this.children.add(this.iconView));const i=new Vf(e);i.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:n.to("label")}]}),this.children.add(i)}}class jf extends(Ts()){focusables;focusTracker;keystrokeHandler;actions;constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];"string"==typeof n&&(n=[n]);for(const i of n)e.keystrokeHandler.set(i,(e,n)=>{this[t](),n()},e.keystrokeHandlerOptions)}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"})}get first(){return this.focusables.find(Hf)||null}get last(){return this.focusables.filter(Hf).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,n)=>{const i=t.element===this.focusTracker.focusedElement;return i&&(e=n),i}),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const e=this.next;e&&this.focusables.getIndex(e)===this.current||e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){const e=this.previous;e&&this.focusables.getIndex(e)===this.current||e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}chain(e){const t=()=>null===this.current?null:this.focusables.get(this.current);this.listenTo(e,"forwardCycle",e=>{const n=t();this.focusNext(),n!==t()&&e.stop()},{priority:"low"}),this.listenTo(e,"backwardCycle",e=>{const n=t();this.focusPrevious(),n!==t()&&e.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 n=this.current;if(null===n)return this[1===e?"first":"last"];let i=this.focusables.get(n),s=(n+t+e)%t;do{const n=this.focusables.get(s);if(Hf(n)){i=n;break}s=(s+t+e)%t}while(s!==n);return i}}function Hf(e){return Wf(e)&&Eo(e.element)}function Wf(e){return!(!("focus"in e)||"function"!=typeof e.focus)}function Uf(e){return class extends e{_onDragBound=this._onDrag.bind(this);_onDragEndBound=this._onDragEnd.bind(this);_lastDraggingCoordinates={x:0,y:0};constructor(...e){super(...e),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(Yi.document,"mouseup",this._onDragEndBound),this.listenTo(Yi.document,"touchend",this._onDragEndBound),this.listenTo(Yi.document,"mousemove",this._onDragBound),this.listenTo(Yi.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(Yi.document,"mouseup",this._onDragEndBound),this.stopListening(Yi.document,"touchend",this._onDragEndBound),this.stopListening(Yi.document,"mousemove",this._onDragBound),this.stopListening(Yi.document,"touchmove",this._onDragBound)}_onDragStart(e,t){if(!this._isHandleElementPressed(t))return;this._attachDragListeners();let n=0,i=0;t instanceof MouseEvent?(n=t.clientX,i=t.clientY):(n=t.touches[0].clientX,i=t.touches[0].clientY),this._lastDraggingCoordinates={x:n,y:i},this.isDragging=!0}_onDrag(e,t){if(!this.isDragging)return void this._detachDragListeners();let n=0,i=0;t instanceof MouseEvent?(n=t.clientX,i=t.clientY):(n=t.touches[0].clientX,i=t.touches[0].clientY),t.preventDefault(),this.fire("drag",{deltaX:Math.round(n-this._lastDraggingCoordinates.x),deltaY:Math.round(i-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:n,y:i}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(e){return!!this.dragHandleElement&&(this.dragHandleElement===e.target||e.target instanceof HTMLElement&&this.dragHandleElement.contains(e.target))}}}class qf extends Vf{children;keystrokes;focusCycler;_focusTracker;_focusables;constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new lr,this._focusTracker=new sr,this._focusables=new uf,this.focusCycler=new jf({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 e=new Lf(this.locale);let n;for(n in e.on("execute",()=>t.onExecute()),t.onCreate&&t.onCreate(e),t)"onExecute"!=n&&"onCreate"!=n&&e.set(n,t[n]);this.children.add(e)}this._updateFocusCyclableItems()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}
9_updateFocusCyclableItems(){Array.from(this.children).forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}}class Kf extends Vf{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}}const Gf="screen-center",Jf="editor-center",Zf="editor-top-side",Qf="editor-top-center",Yf="editor-bottom-center",Xf="editor-above-center",em="editor-below-center",tm=Co("px");class nm extends(Uf(Vf)){parts;headerView;closeButtonView;actionsView;static defaultOffset=15;contentView;keystrokes;focusTracker;wasMoved=!1;_getCurrentDomRoot;_getViewportOffset;_focusables;_focusCycler;constructor(e,{getCurrentDomRoot:t,getViewportOffset:n}){super(e);const i=this.bindTemplate,s=e.t;this.set("className",""),this.set("ariaLabel",s("Editor dialog")),this.set("isModal",!1),this.set("position",Gf),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=n,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new lr,this.focusTracker=new sr,this._focusables=new uf,this._focusCycler=new jf({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",i.if("isModal","ck-dialog-overlay__transparent",e=>!e),i.if("_isVisible","ck-hidden",e=>!e)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",i.if("isModal","ck-dialog_modal"),i.to("className")],role:"dialog","aria-label":i.to("ariaLabel"),style:{top:i.to("_top",e=>tm(e)),left:i.to("_left",e=>tm(e)),visibility:i.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",(e,t)=>{this.fire("close",{source:"escKeyPress"}),t()}),this.on("drag",(e,{deltaX:t,deltaY:n})=>{this.wasMoved=!0,this.moveBy(t,n)}),this.listenTo(Yi.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(Yi.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on("change:_isVisible",(e,t,n)=>{n&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView&&!this.isModal?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:n=!0,content:i,actionButtons:s}){t&&(this.headerView=new zf(this.locale,{icon:e}),n&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),i&&(i instanceof Vf&&(i=[i]),this.contentView=new Kf(this.locale),this.contentView.children.addMany(i),this.parts.add(this.contentView)),s&&(this.actionsView=new qf(this.locale),this.actionsView.setButtons(s),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const n=this._getViewportRect(),i=this._getDialogRect();e+i.width>n.right&&(e=n.right-i.width),e<n.left&&(e=n.left),t<n.top&&(t=n.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t,n=this.position;this._getCurrentDomRoot()?t=this._getVisibleDomRootRect(e):n=Gf;const i=nm.defaultOffset,s=this._getDialogRect();switch(n){case Zf:if(t){const e="ltr"===this.locale.contentLanguageDirection?t.right-s.width-i:t.left+i;this.moveTo(e,t.top+i)}else this._moveOffScreen();break;case Jf:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),Math.round(t.top+t.height/2-s.height/2)):this._moveOffScreen();break;case Gf:this.moveTo(Math.round((e.width-s.width)/2),Math.round((e.height-s.height)/2));break;case Qf:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.top+i):this._moveOffScreen();break;case Yf:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.bottom-s.height-i):this._moveOffScreen();break;case Xf:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.top-s.height-i):this._moveOffScreen();break;case em:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.bottom+i):this._moveOffScreen()}}_getVisibleDomRootRect(e){let t=new go(this._getCurrentDomRoot()).getVisible();return t?(t=e.getIntersection(t),t||null):null}
9_getDialogRect(){return new go(this.element.firstElementChild)}_getViewportRect(){const e=new go(Yi.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)Wf(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach(e=>{var t;this._focusables.add(e),this.focusTracker.add(e.element),Wf(t=e)&&"focusCycler"in t&&t.focusCycler instanceof jf&&this._focusCycler.chain(e.focusCycler)})}_createCloseButton(){const e=new Lf(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:Qu}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}}class im extends Bu{view;static _visibleDialogPlugin;_onHide;static get pluginName(){return"Dialog"}static get isOfficialPlugin(){return!0}constructor(e){super(e);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}]})}destroy(){super.destroy(),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",()=>{im._visibleDialogPlugin&&im._visibleDialogPlugin._hide()}),this.on("hide",()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)},{priority:"low"})}_initFocusToggler(){const e=this.editor;e.keystrokes.set("Ctrl+F6",(t,n)=>{this.isOpen&&!this.view.isModal&&(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),n())})}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",()=>{if(!this.view)return;const t=e.document.differ.getChangedRoots();for(const e of t)e.state&&this.view.updatePosition()})}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:n,hasCloseButton:i=!0,content:s,actionButtons:o,className:r,isModal:a,position:l,onHide:c}){const h=this.editor;this.view=new nm(h.locale,{getCurrentDomRoot:()=>h.editing.view.getDomRoot(h.model.document.selection.anchor.root.rootName),getViewportOffset:()=>h.ui.viewportOffset});const u=this.view;u.on("close",()=>{this.hide()}),h.ui.view.body.add(u),h.keystrokes.listenTo(u.element),l||(l=a?Gf:Jf),a&&this._lockBodyScroll(),u.set({position:l,_isVisible:!0,className:r,isModal:a}),u.setupParts({icon:t,title:n,hasCloseButton:i,content:s,actionButtons:o}),this.id=e,c&&(this._onHide=c),this.isOpen=!0,im._visibleDialogPlugin=this}hide(){im._visibleDialogPlugin&&im._visibleDialogPlugin.fire(`hide:${im._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,im._visibleDialogPlugin=null}_lockBodyScroll(){document.documentElement.classList.add("ck-dialog-scroll-locked")}_unlockBodyScroll(){document.documentElement.classList.remove("ck-dialog-scroll-locked")}}class sm extends Lf{_checkIconHolderView=new om;constructor(e,t=new Ff){super(e,t),this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",n.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",(e,t)=>e||t)}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,n)=>{const{children:i,_checkIconHolderView:s}=this;n?i.add(s,0):i.remove(s)})}}class om extends Vf{children;_checkIconView=this._createCheckIconView();constructor(){super();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",e=>e?"ck-on":"ck-off")]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",(e,t,n)=>{const{children:i,_checkIconView:s}=this;n&&!i.has(s)?i.add(s):!n&&i.has(s)&&i.remove(s)})}_createCheckIconView(){const e=new Nf;return e.content=Yu,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}}class rm extends sm{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}class am extends Vf{id;constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${gs()}`;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 lm extends Vf{constructor(e,t){super(e);const n=e.t,i=new am;i.text=n("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":i.id,role:"document",tabindex:-1},children:[Qs(document,"p",{},n("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())
9),i]})}focus(){this.element.focus()}_createCategories(e){return e.map(e=>{const t=[Qs(document,"h3",{},e.label),...Array.from(e.groups.values()).map(e=>this._createGroup(e)).flat()];return e.description&&t.splice(1,0,Qs(document,"p",{},e.description)),Qs(document,"section",{},t)})}_createGroup(e){const t=e.keystrokes.sort((e,t)=>e.label.localeCompare(t.label)).map(e=>this._createGroupRow(e)).flat(),n=[Qs(document,"dl",{},t)];return e.label&&n.unshift(Qs(document,"h4",{},e.label)),n}_createGroupRow(e){const t=this.locale.t,n=Qs(document,"dt"),i=Qs(document,"dd"),s=function(e){if("string"==typeof e)return[[e]];if("string"==typeof e[0])return[e];return e}(e.keystroke),o=[];for(const r of s)o.push(r.map(cm).join(""));return n.innerHTML=e.label,i.innerHTML=o.join(", ")+(e.mayRequireFn&&ts.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[n,i]}}function cm(e){return Go(e).split("+").map(e=>`<kbd>${e}</kbd>`).join("+")}var hm='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103V9.125Z"/><path clip-rule="evenodd" d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17Zm0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z"/></svg>';class um extends Bu{contentView=null;static get requires(){return[im]}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 e=this._createButton(Lf);return e.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),e}),e.ui.componentFactory.add("menuBar:accessibilityHelp",()=>{const e=this._createButton(rm);return e.label=t("Accessibility"),e}),e.keystrokes.set("Alt+0",(e,t)=>{this._toggleDialog(),t()}),this._setupRootLabels()}_createButton(e){const t=this.editor,n=t.plugins.get("Dialog"),i=new e(t.locale);return i.set({keystroke:"Alt+0",icon:hm,isToggleable:!0}),i.on("execute",()=>this._toggleDialog()),i.bind("isOn").to(n,"id",e=>"accessibilityHelp"===e),i}_setupRootLabels(){const e=this.editor,t=e.editing.view,n=e.t;function i(e,t){const i=[t.getAttribute("aria-label"),n("Press %0 for help.",[Go("Alt+0")])].filter(e=>e).join(". ");e.setAttribute("aria-label",i,t)}e.ui.on("ready",()=>{t.change(e=>{for(const n of t.document.roots)i(e,n)}),e.on("addRoot",(n,s)=>{const o=e.editing.view.document.getRoot(s.rootName);t.change(e=>i(e,o))},{priority:"low"})})}_toggleDialog(){const e=this.editor,t=e.plugins.get("Dialog"),n=e.locale.t;this.contentView||(this.contentView=new lm(e.locale,e.accessibility.keystrokeInfos)),"accessibilityHelp"===t.id?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:n("Accessibility help"),icon:hm,hasCloseButton:!0,content:this.contentView})}}class dm extends uf{locale;_bodyCollectionContainer;constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new df({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=Qs(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}class fm extends Lf{toggleSwitchView;constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new Vf;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}class mm extends(gm(sm)){}function gm(e){return class extends e{buttonView;_fileInputView;constructor(...e){super(...e),this.buttonView=this,this._fileInputView=new pm(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",()=>{this._fileInputView.open()}),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}}class pm extends Vf{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to( 10/* istanbul ignore next -- @preserve */ 11()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}var wm='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';function bm(e){return"string"==typeof e?{model:e,label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:`${e.color}`}}}}class _m extends Lf{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color",e=>ts.isMediaForcedColors?null:e)},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class ym extends Vf{columns;items;focusTracker;keystrokes;constructor(e,t){super(e);const n=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const i={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new sr,this.keystrokes=new lr,this.items.on("add",(e,t)=>{t.isOn=t.color===this.selectedColor}
11),n.forEach(e=>{const t=new _m;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})}),this.items.add(t)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:i}}),this.on("change:selectedColor",(e,t,n)=>{for(const i of this.items)i.isOn=i.color===n})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),Df({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}function vm(e,t){if(!e)return"";const n=km(e);if(!n)return"";if(n.space===t)return e;if(i=n,!Object.keys(Bd).includes(i.space))return"";var i;const s=Bd[n.space][t];if(!s)return"";return function(e,t){switch(t){case"hex":return`#${e}`;case"rgb":return`rgb( ${e[0]}, ${e[1]}, ${e[2]} )`;case"hsl":return`hsl( ${e[0]}, ${e[1]}%, ${e[2]}% )`;case"hwb":return`hwb( ${e[0]}, ${e[1]}, ${e[2]} )`;case"lab":return`lab( ${e[0]}% ${e[1]} ${e[2]} )`;case"lch":return`lch( ${e[0]}% ${e[1]} ${e[2]} )`;default:return""}}(s("hex"===n.space?n.hexValue:n.values),t)}function km(e){if(e.startsWith("#")){const t=Od(e);return{space:"hex",values:t.values,hexValue:e,alpha:t.alpha}}const t=Od(e);return t.space?t:null}class Cm extends Vf{fieldView;labelView;statusView;fieldWrapperChildren;constructor(e,t){super(e);const n=`ck-labeled-field-view-${gs()}`,i=`ck-labeled-field-view-status-${gs()}`;this.fieldView=t(this,n,i),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(i),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const s=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",s.to("class"),s.if("isEnabled","ck-disabled",e=>!e),s.if("isEmpty","ck-labeled-field-view_empty"),s.if("isFocused","ck-labeled-field-view_focused"),s.if("placeholder","ck-labeled-field-view_placeholder"),s.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 am(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new Vf(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",e=>!e)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}class xm extends Vf{focusTracker;constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new sr,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),tabindex:t.to("tabIndex"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById"),"aria-label":t.to("ariaLabel")},on:{input:t.to((...e)=>{this.fire("input",...e),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,n)=>{this._setDomElementValue(n),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}class Am extends xm{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}class Tm extends Am{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class Em extends Vf{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",e=>`ck-dropdown__panel_${e}`),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to(e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;"function"==typeof e.focus?e.focus():_s("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}class Pm extends Vf{buttonView;panelView;focusTracker;keystrokes;listView;toolbarView;menuView;constructor(e,t,n){super(e);const i=this.bindTemplate;this.buttonView=t,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new lr,this.focusTracker=new sr,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",i.to("class"),i.if("isEnabled","ck-disabled",e=>!e)],id:i.to("id"),"aria-describedby":i.to("ariaDescribedById")},children:[t,n]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":i.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.on("change:isOpen",(e,t,n)=>{if(n)if("auto"===this.panelPosition){const e=Pm._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=e?e.name:this._panelPositions[0].name}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);const e=(e,t)=>
11{this.isOpen&&(this.isOpen=!1,t())};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set("arrowright",(e,t)=>{this.isOpen&&t()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:n,southWest:i,northEast:s,northWest:o,southMiddleEast:r,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Pm.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[n,i,r,a,e,s,o,l,c,t]:[i,n,a,r,e,o,s,c,l,t]}static 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)=>({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-3*(t.width-e.width)/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-3*(t.width-e.width)/4,name:"nmw"})};static _getOptimalPosition=Po}class Sm extends Lf{arrowView;constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",e=>String(e))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new Nf;return e.content=wm,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class Rm extends Vf{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",e=>!e)],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}class Om extends Vf{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}class Im extends Vf{labelView;items;children;constructor(e,t=new am){super(e);const n=this.bindTemplate,i=new Mm(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,i]),i.set({role:"group",ariaLabelledBy:t.id}),i.focusTracker.destroy(),i.keystrokes.destroy(),this.items=i.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",n.if("isVisible","ck-hidden",e=>!e)]},children:this.children})}focus(){if(this.items){const e=this.items.find(e=>!(e instanceof Om));e&&e.focus()}}}class Mm extends Vf{focusables;items;focusTracker;keystrokes;_focusCycler;_listItemGroupToChangeListeners=new WeakMap;constructor(e){super(e);const t=this.bindTemplate;this.focusables=new uf,this.items=this.createCollection(),this.focusTracker=new sr,this.keystrokes=new lr,this._focusCycler=new jf({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 Im?this._registerFocusableItemsGroup(e):e instanceof Rm&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(const n of t.removed)n instanceof Im?this._deregisterFocusableItemsGroup(n):n instanceof Rm&&this._deregisterFocusableListItem(n);for(const n of Array.from(t.added).reverse())n instanceof Im?this._registerFocusableItemsGroup(n,t.index):this._registerFocusableListItem(n,t.index)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,n)=>{for(const e of n.removed)this._deregisterFocusableListItem(e);for(const i of Array.from(n.added).reverse())this._registerFocusableListItem(i,this.items.getIndex(e)+n.index)}}
11_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((e,n)=>{const i=void 0!==t?t+n:void 0;this._registerFocusableListItem(e,i)});const n=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,n),e.items.on("change",n)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}const Vm=Co("px"),Bm={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class Dm extends Vf{content;_pinWhenIsVisibleCallback;_resizeObserver;constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",e=>`ck-balloon-panel_${e}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",Vm),left:t.to("left",Vm)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){const t=Nm(e.target);if(t&&!Eo(t))return!1;this.show();const n=Dm.defaultPositions,i=Object.assign({},{element:this.element,positions:[n.southArrowNorth,n.southArrowNorthMiddleWest,n.southArrowNorthMiddleEast,n.southArrowNorthWest,n.southArrowNorthEast,n.northArrowSouth,n.northArrowSouthMiddleWest,n.northArrowSouthMiddleEast,n.northArrowSouthWest,n.northArrowSouthEast,n.viewportStickyNorth],limiter:Yi.document.body,fitInViewport:!0},e),s=Dm._getOptimalPosition(i)||Bm,o=parseInt(s.left),r=parseInt(s.top),a=s.name,l=s.config||{},{withArrow:c=!0}=l;return this.top=r,this.left=o,this.position=a,this.withArrow=c,!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=Nm(e.target);const n=e.limiter?Nm(e.limiter):Yi.document.body;if(this.listenTo(Yi.document,"scroll",(i,s)=>{const o=s.target,r=t&&o.contains(t),a=n&&o.contains(n);!r&&!a&&t&&n||this.attachTo(e)},{useCapture:!0}),this.listenTo(Yi.window,"resize",()=>{this.attachTo(e)}),!this._resizeObserver&&(t&&ho(t)&&(t=t.parentElement),t)){const e=()=>{Eo(t)||this.unpin()};this._resizeObserver=new vo(t,e)}return!0}_stopPinning(){this.stopListening(Yi.document,"scroll"),this.stopListening(Yi.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(e={}){const{sideOffset:t=Dm.arrowSideOffset,heightOffset:n=Dm.arrowHeightOffset,stickyVerticalOffset:i=Dm.stickyVerticalOffset,config:s}=e;return{northWestArrowSouthWest:(e,n)=>({top:o(e,n),left:e.left-t,name:"arrow_sw",...s&&{config:s}}),northWestArrowSouthMiddleWest:(e,n)=>({top:o(e,n),left:e.left-.25*n.width-t,name:"arrow_smw",...s&&{config:s}}),northWestArrowSouth:(e,t)=>({top:o(e,t),left:e.left-t.width/2,name:"arrow_s",...s&&{config:s}}),northWestArrowSouthMiddleEast:(e,n)=>({top:o(e,n),left:e.left-.75*n.width+t,name:"arrow_sme",...s&&{config:s}}),northWestArrowSouthEast:(e,n)=>({top:o(e,n),left:e.left-n.width+t,name:"arrow_se",...s&&{config:s}}),northArrowSouthWest:(e,n)=>({top:o(e,n),left:e.left+e.width/2-t,name:"arrow_sw",...s&&{config:s}}),northArrowSouthMiddleWest:(e,n)=>({top:o(e,n),left:e.left+e.width/2-.25*n.width-t,name:"arrow_smw",...s&&{config:s}}),northArrowSouth:(e,t)=>({top:o(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s",...s&&{config:s}}),northArrowSouthMiddleEast:(e,n)=>({top:o(e,n),left:e.left+e.width/2-.75*n.width+t,name:"arrow_sme",...s&&{config:s}}),northArrowSouthEast:(e,n)=>
11({top:o(e,n),left:e.left+e.width/2-n.width+t,name:"arrow_se",...s&&{config:s}}),northEastArrowSouthWest:(e,n)=>({top:o(e,n),left:e.right-t,name:"arrow_sw",...s&&{config:s}}),northEastArrowSouthMiddleWest:(e,n)=>({top:o(e,n),left:e.right-.25*n.width-t,name:"arrow_smw",...s&&{config:s}}),northEastArrowSouth:(e,t)=>({top:o(e,t),left:e.right-t.width/2,name:"arrow_s",...s&&{config:s}}),northEastArrowSouthMiddleEast:(e,n)=>({top:o(e,n),left:e.right-.75*n.width+t,name:"arrow_sme",...s&&{config:s}}),northEastArrowSouthEast:(e,n)=>({top:o(e,n),left:e.right-n.width+t,name:"arrow_se",...s&&{config:s}}),southWestArrowNorthWest:e=>({top:r(e),left:e.left-t,name:"arrow_nw",...s&&{config:s}}),southWestArrowNorthMiddleWest:(e,n)=>({top:r(e),left:e.left-.25*n.width-t,name:"arrow_nmw",...s&&{config:s}}),southWestArrowNorth:(e,t)=>({top:r(e),left:e.left-t.width/2,name:"arrow_n",...s&&{config:s}}),southWestArrowNorthMiddleEast:(e,n)=>({top:r(e),left:e.left-.75*n.width+t,name:"arrow_nme",...s&&{config:s}}),southWestArrowNorthEast:(e,n)=>({top:r(e),left:e.left-n.width+t,name:"arrow_ne",...s&&{config:s}}),southArrowNorthWest:e=>({top:r(e),left:e.left+e.width/2-t,name:"arrow_nw",...s&&{config:s}}),southArrowNorthMiddleWest:(e,n)=>({top:r(e),left:e.left+e.width/2-.25*n.width-t,name:"arrow_nmw",...s&&{config:s}}),southArrowNorth:(e,t)=>({top:r(e),left:e.left+e.width/2-t.width/2,name:"arrow_n",...s&&{config:s}}),southArrowNorthMiddleEast:(e,n)=>({top:r(e),left:e.left+e.width/2-.75*n.width+t,name:"arrow_nme",...s&&{config:s}}),southArrowNorthEast:(e,n)=>({top:r(e),left:e.left+e.width/2-n.width+t,name:"arrow_ne",...s&&{config:s}}),southEastArrowNorthWest:e=>({top:r(e),left:e.right-t,name:"arrow_nw",...s&&{config:s}}),southEastArrowNorthMiddleWest:(e,n)=>({top:r(e),left:e.right-.25*n.width-t,name:"arrow_nmw",...s&&{config:s}}),southEastArrowNorth:(e,t)=>({top:r(e),left:e.right-t.width/2,name:"arrow_n",...s&&{config:s}}),southEastArrowNorthMiddleEast:(e,n)=>({top:r(e),left:e.right-.75*n.width+t,name:"arrow_nme",...s&&{config:s}}),southEastArrowNorthEast:(e,n)=>({top:r(e),left:e.right-n.width+t,name:"arrow_ne",...s&&{config:s}}),westArrowEast:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.left-t.width-n,name:"arrow_e",...s&&{config:s}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+n,name:"arrow_w",...s&&{config:s}}),viewportStickyNorth:(e,t,n,o)=>{const r=o||n;return e.getIntersection(r)?r.height-e.height>i?null:{top:r.top+i,left:e.left+e.width/2-t.width/2,name:"arrowless",config:{withArrow:!1,...s}}:null}};function o(e,t){return e.top-t.height-n}function r(e){return e.bottom+n}}static arrowSideOffset=25;static arrowHeightOffset=10;static stickyVerticalOffset=20;static _getOptimalPosition=Po;static defaultPositions=Dm.generatePositions()}function Nm(e){return Hi(e)?e:uo(e)?e.commonAncestorContainer:"function"==typeof e?Nm(e()):null}class Fm extends Vf{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Lm extends Vf{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function $m(e){if(Array.isArray(e))return{items:e,removeItems:[]};const t={items:[],removeItems:[]};return e?{...t,...e}:t}const zm=(()=>({alignLeft:ad,bold:Zu,importExport:id,paragraph:sd,plus:od,text:rd,threeVerticalDots:ud,pilcrow:cd,dragIndicator:dd}))();class jm extends Vf{options;items;focusTracker;keystrokes;itemsView;children;focusables;_focusCycler;_behavior;constructor(e,t){super(e);const n=this.bindTemplate,i=this.t;this.options=t||{},this.set("ariaLabel",i("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new sr,this.keystrokes=new lr,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new Hm(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const s="rtl"===e.uiLanguageDirection;this._focusCycler=new jf({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[s?"arrowright":"arrowleft","arrowup"],focusNext:[s?"arrowleft":"arrowright","arrowdown"]}});const o=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];var r;this.options.shouldGroupWhenFull&&this.options.isFloating&&o.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:o,role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")},tabindex:-1}
11,children:this.children,on:{mousedown:(r=this,r.bindTemplate.to(e=>{e.target===r.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Um(this):new Wm(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,n){this.items.addMany(this._buildItemsFromConfig(e,t,n))}_buildItemsFromConfig(e,t,n){const i=$m(e),s=n||i.removeItems;return this._cleanItemsConfiguration(i.items,t,s).map(e=>ie(e)?this._createNestedToolbarDropdown(e,t,s):"|"===e?new Fm:"-"===e?new Lm:t.create(e)).filter(e=>!!e)}_cleanItemsConfiguration(e,t,n){const i=e.filter((e,i,s)=>"|"===e||-1===n.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||(_s("toolbarview-line-break-ignored-when-grouping-items",s),!1):!(!ie(e)&&!t.has(e))||(_s("toolbarview-item-unavailable",{item:e}),!1)));return this._cleanSeparatorsAndLineBreaks(i)}_cleanSeparatorsAndLineBreaks(e){const t=e=>"-"!==e&&"|"!==e,n=e.length,i=e.findIndex(t);if(-1===i)return[];const s=n-e.slice().reverse().findIndex(t);return e.slice(i,s).filter((e,n,i)=>{if(t(e))return!0;return!(n>0&&i[n-1]===e)})}_createNestedToolbarDropdown(e,t,n){let{label:i,icon:s,items:o,tooltip:r=!0,withText:a=!1}=e;if(o=this._cleanItemsConfiguration(o,t,n),!o.length)return null;const l=Km(this.locale);return i||_s("toolbarview-nested-toolbar-dropdown-missing-label",e),l.class="ck-toolbar__nested-toolbar-dropdown",l.buttonView.set({label:i,tooltip:r,withText:!!a}),!1!==s?l.buttonView.icon=zm[s]||s||ud:l.buttonView.withText=!0,Gm(l,()=>l.toolbarView._buildItemsFromConfig(o,t,n)),l}}class Hm extends Vf{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Wm{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>Wf(e)?e:null),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Um{view;viewChildren;viewFocusables;viewItemsView;viewFocusTracker;viewLocale;ungroupedItems;groupedItems;groupedItemsDropdown;resizeObserver=null;cachedPadding=null;shouldUpdateGroupingOnNextResize=!1;viewElement;constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",(e,t)=>{const n=t.index,i=Array.from(t.added);for(const s of t.removed)n>=this.ungroupedItems.length?this.groupedItems.remove(s):this.ungroupedItems.remove(s);for(let s=n;s<n+i.length;s++){const e=i[s-n];s>this.ungroupedItems.length?this.groupedItems.add(e,s-this.ungroupedItems.length):this.ungroupedItems.add(e,s)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Eo(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,n=new go(e.lastChild),i=new go(e);if(!this.cachedPadding){const n=Yi.window.getComputedStyle(e),i="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[i])}return"ltr"===t?n.right>i.right-this.cachedPadding:n.left<i.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new vo(this.viewElement,t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new Fm),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,n=Km(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Gm(n,this.groupedItems),n.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:ud}),n}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{Wf(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}class qm extends Vf{children;actionView;arrowView;keystrokes;focusTracker;constructor(e,t){super(e);const n=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new lr,this.focusTracker=new sr,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",n.to("class"),n.if("isVisible","ck-hidden",e=>!e),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 Lf;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 Lf,t=e.bindTemplate;return e.icon=wm,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",e=>String(e))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}function Km(e,t=Sm){const n="function"==typeof t?new t(e):t,i=new Em(e),s=new Pm(e,n,i);return n.bind("isEnabled").to(s),n instanceof qm?n.arrowView.bind("isOn").to(s,"isOpen"):n.bind("isOn").to(s,"isOpen"),function(e){(function(e){Bf({emitter:e,activator:()=>e.isRendered&&e.isOpen,callback:()=>{e.isOpen=!1},contextElements:()=>
11[e.element,...Xm(e.focusTracker).filter(t=>!e.element.contains(t))]})})(e),function(e){e.on("execute",t=>{t.source instanceof fm||(e.isOpen=!1)})}(e),function(e){e.focusTracker.on("change:isFocused",(t,n,i)=>{!i&&e.isOpen&&(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,n)=>{e.isOpen&&(e.panelView.focus(),n())}),e.keystrokes.set("arrowup",(t,n)=>{e.isOpen&&(e.panelView.focusLast(),n())})}(e),function(e){e.on("change:isOpen",(t,n,i)=>{if(i)return;e.focusTracker.elements.some(e=>e.contains(Yi.document.activeElement))&&e.buttonView.focus()})}(e),function(e){e.on("change:isOpen",(t,n,i)=>{i&&e.panelView.focus()},{priority:"low"})}(e)}(s),s}function Gm(e,t,n={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?Jm(e,t,n):e.once("change:isOpen",()=>Jm(e,t,n),{priority:"highest"}),n.enableActiveItemFocusOnDropdownOpen&&Ym(e,()=>e.toolbarView.items.find(e=>e.isOn))}function Jm(e,t,n){const i=e.locale,s=i.t,o=e.toolbarView=new jm(i),r="function"==typeof t?t():t;o.ariaLabel=n.ariaLabel||s("Dropdown toolbar"),n.maxWidth&&(o.maxWidth=n.maxWidth),n.class&&(o.class=n.class),n.isCompact&&(o.isCompact=n.isCompact),n.isVertical&&(o.isVertical=!0),r instanceof uf?o.items.bindTo(r).using(e=>e):o.items.addMany(r),e.panelView.children.add(o),e.focusTracker.add(o),o.items.delegate("execute").to(e)}function Zm(e,t,n={}){e.isOpen?Qm(e,t,n):e.once("change:isOpen",()=>Qm(e,t,n),{priority:"highest"}),Ym(e,()=>e.listView.items.find(e=>e instanceof Rm&&e.children.first.isOn))}function Qm(e,t,n){const i=e.locale,s=e.listView=new Mm(i),o="function"==typeof t?t():t;s.ariaLabel=n.ariaLabel,s.role=n.role,eg(e,s.items,o,i),e.panelView.children.add(s),s.items.delegate("execute").to(e)}function Ym(e,t){e.on("change:isOpen",()=>{if(!e.isOpen)return;const n=t();n&&("function"==typeof n.focus?n.focus():_s("ui-dropdown-focus-child-on-open-child-missing-focus",{view:n}))},{priority:ps.low-10})}function Xm(e){return[...e.elements,...e.externalViews.flatMap(e=>Xm(e.focusTracker))]}function eg(e,t,n,i){t.on("change",()=>{const e=[...t].reduce((e,t)=>(t instanceof Rm&&t.children.first instanceof sm&&e.push(t.children.first),e),[]),n=e.some(e=>e.isToggleable);e.forEach(e=>{e.hasCheckSpace=n})}),t.bindTo(n).using(t=>{if("separator"===t.type)return new Om(i);if("group"===t.type){const n=new Im(i);return n.set({label:t.label}),eg(e,n.items,t.items,i),n.items.delegate("execute").to(e),n}if("button"===t.type||"switchbutton"===t.type){const e="menuitemcheckbox"===t.model.role||"menuitemradio"===t.model.role,n=new Rm(i);let s;return"button"===t.type?(s=new sm(i),s.set({isToggleable:e})):s=new fm(i),s.bind(...Object.keys(t.model)).to(t.model),s.delegate("execute").to(n),n.children.add(s),n}return null})}const tg=(e,t,n)=>{const i=new Tm(e.locale);return i.set({id:t,ariaDescribedById:n}),i.bind("isReadOnly").to(e,"isEnabled",e=>!e),i.bind("hasError").to(e,"errorText",e=>!!e),i.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused","placeholder").to(i),i};class ng extends Vf{hexInputRow;_debounceColorPickerEvent;_config;constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const n=this.createCollection();t.hideInput||n.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:n}),this._config=t,this._debounceColorPickerEvent=Ni(e=>{this.set("color",e),this.fire("colorSelected",{color:this.color})},150,{leading:!0}),this.on("set:color",(e,t,n)=>{e.return=vm(n,this._config.format||"hsl")}),this.on("change:color",()=>{this._hexColor=ig(this.color)}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),ig(this.color)!=ig(this._hexColor)&&(this.color=this._hexColor)})}render(){var e,t;if(super.render(),e="hex-color-picker",t=hf,void 0===customElements.get(e)&&customElements.define(e,t),this.picker=Yi.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(){if(!this._config.hideInput&&(ts.isGecko||ts.isiOS||ts.isSafari)){this.hexInputRow.children.get(1).focus()}this.slidersView.first.focus()}_createSlidersView(){const e=[...this.picker.shadowRoot.children].filter(e=>"slider"===e.getAttribute("role")).map(e=>new sg(e));
11this.slidersView=this.createCollection(),e.forEach(e=>{this.slidersView.add(e)})}_createInputRow(){const e=this._createColorInput();return new rg(this.locale,e)}_createColorInput(){const e=new Cm(this.locale,tg),{t:t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",t=>e.isFocused?e.fieldView.value:t.startsWith("#")?t.substring(1):t),e.fieldView.on("input",()=>{const t=e.fieldView.element.value;if(t){const e=ag(t);e&&this._debounceColorPickerEvent(e)}}),e}isValid(){const{t:e}=this.locale;return!!this._config.hideInput||(this.resetValidationStatus(),!!this.hexInputRow.getParsedColor()||(this.hexInputRow.inputView.errorText=e('Please enter a valid color (e.g. "ff0000").'),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function ig(e){let t=function(e){if(!e)return"";const t=km(e);return t?"hex"===t.space?t.hexValue:vm(e,"hex"):"#000"}(e);return t||(t="#000"),4===t.length&&(t="#"+[t[1],t[1],t[2],t[2],t[3],t[3]].join("")),t.toLowerCase()}class sg extends Vf{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class og extends Vf{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class rg extends Vf{children;inputView;constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new og,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return ag(this.inputView.fieldView.element.value)}}function ag(e){if(!e)return null;const t=e.trim().replace(/^#/,"");return[3,4,6,8].includes(t.length)&&/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(t)?`#${t}`:null}class lg extends(zs(nr)){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",0===this.length)})}add(e,t){return this.find(t=>t.color===e.color)?this:super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}class cg extends Vf{items;colorDefinitions;focusTracker;columns;documentColors;documentColorsCount;staticColorsGrid;documentColorsGrid;colorPickerButtonView;removeColorButtonView;_focusables;_documentColorsLabel;_removeButtonLabel;_colorPickerLabel;constructor(e,{colors:t,columns:n,removeButtonLabel:i,documentColorsLabel:s,documentColorsCount:o,colorPickerLabel:r,focusTracker:a,focusables:l}){super(e);const c=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=n,this.documentColors=new lg,this.documentColorsCount=o,this._focusables=l,this._removeButtonLabel=i,this._colorPickerLabel=r,this._documentColorsLabel=s,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",c.if("isVisible","ck-hidden",e=>!e)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const n=e.document,i=this.documentColorsCount;this.documentColors.clear();for(const s of n.getRoots()){const n=e.createRangeIn(s);for(const e of n.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=i))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,n=this.selectedColor;t.selectedColor=n,e&&(e.selectedColor=n)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=df.bind(this.documentColors,this.documentColors),t=new Vf(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()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new Lf,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:Xu,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show")})}_createRemoveColorButton(){const e=new Lf;return e.set({withText:!0,icon:ed,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 ym(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",(e,t)=>{this.fire("execute",{value:t.value,source:"staticColorsGrid"})}),e}_createDocumentColorsGrid(){const e=df.bind(this.documentColors,this.documentColors),t=new ym(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(e=>{const t=new _m;return t.set({color:e.color,hasBorder:e.options&&e.options.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on("execute",()=>{this.fire("execute",{value:e.color,source:"documentColorsGrid"})}),t}),this.documentColors.on("change:isEmpty",(e,n,i)=>{i&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(t=>t.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}class hg extends Vf{items;colorPickerView;saveButtonView;cancelButtonView;actionBarView;focusTracker;keystrokes;_focusables;_colorPickerViewConfig;constructor(e,{focusTracker:t,focusables:n,keystrokes:i,colorPickerViewConfig:s}
11){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=i,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=n,this._colorPickerViewConfig=s;const o=this.bindTemplate,{saveButtonView:r,cancelButtonView:a}=this._createActionButtons();this.saveButtonView=r,this.cancelButtonView=a,this.actionBarView=this._createActionBarView({saveButtonView:r,cancelButtonView:a}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",o.if("isVisible","ck-hidden",e=>!e)]},children:this.items})}render(){super.render();const e=new ng(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,n,i)=>{e.color=i}),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set("enter",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=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const t of this.colorPickerView.slidersView)this.focusTracker.add(t.element),this._focusables.add(t);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const n=new Vf,i=this.createCollection();return i.add(e),i.add(t),n.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:i}),n}_createActionButtons(){const e=this.locale,t=e.t,n=new Lf(e),i=new Lf(e);return n.set({icon:Yu,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),i.set({icon:Qu,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),n.on("execute",()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})}),i.on("execute",()=>{this.fire("colorPicker:cancel")}),{saveButtonView:n,cancelButtonView:i}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",(e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)})}}class ug extends Vf{focusTracker;keystrokes;items;colorGridsFragmentView;colorPickerFragmentView;_focusCycler;_focusables;_colorPickerViewConfig;constructor(e,{colors:t,columns:n,removeButtonLabel:i,documentColorsLabel:s,documentColorsCount:o,colorPickerLabel:r,colorPickerViewConfig:a}){super(e),this.items=this.createCollection(),this.focusTracker=new sr,this.keystrokes=new lr,this._focusables=new uf,this._colorPickerViewConfig=a,this._focusCycler=new jf({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new cg(e,{colors:t,columns:n,removeButtonLabel:i,documentColorsLabel:s,documentColorsCount:o,colorPickerLabel:r,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new hg(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:a}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",(e,t,n)=>{this.colorGridsFragmentView.set("selectedColor",n),this.colorPickerFragmentView.set("selectedColor",n)}),this.colorGridsFragmentView.on("change:selectedColor",(e,t,n)=>{this.set("selectedColor",n)}),this.colorPickerFragmentView.on("change:selectedColor",(e,t,n)=>{this.set("selectedColor",n)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){this.colorPickerFragmentView.colorPickerView&&!this._isColorPickerFragmentVisible&&(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(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(){2!==this.items.length&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{this.showColorPickerFragment()}),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}class dg{editor;_components=new Map;constructor(e){this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(fg(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new bs("componentfactory-item-missing",this,{name:e});return this._components.get(fg(e)).callback(this.editor.locale)}has(e){return this._components.has(fg(e))}}function fg(e){return String(e).toLowerCase()}const mg="ck-tooltip";class gg extends(so()){tooltipTextView;balloonPanelView;static defaultBalloonPositions=Dm.generatePositions({heightOffset:5,sideOffset:13});_currentElementWithTooltip=null;_currentTooltipPosition=null;_mutationObserver=null;_pinTooltipDebounced;_unpinTooltipDebounced;_watchdogExcluded;static _editors=new Set;static _instance=null;constructor(e){if(super(),gg._editors.add(e),gg._instance)return gg._instance;gg._instance=this,this.tooltipTextView=new Vf(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 Dm(e.locale),this.balloonPanelView.class=mg,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=function(e){const t=new MutationObserver(()=>{e()});return{attach(e){t.observe(e,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){t.disconnect()}}}(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=Ni(this._pinTooltip,600),this._unpinTooltipDebounced=Ni(this._unpinTooltip,400),this.listenTo(Yi.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(Yi.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(Yi.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(Yi.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(Yi.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(Yi.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;gg._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),gg._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),gg._instance=null)}static getPositioningFunctions(e){const t=gg.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onKeyDown(e,t){"Escape"===t.key&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const n=pg(t);n?n!==this._currentElementWithTooltip&&(this._unpinTooltip(),"focus"!==e.name||n.matches(":hover")?this._pinTooltipDebounced(n,wg(n)):this._pinTooltip(n,wg(n))):"focus"===e.name&&this._unpinTooltip()}_onLeaveOrBlur(e,{target:t,relatedTarget:n}){if("mouseleave"===e.name){if(!Hi(t))return;const e=this.balloonPanelView.element,i=e&&(e===n||e.contains(n)),s=!i&&t===e;if(i)return void this._unpinTooltipDebounced.cancel();if(!s&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const o=pg(t),r=pg(n);(s||o&&o!==r)&&this._unpinTooltipDebounced()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:n,cssClass:i}){this._unpinTooltip();const s=ir(gg._editors.values()).ui.view.body;s.has(this.balloonPanelView)||s.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.class=[mg,i].filter(e=>e).join(" "),this.balloonPanelView.pin({target:e,positions:gg.getPositioningFunctions(n)}),this._mutationObserver.attach(e);for(const o of gg._editors)this.listenTo(o.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=n}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of gg._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=wg(this._currentElementWithTooltip);Eo(this._currentElementWithTooltip)&&e.text?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:gg.getPositioningFunctions(e.position)}):this._unpinTooltip()}}function pg(e){return Hi(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function wg(e){return{text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||"s",cssClass:e.dataset.ckeTooltipClass||""}}class bg extends(so()){editor;_balloonView;_showBalloonThrottled;_lastFocusedEditableElement;constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=Zi(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;(!!e.config.get("ui.poweredBy.forceVisible")||"VALID"!==function(e){function t(e){return e.length>=40&&e.length<=255?"VALID":"INVALID"}if(!e)return"INVALID";let n="";try{n=atob(e)}catch(bC){return"INVALID"}const i=n.split("-"),s=i[0],o=i[1];if(!o)return t(e);try{atob(o)}catch(bC){try{if(atob(s),!atob(s).length)return t(e)}catch(u){return t(e)}}if(s.length<40||s.length>255)return"INVALID";let r="";try{atob(s),r=atob(o)}catch(bC){return"INVALID"}if(8!==r.length)return"INVALID";const a=Number(r.substring(0,4)),l=Number(r.substring(4,6))-1,c=Number(r.substring(6,8)),h=new Date(a,l,c);return h<vs||isNaN(Number(h))?"INVALID":"VALID"}(e.config.get("licenseKey")))&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(e,t,n)=>{this._updateLastFocusedEditableElement(),n?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(e,t,n)=>{this._updateLastFocusedEditableElement(),n&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new Dm,n=vg(e),i=new _g(e.locale,n.label);t.content.add(i),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=function(e,t){const n=vg(e),i="right"===n.side?function(e,t){return yg(e,t,(e,n)=>e.left+e.width-n.width-t.horizontalOffset)}(t,n):function(e,t){return yg(e,t,e=>e.left+t.horizontalOffset)}(t,n);return{target:t,positions:[i]}}(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,n=e.ui.focusTracker.focusedElement;if(!t||!n)return void(this._lastFocusedEditableElement=null);const i=Array.from(e.ui.getEditableElementsNames()).map(t=>e.ui.getEditableElement(t));i.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=i[0]}}class _g extends Vf{constructor(e,t){super(e);const n=new Nf,i=this.bindTemplate;n.set({content:'<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewB
11ox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/>
11<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>\n',isColorInherited:!1}),n.extendTemplate({attributes:{style:{width:"53px",height:"10px"}}}),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:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],n],on:{dragstart:i.to(e=>e.preventDefault())}}]})}}function yg(e,t,n){return(i,s)=>{const o=new go(e);if(o.width<350||o.height<50)return null;let r;r="inside"===t.position?o.bottom-s.height:o.bottom-s.height/2,r-=t.verticalOffset;const a=n(o,s),l=i.clone().moveTo(a,r).getIntersection(s.clone().moveTo(a,r)).getVisible();return!l||l.getArea()<s.getArea()?null:{top:r,left:a,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}function vg(e){const t=e.config.get("ui.poweredBy"),n=t&&t.position||"border";return{position:n,label:"Powered by",verticalOffset:"inside"===n?5:0,horizontalOffset:5,side:"ltr"===e.locale.contentLanguageDirection?"right":"left",...t}}const kg={POLITE:"polite",ASSERTIVE:"assertive"};class Cg{editor;view;constructor(e){this.editor=e,e.once("ready",()=>{for(const e of Object.values(kg))this.announce("",e)})}announce(e,t=kg.POLITE){const n=this.editor;if(!n.ui.view)return;this.view||(this.view=new xg(n.locale),n.ui.view.body.add(this.view));const{politeness:i,isUnsafeHTML:s}="string"==typeof t?{politeness:t}:t;let o=this.view.regionViews.find(e=>e.politeness===i);o||(o=new Ag(n,i),this.view.regionViews.add(o)),o.announce({announcement:e,isUnsafeHTML:s})}}class xg extends Vf{regionViews;constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class Ag extends Vf{politeness;_domConverter;_pruneAnnouncementsInterval;constructor(e,t){super(e.locale),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",()=>{null!==this._pruneAnnouncementsInterval&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)}),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval(()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()},5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;const n=document.createElement("li");t?this._domConverter.setContentOf(n,e):n.innerText=e,this._listElement.appendChild(n)}get _listElement(){return this.element.querySelector("ul")}}class Tg extends Rm{constructor(e,t){super(e);const n=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:n.to("mouseenter")}}),this.delegate("mouseenter").to(t)}}const Eg={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",t=>{if(e.isFocusBorderEnabled||e.isOpen){if(e.isOpen)for(const n of e.menus){const e=t.path[0],i=e instanceof Tg&&e.children.first===n;n.isOpen=(t.path.includes(n)||i)&&n.isEnabled}
11t.source.focus()}})},focusCycleMenusOnArrows(e){const t="rtl"===e.locale.uiLanguageDirection;function n(t,n){const i=e.children.getIndex(t),s=t.isOpen,o=e.children.length,r=e.children.get((i+o+n)%o);t.isOpen=!1,s&&(r.isOpen=!0),r.buttonView.focus()}e.on("menu:arrowright",e=>{n(e.source,t?-1:1)}),e.on("menu:arrowleft",e=>{n(e.source,t?1:-1)})},closeMenusWhenTheBarCloses(e){e.on("change:isOpen",()=>{e.isOpen||e.menus.forEach(e=>{e.isOpen=!1})})},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",(t,n,i)=>{i&&e.menus.filter(e=>t.source.parentMenuView===e.parentMenuView&&t.source!==e&&e.isOpen).forEach(e=>{e.isOpen=!1})})},closeOnClickOutside(e){Bf({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map(e=>e.element)})},enableFocusHighlightOnInteraction(e){let t=!1;e.on("change:isOpen",(n,i,s)=>{s||(t||(e.isFocusBorderEnabled=!1),t=!1)}),e.listenTo(e.element,"keydown",()=>{t=!0},{useCapture:!0}),e.listenTo(e.element,"keyup",()=>{t=!1},{useCapture:!0}),e.listenTo(e.element,"focus",()=>{t&&(e.isFocusBorderEnabled=!0)},{useCapture:!0})}},Pg={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set("arrowdown",(t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),n())})},openOnArrowRightKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(t,(t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&e.isEnabled&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),n())})},openOnButtonClick(e){e.buttonView.on("execute",()=>{e.isOpen=!0})},toggleOnButtonClick(e){e.buttonView.on("execute",()=>{e.isOpen=!e.isOpen})},openAndFocusOnEnterKeyPress(e){e.keystrokes.set("enter",(t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=!0,e.panelView.focus(),n())})},closeOnArrowLeftKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowright":"arrowleft";e.keystrokes.set(t,(t,n)=>{e.isOpen&&(e.isOpen=!1,e.focus(),n())})},closeOnEscKey(e){e.keystrokes.set("esc",(t,n)=>{e.isOpen&&(e.isOpen=!1,e.focus(),n())})},closeOnParentClose(e){e.parentMenuView.on("change:isOpen",(t,n,i)=>{i||t.source!==e.parentMenuView||(e.isOpen=!1)})}},Sg={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),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"}),eastSouth:e=>({top:e.top,left:e.right-5,name:"es"}),eastNorth:(e,t)=>({top:e.top-t.height,left:e.right-5,name:"en"}),westSouth:(e,t)=>({top:e.top,left:e.left-t.width+5,name:"ws"}),westNorth:(e,t)=>({top:e.top-t.height,left:e.left-t.width+5,name:"wn"})},Rg=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:comment","menuBar:insertMergeField"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]}
11,{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function Og({normalizedConfig:e,locale:t,componentFactory:n,extraItems:i}){const s=hi(e);return Ig(e,s,i),function(e,t){const n=t.removeItems,i=[];t.items=t.items.filter(({menuId:e})=>!n.includes(e)||(i.push(e),!1)),Dg(t.items,e=>{e.groups=e.groups.filter(({groupId:e})=>!n.includes(e)||(i.push(e),!1));for(const t of e.groups)t.items=t.items.filter(e=>{const t=zg(e);return!n.includes(t)||(i.push(t),!1)})});for(const s of n)i.includes(s)||_s("menu-bar-item-could-not-be-removed",{menuBarConfig:e,itemName:s})}(e,s),Ig(e,s,s.addItems),function(e,t,n){Dg(t.items,i=>{for(const s of i.groups)s.items=s.items.filter(s=>{const o="string"==typeof s&&!n.has(s);return o&&!t.isUsingDefaultConfig&&_s("menu-bar-item-unavailable",{menuBarConfig:e,parentMenuConfig:hi(i),componentName:s}),!o})})}(e,s,n),Vg(e,s),function(e,t){const n=t.t,i={File:n({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:n({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:n({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:n({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:n({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:n({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:n({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:n({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:n({string:"Font",id:"MENU_BAR_MENU_FONT"})};Dg(e.items,e=>{e.label in i&&(e.label=i[e.label])})}(s,t),s}function Ig(e,t,n){const i=[];if(0!=n.length){for(const e of n){const n=Lg(e.position),s=$g(e.position);if(Ng(e))if(s){const o=t.items.findIndex(e=>e.menuId===s);if(-1!=o)"before"===n?(t.items.splice(o,0,e.menu),i.push(e)):"after"===n&&(t.items.splice(o+1,0,e.menu),i.push(e));else{Mg(t,e.menu,s,n)&&i.push(e)}}else"start"===n?(t.items.unshift(e.menu),i.push(e)):"end"===n&&(t.items.push(e.menu),i.push(e));else if(Fg(e))Dg(t.items,t=>{if(t.menuId===s)"start"===n?(t.groups.unshift(e.group),i.push(e)):"end"===n&&(t.groups.push(e.group),i.push(e));else{const o=t.groups.findIndex(e=>e.groupId===s);-1!==o&&("before"===n?(t.groups.splice(o,0,e.group),i.push(e)):"after"===n&&(t.groups.splice(o+1,0,e.group),i.push(e)))}});else{Mg(t,e.item,s,n)&&i.push(e)}}for(const t of n)i.includes(t)||_s("menu-bar-item-could-not-be-added",{menuBarConfig:e,addedItemConfig:t})}}function Mg(e,t,n,i){let s=!1;return Dg(e.items,e=>{for(const{groupId:o,items:r}of e.groups){if(s)return;if(o===n)"start"===i?(r.unshift(t),s=!0):"end"===i&&(r.push(t),s=!0);else{const e=r.findIndex(e=>zg(e)===n);-1!==e&&("before"===i?(r.splice(e,0,t),s=!0):"after"===i&&(r.splice(e+1,0,t),s=!0))}}}),s}function Vg(e,t){const n=t.isUsingDefaultConfig;let i=!1;t.items=t.items.filter(t=>!!t.groups.length||(Bg(e,t,n),!1)),t.items.length?(Dg(t.items,t=>{t.groups=t.groups.filter(e=>!!e.items.length||(i=!0,!1));for(const s of t.groups)s.items=s.items.filter(t=>!(jg(t)&&!t.groups.length)||(Bg(e,t,n),i=!0,!1))}),i&&Vg(e,t)):Bg(e,e,n)}function Bg(e,t,n){n||_s("menu-bar-menu-empty",{menuBarConfig:e,emptyMenuConfig:t})}function Dg(e,t){if(Array.isArray(e))for(const i of e)n(i);function n(e){t(e);for(const t of e.groups)for(const e of t.items)jg(e)&&n(e)}}function Ng(e){return"object"==typeof e&&"menu"in e}function Fg(e){return"object"==typeof e&&"group"in e}function Lg(e){return e.startsWith("start")?"start":e.startsWith("end")?"end":e.startsWith("after")?"after":"before"}function $g(e){const t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function zg(e){return"string"==typeof e?e:e.menuId}function jg(e){return"object"==typeof e&&"menuId"in e}class Hg extends(zs()){editor;componentFactory;focusTracker;tooltipManager;poweredBy;ariaLiveAnnouncer;isReady=!1;_editableElementsMap=new Map;_focusableToolbarDefinitions=[];_extraMenuBarElements=[];_lastFocusedForeignElement=null;constructor(e){super();const t=e.editing.view;this.editor=e,this.componentFactory=new dg(e),this.focusTracker=new sr,this.tooltipManager=new gg(e),this.poweredBy=new bg(e),this.ariaLiveAnnouncer=new Cg(e),this.set("viewportOffset",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()}
11get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const n=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?n():this.once("ready",n)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e),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)}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_initMenuBar(e){const t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);const n=function(e){let t;return t="items"in e&&e.items?{items:e.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...e}:{items:hi(Rg),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...e},t}(this.editor.config.get("menuBar")||{});e.fillFromConfig(n,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",(e,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),n())}),this.editor.keystrokes.set("Alt+F9",(n,i)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),i())})}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const n=e.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){const e=this.editor;let t;e.keystrokes.set("Alt+F10",(e,n)=>{this._saveLastFocusedForeignElement();const i=this._getCurrentFocusedToolbarDefinition();i&&t||(t=this._getFocusableCandidateToolbarDefinitions());for(let s=0;s<t.length;s++){const e=t.shift();if(t.push(e),e!==i&&this._focusFocusableCandidateToolbar(e)){i&&i.options.afterBlur&&i.options.afterBlur();break}}n()}),e.keystrokes.set("Esc",(t,n)=>{const i=this._getCurrentFocusedToolbarDefinition();i&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),i.options.afterBlur&&i.options.afterBlur(),n())})}_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:n,options:i}=t;(Eo(n.element)||i.beforeFocus)&&e.push(t)}return e.sort((e,t)=>Wg(e)-Wg(t)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:n}}=e;return n&&n(),!!Eo(t.element)&&(t.focus(),!0)}_handleScrollToTheSelection(e,t){const n={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=n.top,t.viewportOffset.bottom+=n.bottom,t.viewportOffset.left+=n.left,t.viewportOffset.right+=n.right}_bindBodyCollectionWithFocusTracker(){const e=this.view.body;for(const t of e)this.focusTracker.add(t.element);e.on("add",(e,t)=>{this.focusTracker.add(t.element)}),e.on("remove",(e,t)=>{this.focusTracker.remove(t.element)})}}function Wg(e){const{toolbarView:t,options:n}=e;let i=10;return Eo(t.element)&&i--,n.isContextual&&i--,i}class Ug extends Vf{body;menuBarView;constructor(e){super(e),this.body=new dm(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class qg extends Ug{top;main;_voiceLabelView;constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createV
11oiceLabel(),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 am;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class Kg extends Vf{name=null;_editingView;_editableElement;_hasExternalElement;constructor(e,t,n){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(n=>{const i=e.document.getRoot(t.name);n.addClass(t.isFocused?"ck-focused":"ck-blurred",i),n.removeClass(t.isFocused?"ck-blurred":"ck-focused",i)})}e.isRenderingInProgress?function n(i){e.once("change:isRenderingInProgress",(e,s,o)=>{o?n(i):t(i)})}(this):t(this)}}class Gg extends Kg{_options;constructor(e,t,n,i={}){super(e,t,n),this._options=i,this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView;e.change(t=>{const n=e.document.getRoot(this.name);t.setAttribute("aria-label",this.getEditableAriaLabel(),n)})}getEditableAriaLabel(){const e=this.locale.t,t=this._options.label,n=this._editableElement,i=this.name;if("string"==typeof t)return t;if("object"==typeof t)return t[i];if("function"==typeof t)return t(this);if(n){const e=n.getAttribute("aria-label");if(e)return e}return e("Rich Text Editor. Editing area: %0",i)}}class Jg extends(zs()){constructor(e,t){super(),t&&vt(this,t),e&&this.set(e)}}const Zg=Co("px");class Qg extends Bu{positionLimiter;visibleStack;_viewToStack=new Map;_idToStack=new Map;_view=null;_rotatorView=null;_fakePanelsView=null;static get pluginName(){return"ContextualBalloon"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.decorate("getPositionOptions"),this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new bs("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new bs("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(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})),e}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new bs("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new Dm(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(t=>t[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 Yg(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,n)=>{if(n<2)return"";const i=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[i,n])}),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 Xg(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:n=!0,singleViewMode:i=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition(),i&&(this._singleViewMode=!0)}}class Yg extends Vf{focusTracker;buttonPrevView;buttonNextView;content;constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new sr,this.buttonPrevView=this._createButtonView(t("Previous"),td),this.buttonNextView=this._createButtonView(t("Next"),nd),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",n.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const n=new Lf(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class Xg extends Vf{content;_balloonPanelView;constructor(e,t){super(e);const n=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",e=>
11e?"":"ck-hidden")],style:{top:n.to("top",Zg),left:n.to("left",Zg),width:n.to("width",Zg),height:n.to("height",Zg)}},children:this.content}),this.on("change:numberOfPanels",(e,t,n,i)=>{n>i?this._addPanels(n-i):this._removePanels(i-n),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new Vf;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:n,height:i}=new go(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:i})}}}const ep=Co("px");class tp extends Vf{content;contentPanelElement;_contentPanelPlaceholder;constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new df({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",e=>e?"block":"none"),height:t.to("isSticky",e=>e?ep(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new df({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",e=>e?ep(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",e=>e?ep(e):e),bottom:t.to("_stickyBottomOffset",e=>e?ep(e):e),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(Yi.document,"scroll",()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky()})}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive)return void this._unstick();const e=new go(this.limiterElement);let t=e.getVisible();if(t){const e=new go(Yi.window);e.top+=this.viewportTopOffset,e.height-=this.viewportTopOffset,t=t.getIntersection(e)}if(t&&e.top<t.top){const n=t.top;if(n+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const n=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-n>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(n):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(n):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=ep(-Yi.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=ep(-Yi.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new go(this.contentPanelElement)}}class np extends sm{arrowView;constructor(e){super(e);const t=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",e=>String(e)),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new Nf;return e.content=wm,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}class ip extends Vf{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-menu-bar__menu__panel",t.to("position",e=>`ck-menu-bar__menu__panel_position_${e}`),t.if("isVisible","ck-hidden",e=>!e)],tabindex:"-1"},children:this.children,on:{selectstart:t.to(e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()})}})}focus(e=1){this.children.length&&(1===e?this.children.first.focus():this.children.last.focus())}}class sp extends Vf{buttonView;panelView;focusTracker;keystrokes;constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new np(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new ip(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new lr,this.focusTracker=new sr,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",e=>!e),t.if("parentMenuView","ck-menu-bar__menu_top-level",e=>!e)]},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),Pg.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(Pg.openOnButtonClick(this),Pg.openOnArrowRightKey(this),Pg.closeOnArrowLeftKey(this),Pg.openAndFocusOnEnterKeyPress(this),Pg.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),Pg.openAndFocusPanelOnArrowDownKey(this),Pg.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",(e,t)=>{this.fire("arrowright"),t()}),this.keystrokes.set("arrowleft",(e,t)=>{this.fire("arrowleft"),t()})}_repositionPanelOnOpen(){this.on("change:isOpen",(e,t,n)=>{if(!n)return;const i=sp._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=i?i.name:this._panelPositions[0].name})}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:n,northWest:i,westSouth:s,eastSouth:o,westNorth:r,eastNorth:a}=Sg;return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?[o,a,s,r]:[e,t,n,i]:this.parentMenuView?[s,r,o,a]:[t,e,i,n]}static _getOptimalPosition=Po}class op extends Mm{constructor(e){super(e),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){const e=Array.from(this.items).some(e=>{const t=rp(e);return t&&t.isToggleable});
11this.items.forEach(t=>{const n=rp(t);n&&(n.hasCheckSpace=e)})}}function rp(e){return e instanceof Rm?e.children.map(e=>function(e){return"object"==typeof e&&"buttonView"in e&&e.buttonView instanceof Lf}(e)?e.buttonView:e).find(e=>e instanceof sm):null}class ap extends mm{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}const lp=["mouseenter","arrowleft","arrowright","change:isOpen"];class cp extends Vf{children;menus=[];constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",n.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t,n=[]){const i=Og({normalizedConfig:e,locale:this.locale,componentFactory:t,extraItems:n}).items.map(e=>this._createMenu({componentFactory:t,menuDefinition:e}));this.children.addMany(i)}render(){super.render(),Eg.toggleMenusAndFocusItemsOnHover(this),Eg.closeMenusWhenTheBarCloses(this),Eg.closeMenuWhenAnotherOnTheSameLevelOpens(this),Eg.focusCycleMenusOnArrows(this),Eg.closeOnClickOutside(this),Eg.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}registerMenu(e,t=null){t?(e.delegate(...lp).to(t),e.parentMenuView=t):e.delegate(...lp).to(this,e=>"menu:"+e),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:n}){const i=this.locale,s=new sp(i);return this.registerMenu(s,n),s.buttonView.set({label:t.label}),s.once("change:isOpen",()=>{const n=new op(i);n.ariaLabel=t.label,s.panelView.children.add(n),n.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:s,componentFactory:e}))}),s}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:n}){const i=this.locale,s=[];for(const o of e.groups){for(const e of o.items){const o=new Tg(i,t);if(ie(e))o.children.add(this._createMenu({componentFactory:n,menuDefinition:e,parentMenuView:t}));else{const i=this._createMenuItemContentFromFactory({componentName:e,componentFactory:n,parentMenuView:t});if(!i)continue;o.children.add(i)}s.push(o)}o!==e.groups[e.groups.length-1]&&s.push(new Om(i))}return s}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:n}){const i=n.create(e);return i instanceof sp||i instanceof rm||i instanceof ap?(this._registerMenuTree(i,t),i.on("execute",()=>{this.close()}),i):(_s("menu-bar-component-unsupported",{componentName:e,componentView:i}),null)}_registerMenuTree(e,t){if(!(e instanceof sp))return void e.delegate("mouseenter").to(t);this.registerMenu(e,t);const n=e.panelView.children.filter(e=>e instanceof op)[0];if(!n)return void e.delegate("mouseenter").to(t);const i=n.items.filter(e=>e instanceof Rm);for(const s of i)this._registerMenuTree(s.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",(t,n,i)=>{clearTimeout(e),i?this.isOpen=!0:e=setTimeout(()=>{this.isOpen=Array.from(this.children).some(e=>e.isOpen)},0)})}}class hp{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("
11change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class up extends Nu{_buffer;constructor(e,t){super(e),this._buffer=new hp(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,i=e.text||"",s=i.length;let o=n.selection;if(e.selection?o=e.selection:e.range&&(o=t.createSelection(e.range)),!t.canEditAt(o))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock();const a=Array.from(n.selection.getAttributes());t.deleteContent(o),i&&t.insertContent(e.createText(i,a),o),r?e.setSelection(r):o.is("documentSelection")||e.setSelection(o),this._buffer.unlock(),this._buffer.input(s)})}}const dp=["insertText","insertReplacementText"],fp=[...dp,"insertCompositionText"];class mp extends Ua{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(Ya);const t=ts.isAndroid?fp:dp,n=e.document;n.on("beforeinput",(i,s)=>{if(!this.isEnabled)return;const{data:o,targetRanges:r,inputType:a,domEvent:l}=s;if(!t.includes(a))return;this.focusObserver.flush();const c=new fs(n,"insertText");n.fire(c,new qa(e,l,{text:o,selection:e.createSelection(r)})),c.stop.called&&i.stop()}),ts.isAndroid||n.on("compositionend",(t,{data:i,domEvent:s})=>{this.isEnabled&&i&&n.fire("insertText",new qa(e,s,{text:i}))},{priority:"lowest"})}observe(){}stopObserving(){}}class gp extends Bu{_compositionQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=e.editing.view,i=e.editing.mapper,s=t.document.selection;this._compositionQueue=new pp(e),n.addObserver(mp);const o=new up(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",o),e.commands.add("input",o),this.listenTo(n.document,"insertText",(o,r)=>{n.document.isComposing||r.preventDefault(),ts.isAndroid&&n.document.isComposing&&this._compositionQueue.flush("next beforeinput");const{text:a,selection:l}=r;let c;c=l?Array.from(l.getRanges()).map(e=>i.toModelRange(e)):Array.from(s.getRanges());let h=a;if(ts.isAndroid){const e=Array.from(c[0].getItems()).reduce((e,t)=>e+(t.is("$textProxy")?t.data:""),"");if(e&&(e.length<=h.length?h.startsWith(e)&&(h=h.substring(e.length),c[0].start=c[0].start.getShiftedBy(e.length)):e.startsWith(h)&&(c[0].start=c[0].start.getShiftedBy(h.length),h="")),0==h.length&&c[0].isCollapsed)return}const u={text:h,selection:t.createSelection(c)};ts.isAndroid&&n.document.isComposing?this._compositionQueue.push(u):(e.execute("insertText",u),n.scrollToTheSelection())}),ts.isAndroid?this.listenTo(n.document,"keydown",(e,i)=>{!s.isCollapsed&&229==i.keyCode&&n.document.isComposing&&wp(t,o)}):this.listenTo(n.document,"compositionstart",()=>{s.isCollapsed||wp(t,o)}),ts.isAndroid?(this.listenTo(n.document,"mutations",(e,{mutations:t})=>{if(n.document.isComposing)for(const{node:n}of t){const e=bp(n,i),t=i.toModelElement(e);if(this._compositionQueue.isComposedElement(t))return void this._compositionQueue.flush("mutations")}}),this.listenTo(n.document,"compositionend",()=>{this._compositionQueue.flush("composition end")}),this.listenTo(n.document,"compositionend",()=>{const e=[];for(const t of this._compositionQueue.flushComposedElements()){const n=i.toViewElement(t);n&&e.push({type:"children",node:n})}e.length&&n.document.fire("mutations",{mutations:e})},{priority:"lowest"})):this.listenTo(n.document,"compositionend",()=>{n.document.fire("mutations",{mutations:[]})},{priority:"lowest"})}destroy(){super.destroy(),this._compositionQueue.destroy()}}class pp{editor;flushDebounced=Ni(()=>this.flush("timeout"),50);_queue=[];_compositionElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._compositionElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e){const t={text:e.text};if(e.selection){t.selectionRanges=[];for(const n of e.selection.getRanges())t.selectionRanges.push(Bl.fromRange(n)),this._compositionElements.add(n.start.parent)}this._queue.push(t),this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};
11if(e.selectionRanges){const n=e.selectionRanges.map(e=>function(e){const t=e.toRange();if(e.detach(),"$graveyard"==t.root.rootName)return null;return t}(e)).filter(e=>!!e);n.length&&(t.selection=this.editor.model.createSelection(n))}return t}flush(e){const t=this.editor,n=t.model,i=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const s=t.commands.get("insertText").buffer;n.enqueueChange(s.batch,()=>{for(s.lock();this._queue.length;){const e=this.shift();t.execute("insertText",e)}s.unlock()}),i.scrollToTheSelection()}isComposedElement(e){return this._compositionElements.has(e)}flushComposedElements(){const e=Array.from(this._compositionElements);return this._compositionElements.clear(),e}}function wp(e,t){if(!t.isEnabled)return;const n=t.buffer;n.lock(),e.enqueueChange(n.batch,()=>{e.deleteContent(e.document.selection)}),n.unlock()}function bp(e,t){let n=e.is("$text")?e.parent:e;for(;!t.toModelElement(n);)n=n.parent;return n}class _p extends Nu{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new hp(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,i=>{this._buffer.lock();const s=i.createSelection(e.selection||n.selection);if(!t.canEditAt(s))return;const o=e.sequence||1,r=s.isCollapsed;if(s.isCollapsed&&t.modifySelection(s,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(o))return void this._replaceEntireContentWithParagraph(i);if(this._shouldReplaceFirstBlockWithParagraph(s,o))return void this.editor.execute("paragraph",{selection:s});if(s.isCollapsed)return;let a=0;
11s.getFirstRange().getMinimalFlatRanges().forEach(e=>{a+=Gs(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(s,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(a),i.setSelection(s),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(i)))return!1;if(!t.schema.checkChild(i,"paragraph"))return!1;const s=i.getChild(0);return!s||!s.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n),s=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(s,i),e.setSelection(s,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const i=e.getFirstPosition(),s=n.schema.getLimitElement(i),o=s.getChild(0);return i.parent==o&&(!!e.containsEntireContent(o)&&(!!n.schema.checkChild(s,"paragraph")&&"paragraph"!=o.name))}}const yp="word",vp="selection",kp="backward",Cp="forward",xp={deleteContent:{unit:vp,direction:kp},deleteContentBackward:{unit:"codePoint",direction:kp},deleteWordBackward:{unit:yp,direction:kp},deleteHardLineBackward:{unit:vp,direction:kp},deleteSoftLineBackward:{unit:vp,direction:kp},deleteContentForward:{unit:"character",direction:Cp},deleteWordForward:{unit:yp,direction:Cp},deleteHardLineForward:{unit:vp,direction:Cp},deleteSoftLineForward:{unit:vp,direction:Cp}};class Ap extends Ua{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(i,s)=>{if(!this.isEnabled)return;const{targetRanges:o,domEvent:r,inputType:a}=s,l=xp[a];if(!l)return;const c={direction:l.direction,unit:l.unit,sequence:n};c.unit==vp&&(c.selectionToRemove=e.createSelection(o[0])),"deleteContentBackward"===a&&(ts.isAndroid&&(c.sequence=1),function(e){if(1!=e.length||e[0].isCollapsed)return!1;const t=e[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let n=0;for(const{nextPosition:i,item:s}of t){if(i.parent.is("$text")){const e=i.parent.data,t=i.offset;if(dr(e,t)||fr(e,t)||gr(e,t))continue;n++}else(s.is("containerElement")||s.is("emptyElement"))&&n++;if(n>1)return!0}return!1}(o)&&(c.unit=vp,c.selectionToRemove=e.createSelection(o)));const h=new Kr(t,"delete",o[0]);t.fire(h,new qa(e,r,c)),h.stop.called&&i.stop()}),ts.isBlink&&function(e){const t=e.view,n=t.document;let i=null,s=!1;function o(e){return e==Wo.backspace||e==Wo.delete}function r(e){return e==Wo.backspace?kp:Cp}n.on("keydown",(e,{keyCode:t})=>{i=t,s=!1}),n.on("keyup",(a,{keyCode:l,domEvent:c})=>{const h=n.selection,u=e.isEnabled&&l==i&&o(l)&&!h.isCollapsed&&!s;if(i=null,u){const e=h.getFirstRange(),i=new Kr(n,"delete",e),s={unit:vp,direction:r(l),selectionToRemove:h};n.fire(i,new qa(t,c,s))}}),n.on("beforeinput",(e,{inputType:t})=>{const n=xp[t];o(i)&&n&&n.direction==r(i)&&(s=!0)},{priority:"high"}),n.on("beforeinput",(e,{inputType:t,data:n})=>{i==Wo.delete&&"insertText"==t&&"�"==n&&e.stop()},{priority:"high"})}(this)}observe(){}stopObserving(){}}class Tp extends Bu{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=e.model.document;t.addObserver(Ap),this._undoOnBackspace=!1;const s=new _p(e,"forward");e.commands.add("deleteForward",s),e.commands.add("forwardDelete",s),e.commands.add("delete",new _p(e,"backward")),this.listenTo(n,"delete",(i,s)=>{n.isComposing||s.preventDefault();const{direction:o,sequence:r,selectionToRemove:a,unit:l}=s,c="forward"===o?"deleteForward":"delete",h={sequence:r};if("selection"==l){const t=Array.from(a.getRanges()).map(t=>e.editing.mapper.toModelRange(t));h.selection=e.model.createSelection(t)}else h.unit=l;e.execute(c,h),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(t,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._und
11oOnBackspace=!1,e.execute("undo"),n.preventDefault(),t.stop())},{context:"$capture"}),this.listenTo(i,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Ep extends Bu{static get requires(){return[gp,Tp]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}function Pp(e,t){let n=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce((e,{item:i})=>i.is("$text")||i.is("$textProxy")?e+i.data:(n=t.createPositionAfter(i),""),""),range:t.createRange(n,e.end)}}class Sp extends(zs()){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:n})=>{n&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))}),this.listenTo(e,"change:data",(e,t)=>{!t.isUndo&&t.isLocal&&this._evaluateTextBeforeSelection("data",{batch:t})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,s=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:o,range:r}=Pp(s,n),a=this.testCallback(o);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const n=Object.assign(t,{text:o,range:r});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${e}`,n)}}}class Rp extends Bu{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,i=e.locale,s=t.document.selection;this.listenTo(n.document,"arrowKey",(e,t)=>{if(!s.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const n=t.keyCode==Wo.arrowright,o=t.keyCode==Wo.arrowleft;if(!n&&!o)return;const r=i.contentLanguageDirection;let a=!1;a="ltr"===r&&n||"rtl"===r&&o?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{context:"$text",priority:"highest"}),this.listenTo(s,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&Dp(s.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model,i=n.document.selection,s=i.getFirstPosition();return!this._isGravityOverridden&&((!s.isAtStart||!Op(i,t))&&(!!Dp(s,t)&&(Vp(e),Op(i,t)&&Dp(s,t,!0)?Mp(n,t):this._overrideGravity(),!0)))}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,i=n.document.selection,s=i.getFirstPosition();return this._isGravityOverridden?(Vp(e),this._restoreGravity(),Dp(s,t,!0)?Mp(n,t):Ip(n,t,s),!0):s.isAtStart?!!Op(i,t)&&(Vp(e),Ip(n,t,s),!0):!Op(i,t)&&Dp(s,t,!0)?(Vp(e),Ip(n,t,s),!0):!!Bp(s,t)&&(s.isAtEnd&&!Op(i,t)&&Dp(s,t)?(Vp(e),Ip(n,t,s),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}_enableClickingAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,i=e.editing.view.document;e.editing.view.addObserver(ou);let s=!1;this.listenTo(i,"mousedown",()=>{s=!0}),this.listenTo(i,"selectionChange",()=>{const e=this.attributes;if(!s)return;if(s=!1,!n.isCollapsed)return;if(!Op(n,e))return;const i=n.getFirstPosition();Dp(i,e)&&(i.isAtStart||Dp(i,e,!0)?Mp(t,e):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection,n=this.attributes;this.listenTo(e,"insertContent",()=>{const i=t.getFirstPosition();Op(t,n)&&Dp(i,n)&&Mp(e,n)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,i=e.editing.view;let s=!1,o=!1;this.listenTo(i.document,"delete",(e,t)=>{s="backward"===t.direction},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!s)return;const e=n.getFirstPosition();o=Op(n,this.attributes)&&!Bp(e,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,o||e.model.enqueueChange(()=>{const e=n.getFirstPosition();Op(n,this.attributes)&&Dp(e,this.attributes)&&(e.isAtStart||Dp(e,this.attributes,!0)?Mp(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 Op(e,t){for(const n of t)if(e.hasAttribute(n))return!0;return!1}function Ip(e,t,n){const i=n.nodeBefore;e.change(n=>
11{if(i){const t=[],s=e.schema.isObject(i)&&e.schema.isInline(i);for(const[n,o]of i.getAttributes())!e.schema.checkAttribute("$text",n)||s&&!1===e.schema.getAttributeProperties(n).copyFromObject||t.push([n,o]);n.setSelectionAttribute(t)}else n.removeSelectionAttribute(t)})}function Mp(e,t){e.change(e=>{e.removeSelectionAttribute(t)})}function Vp(e){e.preventDefault()}function Bp(e,t){return Dp(e.getShiftedBy(-1),t)}function Dp(e,t,n=!1){const{nodeBefore:i,nodeAfter:s}=e;for(const o of t){const e=i?i.getAttribute(o):void 0,t=s?s.getAttribute(o):void 0;if((!n||void 0!==e&&void 0!==t)&&t!==e)return!0}return!1}function Np(e,t,n,i){return i.createRange(Fp(e,t,n,!0,i),Fp(e,t,n,!1,i))}function Fp(e,t,n,i,s){let o=e.textNode||(i?e.nodeBefore:e.nodeAfter),r=null;for(;o&&o.getAttribute(t)==n;)r=o,o=i?o.previousSibling:o.nextSibling;return r?s.createPositionAt(r,i?"before":"after"):e}class Lp extends Nu{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,n=t.document.selection,i=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(n.isCollapsed)i?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const s=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of s)i?e.setAttribute(this.attributeKey,i,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const i of n.getRanges())for(const e of i.getItems())if(t.checkAttribute(e,this.attributeKey))return e.hasAttribute(this.attributeKey);return!1}}const $p="bold";class zp extends Bu{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:$p}),e.model.schema.setAttributeProperties($p,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:$p,view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t&&("bold"==t||Number(t)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add($p,new Lp(e,$p)),e.keystrokes.set("CTRL+B",$p),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}function jp({editor:e,commandName:t,plugin:n,icon:i,label:s,keystroke:o}){return r=>{const a=e.commands.get(t),l=new r(e.locale);return l.set({label:s,icon:i,keystroke:o,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),l.bind("isOn").to(a,"value"),l instanceof rm?l.set({role:"menuitemcheckbox"}):l.set({tooltip:!0}),n.listenTo(l,"execute",()=>{e.execute(t),e.editing.view.focus()}),l}}const Hp="bold";class Wp extends Bu{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=jp({editor:e,commandName:Hp,plugin:this,icon:Zu,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(Hp,()=>n(Lf)),e.ui.componentFactory.add("menuBar:"+Hp,()=>n(rm))}}class Up extends Bu{static get requires(){return[zp,Wp]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}const qp="italic";class Kp extends Bu{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:qp}),e.model.schema.setAttributeProperties(qp,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:qp,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(qp,new Lp(e,qp)),e.keystrokes.set("CTRL+I",qp),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}const Gp="italic";class Jp extends Bu{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale.t,n=jp({editor:e,commandName:Gp,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
11<path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(Gp,()=>n(Lf)),e.ui.componentFactory.add("menuBar:"+Gp,()=>n(rm))}}class Zp extends Bu{static get requires(){return[Kp,Jp]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}function*Qp(e,t){for(const n of t)n&&e.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class Yp extends Nu{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,s=n.isCollapsed,o=n.getFirstRange(),r=o.start.parent,a=o.end.parent;if(i.isLimit(r)||i.isLimit(a))return s||r!=a||t.deleteContent(n),!1;if(s){const t=Qp(e.model.schema,n.getAttributes());return Xp(e,o.start),e.setSelectionAttribute(t),!0}{const i=!(o.start.isAtStart&&o.end.isAtEnd),s=r==a;if(t.deleteContent(n,{leaveUnmerged:i}),i){if(s)return Xp(e,n.focus),!0;e.setSelection(a,0)}}return!1}}function Xp(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}const ew={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class tw extends Ua{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(e,t)=>{n=t.shiftKey}),t.on("beforeinput",(i,s)=>{if(!this.isEnabled)return;let o=s.inputType;ts.isSafari&&n&&"insertParagraph"==o&&(o="insertLineBreak");const r=s.domEvent,a=ew[o];if(!a)return;const l=new Kr(t,"enter",s.targetRanges[0]);t.fire(l,new qa(e,r,{isSoft:a.isSoft})),l.stop.called&&i.stop()})}observe(){}stopObserving(){}}class nw extends Bu{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=this.editor.t;t.addObserver(tw),e.commands.add("enter",new Yp(e)),this.listenTo(n,"enter",(i,s)=>{n.isComposing||s.preventDefault(),s.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class iw extends Nu{execute(){const e=this.editor.model,t=e.document;e.change(n=>{!function(e,t,n){const i=n.isCollapsed,s=n.getFirstRange(),o=s.start.parent,r=s.end.parent,a=o==r;if(i){const i=Qp(e.schema,n.getAttributes());sw(e,t,s.end),t.removeSelectionAttribute(n.getAttributeKeys()),t.setSelectionAttribute(i)}else{const i=!(s.start.isAtStart&&s.end.isAtEnd);e.deleteContent(n,{leaveUnmerged:i}),a?sw(e,t,n.focus):i&&t.setSelection(r,0)}}(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const n=t.anchor;if(!n||!e.checkChild(n,"softBreak"))return!1;const i=t.getFirstRange(),s=i.start.parent,o=i.end.parent;if((ow(s,e)||ow(o,e))&&s!==o)return!1;return!0}(e.schema,t.selection)}}function sw(e,t,n){const i=t.createElement("softBreak");e.insertContent(i,n),t.setSelection(i,"after")}function ow(e,t){return!e.is("rootElement")&&(t.isLimit(e)||ow(e.parent,t))}class rw extends Bu{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,s=i.document,o=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),i.addObserver(tw),e.commands.add("shiftEnter",new iw(e)),this.listenTo(s,"enter",(t,n)=>{s.isComposing||n.preventDefault(),n.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:o("Insert a soft break (a <code><br></code> element)"),keystroke:"Shift+Enter"}]})}}class aw extends Nu{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,i=t.document.selection,s=Array.from(i.getSelectedBlocks()),o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(o){const t=s.filter(e=>lw(e)||hw(n,e));this._applyQuote(e,t)}else this._removeQuote(e,s.filter(lw))})}_getValue(){const e=ir(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!lw(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ir(e.getSelectedBlocks());return!!n&&hw(t,n)}
11_removeQuote(e,t){cw(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const n=e.createPositionBefore(t.start.parent);return void e.move(t,n)}t.end.isAtEnd||e.split(t.end);const n=e.createPositionAfter(t.end.parent);e.move(t,n)})}_applyQuote(e,t){const n=[];cw(e,t).reverse().forEach(t=>{let i=lw(t.start);i||(i=e.createElement("blockQuote"),e.wrap(t,i)),n.push(i)}),n.reverse().reduce((t,n)=>t.nextSibling==n?(e.merge(e.createPositionAfter(t)),t):n)}}function lw(e){return"blockQuote"==e.parent.name?e.parent:null}function cw(e,t){let n,i=0;const s=[];for(;i<t.length;){const o=t[i],r=t[i+1];n||(n=e.createPositionBefore(o)),r&&o.nextSibling==r||(s.push(e.createRange(n,e.createPositionAfter(o))),n=null),i++}return s}function hw(e,t){const n=e.checkChild(t.parent,"blockQuote"),i=e.checkChild(["$root","blockQuote"],t);return n&&i}class uw extends Bu{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[nw,Tp]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new aw(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(n=>{const i=e.model.document.differ.getChanges();for(const e of i)if("insert"==e.type){const i=e.position.nodeAfter;if(!i)continue;if(i.is("element","blockQuote")&&i.isEmpty)return n.remove(i),!0;if(i.is("element","blockQuote")&&!t.checkChild(e.position,i))return n.unwrap(i),!0;if(i.is("element")){const e=n.createRangeIn(i);for(const i of e.getItems())if(i.is("element","blockQuote")&&!t.checkChild(n.createPositionBefore(i),i))return n.unwrap(i),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return n.remove(t),!0}return!1});const n=this.editor.editing.view.document,i=e.model.document.selection,s=e.commands.get("blockQuote");this.listenTo(n,"enter",(t,n)=>{if(!i.isCollapsed||!s.value)return;i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())},{context:"blockquote"}),this.listenTo(n,"delete",(t,n)=>{if("backward"!=n.direction||!i.isCollapsed||!s.value)return;const o=i.getLastPosition().parent;o.isEmpty&&!o.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())},{context:"blockquote"})}}class dw extends Bu{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",()=>{const e=this._createButton(Lf);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add("menuBar:blockQuote",()=>{const e=this._createButton(rm);return e.set({role:"menuitemcheckbox"}),e})}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("blockQuote"),s=new e(t.locale),o=n.t;return s.set({label:o("Block quote"),icon:hd,isToggleable:!0}),s.bind("isEnabled").to(i,"isEnabled"),s.bind("isOn").to(i,"value"),this.listenTo(s,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),s}}class fw extends Bu{static get requires(){return[uw,dw]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}class mw extends(Ts()){_stack=[];add(e,t){const n=this._stack,i=n[0];this._insertDescriptor(e);const s=n[0];i===s||gw(i,s)||this.fire("change:top",{oldDescriptor:i,newDescriptor:s,writer:t})}remove(e,t){const n=this._stack,i=n[0];this._removeDescriptor(e);const s=n[0];i===s||gw(i,s)||this.fire("change:top",{oldDescriptor:i,newDescriptor:s,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex(t=>t.id===e.id);if(gw(e,t[n]))return;n>-1&&t.splice(n,1);let i=0;for(;t[i]&&pw(t[i],e);)i++;t.splice(i,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex(t=>t.id===e);n>-1&&t.splice(n,1)}}function gw(e,t){return e&&t&&e.priority==t.priority&&ww(e.classes)==ww(t.classes)}function pw(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&ww(e.classes)>ww(t.classes)}function ww(e){return Array.isArray(e)?e.sort().join(","):e}var bw='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>';const _w="ck-widget_selected";function yw(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function vw(e,t,n={}
11){if(!e.is("containerElement"))throw new bs("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=Tw,t.setCustomProperty("widgetLabel",[],e),n.label&&function(e,t){const n=e.getCustomProperty("widgetLabel");n.push(t)}(e,n.label),n.hasSelectionHandle&&function(e,t){const n=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(e){const t=this.toDomElement(e),n=new Nf;return n.set("content",bw),n.render(),t.appendChild(n.element),t});t.insert(t.createPositionAt(e,0),n),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),xw(e,t),e}function kw(e,t,n){if(t.classes&&n.addClass(Xo(t.classes),e),t.attributes)for(const i in t.attributes)n.setAttribute(i,t.attributes[i],e)}function Cw(e,t,n){if(t.classes&&n.removeClass(Xo(t.classes),e),t.attributes)for(const i in t.attributes)n.removeAttribute(i,e)}function xw(e,t,n=kw,i=Cw){const s=new mw;s.on("change:top",(t,s)=>{s.oldDescriptor&&i(e,s.oldDescriptor,s.writer),s.newDescriptor&&n(e,s.newDescriptor,s.writer)});t.setCustomProperty("addHighlight",(e,t,n)=>s.add(t,n),e),t.setCustomProperty("removeHighlight",(e,t,n)=>s.remove(t,n),e)}function Aw(e,t,n={}){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("role","textbox",e),t.setAttribute("tabindex","-1",e),n.label&&t.setAttribute("aria-label",n.label,e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(n,i,s)=>{t.setAttribute("contenteditable",s?"false":"true",e)}),e.on("change:isFocused",(n,i,s)=>{s?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),xw(e,t),e}function Tw(){return null}const Ew="widget-type-around";function Pw(e,t,n){return!!e&&yw(e)&&!n.isInline(t)}function Sw(e){return e.getAttribute(Ew)}const Rw=["before","after"],Ow=(new DOMParser).parseFromString('<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>',"image/svg+xml").firstChild,Iw="ck-widget__type-around_disabled";class Mw extends Bu{_currentFakeCaretModelElement=null;static get pluginName(){return"WidgetTypeAround"}static get isOfficialPlugin(){return!0}static get requires(){return[nw,Tp]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(n,i,s)=>{t.change(e=>{for(const n of t.document.roots)s?e.removeClass(Iw,n):e.addClass(Iw,n)}),s||e.model.change(e=>{e.removeSelectionAttribute(Ew)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const n=this.editor,i=n.editing.view,s=n.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(e,t),attributes:s}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(e,t,n,i){this.listenTo(e,t,(...e)=>{this.isEnabled&&n(...e)},i)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Sw(e);if(!t)return!1;const n=e.getSelectedElement();return this._insertParagraph(n,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,n=e.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,s,o)=>{const r=o.mapper.toViewElement(s.item);if(r&&Pw(r,s.item,t)){!function(e,t,n){const i=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(e){const n=this.toDomElement(e);return function(e,t){for(const n of Rw){const i=new df({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:t[n],"aria-hidden":"true"},children:[e.ownerDocument.importNode(Ow,!0)]});e.appendChild(i.render())}}(n,t),function(e){const t=new df({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(n),n});e.insert(e.createPositionAt(n,"end"),i)}(o.writer,i,r);r.getCustomProperty("widgetLabel").push(()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):"")}},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,n=t.document.selection,i=t.schema,s=e.editing.view;function o(e){return`ck-widget_type-around_show-fake-caret_${e}`}this._listenToIfEnabled(s.document,"arrowKey",(e,t)=>{this._handleArrowKeyPress(e,t)},{context:[yw,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",(t,n)=>{n.directChange&&e.model.change(e=>{e.removeSelectionAttribute(Ew)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=n.getSelectedElement();if(t){if(Pw(e.editing.mapper.toViewElement(t),t,i))return}e.model.change(e=>{e.removeSelectionAttribute(Ew)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,n)=>{const s=n.writer;if(this._currentFakeCaretModelElement){const e=n.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(s.removeClass(Rw.map(o),e),this._currentFakeCaretModelElement=null)}const r=t.selection.getSelectedElement();if(!r)return;const a=n.mapper.toViewElement(r);if(!Pw(a,r,i))return;const l=Sw(t.selection);l&&(s.addClass(o(l),a),this._currentFakeCaretModelElement=r)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,n,i)=>{i||e.model.change(e=>{e.removeSelectionAttribute(Ew)})})}_handleArrowKeyPress(e,t){const n=this.editor,i=n.model,s=i.document.selection,o=i.schema,r=n.editing.view,a=function(e,t){const n=Jo(e,t);return"down"===n||"right"===n}(t.keyCode,n.locale.contentLanguageDirection),l=r.document.selection.getSelectedElement();let c;Pw(l,n.editing.mapper.toModelElement(l),o)?c=this._handleArrowKeyPressOnSelectedWidget(a):s.isCollapsed?c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):t.shiftKey||(c=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,n=Sw(t.document.selection);return t.change(t=>{if(!n)return t.setSelectionAttribute(Ew,e?"after":"before"),!0;if(!(n===(e?"after":"before")))return t.removeSelectionAttribute(Ew),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,n=t.model,i=n.schema,s=t.plugins.get("Widget"),o=s._getObjectElementNextToSelection(e);return!!Pw(t.editing.mapper.toViewElement(o),o,i)&&(n.change(t=>{s._setSelectionOverElement(o),t.setSelectionAttribute(Ew,e?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,n=t.model,i=n.schema,s=t.editing.mapper,o=n.document.selection,r=e?o.getLastPosition().nodeBefore:o.getFirstPosition().nodeAfter;return!!Pw(s.toViewElement(r),r,i)&&(n.change(t=>{t.setSelection(r,"on"),t.setSelectionAttribute(Ew,e?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(n,i)=>{const s=i.domTarget.closest(".ck-widget__type-around__button");if(!s)return;const o=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(s),r=function(e,t){const n=e.closest(".ck-widget");return t.mapDomToView(n)}(s,t.domConverter),a=e.editing.mapper.toModelElement(r);this._insertParagraph(a,o),i.preventDefault(),n.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,n=e.editing.view;this._listenToIfEnabled(n.document,"enter",(n,i)=>{if("atTarget"!=n.eventPhase)return;const s=t.getSelectedElement(),o=e.editing.mapper.toViewElement(s),r=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Pw(o,s,r)&&(this._insertParagraph(s,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())},{context:yw})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=e.selection)},{priority:"high"}),ts.isAndroid?this._listenToIfEnabled(e,"keydown",(e,t)=>{229==t.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,n=e.model,i=n.schema;this._listenToIfEnabled(t.document,"delete",(t,s)=>{if("atTarget"!=t.eventPhase)return;const o=Sw(n.document.selection);if(!o)return;const r=s.direction,a=n.document.selection.getSelectedElement(),l="forward"==r;if("before"===o===l)e.execute("delete",{selection:n.createSelection(a,"on")});else{const t=i.getNearestSelectionRange(n.createPositionAt(a,o),r);if(t)if(t.isCollapsed){const s=n.createSelection(t.start);if(n.modifySelection(s,{direction:r}),s.focus.isEqual(t.start)){const e=function(e,t){let n=t;for(const i of t.getAncestors({parentFirst:!0})){if(i.childCount>1||e.isLimit(i))break;n=i}return n}(i,t.start.parent);n.deleteContent(n.createSelection(e,"on"),{doNotAutoparagraph:!0})}else n.change(n=>{n.setSelection(t),e.execute(l?"deleteForward":"delete")})}else n.change(n=>{n.setSelection(t),e.execute(l?"deleteForward":"delete")})}s.preventDefault(),t.stop()},{context:yw})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[i,s])=>{if(s&&!s.is("documentSelection"))return;const o=Sw(n);return o?(e.stop(),t.change(e=>{const s=n.getSelectedElement(),r=t.createPositionAt(s,o),a=e.createSelection(r),l=t.insertContent(i,a);return e.setSelection(a),l})):void 0},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(e,n)=>{const[,i,s={}]=n;if(i&&!i.is("documentSelection"))return;const o=Sw(t);o&&(s.findOptimalPosition=o,n[3]=s)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(e,[n])=>{if(n&&!n.is("documentSelection"))return;Sw(t)&&e.stop()},{priority:"high"})}}function Vw(e){const t=e.model;return(n,i)=>{const s=i.keyCode==Wo.arrowup,o=i.keyCode==Wo.arrowdown,r=i.shiftKey,a=t.document.selection;if(!s&&!o)return;const l=o;if(r&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,n){const i=e.model;if(n){const e=t.isCollapsed?t.focus:t.getLastPosition(),n=Bw(i,e,"forward");if(!n)return null;
11const s=i.createRange(e,n),o=Dw(i.schema,s,"backward");return o?i.createRange(e,o):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),n=Bw(i,e,"backward");if(!n)return null;const s=i.createRange(n,e),o=Dw(i.schema,s,"forward");return o?i.createRange(o,e):null}}(e,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(r)return}(c.isCollapsed||function(e,t,n){const i=e.model,s=e.view.domConverter;if(n){const e=i.createSelection(t.start);i.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=i.createRange(e.focus,t.end))}const o=e.mapper.toViewRange(t),r=s.viewRangeToDom(o),a=go.getDomRangeRects(r);let l;for(const c of a)if(void 0!==l){if(Math.round(c.top)>=l)return!1;l=Math.max(l,Math.round(c.bottom))}else l=Math.round(c.bottom);return!0}(e,c,l))&&(t.change(e=>{const n=l?c.end:c.start;if(r){const i=t.createSelection(a.anchor);i.setFocus(n),e.setSelection(i)}else e.setSelection(n)}),n.stop(),i.preventDefault(),i.stopPropagation())}}}function Bw(e,t,n){const i=e.schema,s=e.createRangeIn(t.root),o="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:r,item:a,type:l}of s.getWalker({startPosition:t,direction:n})){if(i.isLimit(a)&&!i.isInline(a))return r;if(l==o&&i.isBlock(a))return null}return null}function Dw(e,t,n){const i="backward"==n?t.end:t.start;if(e.checkChild(i,"$text"))return i;for(const{nextPosition:s}of t.getWalker({direction:n}))if(e.checkChild(s,"$text"))return s;return null}class Nw extends Bu{_previouslySelected=new Set;static get pluginName(){return"Widget"}static get isOfficialPlugin(){return!0}static get requires(){return[Mw,Tp]}init(){const e=this.editor,t=e.editing.view,n=t.document,i=e.t;this.editor.editing.downcastDispatcher.on("selection",(t,n,i)=>{const s=i.writer,o=n.selection;if(o.isCollapsed)return;const r=o.getSelectedElement();if(!r)return;const a=e.editing.mapper.toViewElement(r);var l;yw(a)&&(i.consumable.consume(o,"selection")&&s.setSelection(s.createRangeOn(a),{fake:!0,label:(l=a,l.getCustomProperty("widgetLabel").reduce((e,t)=>"function"==typeof t?e?e+". "+t():t():e?e+". "+t:t,""))}))}),this.editor.editing.downcastDispatcher.on("selection",(e,t,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const i=n.writer,s=i.document.selection;let o=null;for(const r of s.getRanges())for(const e of r){const t=e.item;yw(t)&&!Fw(t,o)&&(i.addClass(_w,t),this._previouslySelected.add(t),o=t)}},{priority:"low"}),t.addObserver(ou),this.listenTo(n,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(n,"arrowKey",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{context:[yw,"$text"]}),this.listenTo(n,"arrowKey",(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{context:"$root"}),this.listenTo(n,"arrowKey",Vw(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{context:"$root"}),this.listenTo(n,"tab",(e,t)=>{"atTarget"==e.eventPhase&&(t.shiftKey||this._selectFirstNestedEditable()&&(t.preventDefault(),e.stop()))},{context:yw,priority:"low"}),this.listenTo(n,"tab",(e,t)=>{t.shiftKey&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())},{priority:"low"}),this.listenTo(n,"keydown",(e,t)=>{t.keystroke==Wo.esc&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())},{priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:i("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:i("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:i("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:i("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:i("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:i("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){const n=this.editor,i=n.editing.view,s=i.document;let o=t.target;if(!o)return;if(t.domEvent.detail>=3)return void(this._selectBlockContent(o)&&t.preventDefault());if(!yw(o)){const e=function(e){let t=e;for(;t;){if(t.is("editableElement")||yw(t))return t;t=t.parent}return null}(o);if(!e)return;if(yw(e))o=e;else{const e=function(e,t){const n=co(t.domEvent);let i=null;i=n?e.domConverter.domRangeToView(n):e.createRange(e.createPositionAt(t.target,0));if(!i)return null;const s=i.start;if(!s.parent)return null;let o=s.parent;
11s.parent.is("editableElement")&&(s.isAtEnd&&s.nodeBefore?o=s.nodeBefore:s.isAtStart&&s.nodeAfter&&(o=s.nodeAfter));if(o.is("$text"))return o.parent;return o}(i,t);if(!e||!yw(e))return;o=e}}ts.isAndroid&&t.preventDefault(),s.isFocused||i.focus();const r=n.editing.mapper.toModelElement(o);this._setSelectionOverElement(r)}_selectBlockContent(e){const t=this.editor,n=t.model,i=t.editing.mapper,s=n.schema,o=i.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),r=function(e,t){for(const n of e.getAncestors({includeSelf:!0,parentFirst:!0})){if(t.checkChild(n,"$text"))return n;if(t.isLimit(n)&&!t.isObject(n))break}return null}(i.toModelElement(o),n.schema);return!!r&&(n.change(e=>{const t=s.isLimit(r)?null:function(e,t){const n=new fl({startPosition:e});for(const{item:i}of n){if(t.isLimit(i)||!i.is("element"))return null;if(t.checkChild(i,"$text"))return i}return null}(e.createPositionAfter(r),s),n=e.createPositionAt(r,0),i=t?e.createPositionAt(t,0):e.createPositionAt(r,"end");e.setSelection(e.createRange(n,i))}),!0)}_handleSelectionChangeOnArrowKeyPress(e,t){const n=t.keyCode,i=this.editor.model,s=i.schema,o=i.document.selection,r=o.getSelectedElement(),a=Jo(n,this.editor.locale.contentLanguageDirection),l="down"==a||"right"==a,c="up"==a||"down"==a;if(r&&s.isObject(r)){const n=l?o.getLastPosition():o.getFirstPosition(),r=s.getNearestSelectionRange(n,l?"forward":"backward");return void(r&&(i.change(e=>{e.setSelection(r)}),t.preventDefault(),e.stop()))}if(!o.isCollapsed&&!t.shiftKey){const n=o.getFirstPosition(),r=o.getLastPosition(),a=n.nodeAfter,c=r.no
11deBefore;return void((a&&s.isObject(a)||c&&s.isObject(c))&&(i.change(e=>{e.setSelection(l?r:n)}),t.preventDefault(),e.stop()))}if(!o.isCollapsed)return;const h=this._getObjectElementNextToSelection(l);if(h&&s.isObject(h)){if(s.isInline(h)&&c)return;this._setSelectionOverElement(h),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const n=this.editor.model,i=n.schema,s=n.document.selection.getSelectedElement();s&&i.isObject(s)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t))return;if(!t.isCollapsed)return;const n=this._getObjectElementNextToSelection(e);return n?(this.editor.model.change(e=>{let i=t.anchor.parent;for(;i.isEmpty;){const t=i;i=t.parent,e.remove(t)}this._setSelectionOverElement(n)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,i=t.document.selection,s=t.createSelection(i);if(t.modifySelection(s,{direction:e?"forward":"backward"}),s.isEqual(i))return null;const o=e?s.focus.nodeBefore:s.focus.nodeAfter;return o&&n.isObject(o)?o:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(_w,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,t=this.editor.editing.view.document;for(const n of t.selection.getFirstRange().getItems())if(n.is("editableElement")){const t=e.editing.mapper.toModelElement(n);if(!t)continue;const i=e.model.createPositionAt(t,0),s=e.model.schema.getNearestSelectionRange(i,"forward");return e.model.change(e=>{e.setSelection(s)}),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,n=e.editing.view.document.selection.getFirstPosition().parent,i=(n.is("$text")?n.parent:n).findAncestor(yw);if(!i)return!1;const s=t.toModelElement(i);return!!s&&(e.model.change(e=>{e.setSelection(s,"on")}),!0)}}function Fw(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class Lw extends Ka{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;function n(e){return(n,i)=>{i.preventDefault();const s=i.dropRange?[i.dropRange]:null,o=new fs(t,e);t.fire(o,{dataTransfer:i.dataTransfer,method:n.name,targetRanges:s,target:i.target,domEvent:i.domEvent}),o.stop.called&&i.stopPropagation()}}this.listenTo(t,"paste",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",n("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,n="drop"==e.type||"paste"==e.type,i={dataTransfer:new tl(t,{cacheFiles:n})};if("drop"==e.type||"dragover"==e.type){const t=co(e);i.dropRange=t&&this.view.domConverter.domRangeToView(t)}this.fire(e.type,e,i)}}const $w=["figcaption","li"],zw=["ol","ul"];function jw(e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return"\n";let t="",n=null;for(const i of e.getChildren())t+=Hw(i,n)+jw(i),n=i;return t}function Hw(e,t){return t?e.is("element","li")&&!e.isEmpty&&e.getChild(0).is("containerElement")||zw.includes(e.name)&&zw.includes(t.name)?"\n\n":e.is("containerElement")||t.is("containerElement")?$w.includes(e.name)||$w.includes(t.name)?"\n":e.is("element")&&e.getCustomProperty("dataPipeline:transparentRendering")||t.is("element")&&t.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":""}class Ww extends Bu{_markersToCopy=new Map;static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,n=e=>e.model.getSelectedContent(e.model.document.selection)){return this.editor.model.change(i=>{const s=i.model.document.selection;i.setSelection(t);const o=this._insertFakeMarkersIntoSelection(i,i.model.document.selection,e),r=n(i),a=this._removeFakeMarkersInsideElement(i,r);for(const[e,t]of Object.entries(o)){a[e]||=i.createRangeIn(r);for(const e of t)i.remove(e)}r.markers.clear();for(const[e,t]of Object.entries(a))r.markers.set(e,t);return i.setSelection(s),r})}_pasteMarkersIntoTransformedElement(e,t){const n=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(e=>{const i=this._insertFakeMarkersElements(e,n),s=t(e),o=this._removeFakeMarkersInsideElement(e,s);for(const t of Object.values(i).flat())e.remove(t);for(const[t,n]of Object.entries(o))e.model.markers.has(t)||e.addMarker(t,{usingOperation:!0,affectsData:!0,range:n});return s})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const n of t)e.markers.set(n.name,n.range);return this.editor.model.insertContent(e)}
11_forceMarkersCopy(e,t,n={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const i=this._markersToCopy.get(e);this._markersToCopy.set(e,n),t(),i?this._markersToCopy.set(e,i):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const n=this._getMarkerClipboardConfig(e);if(!n)return!1;if(!t)return!0;const{allowedActions:i}=n;return"all"===i||i.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,n){const i=this._getCopyableMarkersFromSelection(e,t,n);return this._insertFakeMarkersElements(e,i)}_getCopyableMarkersFromSelection(e,t,n){const i=Array.from(t.getRanges()),s=new Set(i.flatMap(t=>Array.from(e.model.markers.getMarkersIntersectingRange(t))));return Array.from(s).filter(e=>{if(!this._isMarkerCopyable(e.name,n))return!1;const{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){const t=e.getRange();return i.some(e=>e.containsRange(t,!0))}return!0}).map(e=>({name:"dragstart"===n?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:n}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([e,i])=>{if(!this._hasMarkerConfiguration(e))return[{name:e,range:i}];if(this._isMarkerCopyable(e,t)){const t=this._getMarkerClipboardConfig(e),s=n.markers.has(e)&&"$graveyard"===n.markers.get(e).getRange().root.rootName;return(t.duplicateOnPaste||s)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:i}]}return[]})}_insertFakeMarkersElements(e,t){const n={},i=t.flatMap(e=>{const{start:t,end:n}=e.range;return[{position:t,marker:e,type:"start"},{position:n,marker:e,type:"end"}]}).sort(({position:e},{position:t})=>e.isBefore(t)?1:-1);for(const{position:s,marker:o,type:r}of i){const t=e.createElement("$marker",{"data-name":o.name,"data-type":r});n[o.name]||(n[o.name]=[]),n[o.name].push(t),e.insert(t,s)}return n}_removeFakeMarkersInsideElement(e,t){return qi(this._getAllFakeMarkersFromElement(e,t).reduce((t,n)=>{const i=n.markerElement&&e.createPositionBefore(n.markerElement);let s=t[n.name],o=!1;if(s&&s.start&&s.end){this._getMarkerClipboardConfig(n.name).duplicateOnPaste?t[this._getUniqueMarkerName(n.name)]=t[n.name]:o=!0,s=null}return o||(t[n.name]={...s,[n.type]:i}),n.markerElement&&e.remove(n.markerElement),t},{}),n=>new vl(n.start||e.createPositionFromPath(t,[0]),n.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const n=Array.from(e.createRangeIn(t)).flatMap(({item:e})=>
11{if(!e.is("element","$marker"))return[];const t=e.getAttribute("data-name"),n=e.getAttribute("data-type");return[{markerElement:e,name:t,type:n}]}),i=[],s=[];for(const o of n){if("end"===o.type){n.some(e=>e.name===o.name&&"start"===e.type)||i.push({markerElement:null,name:o.name,type:"start"})}if("start"===o.type){n.some(e=>e.name===o.name&&"end"===e.type)||s.unshift({markerElement:null,name:o.name,type:"end"})}}return[...i,...n,...s]}_getUniqueMarkerName(e){const t=e.split(":"),n=gs().substring(1,6);return 3===t.length?`${t.slice(0,2).join(":")}:${n}`:`${t.join(":")}:${n}`}}class Uw extends Bu{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[Ww]}init(){this.editor.editing.view.addObserver(Lw),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,n){const i=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===n},()=>{const s=i._copySelectedFragmentWithMarkers(n,t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:n})})}_setupPasteDrop(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(i,"clipboardInput",(t,n)=>{"paste"!=n.method||e.model.canEditAt(e.model.document.selection)||t.stop()},{priority:"highest"}),this.listenTo(i,"clipboardInput",(e,t)=>{const i=t.dataTransfer;let s;if(t.content)s=t.content;else{let e="";i.getData("text/html")?e=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t).replace(/<!--[\s\S]*?-->/g,"")}(i.getData("text/html")):i.getData("text/plain")&&(((o=(o=i.getData("text/plain")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("</p><p>")||o.includes("<br>"))&&(o=`<p>${o}</p>`),e=o),s=this.editor.data.htmlProcessor.toView(e)}var o;const r=new fs(this,"inputTransformation");this.fire(r,{content:s,dataTransfer:i,targetRanges:t.targetRanges,method:t.method}),r.stop.called&&e.stop(),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(e.stop(),t.change(()=>{this.fire("contentInsertion",{content:i,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(e,t)=>{t.resultRange=s._pasteFragmentWithMarkers(t.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,i=(e,n)=>{const i=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(i,t.selection,e.name)};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",(t,n)=>{e.model.canEditAt(e.model.document.selection)?i(t,n):n.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(t,i)=>{const s=e.data.toView(i.content);n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:s,method:i.method})},{priority:"low"}),this.listenTo(n,"clipboardOutput",(n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",jw(i.content))),"cut"==i.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}const qw=Co("px");class Kw extends Vf{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",e=>!e)],style:{left:e.to("left",e=>qw(e)),top:e.to("top",e=>qw(e)),width:e.to("width",e=>qw(e))}}})}}class Gw extends Bu{removeDropMarkerDelayed=ur(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=Zi(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=Zi(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0);_dropTargetLineView=new Kw;_domEmitter=new(so());_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,n,i,s,o){this.removeDropMarkerDelayed.cancel();const r=Jw(this.editor,e,t,n,i,s,o);if(r)return o&&o.containsRange(r)?this.removeDropMarker():void this._updateDropMarkerThrottled(r)}getFinalDropRange(e,t,n,i,s,o){const r=Jw(this.editor,e,t,n,i,s,o);return this.removeDropMarker(),r}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(e=>{e.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
11:n})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,n=t.model.markers;t.model.change(t=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(e){const t=this.toDomElement(e);return t.append("â ",e.createElement("span"),"â "),t})}_updateDropTargetLine(e){const t=this.editor.editing,n=e.start.nodeBefore,i=e.start.nodeAfter,s=e.start.parent,o=n?t.mapper.toViewElement(n):null,r=o?t.view.domConverter.mapViewToDom(o):null,a=i?t.mapper.toViewElement(i):null,l=a?t.view.domConverter.mapViewToDom(a):null,c=t.mapper.toViewElement(s);if(!c)return;const h=t.view.domConverter.mapViewToDom(c),u=this._getScrollableRect(c),{scrollX:d,scrollY:f}=Yi.window,m=r?new go(r):null,g=l?new go(l):null,p=new go(h).excludeScrollbarsAndBorders(),w=m?m.bottom:p.top,b=g?g.top:p.bottom,_=Yi.window.getComputedStyle(h),y=w<=b?(w+b)/2:b;if(u.top<y&&y<u.bottom){const e=p.left+parseFloat(_.paddingLeft),t=p.right-parseFloat(_.paddingRight),n=Math.max(e+d,u.left),i=Math.min(t+d,u.right);this._dropTargetLineView.set({isVisible:!0,left:n,top:y+f,width:i-n})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let n;if(this._scrollables.has(t))n=this._scrollables.get(t).domElement;else{n=function(e){let t=e;do{t=t.parentElement;const e=Yi.window.getComputedStyle(t).overflowY;if("auto"==e||"scroll"==e)break}while("BODY"!=t.tagName);return t}(this.editor.editing.view.domConverter.mapViewToDom(e)),this._domEmitter.listenTo(n,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const i=new vo(n,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:n,resizeObserver:i})}return new go(n).excludeScrollbarsAndBorders()}}function Jw(e,t,n,i,s,o,r){const a=e.model,l=e.editing.mapper;let c=Xw(e,t);for(;c;){if(!o)if(a.schema.checkChild(c,"$text")){if(n){const t=n[0].start,o=l.toModelPosition(t);if(!r||Array.from(r.getItems()).every(e=>a.schema.checkChild(o,e))){if(a.schema.checkChild(o,"$text"))return a.createRange(o);if(t)return Qw(e,Xw(e,t.parent),i,s)}}}else if(a.schema.isInline(c))return Qw(e,c,i,s);if(a.schema.isBlock(c))return Qw(e,c,i,s);if(a.schema.checkChild(c,"$block")){const t=Array.from(c.getChildren()).filter(t=>t.is("element")&&!Zw(e,t));let n=0,o=t.length;if(0==o)return a.createRange(a.createPositionAt(c,"end"));for(;n<o-1;){const r=Math.floor((n+o)/2);"before"==Yw(e,t[r],i,s)?o=r:n=r}return Qw(e,t[n],i,s)}c=c.parent}return null}function Zw(e,t){const n=e.editing.mapper,i=e.editing.view.domConverter,s=n.toViewElement(t);if(!s)return!0;const o=i.mapViewToDom(s);return"none"!=Yi.window.getComputedStyle(o).float}function Qw(e,t,n,i){const s=e.model;return s.createRange(s.createPositionAt(t,Yw(e,t,n,i)))}function Yw(e,t,n,i){const s=e.editing.mapper,o=e.editing.view.domConverter,r=s.toViewElement(t),a=o.mapViewToDom(r),l=new go(a);return e.model.schema.isInline(t)?n<(l.left+l.right)/2?"before":"after":i<(l.top+l.bottom)/2?"before":"after"}function Xw(e,t){const n=e.editing.mapper,i=e.editing.view,s=n.toModelElement(t);if(s)return s;const o=i.createPositionBefore(t),r=n.findMappedViewAncestor(o);return n.toModelElement(r)}class eb extends Bu{_isBlockDragging=!1;_domEmitter=new(so());static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(e,t,n)=>{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),ts.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",(e,t)=>this._handleBlockDragStart(t)),this._domEmitter.listenTo(Yi.document,"dragover",(e,t)=>this._handleBlockDragging(t)),this._domEmitter.listenTo(Yi.document,"drop",(e,t)=>this._handleBlockDragging(t)),this._domEmitter.listenTo(Yi.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",(e,n,i)=>{t.setAttribute("draggable",i?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,n=t.document.selection,i=this.editor.editing.view,s=Array.from(n.getSelectedBlocks()),o=t.createRange(t.createPositionBefore(s[0]),t.createPositionAfter(s[s.length-1]));t.change(e=>e.setSelection(o)),this._isBlockDragging=!0,i.focus(),i.getObserver(Lw).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),n=e.clientY,i=document.elementFromPoint(t,n),s=this.editor.editing.view;i&&i.closest(".ck-editor__editable")&&s.getObserver(Lw).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:i,clientX:t,clientY:n,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class tb extends Bu{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=ur(()=>this._clearDraggableAttributes(),40);_blockMode=!1;_domEmitter=new(so());_previewContainer;static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[Uw,Nw,Gw,eb]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(Lw),t.addObserver(ou),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(e,t,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(e,t,n)=>{n||this._finalizeDragging(!1)}),ts.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,s=e.plugins.get(Gw);this.listenTo(i,"dragstart",(e,n)=>{if(n.target&&n.target.is("editableElement"))return void n.preventDefault();if(this._prepareDraggedRange(n.target),!this._draggedRange)return void n.preventDefault();this._draggingUid=gs(),n.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const i=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,i,"dragstart");
11const{dataTransfer:s,domTarget:o,domEvent:r}=n,{clientX:a}=r;this._updatePreview({dataTransfer:s,domTarget:o,clientX:a}),n.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(i,"dragend",(e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)},{priority:"low"}),this._domEmitter.listenTo(Yi.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(i,"dragenter",()=>{this.isEnabled&&n.focus()}),this.listenTo(i,"dragleave",()=>{s.removeDropMarkerDelayed()}),this.listenTo(i,"dragging",(e,t)=>{if(!this.isEnabled)return void(t.dataTransfer.dropEffect="none");const{clientX:n,clientY:i}=t.domEvent;s.updateDropMarker(t.target,t.targetRanges,n,i,this._blockMode,this._draggedRange),this._draggedRange||(t.dataTransfer.dropEffect="copy"),ts.isGecko||("copy"==t.dataTransfer.effectAllowed?t.dataTransfer.dropEffect="copy":["all","copyMove"].includes(t.dataTransfer.effectAllowed)&&(t.dataTransfer.dropEffect="move")),e.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,n=e.plugins.get(Gw);this.listenTo(t,"clipboardInput",(t,i)=>{if("drop"!=i.method)return;const{clientX:s,clientY:o}=i.domEvent,r=n.getFinalDropRange(i.target,i.targetRanges,s,o,this._blockMode,this._draggedRange);if(!r)return this._finalizeDragging(!1),void t.stop();this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==nb(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(r,!0))return this._finalizeDragging(!1),void t.stop();i.targetRanges=[e.editing.mapper.toViewRange(r)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Uw);e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const n=t.targetRanges.map(e=>this.editor.editing.mapper.toModelRange(e));this.editor.model.change(e=>e.setSelection(n))},{priority:"high"}),e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const n="move"==nb(t.dataTransfer),i=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(i&&n)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,"mousedown",(i,s)=>{if(ts.isAndroid||!s)return;this._clearDraggableAttributesDelayed.cancel();let o=ib(s.target);if(ts.isBlink&&!e.isReadOnly&&!o&&!n.selection.isCollapsed){const e=n.selection.getSelectedElement();e&&yw(e)||(o=n.selection.editableElement)}o&&(t.change(e=>{e.setAttribute("draggable","true",o)}),this._draggableElement=e.editing.mapper.toModelElement(o))}),this.listenTo(n,"mouseup",()=>{ts.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,n=t.model;if(t.plugins.get(Gw).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")){t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop")}this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&n.change(e=>{const t=n.createSelection(this._draggedRange);n.deleteContent(t,{doNotAutoparagraph:!0});const i=t.getFirstPosition().parent;i.isEmpty&&!n.schema.checkChild(i,"$text")&&n.schema.checkChild(i,"paragraph")&&e.insertElement("paragraph",i,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,n=t.model,i=n.document.selection,s=e?ib(e):null;if(s){const e=t.editing.mapper.toModelElement(s);if(this._draggedRange=Bl.fromRange(n.createRangeOn(e)),this._blockMode=n.schema.isBlock(e),t.plugins.has("WidgetToolbarRepository")){t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}return}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const o=Array.from(i.getSelectedBlocks()),r=i.getFirstRange();if(0==o.length)return void(this._draggedRange=Bl.fromRange(r));const a=sb(n,o);if(o.length>1)this._draggedRange=Bl.fromRange(a),this._blockMode=!0;else if(1==o.length){const e=r.start.isTouching(a.start)&&r.end.isTouching(a.end);this._draggedRange=Bl.fromRange(e?a:r),this._blockMode=e}
11n.change(e=>e.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:n}){const i=this.editor.editing.view,s=i.document.selection.editableElement,o=i.domConverter.mapViewToDom(s),r=Yi.window.getComputedStyle(o);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Qs(Yi.document,"div",{style:"position: fixed; left: -999999px;"}),Yi.document.body.appendChild(this._previewContainer));const a=new go(o);if(o.contains(t))return;const l=parseFloat(r.paddingLeft),c=Qs(Yi.document,"div");c.className="ck ck-content",c.style.width=r.width,c.style.paddingLeft=`${a.left-n+l}px`,ts.isiOS&&(c.style.backgroundColor="white"),i.domConverter.setContentOf(c,e.getData("text/html")),e.setDragImage(c,0,0),this._previewContainer.appendChild(c)}}function nb(e){return ts.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function ib(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(yw);if(yw(e))return e;const t=e.findAncestor(e=>yw(e)||e.is("editableElement"));return yw(t)?t:null}function sb(e,t){const n=t[0],i=t[t.length-1],s=n.getCommonAncestor(i),o=e.createPositionBefore(n),r=e.createPositionAfter(i);if(s&&s.is("element")&&!e.schema.isLimit(s)){const t=e.createRangeOn(s),n=o.isTouching(t.start),i=r.isTouching(t.end);if(n&&i)return sb(e,[s])}return e.createRange(o,r)}class ob extends Bu{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[Uw]}init(){const e=this.editor,t=e.model,n=e.editing.view,i=t.document.selection;n.addObserver(Lw),e.plugins.get(Uw).on("contentInsertion",(e,n)=>{(function(e,t){let n=t.createRangeIn(e);if(1==e.childCount){const i=e.getChild(0);i.is("element")&&t.schema.isBlock(i)&&!t.schema.isObject(i)&&!t.schema.isLimit(i)&&(n=t.createRangeIn(i))}for(const i of n.getItems()){if(!t.schema.isInline(i))return!1;if(Array.from(i.getAttributeKeys()).find(e=>t.schema.getAttributeProperties(e).isFormatting))return!1}return!0})(n.content,t)&&t.change(e=>{const s=Array.from(i.getAttributes()).filter(([e])=>t.schema.getAttributeProperties(e).isFormatting);i.isCollapsed||t.deleteContent(i,{doNotAutoparagraph:!0}),s.push(...i.getAttributes());const o=e.createRangeIn(n.content);for(const n of o.getItems())for(const i of s)t.schema.checkAttribute(n,i[0])&&e.setAttribute(i[0],i[1],n)})})}}class rb extends Bu{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Ww,Uw,tb,ob]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}class ab extends Hg{view;_toolbarConfig;_elementReplacer;constructor(e,t){super(e),this.view=t,this._toolbarConfig=$m(e.config.get("toolbar")),this._elementReplacer=new Ks,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){const t=this.editor,n=this.view,i=t.editing.view,s=n.editable,o=i.document.getRoot();s.name=o.rootName,n.render();const r=s.element;this.setEditableElement(s.name,r),n.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(r),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),n.menuBarView&&this._initMenuBar(n.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({top:e})=>e||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),i=e.sourceElement;let s;const o=e.config.get("placeholder");o&&(s="string"==typeof o?o:o[this.view.editable.name]),!s&&i&&"textarea"===i.tagName.toLowerCase()&&(s=i.getAttribute("placeholder")),s&&(n.placeholder=s),_r({view:t,element:n,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:e}=this.view,t=this.editor.plugins.get("ContextualBalloon");t.on("getPositionOptions",t=>{const n=t.return;if(!n||!e.isSticky||!e.element)return;const i=new go(e.element).height,s="function"==typeof n.target?n.target():n.target,o="function"==typeof n.limiter?n.limiter():n.limiter;if(s&&o&&new go(s).height>=new go(o).height-i)return;const r={...n.viewportOffsetConfig},a=(r.top||0)+i;t.return={...n,viewportOffsetConfig:{...r,top:a}}},{priority:"low"});const n=()=>{t.visibleView&&t.updatePosition()};this.listenTo(e,"change:isSticky",n),this.listenTo(this.editor.ui,"change:viewportOffset",n)}_handleScrollToTheSelectionWithStickyPanel(e,t,n){const i=this.view.stickyPanel;if(i.isSticky){const e=new go(i.element).height;t.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(n)};this.listenTo(i,"change:isSticky",e),setTimeout(()=>{this.stopListening(i,"change:isSticky",e)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",()=>{const n=t.view;n.on("moveTo",(t,i)=>{if(!e.isSticky||n.wasMoved)return;const s=new go(e.contentPanelElement);i[1]<s.bottom+nm.defaultOffset&&(i[1]=s.bottom+nm.defaultOffset)},{priority:"high"})},{priority:"low"})}}class lb extends qg{stickyPanel;toolbar;editable;constructor(e,t,n={}
11){super(e),this.stickyPanel=new tp(e),this.toolbar=new jm(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),n.useMenuBar&&(this.menuBarView=new cp(e)),this.editable=new Gg(e,t,void 0,{label:n.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class cb extends(Ju(Ku)){ui;constructor(e,t={}){if(!hb(e)&&void 0!==t.initialData)throw new bs("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return hb(e)?ao(e):e}(e)),hb(e)&&(this.sourceElement=e),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=this.config.get("menuBar"),s=new lb(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:n,useMenuBar:i.isVisible,label:this.config.get("label")});this.ui=new ab(this,s),Gu(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(n=>{const i=new this(e,t);n(i.initPlugins().then(()=>i.ui.init(hb(e)?e:null)).then(()=>i.data.init(i.config.get("initialData"))).then(()=>i.fire("ready")).then(()=>i))})}}function hb(e){return Hi(e)}class ub extends Hg{view;_toolbarConfig;constructor(e,t){super(e),this.view=t,this._toolbarConfig=$m(e.config.get("toolbar"))}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,n=e.editing.view,i=t.editable,s=n.document.getRoot();i.name=s.rootName,t.render();const o=i.element;this.setEditableElement(i.name,o),i.bind("isFocused").to(this.focusTracker),n.attachDomRoot(o),this._initPlaceholder(),this._initToolbar(),t.menuBarView&&this._initMenuBar(t.menuBarView),this.fire("ready")}destroy(){super.destroy();const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.editor,t=this.view,n=t.editable.element,i=t.toolbar;t.panel.bind("isVisible").to(this.focusTracker,"isFocused"),t.bind("viewportTopOffset").to(this,"viewportOffset",({top:e})=>e||0),t.listenTo(e.ui,"update",()=>{t.panel.isVisible&&t.panel.pin({target:n,positions:t.panelPositions})}),i.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(i)}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),i=e.config.get("placeholder");if(i){const e="string"==typeof i?i:i[n.rootName];e&&(n.placeholder=e)}_r({view:t,element:n,isDirectHost:!1,keepOnFocus:!0})}}const db=Co("px");class fb extends Ug{toolbar;panel;panelPositions;editable;_resizeObserver;constructor(e,t,n,i={}){super(e),this.toolbar=new jm(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull,isFloating:!0}),i.useMenuBar&&(this.menuBarView=new cp(e)),this.set("viewportTopOffset",0),this.panel=new Dm(e),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new Gg(e,t,n,{label:i.label}),this._resizeObserver=null}render(){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);if(this.toolbar.options.shouldGroupWhenFull){const e=this.editable.element;this._resizeObserver=new vo(e,()=>{this.toolbar.maxWidth=db(new go(e).width)})}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(e,t){let n;return n=e.top>t.height+this.viewportTopOffset?e.top-t.height:e.bottom>t.height+this.viewportTopOffset+50?this.viewportTopOffset:e.bottom,n}_getPanelPositions(){const e=[(e,t)=>({top:this._getPanelPositionTop(e,t),left:e.left,name:"toolbar_west",config:{withArrow:!1}}),(e,t)=>({top:this._getPanelPositionTop(e,t),left:e.left+e.width-t.width,name:"toolbar_east",config:{withArrow:!1}})];return"ltr"===this.locale.uiLanguageDirection?e:e.reverse()}}class mb extends(Ju(Ku)){ui;constructor(e,t={}){if(!gb(e)&&void 0!==t.initialData)throw new bs("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return gb(e)?ao(e):e}(e)),this.model.document.createRoot(),gb(e)&&(this.sourceElement=e,function(e,t){if(t.ckeditorInstance)throw new bs("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}(this,e));const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=this.config.get("menuBar"),s=new fb(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:n,useMenuBar:i.isVisible,label:this.config.get("label")});this.ui=new ub(this,s),Gu(this)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,t={}){return new Promise(n=>{if(gb(e)&&"TEXTAREA"===e.tagName)throw new bs("editor-wrong-element",null);const i=new this(e,t);n(i.initPlugins().then(()=>i.ui.init()).then(()=>i.data.init(i.config.get("initialData"))).then(()=>i.fire("ready")).then(()=>i))})}}function gb(e){return Hi(e)}class pb extends Nu{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;
11let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!wb(e.schema,n))do{if(n=n.parent,!n)return}while(!wb(e.schema,n));e.change(e=>{e.setSelection(n,"in")})}}function wb(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const bb=Ko("Ctrl+A");class _b extends Bu{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=e.editing.view.document;e.commands.add("selectAll",new pb(e)),this.listenTo(n,"keydown",(t,n)=>{qo(n)===bb&&(e.execute("selectAll"),n.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}class yb extends Bu{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const e=this._createButton(Lf);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(rm))}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("selectAll"),s=new e(t.locale),o=n.t;return s.set({label:o("Select all"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>',keystroke:"Ctrl+A"}),s.bind("isEnabled").to(i,"isEnabled"),this.listenTo(s,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),s}}class vb extends Bu{static get requires(){return[_b,yb]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}class kb extends Nu{_stack=[];_createdBatches=new WeakSet;constructor(e){super(e),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(e,t)=>{t[1]={...t[1]};const n=t[1];n.batchType||(n.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(e,t)=>{t[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const i=this.editor.model,s=i.document,o=[],r=e.map(e=>e.getTransformedByOperations(n)),a=r.flat();for(const l of r){const e=l.filter(e=>e.root!=s.graveyard).filter(e=>!xb(e,a));e.length&&(Cb(e),o.push(e[0]))}o.length&&i.change(e=>{e.setSelection(o,{backward:t})})}_undo(e,t){const n=this.editor.model,i=n.document;this._createdBatches.add(t);const s=e.operations.slice().filter(e=>e.isDocumentOperation);s.reverse();for(const o of s){const e=o.baseVersion+1,s=Array.from(i.history.getOperations(e)),r=dh([o.getReversed()],s,{useRelations:!0,document:this.editor.model.document,forceWeakRemove:!0}).operationsA;for(let a of r){const e=a.affectedSelectable;e&&!n.canEditAt(e)&&(a=new nh(a.baseVersion)),t.addOperation(a),n.applyOperation(a),i.history.setOperationAsUndone(o,a)}}}}function Cb(e){e.sort((e,t)=>
11e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){const n=e[t-1].getJoined(e[t],!0);n&&(t--,e.splice(t,2,n))}}function xb(e,t){return t.some(t=>t!==e&&t.containsRange(e,!0))}class Ab extends kb{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,()=>{this._undo(n.batch,i);const e=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,e)}),this.fire("revert",n.batch,i),this.refresh()}}class Tb extends kb{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,i),this._undo(e.batch,t)}),this.refresh()}}class Eb extends Bu{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t;this._undoCommand=new Ab(e),this._redoCommand=new Tb(e),e.commands.add("undo",this._und
11oCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const n=t[0];if(!n.isDocumentOperation)return;const i=n.batch,s=this._redoCommand.createdBatches.has(i),o=this._undoCommand.createdBatches.has(i);this._batchRegistry.has(i)||(this._batchRegistry.add(i),i.isUndoable&&(s?this._undoCommand.addBatch(i):o||(this._undoCommand.addBatch(i),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,n)=>{this._redoCommand.addBatch(n)}),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 Pb extends Bu{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale,n=e.t,i="ltr"==t.uiLanguageDirection?md:fd,s="ltr"==t.uiLanguageDirection?fd:md;this._addButtonsToFactory("undo",n("Undo"),"CTRL+Z",i),this._addButtonsToFactory("redo",n("Redo"),"CTRL+Y",s)}_addButtonsToFactory(e,t,n,i){const s=this.editor;s.ui.componentFactory.add(e,()=>{const s=this._createButton(Lf,e,t,n,i);return s.set({tooltip:!0}),s}),s.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(rm,e,t,n,i))}_createButton(e,t,n,i,s){const o=this.editor,r=o.locale,a=o.commands.get(t),l=new e(r);return l.set({label:n,icon:s,keystroke:i}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{o.execute(t),o.editing.view.focus()}),l}}class Sb extends Bu{static get requires(){return[Eb,Pb]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}}class Rb extends Bu{static get requires(){return[um,rb,nw,vb,rw,Ep,Sb]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}class Ob extends Nu{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,n=t.document.selection,i=e.value,s=e.batch,o=e=>{if(n.isCollapsed)i?e.setSelectionAttribute(this.attributeKey,i):e.removeSelectionAttribute(this.attributeKey);else{const s=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of s)i?e.setAttribute(this.attributeKey,i,t):e.removeAttribute(this.attributeKey,t)}};s?t.enqueueChange(s,e=>{o(e)}):t.change(e=>{o(e)})}}const Ib="fontSize",Mb="fontFamily",Vb="fontColor",Bb="fontBackgroun
11dColor";function Db(e,t){const n={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const i of t)n.model.values.push(i.model),n.view[i.model]=i.view,i.upcastAlso&&(n.upcastAlso[i.model]=i.upcastAlso);return n}function Nb(e){return t=>t.getStyle(e).replace(/\s/g,"")}function Fb(e){return(t,{writer:n})=>n.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class Lb extends Ob{constructor(e){super(e,Mb)}}function $b(e){return e.map(zb).filter(e=>void 0!==e)}function zb(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),n=t[0],i=t.map(jb).join(", ");return{title:n,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}(e):void 0}function jb(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class Hb extends Bu{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(Mb,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Mb}),e.model.schema.setAttributeProperties(Mb,{isFormatting:!0,copyOnEnter:!0});const t=$b(e.config.get("fontFamily.options")).filter(e=>e.model),n=Db(Mb,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(Mb,new Lb(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:Mb,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:Mb,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:Mb,value:e=>e.getAttribute("face")}})}}var Wb='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';class Ub extends Bu{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),i=e.commands.get(Mb),s=t("Font Family"),o=function(e,t){const n=new nr;for(const i of e){const e={type:"button",model:new Jg({commandName:Mb,commandParam:i.model,label:i.title,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",e=>e===i.model||!(!e||!i.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase()),i.view&&"string"!=typeof i.view&&i.view.styles&&e.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),n.add(e)}return n}(n,i);e.ui.componentFactory.add(Mb,t=>{const n=Km(t);return Zm(n,o,{role:"menu",ariaLabel:s}),n.buttonView.set({label:s,icon:Wb,tooltip:!0}),n.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),n}),e.ui.componentFactory.add(`menuBar:${Mb}`,t=>{const n=new sp(t);n.buttonView.set({label:s,icon:Wb}),n.bind("isEnabled").to(i);const r=new op(t);for(const i of o){const s=new Tg(t,n),o=new rm(t);o.set({role:"menuitemradio",isToggleable:!0}),o.bind(...Object.keys(i.model)).to(i.model),o.delegate("execute").to(n),o.on("execute",()=>{e.execute(i.model.commandName,{value:i.model.commandParam}),e.editing.view.focus()}),s.children.add(o),r.items.add(s)}return n.panelView.children.add(r),n})}_getLocalizedOptions(){const e=this.editor,t=e.t;return $b(e.config.get(Mb).options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class qb extends Bu{static get requires(){return[Hb,Ub]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}class Kb extends Ob{constructor(e){super(e,Ib)}}function Gb(e){return e.map(e=>function(e){"number"==typeof e&&(e=String(e));if("object"==typeof e&&(t=e,t.title&&t.model&&t.view))return Zb(e);var t;const n=function(e){return"string"==typeof e?Jb[e]:Jb[e.model]}(e);if(n)return Zb(n);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new bs("font-size-invalid-definition",null,e);t=parseFloat(e.model)}
11else t=parseFloat(e);return isNaN(t)}(e))return;return function(e){"string"==typeof e&&(e={title:e,model:`${parseFloat(e)}px`});return e.view={name:"span",styles:{"font-size":e.model}},Zb(e)}(e)}(e)).filter(e=>void 0!==e)}const Jb={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 Zb(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const Qb=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class Yb extends Bu{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(Ib,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ib}),e.model.schema.setAttributeProperties(Ib,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),n=Gb(this.editor.config.get("fontSize.options")).filter(e=>e.model),i=Db(Ib,n);t?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(Ib,new Kb(e))}_prepareAnyValueConverters(e){const t=this.editor,n=e.model.values.filter(e=>{return!(t=String(e),mu.test(t)||function(e){return gu.test(e)}(String(e)));var t});if(n.length)throw new bs("font-size-invalid-use-of-named-presets",null,{presets:n});t.conversion.for("downcast").attributeToElement({model:Ib,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:Ib,value:e=>e.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:Ib,value:e=>{const t=e.getAttribute("size"),n="-"===t[0]||"+"===t[0];let i=parseInt(t,10);n&&(i=3+i);const s=Qb.length-1,o=Math.min(Math.max(i,0),s);return Qb[o]}}})}}var Xb='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';class e_ extends Bu{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),i=e.commands.get(Ib),s=t("Font Size"),o=function(e,t){const n=new nr;for(const i of e){const e={type:"button",model:new Jg({commandName:Ib,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&"string"!=typeof i.view&&(i.view.styles&&e.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view.classes&&e.model.set("class",`${e.model.class} ${i.view.classes}`)),e.model.bind("isOn").to(t,"value",e=>e===i.model),n.add(e)}return n}(n,i);e.ui.componentFactory.add(Ib,t=>{const n=Km(t);return Zm(n,o,{role:"menu",ariaLabel:s}),n.buttonView.set({label:s,icon:Xb,tooltip:!0}),n.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),n}),e.ui.componentFactory.add(`menuBar:${Ib}`,t=>{const n=new sp(t);n.buttonView.set({label:s,icon:Xb}),n.bind("isEnabled").to(i);const r=new op(t);for(const i of o){const s=new Tg(t,n),o=new rm(t);o.set({role:"menuitemradio",isToggleable:!0}),o.bind(...Object.keys(i.model)).to(i.model),o.delegate("execute").to(n),o.on("execute",()=>{e.execute(i.model.commandName,{value:i.model.commandParam}),e.editing.view.focus()}),s.children.add(o),r.items.add(s)}return n.panelView.children.add(r),n})}_getLocalizedOptions(){const e=this.editor,t=e.t,n={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t
11("Big"),Huge:t("Huge")};return Gb(e.config.get(Ib).options).map(e=>{const t=n[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class t_ extends Bu{static get requires(){return[Yb,e_]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return Gb(e)}}class n_ extends Ob{constructor(e){super(e,Vb)}}class i_ extends Bu{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(Vb,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:Vb,value:Nb("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:Vb,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:Vb,view:Fb("color")}),e.commands.add(Vb,new n_(e)),e.model.schema.extend("$text",{allowAttributes:Vb}),e.model.schema.setAttributeProperties(Vb,{isFormatting:!0,copyOnEnter:!0})}}class s_ extends Bu{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:t,componentName:n,icon:i,dropdownLabel:s}){super(e),this.commandName=t,this.componentName=n,this.icon=i,this.dropdownLabel=s,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,n=t.t,i=e.commands.get(this.commandName),s=e.config.get(this.componentName);const o=function(e,t){const n=e.t,i={Black:n("Black"),"Dim grey":n("Dim grey"),Grey:n("Grey"),"Light grey":n("Light grey"),White:n("White"),Red:n("Red"),Orange:n("Orange"),Yellow:n("Yellow"),"Light green":n("Light green"),Green:n("Green"),Aquamarine:n("Aquamarine"),Turquoise:n("Turquoise"),"Light blue":n("Light blue"),Blue:n("Blue"),Purple:n("Purple")};return t.map(e=>{const t=i[e.label];return t&&t!=e.label&&(e.label=t),e})}(t,s.colors.map(bm).filter(e=>!!e)),r=s.documentColors,a=!1!==s.colorPicker;e.ui.componentFactory.add(this.componentName,t=>{const l=Km(t);let c=!1;const h=function({dropdownView:e,colors:t,columns:n,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a}){const l=e.locale,c=new ug(l,{colors:t,columns:n,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a});return e.colorSelectorView=c,e.panelView.children.add(c),c}({dropdownView:l,colors:o.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==r?n("Document colors"):"",documentColorsCount:void 0===r?this.columns:r,colorPickerViewConfig:!!a&&(s.colorPicker||{})});return h.bind("selectedColor").to(i,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(i),h.on("execute",(t,n)=>{l.isOpen&&e.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),"colorPicker"!==n.source&&e.editing.view.focus(),"colorPickerSaveButton"===n.source&&(l.isOpen=!1)}),h.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),h.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(l.isOpen=!1,e.execute("undo",this._und
11oStepBatch)),e.editing.view.focus()}),l.on("change:isOpen",(t,n,i)=>{c||(c=!0,l.colorSelectorView.appendUI()),i&&(0!==r&&h.updateDocumentColors(e.model,this.componentName),h.updateSelectedColors(),h.showColorGridsFragment())}),Ym(l,()=>l.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(e=>e.isOn)),l}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,t=>{const s=new sp(t);s.buttonView.set({label:this.dropdownLabel,icon:this.icon}),s.bind("isEnabled").to(i);let a=!1;const l=new ug(t,{colors:o.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==r?n("Document colors"):"",documentColorsCount:void 0===r?this.columns:r,colorPickerViewConfig:!1});return l.bind("selectedColor").to(i,"value"),l.delegate("execute").to(s),l.on("execute",(t,n)=>{e.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),e.editing.view.focus()}),s.on("change:isOpen",(t,n,i)=>{a||(a=!0,l.appendUI()),i&&(0!==r&&l.updateDocumentColors(e.model,this.componentName),l.updateSelectedColors(),l.showColorGridsFragment())}),s.panelView.children.add(l),s})}}class o_ extends s_{constructor(e){const t=e.locale.t;super(e,{commandName:Vb,componentName:Vb,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}class r_ extends Bu{static get requires(){return[i_,o_]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class a_ extends Ob{constructor(e){super(e,Bb)}}class l_ extends Bu{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(Bb,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(xu),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:Bb,value:Nb("background-color")}}),e.conversion.for("downcast").attributeToElement({model:Bb,view:Fb("background-color")}),e.commands.add(Bb,new a_(e)),e.model.schema.extend("$text",{allowAttributes:Bb}),e.model.schema.setAttributeProperties(Bb,{isFormatting:!0,copyOnEnter:!0})}}class c_ extends s_{constructor(e){const t=e.locale.t;super(e,{commandName:Bb,componentName:Bb,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class h_ extends Bu{static get requires(){return[l_,c_]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}class u_ extends Bu{static get requires(){return[qb,t_,r_,h_]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}}class d_ extends Nu{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=ir(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&f_(t,e.schema)}execute(e={}){const t=this.editor.model,n=t.document,i=e.selection||n.selection;t.canEditAt(i)&&t.change(e=>{const n=i.getSelectedBlocks();for(const i of n)!i.is("element","paragraph")&&f_(i,t.schema)&&e.rename(i,"paragraph")})}}function f_(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class m_ extends Nu{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,n=e.attributes;let i=e.position;t.canEditAt(i)&&t.change(e=>{if(i=this._findPositionToInsertParagraph(i,e),!i)return;const s=e.createElement("paragraph");n&&t.schema.setAllowedAttributes(s,n,e),t.insertContent(s,i),e.setSelection(s,"in")})}_findPositionToInsertParagraph(e,t){const n=this.editor.model;if(n.schema.checkChild(e,"paragraph"))return e;const i=n.schema.findAllowedParent(e,"paragraph");if(!i)return null;const s=e.parent,o=n.schema.checkChild(s,"$text");return s.isEmpty||o&&e.isAtEnd?n.createPositionAfter(s):!s.isEmpty&&o&&e.isAtStart?n.createPositionBefore(s):t.split(e,i).position}}class g_ extends Bu{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new d_(e)),e.commands.add("insertParagraph",new m_(e)),t.schema.register("paragraph",{inheritAllFrom
11:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>g_.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}static paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"])}class p_ extends Nu{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){const e=ir(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>w_(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,n=t.document,i=e.value;t.change(e=>{const s=Array.from(n.selection.getSelectedBlocks()).filter(e=>w_(e,i,t.schema));for(const t of s)t.is("element",i)||e.rename(t,i)})}}function w_(e,t,n){return n.checkChild(e.parent,t)&&!n.isObject(e)}const b_="paragraph";class __ extends Bu{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[g_]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const i of t)"paragraph"!==i.model&&(e.model.schema.register(i.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(i),n.push(i.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new p_(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,i)=>{const s=e.model.document.selection.getFirstPosition().parent;n.some(e=>s.is("element",e.model))&&!s.is("element",b_)&&0===s.childCount&&i.writer.rename(s,b_)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:ps.low+1})}}class y_ extends Bu{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=function(e){const t=e.t,n={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map(e=>{const t=n[e.title];return t&&t!=e.title&&(e.title=t),e})}(e),i=t("Choose heading"),s=t("Heading");e.ui.componentFactory.add("heading",t=>{const o={},r=new nr,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of n){const t={type:"button",model:new Jg({label:e.title,class:e.class,role:"menuitemradio",withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(l,"value"),t.model.set("commandName","paragraph"),c.push(l)):(t.model.bind("isOn").to(a,"value",t=>t===e.model),t.model.set({commandName:"heading",commandValue:e.model})),r.add(t),o[e.model]=e.title}const h=Km(t);return Zm(h,r,{ariaLabel:s,role:"menu"}),h.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),h.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),h.bind("isEnabled").toMany(c,"isEnabled",(...e)=>e.some(e=>e)),h.buttonView.bind("label").to(a,"value",l,"value",(e,t)=>{const n=t?"paragraph":e;return"boolean"==typeof n?i:o[n]?o[n]:i}),h.buttonView.bind("ariaLabel").to(a,"value",l,"value",(e,t)=>{const n=t?"paragraph":e;return"boolean"==typeof n?s:o[n]?`${o[n]}, ${s}`:s}),this.listenTo(h,"execute",t=>{const{commandName:n,commandValue:i}=t.source;e.execute(n,i?{value:i}:void 0),e.editing.view.focus()}),h}),e.ui.componentFactory.add("menuBar:heading",i=>{const s=new sp(i),o=e.commands.get("heading"),r=e.commands.get("paragraph"),a=[o],l=new op(i);s.set({class:"ck-heading-dropdown"}),l.set({ariaLabel:t("Heading"),role:"menu"}),s.buttonView.set({label:t("Heading")}),s.panelView.children.add(l);for(const t of n){const n=new Tg(i,s),c=new rm(i);n.children.add(c),l.items.add(n),c.set({isToggleable:!0,label:t.title,role:"menuitemradio",class:t.class}),c.delegate("execute").to(s),c.on("execute",()=>{const n="paragraph"===t.model?"paragraph":"heading";e.execute(n,{value:t.model}),e.editing.view.focus()}),"paragraph"===t.model?(c.bind("isOn").to(r,"value"),a.push(r)):c.bind("isOn").to(o,"value",e=>e===t.model)}return s.bind("isEnabled").toMany(a,"isEnabled",(...e)=>e.some(e=>e)),s})}}class v_ extends Bu{static get requires(){return[__,y_]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}}class k_ extends Bu{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;
11e.commands.add("indent",new Lu(e)),e.commands.add("outdent",new Lu(e))}}class C_ extends Bu{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.locale,n=e.t,i="ltr"==t.uiLanguageDirection?wd:bd,s="ltr"==t.uiLanguageDirection?bd:wd;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),s)}_defineButton(e,t,n){const i=this.editor;i.ui.componentFactory.add(e,()=>{const i=this._createButton(Lf,e,t,n);return i.set({tooltip:!0}),i}),i.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(rm,e,t,n))}_createButton(e,t,n,i){const s=this.editor,o=s.commands.get(t),r=new e(s.locale);return r.set({label:n,icon:i}),r.bind("isEnabled").to(o,"isEnabled"),this.listenTo(r,"execute",()=>{s.execute(t),s.editing.view.focus()}),r}}class x_ extends Bu{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[k_,C_]}}class A_{_definitions=new Set;get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(e=>this._definitions.add(e)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(e,t,n)=>{if(!n.consumable.test(t.item,"attribute:linkHref"))return;if(!t.item.is("selection")&&!n.schema.isInline(t.item))return;const i=n.writer,s=i.document.selection;for(const o of this._definitions){const e=i.createAttributeElement("a",o.attributes,{priority:5});o.classes&&i.addClass(o.classes,e);for(const t in o.styles)i.setStyle(t,o.styles[t],e);i.setCustomProperty("link",!0,e),o.callback(t.attributeNewValue)?t.item.is("selection")?i.wrap(s.getFirstRange(),e):i.wrap(n.mapper.toViewRange(t.range),e):i.unwrap(n.mapper.toViewRange(t.range),e)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(e,t,{writer:n,mapper:i})=>{const s=i.toViewElement(t.item),o=Array.from(s.getChildren()).find(e=>e.is("element","a"));if(o)for(const r of this._definitions){const e=cr(r.attributes);if(r.callback(t.attributeNewValue)){for(const[t,i]of e)"class"===t?n.addClass(i,o):n.setAttribute(t,i,o);r.classes&&n.addClass(r.classes,o);for(const e in r.styles)n.setStyle(e,r.styles[e],o)}else{for(const[t,i]of e)"class"===t?n.removeClass(i,o):n.removeAttribute(t,o);r.classes&&n.removeClass(r.classes,o);for(const e in r.styles)n.removeStyle(e,o)}}})}}}const T_=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,E_=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,P_=/^((\w+:(\/{2,})?)|(\W))/i,S_=["https?","ftps?","mailto"],R_="Ctrl+K";function O_(e,{writer:t}){const n=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,n),n}function I_(e,t=S_){const n=String(e),i=t.join("|");return function(e,t){const n=e.replace(T_,"");return!!n.match(t)}(n,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",i)}`,"i"))?n:"#"}function M_(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function V_(e,t){const n=(i=e,E_.test(i)?"mailto:":t);var i;const s=!!n&&!B_(e);return e&&s?n+e:e}function B_(e){return P_.test(e)}function D_(e){window.open(e,"_blank","noopener")}class N_ extends Nu{manualDecorators=new nr;automaticDecorators=new A_;restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement()||ir(t.getSelectedBlocks());M_(n,e.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(n,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const i of this.manualDecorators)i.value=this._getDecoratorStateFromModel(i.id)}execute(e,t={}){const n=this.editor.model,i=n.document.selection,s=[],o=[];for(const r in t)t[r]?s.push(r):o.push(r);n.change(t=>{if(i.isCollapsed){const r=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=F_(i);let l=Np(r,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(l=this._updateLinkContent(n,t,l,e)),t.setAttribute("linkHref",e,l),s.forEac
11h(e=>{t.setAttribute(e,!0,l)}),o.forEach(e=>{t.removeAttribute(e,l)}),t.setSelection(t.createPositionAfter(l.end.nodeBefore))}else if(""!==e){const o=cr(i.getAttributes());o.set("linkHref",e),s.forEach(e=>{o.set(e,!0)});const{end:a}=n.insertContent(t.createText(e,o),r);t.setSelection(a)}["linkHref",...s,...o].forEach(e=>{t.removeSelectionAttribute(e)})}else{const r=n.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const e of i.getSelectedBlocks())n.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const l=a.slice();for(const e of r)this._isRangeToUpdate(e,a)&&l.push(e);for(const c of l){let r=c;if(1===l.length){const s=F_(i);i.getAttribute("linkHref")===s&&(r=this._updateLinkContent(n,t,c,e),t.setSelection(t.createSelection(r)))}t.setAttribute("linkHref",e,r),s.forEach(e=>{t.setAttribute(e,!0,r)}),o.forEach(e=>{t.removeAttribute(e,r)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,n=t.document.selection,i=n.getSelectedElement();return M_(i,t.schema)?i.getAttribute(e):n.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t)if(n.containsRange(e))return!1;return!0}_updateLinkContent(e,t,n,i){const s=t.createText(i,{linkHref:i});return e.insertContent(s,n)}}function F_(e){if(e.isCollapsed){const t=e.getFirstPosition();return t.textNode&&t.textNode.data}{const t=Array.from(e.getFirstRange().getItems());if(t.length>1)return null;const n=t[0];return n.is("$text")||n.is("$textProxy")?n.data:null}}class L_ extends Nu{refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement();M_(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,i=e.commands.get("link");t.change(e=>{const s=n.isCollapsed?[Np(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),t)]:t.schema.getValidRanges(n.getRanges(),"linkHref");for(const t of s)if(e.removeAttribute("linkHref",t),i)for(const n of i.manualDecorators)e.removeAttribute(n.id,t)})}}class $_ extends(zs()){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:n,classes:i,styles:s,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=n,this.classes=i,this.styles=s}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const z_="automatic",j_=/^(https?:)?\/\//;class H_ extends Bu{static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Rp,gp,Uw]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:O_}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,n)=>O_(I_(e,t),n)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new N_(e)),e.commands.add("unlink",new L_(e));const n=function(e,t){const n={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>("label"in e&&n[e.label]&&(e.label=n[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[n,i]of Object.entries(e)){const e=Object.assign({},i,{id:`link${pn(n)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter(e=>e.mode===z_)),this._enableManualDecorators(n.filter(e=>"manual"===e.mode));e.plugins.get(Rp).registerAttribute("linkHref"),function(e,t,n,i){const s=e.editing.view,o=new Set;s.document.registerPostFixer(s=>{const r=e.model.document.selection;let a=!1;if(r.hasAttribute(t)){const l=Np(r.getFirstPosition(),t,r.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",n)&&!e.hasClass(i)&&(s.addClass(i,e),o.add(e),a=!0)}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){s.change(e=>{for(const t of o.values())e.removeClass(i,t),o.delete(t)})}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,n=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:z_,callback:e=>!!e&&j_.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;
11e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const i=new $_(e);n.add(i),t.conversion.for("downcast").attributeToElement({model:i.id,view:(e,{writer:t,schema:n},{item:s})=>{if((s.is("selection")||n.isInline(s))&&e){const e=t.createAttributeElement("a",i.attributes,{priority:5});i.classes&&t.addClass(i.classes,e);for(const n in i.styles)t.setStyle(n,i.styles[n],e);return t.setCustomProperty("link",!0,e),e}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...i._createPattern()},model:{key:i.id}})})}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(e,t)=>{if(!(ts.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let n=t.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const i=n.getAttribute("href");i&&(e.stop(),t.preventDefault(),D_(i))},{context:"$capture"}),this.listenTo(t,"keydown",(t,n)=>{const i=e.commands.get("link").value;!!i&&n.keyCode===Wo.enter&&n.altKey&&(t.stop(),D_(i))})}_enableSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",(n,{attributeKeys:i})=>{i.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change(t=>{var n;!function(e,t){e.removeSelectionAttribute("linkHref");for(const n of t)e.removeSelectionAttribute(n)}(t,(n=e.schema,n.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(e,i)=>{t.change(e=>{const t=e.createRangeIn(i.content);for(const i of t.getItems())if(i.hasAttribute("linkHref")){const t=V_(i.getAttribute("linkHref"),n);e.setAttribute("linkHref",t,i)}})})}}class W_ extends Vf{focusTracker=new sr;keystrokes=new lr;urlInputView;saveButtonView;cancelButtonView;_manualDecoratorSwitches;children;_validators;_focusables=new uf;_focusCycler;constructor(e,t,n){super(e);const i=e.t;this._validators=n,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Yu,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Qu,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new jf({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const s=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&s.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:s,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),function({view:e}){e.listenTo(e.element,"submit",(t,n)=>{n.preventDefault(),e.fire("submit")},{useCapture:!0})}({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const e=this.locale.t,t=new Cm(this.locale,tg);return t.fieldView.inputMode="url",t.label=e("Link URL"),t}_createButton(e,t,n,i){const s=new Lf(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s.extendTemplate({attributes:{class:n}}),i&&s.delegate("execute").to(this,i),s}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e.manualDecorators){const i=new fm(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,e],"value",(e,t)=>void 0===t&&void 0===e?!!n.defaultValue:!!e),i.on("execute",()=>{n.set("value",!i.isOn)}),t.add(i)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new Vf;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}}
11)),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class U_ extends Vf{focusTracker=new sr;keystrokes=new lr;previewButtonView;unlinkButtonView;editButtonView;_focusables=new uf;_focusCycler;_linkConfig;constructor(e,t={}){super(e);const n=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(n("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(n("Edit link"),ld,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new jf({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n){const i=new Lf(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const e=new Lf(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0,tooltip:n("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&I_(e,this._linkConfig.allowedProtocols)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||n("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}const q_="link-ui";class K_ extends Bu{actionsView=null;formView=null;_balloon;static get requires(){return[Qg]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver(su),this._balloon=e.plugins.get(Qg),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:q_,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:q_,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const n=t.createUIElement("span");return t.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:R_},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new U_(e.locale,e.config.get("link")),n=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t()}),t.keystrokes.set(R_,(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),i=new(s=W_,class extends s{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...e){super(...e),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}})(e.locale,t,function(e){const t=e.t,n=e.config.get("link.allowCreatingEmptyLinks");return[e=>{if(!n&&!e.url.length)return t("Link URL must not be empty.")}]}(e));var s;return i.urlInputView.fieldView.bind("value").to(t,"value"),i.urlInputView.bind("isEnabled").to(t,"isEnabled"),i.saveButtonView.bind("isEnabled").to(t,"isEnabled"),this.listenTo(i,"submit",()=>{if(i.isValid()){const{value:t}=i.urlInputView.fieldView.element,s=V_(t,n);e.execute("link",s,i.getDecoratorSwitchesState()),this._closeFormView()}}),this.listenTo(i.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(i,"cancel",()=>{this._closeFormView()}),i.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),i}_createToolbarLinkButton(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const e=this._createButton(Lf);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add("menuBar:link",()=>{const e=this._createButton(rm);return e.set({role:"menuitemcheckbox"}),e})}_createButton(e){const t=this.editor,n=t.locale,i=t.commands.get("link"),s=new e(t.locale),o=n.t;return s.set({label:o("Link"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
11<path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',keystroke:R_,isToggleable:!0}),s.bind("isEnabled").to(i,"isEnabled"),s.bind("isOn").to(i,"value",e=>!!e),this.listenTo(s,"execute",()=>this._showUI(!0)),s}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(R_,(t,n)=>{n(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Bf({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let n=this._getSelectedLinkElement(),i=o();const s=()=>{const e=this._getSelectedLinkElement(),t=o();n&&!e||!n&&t!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=e,i=t};function o(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",s),this.listenTo(this._balloon,"change:visibleView",s)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,n=e.document;let i;if(t.markers.has(q_)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(q_)),n=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));i=e.domConverter.viewRangeToDom(n)}else i=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,n=t.getSelectedElement();if(t.isCollapsed||n&&yw(n))return G_(t.getFirstPosition());{const n=t.getFirstRange().getTrimmed(),i=G_(n.start),s=G_(n.end);return i&&i==s&&e.createRangeIn(i).getTrimmed().isEqual(n)?i:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const n=e.document.selection.getFirstRange();if(e.markers.has(q_))t.updateMarker(q_,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:n});t.addMarker(q_,{usingOperation:!1,affectsData:!1,range:t.createRange(i,n.end)})}else t.addMarker(q_,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(q_)&&e.change(e=>{e.removeMarker(q_)})}}function G_(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})||null}const J_=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class Z_ extends Bu{static get requires(){return[Tp,H_]}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(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?Np(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const n=this.editor.model,i=n.document.selection,s=i.getFirstPosition(),o=i.getLastPosition();let r=t.getJoined(this._expandLinkRange(n,s)||t);r&&(r=r.getJoined(this._expandLinkRange(n,o)||t)),r&&(r.start.isBefore(s)||r.end.isAfter(o
11))&&e.setSelection(r)}_enablePasteLinking(){const e=this.editor,t=e.model,n=t.document.selection,i=e.plugins.get("ClipboardPipeline"),s=e.commands.get("link");i.on("inputTransformation",(e,i)=>{if(!this.isEnabled||!s.isEnabled||n.isCollapsed||"paste"!==i.method)return;if(n.rangeCount>1)return;const o=n.getFirstRange(),r=i.dataTransfer.getData("text/plain");if(!r)return;const a=r.match(J_);a&&a[2]===r&&(t.change(e=>{this._selectEntireLinks(e,o),s.execute(r)}),e.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new Sp(e.model,e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=Q_(e.substr(0,e.length-1));return t?{url:t}:void 0});t.on("matched:data",(t,n)=>{const{batch:i,range:s,url:o}=n;if(!i.isTyping)return;const r=s.end.getShiftedBy(-1),a=r.getShiftedBy(-o.length),l=e.model.createRange(a,r);this._applyAutoLink(o,l)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("enter");n&&n.on("execute",()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const n=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("shiftEnter");n&&n.on("execute",()=>{const e=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:n,range:i}=Pp(e,t),s=Q_(n);if(s){const e=t.createRange(i.end.getShiftedBy(-s.length),i.end);this._applyAutoLink(s,e)}}_applyAutoLink(e,t){const n=this.editor.model,i=V_(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,n)&&B_(i)&&!function(e){const t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(i,t)}_persistAutoLink(e,t){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange(s=>{s.setAttribute("linkHref",e,t),n.enqueueChange(()=>{i.requestUndoOnBackspace()})})}}function Q_(e){const t=J_.exec(e);return t?t[2]:null}class Y_ extends Bu{static get requires(){return[H_,K_,Z_]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}}class X_{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward="forward"==t.direction,this._includeSelf=!!t.includeSelf,this._sameAttributes=Xo(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){return ir(new this(e,t)[Symbol.iterator]())}*[Symbol.iterator](){const e=[];for(const{node:t}of ey(this._getStartNode(),this._isForward?"forward":"backward")){const n=t.getAttribute("listIndent");if(n<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=n}else if(n>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some(e=>t.getAttribute(e)!==this._startElement.getAttribute(e)))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*ey(e,t="forward"){const n="forward"==t,i=[];let s=null;for(;iy(e);){let t=null;if(s){const n=e.getAttribute("listIndent"),o=s.getAttribute("listIndent");n>o?i[o]=s:n<o?(t=i[n],i.length=n):t=s}yield{node:e,previous:s,previousNodeInList:t},s=e,e=n?e.nextSibling:e.previousSibling}}class ty{_listHead;constructor(e){this._listHead=e}[Symbol.iterator](){return ey(this._listHead,"forward")}}class ny{ 12/* istanbul ignore next: static function definition -- @preserve */ 13static next(){return gs()}}function iy(e){return!!e&&e.is("element")&&e.hasAttribute("listItemId")}function sy(e,t={}){return[...oy(e,{...t,direction:"backward"}),...oy(e,{...t,direction:"forward"})]}function oy(e,t={}){const n="forward"==t.direction,i=Array.from(new X_(e,{...t,includeSelf:n,sameIndent:!0,sameAttributes:"listItemId"}));return n?i:i.reverse()}function ry(e,t){const n=new X_(e,{sameIndent:!0,sameAttributes:"listType",...t}),i=new X_(e,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(n).reverse(),...i]}function ay(e){return!X_.first(e,{sameIndent:!0,sameAttributes:"listItemId"})}function ly(e){return!X_.first(e,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function cy(e,t={}){e=Xo(e);const n=!1!==t.withNested,i=new Set;for(const s of e)for(const e of sy(s,{higherIndent:n}))i.add(e);return gy(i)}function hy(e,t){const n=oy(e,{direction:"forward"}),i=ny.next();for(const s of n)t.setAttribute("listItemId",i,s);return n}
13function uy(e,t,n){const i={};for(const[o,r]of t.getAttributes())o.startsWith("list")&&(i[o]=r);const s=oy(e,{direction:"forward"});for(const o of s)n.setAttributes(i,o);return s}function dy(e,t,{expand:n,indentBy:i=1}={}){e=Xo(e);const s=n?cy(e):e;for(const o of s){const e=o.getAttribute("listIndent")+i;e<0?fy(o,t):t.setAttribute("listIndent",e,o)}return s}function fy(e,t){e=Xo(e);for(const n of e)n.is("element","listItem")&&t.rename(n,"paragraph");for(const n of e)for(const e of n.getAttributeKeys())e.startsWith("list")&&t.removeAttribute(e,n);return e}function my(e){if(!e.length)return!1;const t=e[0].getAttribute("listItemId");return!!t&&!e.some(e=>e.getAttribute("listItemId")!=t)}function gy(e){return Array.from(e).filter(e=>"$graveyard"!==e.root.rootName).sort((e,t)=>e.index-t.index)}function py(e){const t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function wy(e,t){return t.checkChild(e.parent,"listItem")&&t.checkChild(e,"$text")&&!t.isObject(e)}function by(e,t,n){return oy(t,{direction:"forward"}).pop().index>e.index?uy(e,t,n):[]}class _y extends Nu{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=yy(e.document.selection);e.change(e=>{const n=[];my(t)&&!ay(t[0])?("forward"==this._direction&&n.push(...dy(t,e)),n.push(...hy(t[0],e))):"forward"==this._direction?n.push(...dy(t,e,{expand:!0})):n.push(...function(e,t){const n=cy(e=Xo(e)),i=new Set,s=Math.min(...n.map(e=>e.getAttribute("listIndent"))),o=new Map;for(const r of n)o.set(r,X_.first(r,{lowerIndent:!0}));for(const r of n){if(i.has(r))continue;i.add(r);const e=r.getAttribute("listIndent")-1;if(e<0)fy(r,t);else{if(r.getAttribute("listIndent")==s){const e=by(r,o.get(r),t);for(const t of e)i.add(t);if(e.length)continue}t.setAttribute("listIndent",e,r)}}return gy(i)}(t,e));for(const t of n){if(!t.hasAttribute("listType"))continue;const n=X_.first(t,{sameIndent:!0});n&&e.setAttribute("listType",n.getAttribute("listType"),t)}this._fireAfterExecute(n)})}_fireAfterExecute(e){this.fire("afterExecute",gy(new Set(e)))}_checkEnabled(){let e=yy(this.editor.model.document.selection),t=e[0];if(!t)return!1;if("backward"==this._direction)return!0;if(my(e)&&!ay(e[0]))return!0;e=cy(e),t=e[0];const n=X_.first(t,{sameIndent:!0});return!!n&&n.getAttribute("listType")==t.getAttribute("listType")}}function yy(e){const t=Array.from(e.getSelectedBlocks()),n=t.findIndex(e=>!iy(e));return-1!=n&&(t.length=n),t}class vy extends Nu{type;_listWalkerOptions;constructor(e,t,n={}){super(e),this.type=t,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.document,i=py(t),s=Array.from(n.selection.getSelectedBlocks()).filter(e=>t.schema.checkAttribute(e,"listType")||wy(e,t.schema)),o=void 0!==e.forceValue?!e.forceValue:this.value;t.change(r=>{if(o){const e=s[s.length-1],t=oy(e,{direction:"forward"}),n=[];t.length>1&&n.push(...hy(t[1],r)),n.push(...fy(s,r)),n.push(...function(e,t){const n=[];let i=Number.POSITIVE_INFINITY;for(const{node:s}of ey(e.nextSibling,"forward")){const e=s.getAttribute("listIndent");if(0==e)break;e<i&&(i=e);const o=e-i;t.setAttribute("listIndent",o,s),n.push(s)}return n}(e,r)),this._fireAfterExecute(n)}else if((i||n.selection.isCollapsed)&&iy(s[0])){const t=ry(i||s[0],this._listWalkerOptions);for(const n of t)r.setAttributes({...e.additionalAttributes,listType:this.type},n);this._fireAfterExecute(t)}else{const n=[];for(const i of s)if(i.hasAttribute("listType"))for(const t of cy(i,{withNested:!1}))t.getAttribute("listType")!=this.type&&(r.setAttributes({...e.additionalAttributes,listType:this.type},t),n.push(t));else!i.is("element","listItem")&&wy(i,t.schema)&&r.rename(i,"listItem"),r.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:ny.next(),listType:this.type},i),n.push(i);this._fireAfterExecute(n)}})}_fireAfterExecute(e){this.fire("afterExecute",gy(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const n of t)if(n.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,n=e.document.selection,i=Array.from(n.getSelectedBlocks());if(!i.length)return!1;if(this.value)return!0;for(const s of i)if(t.checkAttribute(s,"listType")||wy(s,t))return!0;return!1}}class ky extends Nu{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,n=t.document.selection,i=[];t.change(s=>{const{firstElement:o,lastElement:r}=this._getMergeSubjectElements(n,e),a=o.getAttribute("listIndent")||0,l=r.getAttribute("listIndent"),c=r.getAttribute("listItemId");if(a!=l){const e=(h=r,Array.from(new X_(h,{direction:"forward",higherIndent:!0})));i.push(...dy([r,...e],s,{indentBy:a-l,expand:a<l}))}var h;if(e){let e=n;n.isCollapsed&&(e=s.createSelection(s.createRange(s.createPositionAt(o,"end"),s.createPositionAt(r,0)))),t.deleteContent(e,{doNotResetEntireContent:n.isCollapsed});const a=e.getLastPosition().parent,l=a.nextSibling;i.push(a),l&&l!==r&&l.getAttribute("listItemId")==c&&i.push(...uy(l,a,s))}else i.push(...uy(r,o,s));this._fireAfterExecute(i)})}_fireAfterExecute(e){this.fire("afterExecute",gy(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,n=py(e);if(t.isCollapsed||n){const e=n||t.getFirstPosition().parent;if(!iy(e))return!1;const i="backward"==this._direction?e.previousSibling:e.nextSibling;if(!i)return!1;if(my([e,i]))return!1}else{const e=t.getLastPosition(),n=t.getFirstPosition();if(e.parent===n.parent)return!1;if(!iy(e.parent))return!1}return!0}_getMergeSubjectElements(e,t){const n=py(this.editor.model);let i,s;if(e.isCollapsed||n){const o=n||e.getFirstPosition().parent,r=ay(o);"backward"==this._direction?(s=o,i=r&&!t?X_.first(o,{sameIndent:!0,lowerIndent:!0}):o.previousSibling):(i=o,s=o.nextSibling)}else i=e.getFirstPosition().parent,s=e.getLastPosition().parent;return{firstElement:i,lastElement:s}}}class Cy extends Nu{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(e=>{const t=hy(this._getStartBlock(),e);this._fireAfterExecute(t)})}_fireAfterExecute(e){this.fire("afterExecute",gy(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&iy(t)&&!ay(t)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?e:e.nextSibling}}class xy extends Bu{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(e){return function(e){e=Xo(e);const t=new Set;for(const n of e)for(const e of ry(n))t.add(e);return gy(t)}(e)}isFirstBlockOfListItem(e){return ay(e)}isListItemBlock(e){return iy(e)}expandListBlocksToCompleteItems(e,t={}){return cy(e,t)}isNumberedListType(e){return function(e){return"numbered"==e||"customNumbered"==e}(e)}}function Ay(e){return e.is("element","ol")||e.is("element","ul")}function Ty(e){return e.is("element","li")}function Ey(e,t,n,i=Ry(n,t)){return e.createAttributeElement(Sy(n),null,{priority:2*t/100-100,id:i})}function Py(e,t,n){return e.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:n})}function Sy(e){return"numbered"==e||"customNumbered"==e?"ol":"ul"}function Ry(e,t){return`list-${e}-${t}`}function Oy(e,t){const n=e.nodeBefore;if(iy(n)){let e=n;for(const{node:n}of ey(e,"backward"))if(e=n,t.has(e))return;t.set(n,e)}else{const n=e.nodeAfter;iy(n)&&t.set(n,n)}}function Iy(){return(e,t,n)=>{const{writer:i,schema:s}=n;if(!t.modelRange)return;const o=Array.from(t.modelRange.getItems({shallow:!0})).filter(e=>s.checkAttribute(e,"listItemId"));if(!o.length)return;const r=ny.next(),a=function(e){let t=0,n=e.parent;for(;n;){if(Ty(n))t++;else{const e=n.previousSibling;e&&Ty(e)&&t++}n=n.parent}return t}(t.viewItem);let l=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=o[0].getAttribute("listType");c&&(l=c);const h={listItemId:r,listIndent:a,listType:l};for(const u of o)u.hasAttribute("listItemId")||i.setAttributes(h,u);o.length>1&&o[1].getAttribute("listItemId")!=h.listItemId&&n.keepEmptyElement(o[
130])}}function My(e,t,n,{dataPipeline:i}={}){const s=function(e){return(t,n)=>{const i=[];for(const s of e)t.hasAttribute(s)&&i.push(`attribute:${s}`);return!!i.every(e=>!1!==n.test(t,e))&&(i.forEach(e=>n.consume(t,e)),!0)}}(e);return(o,r,a)=>{const{writer:l,mapper:c,consumable:h}=a,u=r.item;if(!e.includes(r.attributeKey))return;if(!s(u,h))return;const d=function(e,t,n){const i=n.createRangeOn(e),s=t.toViewRange(i).getTrimmed();return s.end.nodeBefore}(u,c,n);By(d,l,c),function(e,t){let n=e.parent;for(;n.is("attributeElement")&&["ul","ol","li"].includes(n.name);){const i=n.parent;t.unwrap(t.createRangeOn(e),n),n=i}}(d,l);const f=function(e,t,n,i,{dataPipeline:s}){let o=i.createRangeOn(t);if(!ay(e))return o;for(const r of n){if("itemMarker"!=r.scope)continue;const n=r.createElement(i,e,{dataPipeline:s});if(!n)continue;if(i.setCustomProperty("listItemMarker",!0,n),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(e)?i.insert(i.createPositionAt(t,0),n):(i.insert(o.start,n),o=i.createRange(i.createPositionBefore(n),i.createPositionAfter(t))),!r.createWrapperElement||!r.canWrapElement)continue;const a=r.createWrapperElement(i,e,{dataPipeline:s});i.setCustomProperty("listItemWrapper",!0,a),r.canWrapElement(e)?o=i.wrap(o,a):(o=i.wrap(i.createRangeOn(n),a),o=i.createRange(o.start,i.createPositionAfter(t)))}return o}(u,d,t,l,{dataPipeline:i});!function(e,t,n,i){if(!e.hasAttribute("listIndent"))return;const s=e.getAttribute("listIndent");let o=e;for(let r=s;r>=0;r--){const e=Py(i,r,o.getAttribute("listItemId")),s=Ey(i,r,o.getAttribute("listType"));for(const t of n)"list"!=t.scope&&"item"!=t.scope||!o.hasAttribute(t.attributeName)||t.setAttributeOnDowncast(i,o.getAttribute(t.attributeName),"list"==t.scope?s:e);if(t=i.wrap(t,e),t=i.wrap(t,s),0==r)break;if(o=X_.first(o,{lowerIndent:!0}),!o)break}}(u,f,t,l)}}function Vy(e,{dataPipeline:t}={}){return(n,{writer:i})=>{if(!Dy(n,e))return null;if(!t)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function By(e,t,n){for(;e.parent.is("attributeElement")&&e.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(e),e.parent);const i=[];s(t.createPositionBefore(e).getWalker({direction:"backward"})),s(t.createRangeIn(e).getWalker());for(const o of i)t.remove(o);function s(e){for(const{item:t}of e){if(t.is("element")&&n.toModelElement(t))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&i.push(t)}}}function Dy(e,t,n=sy(e)){if(!iy(e))return!1;for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&!t.includes(i))return!1;return n.length<2}const Ny=["listType","listIndent","listItemId"];class Fy extends Bu{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[nw,Tp,xy,Uw]}constructor(e){super(e),e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,n=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new bs("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:Ny}),n?(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 i of Ny)t.schema.setAttributeProperties(i,{copyOnReplace:!0});e.commands.add("numberedList",new vy(e,"numbered")),e.commands.add("bulletedList",new vy(e,"bulleted")),e.commands.add("customNumberedList",new vy(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new vy(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new _y(e,"forward")),e.commands.add("outdentList",new _y(e,"backward")),e.commands.add("splitListItemBefore",new Cy(e,"before")),e.commands.add("splitListItemAfter",new Cy(e,"after")),n&&(e.commands.add("mergeListItemBackward",new ky(e,"backward")),e.commands.add("mergeListItemForward",new ky(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const e=this.editor.commands,t=e.get("indent"),n=e.get("outdent");t&&t.registerChildCommand(e.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...Ny,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),n=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(i,s)=>{const o=e.model.document.selection;py(e.model)||e.model.change(()=>{const r=o.getFirstPosition();if(o.isCollapsed&&"backward"==s.direction){if(!r.isAtStart)return;const n=r.parent;if(!iy(n))return;if(X_.first(n,{sameAttributes:"listType",sameIndent:!0})||0!==n.getAttribute("listIndent")){if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:Ly(e.model,"backward")})}else ly(n)||e.execute("splitListItemAfter"),e.execute("outdentList");s.preventDefault(),i.stop()}else{if(o.isCollapsed&&!o.getLastPosition().isAtEnd)return;if(!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:Ly(e.model,"forward")}),s.preventDefault(),i.stop()}})},{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,n=e.commands,i=n.get("enter");this.listenTo(e.editing.view.document,"enter",(n,i)=>{const s=t.document,o=s.selection.getFirstPosition().parent;if(s.selection.isCollapsed&&iy(o)&&o.isEmpty&&!i.isSoft){const t=ay(o),s=ly(o);t&&s?(e.execute("outdentList"),i.preventDefault(),n.stop()):t&&!s?(e.execute("splitListItemAfter"),i.preventDefault(),n.stop()):s&&(e.execute("splitListItemBefore"),i.preventDefault(),n.stop())}},{context:"li"}),this.listenTo(i,"afterExecute",()=>{const t=n.get("splitListItemBefore");if(t.refresh(),!t.isEnabled)return;2===sy(e.model.document.selection.getLastPosition().parent).length&&t.execute()})}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,n)=>{const i=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(i).isEnabled&&(e.execute(i),n.stopPropagation(),n.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,n=this.getListAttributeNames(),i=e.config.get("list.multiBlock"),s=i?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(e,{writer
13:t})=>t.createElement(s,{listType:""})}).elementToElement({view:"p",model:(e,{writer:t})=>e.parent&&e.parent.is("element","li")?t.createElement(s,{listType:""}):null,converterPriority:"high"}).add(e=>{e.on("element:li",Iy())}),i||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:s,view:Vy(n),converterPriority:"high"}).add(e=>{var i;e.on("attribute",My(n,this._downcastStrategies,t)),e.on("remove",(i=t.schema,(e,t,n)=>{const{writer:s,mapper:o}=n,r=e.name.split(":")[1];if(!i.checkAttribute(r,"listItemId"))return;const a=o.toViewPosition(t.position),l=t.position.getShiftedBy(t.length),c=o.toViewPosition(l,{isPhantom:!0}),h=s.createRange(a,c).getTrimmed().end.nodeBefore;h&&By(h,s,o)}))}),e.conversion.for("dataDowncast").elementToElement({model:s,view:Vy(n,{dataPipeline:!0}),converterPriority:"high"}).add(e=>{e.on("attribute",My(n,this._downcastStrategies,t,{dataPipeline:!0}))});const o=(r=this._downcastStrategies,a=e.editing.view,(e,t)=>{if(t.modelPosition.offset>0)return;const n=t.modelPosition.parent;if(!iy(n))return;if(!r.some(e=>"itemMarker"==e.scope&&e.canInjectMarkerIntoElement&&e.canInjectMarkerIntoElement(n)))return;const i=t.mapper.toViewElement(n),s=a.createRangeIn(i),o=s.getWalker();let l=s.start;for(const{item:r}of o){if(r.is("element")&&t.mapper.toModelElement(r)||r.is("$textProxy"))break;r.is("element")&&r.getCustomProperty("listItemMarker")&&(l=a.createPositionAfter(r),o.skip(({previousPosition:e})=>!e.isEqual(l)))}t.viewPosition=l});var r,a;e.editing.mapper.on("modelToViewPosition",o),e.data.mapper.on("modelToViewPosition",o),this.listenTo(t.document,"change:data",function(e,t,n,i){return()=>{const i=e.document.differ.getChanges(),r=[],a=new Map,l=new Set;for(const e of i)if("insert"==e.type&&"$text"!=e.name)Oy(e.position,a),e.attributes.has("listItemId")?l.add(e.position.nodeAfter):Oy(e.position.getShiftedBy(e.length),a);else if("remove"==e.type&&e.attributes.has("listItemId"))Oy(e.position,a);else if("attribute"==e.type){const t=e.range.start.nodeAfter;n.includes(e.attributeKey)?(Oy(e.range.start,a),null===e.attributeNewValue?(Oy(e.range.start.getShiftedBy(1),a),o(t)&&r.push(t)):l.add(t)):iy(t)&&o(t)&&r.push(t)}for(const e of a.values())r.push(...s(e,l));for(const e of new Set(r))t.reconvertItem(e)};function s(e,t){const i=[],s=new Set,a=[];for(const{node:l,previous:c}of ey(e,"forward")){if(s.has(l))continue;const e=l.getAttribute("listIndent");c&&e<c.getAttribute("listIndent")&&(a.length=e+1),a[e]=Object.fromEntries(Array.from(l.getAttributes()).filter(([e])=>n.includes(e)));const h=oy(l,{direction:"forward"});for(const n of h)s.add(n),(o(n,h)||r(n,a,t))&&i.push(n)}return i}function o(e,s){const o=t.mapper.toViewElement(e);if(!o)return!1;if(i.fire("checkElement",{modelElement:e,viewElement:o}))return!0;if(!e.is("element","paragraph")&&!e.is("element","listItem"))return!1;const r=Dy(e,n,s);return!(!r||!o.is("element","p"))||!(r||!o.is("element","span"))}function r(e,n,s){if(s.has(e))return!1;const o=t.mapper.toViewElement(e);let r=n.length-1;for(let t=o.parent;!t.is("editableElement");t=t.parent){const e=Ty(t),s=Ay(t);if(!s&&!e)continue;const o="checkAttributes:"+(e?"item":"list");if(i.fire(o,{viewElement:t,modelAttributes:n[r]}))break;if(s&&(r--,r<0))return!1}return!0}}(t,e.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",(e,{viewElement:t,modelAttributes:n})=>{t.id!=n.listItemId&&(e.return=!0,e.stop())}),this.on("checkAttributes:list",(e,{viewElement:t,modelAttributes:n})=>{t.name==Sy(n.listType)&&t.id==Ry(n.listType,n.listIndent)||(e.return=!0,e.stop())})}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(n=>function(e,t,n,i){const s=e.document.differ.getChanges(),o=new Map,r=i.editor.config.get("list.multiBlock");let a=!1;for(const c of s){if("insert"==c.type&&"$text"!=c.name){const i=c.position.nodeAfter;if(!e.schema.checkAttribute(i,"listItemId"))for(const e of Array.from(i.getAttributeKeys()))n.includes(e)&&(t.removeAttribute(e,i),a=!0);Oy(c.position,o),c.attributes.has("listItemId")||Oy(c.position.getShiftedBy(c.length),o);for(const{item:t,previousPosition:n}of e.createRangeIn(i))iy(t)&&Oy(n,o)}else"remove"==c.type?Oy(c.position,o):"attribute"==c.type&&n.includes(c.attributeKey)&&
13(Oy(c.range.start,o),null===c.attributeNewValue&&Oy(c.range.start.getShiftedBy(1),o));if(!r&&"attribute"==c.type&&Ny.includes(c.attributeKey)){const e=c.range.start.nodeAfter;null===c.attributeNewValue&&e&&e.is("element","listItem")?(t.rename(e,"paragraph"),a=!0):null===c.attributeOldValue&&e&&e.is("element")&&"listItem"!=e.name&&(t.rename(e,"listItem"),a=!0)}}const l=new Set;for(const c of o.values())a=i.fire("postFixer",{listNodes:new ty(c),listHead:c,writer:t,seenIds:l})||a;return a}(e,n,t,this)),this.on("postFixer",(e,{listNodes:t,writer:n})=>{e.return=function(e,t){let n=0,i=-1,s=null,o=!1;for(const{node:r}of e){const e=r.getAttribute("listIndent");if(e>n){let a;null===s?(s=e-n,a=n):(s>e&&(s=e),a=e-s),a>i+1&&(a=i+1),t.setAttribute("listIndent",a,r),o=!0,i=a}else s=null,n=e+1,i=e}return o}(t,n)||e.return},{priority:"high"}),this.on("postFixer",(e,{listNodes:t,writer:n,seenIds:i})=>{e.return=function(e,t,n){const i=new Set;let s=!1;for(const{node:o}of e){if(i.has(o))continue;let e=o.getAttribute("listType"),r=o.getAttribute("listItemId");if(t.has(r)&&(r=ny.next()),t.add(r),o.is("element","listItem"))o.getAttribute("listItemId")!=r&&(n.setAttribute("listItemId",r,o),s=!0);else for(const t of oy(o,{direction:"forward"}))i.add(t),t.getAttribute("listType")!=e&&(r=ny.next(),e=t.getAttribute("listType")),t.getAttribute("listItemId")!=r&&(n.setAttribute("listItemId",r,t),s=!0)}return s}(t,i,n)||e.return},{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",function(e){return(t,[n,i])=>{const s=n.is("documentFragment")?Array.from(n.getChildren()):[n];if(!s.length)return;const o=(i?e.createSelection(i):e.document.selection).getFirstPosition();let r;if(iy(o.parent))r=o.parent;else{if(!iy(o.nodeBefore))return;r=o.nodeBefore}e.change(e=>{const t=r.getAttribute("listType"),n=r.getAttribute("listIndent"),i=s[0].getAttribute("listIndent")||0,o=Math.max(n-i,0);for(const a of s){const n=iy(a);r.is("element","listItem")&&a.is("element","paragraph")&&e.rename(a,"listItem"),e.setAttributes({listIndent:(n?a.getAttribute("listIndent"):0)+o,listItemId:n?a.getAttribute("listItemId"):ny.next(),listType:t},a)}})}}(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(t,n)=>{e.change(e=>{const t=Array.from(n.content.getChildren()),i=t[t.length-1];if(t.length>1&&i.is("element")&&i.isEmpty){t.slice(0,-1).every(iy)&&e.remove(i)}if("copy"==n.method||"cut"==n.method){const t=Array.from(n.content.getChildren());my(t)&&fy(t,e)}})})}_setupAccessibilityIntegration(){const e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function Ly(e,t){const n=e.document.selection;if(!n.isCollapsed)return!py(e);if("forward"===t)return!0;const i=n.getFirstPosition().parent,s=i.previousSibling;return!e.schema.isObject(s)&&(!!s.isEmpty||my([i,s]))}function $y(e,t,n,i){e.ui.componentFactory.add(t,()=>{const s=zy(Lf,e,t,n,i);return s.set({tooltip:!0,isToggleable:!0}),s}),e.ui.componentFactory.add(`menuBar:${t}`,()=>{const s=zy(rm,e,t,n,i);return s.set({role:"menuitemcheckbox",isToggleable:!0}),s})}function zy(e,t,n,i,s){const o=t.commands.get(n),r=new e(t.locale);return r.set({label:i,icon:s}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{t.execute(n),t.editing.view.focus()}),r}class jy extends Bu{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||$y(this.editor,"numberedList",e("Numbered List"),pd),this.editor.ui.componentFactory.has("bulletedList")||$y(this.editor,"bulletedList",e("Bulleted List"),gd)}}class Hy extends Bu{static get requires(){return[Fy,jy]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}}const Wy=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:_C,typeAttribute:yC,listType:vC}of Wy);function Uy(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let qy={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const Ky=/[&<>"']/,Gy=/[&<>"']/g,Jy=/[<>"']|&(?!#?\w+;)/,Zy=/[<>"']|&(?!#?\w+;)/g,Qy={"&":"&","<":"<",">":">",'"':""","'":"'"},Yy=e=>Qy[e];function Xy(e,t){if(t){if(Ky.test(e))return e.replace(Gy,Yy)}else if(Jy.test(e))return e.replace(Zy,Yy);return e}const ev=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function tv(e){return e.replace(ev,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")}const nv=/(^|[^\[])\^/g;function iv(e,t){e=e.source||e,t=t||"";const n={replace:(t,i)=>(i=(i=i.source||i).replace(nv,"$1"),e=e.replace(t,i),n),getRegex:()=>new RegExp(e,t)};return n}
13const sv=/[^\w:]/g,ov=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function rv(e,t,n){if(e){let e;try{e=decodeURIComponent(tv(n)).replace(sv,"").toLowerCase()}catch(bC){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!ov.test(n)&&(n=function(e,t){av[" "+e]||(lv.test(e)?av[" "+e]=e+"/":av[" "+e]=mv(e,"/",!0));e=av[" "+e];const n=-1===e.indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(cv,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(hv,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(bC){return null}return n}const av={},lv=/^[^:]+:\/*[^/]*$/,cv=/^([^:]+:)[\s\S]*$/,hv=/^([^:]+:\/*[^/]*)[\s\S]*$/;const uv={exec:function(){}};function dv(e){let t,n,i=1;for(;i<arguments.length;i++)for(n in t=arguments[i],t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function fv(e,t){const n=e.replace(/\|/g,(e,t,n)=>{let i=!1,s=t;for(;--s>=0&&"\\"===n[s];)i=!i;return i?"|":" |"}).split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function mv(e,t,n){const i=e.length;if(0===i)return"";let s=0;for(;s<i;){const o=e.charAt(i-s-1);if(o!==t||n){if(o===t||!n)break;s++}else s++}return e.substr(0,i-s)}function gv(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function pv(e,t){if(t<1)return"";let n="";for(;t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function wv(e,t,n,i){const s=t.href,o=t.title?Xy(t.title):null,r=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){i.state.inLink=!0;const e={type:"link",raw:n,href:s,title:o,text:r,tokens:i.inlineTokens(r,[])};return i.state.inLink=!1,e}return{type:"image",raw:n,href:s,title:o,text:Xy(r)}}class bv{constructor(e){this.options=e||qy}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:mv(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const i=n[1];return t.split("\n").map(e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e}).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim():t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=mv(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}const n={type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(e,[]),text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,i,s,o,r,a,l,c,h,u,d,f,m=t[1].trim();const g=m.length>1,p={type:"list",raw:"",ordered:g,start:g?+m.slice(0,-1):"",loose:!1,items:[]};m=g?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=g?m:"[*+-]");const w=new RegExp(`^( {0,3}${m})((?: [^\\n]*)?(?:\\n|$))`);for(;e&&(f=!1,t=w.exec(e))&&!this.rules.block.hr.test(e);){if(n=t[0],e=e.substring(n.length),c=t[2].split("\n",1)[0],h=e.split("\n",1)[0],this.options.pedantic?(o=2,d=c.trimLeft()):(o=t[2].search(/[^ ]/),o=o>4?1:o,d=c.slice(o),o+=t[1].length),a=!1,!c&&/^ *$/.test(h)&&(n+=h+"\n",e=e.substring(h.length+1),f=!0),!f){const t=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(;e&&(u=e.split("\n",1)[0],c=u,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!t.test(c));){if(c.search(/[^ ]/)>=o||!c.trim())d+="\n"+c.slice(o);else{if(a)break;d+="\n"+c}a||c.trim()||(a=!0),n+=u+"\n",e=e.substring(u.length+1)}}p.loose||(l?p.loose=!0:/\n *\n *$/.test(n)&&(l=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(d),i&&(s="[ ] "!==i[0],d=d.replace(/^\[[ xX]\] +/,""))),p.items.push({type:"list_item",raw:n,task:!!i,checked:s,loose:!1,text:d}),p.raw+=n}p.items[p.items.length-1].raw=n.trimRight(),p.items[p.items.length-1].text=d.trimRight(),p.raw=p.raw.trimRight();const b=p.items.length;for(r=0;r<b;r++){this.lexer.state.top=!1,p.items[r].tokens=this.lexer.blockTokens(p.items[r].text,[]);const e=p.items[r].tokens.filter(e=>
13"space"===e.type),t=e.every(e=>{const t=e.raw.split("");let n=0;for(const i of t)if("\n"===i&&(n+=1),n>1)return!0;return!1});!p.loose&&e.length&&t&&(p.loose=!0,p.items[r].loose=!0)}return p}}html(e){const t=this.rules.block.html.exec(e);if(t){const e={type:"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};return this.options.sanitize&&(e.type="paragraph",e.text=this.options.sanitizer?this.options.sanitizer(t[0]):Xy(t[0]),e.tokens=[],this.lexer.inline(e.text,e.tokens)),e}}def(e){const t=this.rules.block.def.exec(e);if(t){t[3]&&(t[3]=t[3].substring(1,t[3].length-1));return{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:fv(t[1]).map(e=>({text:e})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let n,i,s,o,r=e.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(e.align[n])?e.align[n]="right":/^ *:-+: *$/.test(e.align[n])?e.align[n]="center":/^ *:-+ *$/.test(e.align[n])?e.align[n]="left":e.align[n]=null;for(r=e.rows.length,n=0;n<r;n++)e.rows[n]=fv(e.rows[n],e.header.length).map(e=>({text:e}));for(r=e.header.length,i=0;i<r;i++)e.header[i].tokens=[],this.lexer.inlineTokens(e.header[i].text,e.header[i].tokens);for(r=e.rows.length,i=0;i<r;i++)for(o=e.rows[i],s=0;s<o.length;s++)o[s].tokens=[],this.lexer.inlineTokens(o[s].text,o[s].tokens);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t){const e={type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e={type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}text(e){const t=this.rules.block.text.exec(e);if(t){const e={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Xy(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):Xy(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=mv(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let i=0,s=0;for(;s<n;s++)if("\\"===e[s])s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),wv(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:i?i.replace(this.rules.inline._escapes,"$1"):i},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e||!e.href){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return wv(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i)return;if(i[3]&&n.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(""===n||this.rules.inline.punctuation.exec(n))){const n=i[0].length-1;let s,o,r=n,a=0;const l="*"===i[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(i=l.exec(t));){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(o=s.length,i[3]||i[4]){r+=o;continue}if((i[5]||i[6])&&n%3&&!((n+o)%3)){a+=o;continue}if(r-=o,r>0)continue;if(o=Math.min(o,o+r+a),Math.min(n,o)%2){const t=e.slice(1,n+i.index+o);return{type:"em",raw:e.slice(0,n+i.index+o+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}const t=e.slice(2,n+i.index+o-1);return{type:"strong",raw:e.slice(0,n+i.index+o+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return n&&i&&(e=e.substring(1,e.length-1)),e=Xy(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,i;return"@"===n[2]?(e=Xy(this.options.mangle?t(n[1]):n[1]),i="mailto:"+e):(e=Xy(n[1]),i=e),{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,i;if("@"===n[2])e=Xy(this.options.mangle?t(n[0]):n[0]),i="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=Xy(n[0]),i="www."===n[1]?"http://"+e:e}return{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Xy(n[0]):n[0]:Xy(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const _v={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>
13)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:uv,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};_v.def=iv(_v.def).replace("label",_v._label).replace("title",_v._title).getRegex(),_v.bullet=/(?:[*+-]|\d{1,9}[.)])/,_v.listItemStart=iv(/^( *)(bull) */).replace("bull",_v.bullet).getRegex(),_v.list=iv(_v.list).replace(/bull/g,_v.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+_v.def.source+")").getRegex(),_v._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_v._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,_v.html=iv(_v.html,"i").replace("comment",_v._comment).replace("tag",_v._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_v.paragraph=iv(_v._paragraph).replace("hr",_v.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_v._tag).getRegex(),_v.blockquote=iv(_v.blockquote).replace("paragraph",_v.paragraph).getRegex(),_v.normal=dv({},_v),_v.gfm=dv({},_v.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),_v.gfm.table=iv(_v.gfm.table).replace("hr",_v.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_v._tag).getRegex(),_v.gfm.paragraph=iv(_v._paragraph).replace("hr",_v.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",_v.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_v._tag).getRegex(),_v.pedantic=dv({},_v.normal,{html:iv("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",_v._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:uv,paragraph:iv(_v.normal._paragraph).replace("hr",_v.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",_v.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const yv={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:uv,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:uv,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function vv(e){return e.replace(/---/g,"â").replace(/--/g,"â").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1â").replace(/'/g,"â").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1â").replace(/"/g,"â").replace(/\.{3}/g,"â¦")}function kv(e){let t,n,i="";const s=e.length;for(t=0;t<s;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),i+="&#"+n+";";return i}yv._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}
13~",yv.punctuation=iv(yv.punctuation).replace(/punctuation/g,yv._punctuation).getRegex(),yv.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,yv.escapedEmSt=/\\\*|\\_/g,yv._comment=iv(_v._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),yv.emStrong.lDelim=iv(yv.emStrong.lDelim).replace(/punct/g,yv._punctuation).getRegex(),yv.emStrong.rDelimAst=iv(yv.emStrong.rDelimAst,"g").replace(/punct/g,yv._punctuation).getRegex(),yv.emStrong.rDelimUnd=iv(yv.emStrong.rDelimUnd,"g").replace(/punct/g,yv._punctuation).getRegex(),yv._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,yv._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,yv._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,yv.autolink=iv(yv.autolink).replace("scheme",yv._scheme).replace("email",yv._email).getRegex(),yv._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,yv.tag=iv(yv.tag).replace("comment",yv._comment).replace("attribute",yv._attribute).getRegex(),yv._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,yv._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,yv._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,yv.link=iv(yv.link).replace("label",yv._label).replace("href",yv._href).replace("title",yv._title).getRegex(),yv.reflink=iv(yv.reflink).replace("label",yv._label).replace("ref",_v._label).getRegex(),yv.nolink=iv(yv.nolink).replace("ref",_v._label).getRegex(),yv.reflinkSearch=iv(yv.reflinkSearch,"g").replace("reflink",yv.reflink).replace("nolink",yv.nolink).getRegex(),yv.normal=dv({},yv),yv.pedantic=dv({},yv.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:iv(/^!?\[(label)\]\((.*?)\)/).replace("label",yv._label).getRegex(),reflink:iv(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",yv._label).getRegex()}),yv.gfm=dv({},yv.normal,{escape:iv(yv.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),yv.gfm.url=iv(yv.gfm.url,"i").replace("email",yv.gfm._extended_email).getRegex(),yv.breaks=dv({},yv.gfm,{br:iv(yv.br).replace("{2,}","*").getRegex(),text:iv(yv.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});class Cv{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||qy,this.options.tokenizer=this.options.tokenizer||new bv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:_v.normal,inline:yv.normal};this.options.pedantic?(t.block=_v.pedantic,t.inline=yv.pedantic):this.options.gfm&&(t.block=_v.gfm,this.options.breaks?t.inline=yv.breaks:t.inline=yv.gfm),this.tokenizer.rules=t}static get rules(){return{block:_v,inline:yv}}static lex(e,t){return new Cv(t).lex(e)}static lexInline(e,t){return new Cv(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,i,s,o;for(this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(s=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startBlock.forEach(function(e){i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))i=t[t.length-1],o&&"paragraph"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),o=s.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t){this.inlineQueue.push({src:e,tokens:t})}inlineTokens(e,t=[]){let n,i,s,o,r,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+pv("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,o.index)+"["+pv("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.escapedEmSt.exec(l));)l=l.slice(0,o.index)+"++"+l.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(r||(a=""),r=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,kv))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,kv))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startInline.forEach(function(e){i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s,vv))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),r
13=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class xv{constructor(e){this.options=e||qy}code(e,t,n){const i=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,i);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="'+this.options.langPrefix+Xy(i,!0)+'">'+(n?e:Xy(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Xy(e,!0))+"</code></pre>\n"}blockquote(e){return"<blockquote>\n"+e+"</blockquote>\n"}html(e){return e}heading(e,t,n,i){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+i.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}hr(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}list(e,t,n){const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+i+">\n"}listitem(e){return"<li>"+e+"</li>\n"}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return"<p>"+e+"</p>\n"}table(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return"<tr>\n"+e+"</tr>\n"}tablecell(e,t){const n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,t,n){if(null===(e=rv(this.options.sanitize,this.options.baseUrl,e)))return n;let i='<a href="'+Xy(e)+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>",i}image(e,t,n){if(null===(e=rv(this.options.sanitize,this.options.baseUrl,e)))return n;let i='<img src="'+e+'" alt="'+n+'"';return t&&(i+=' title="'+t+'"'),i+=this.options.xhtml?"/>":">",i}text(e){return e}}class Av{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Tv{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do{i++,n=e+"-"+i}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class Ev{constructor(e){this.options=e||qy,this.options.renderer=this.options.renderer||new xv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Av,this.slugger=new Tv}static parse(e,t){return new Ev(t).parse(e)}static parseInline(e,t){return new Ev(t).parseInline(e)}parse(e,t=!0){let n,i,s,o,r,a,l,c,h,u,d,f,m,g,p,w,b,_,y,v="";const k=e.length;for(n=0;n<k;n++)if(u=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[u.type]&&(y=this.options.extensions.renderers[u.type].call({parser:this},u),!1!==y||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)))v+=y||"";else switch(u.type){case"space":continue;case"hr":v+=this.renderer.hr();continue;case"heading":v+=this.renderer.heading(this.parseInline(u.tokens),u.depth,tv(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue;case"code":v+=this.renderer.code(u.text,u.lang,u.escaped);continue;case"table":for(c="",l="",o=u.header.length,i=0;i<o;i++)l+=this.renderer.tablecell(this.parseInline(u.header[i].tokens),{header:!0,align:u.align[i]});for(c+=this.renderer.tablerow(l),h="",o=u.rows.length,i=0;i<o;i++){for(a=u.rows[i],l="",r=a.length,s=0;s<r;s++)l+=this.renderer.tablecell(this.parseInline(a[s].tokens),{header:!1,align:u.align[s]});h+=this.renderer.tablerow(l)}v+=this.renderer.table(c,h);continue;case"blockquote":h=this.parse(u.tokens),v+=this.renderer.blockquote(h);continue;case"list":for(d=u.ordered,f=u.start,m=u.loose,o=u.items.length,h="",i=0;i<o;i++)p=u.items[i],w=p.checked,b=p.task,g="",p.task&&(_=this.renderer.checkbox(w),m?p.tokens.length>0&&"paragraph"===p.tokens[0].type?(p.tokens[0].text=_+" "+p.tokens[0].text,p.tokens[0].tokens&&p.tokens[0].tokens.length>0&&"text"===p.tokens[0].tokens[0].type&&(p.tokens[0].tokens[0].text=_+" "+p.tokens[0].tokens[0].text)):p.tokens.unshift({type:"text",text:_}):g+=_),g+=this.parse(p.tokens,m),h+=this.renderer.listitem(g,b,w);v+=this.renderer.list(h,d,f);continue;case"html":v+=this.renderer.html(u.text);continue;case"paragraph":v+=this.renderer.paragraph(this.parseInline(u.tokens));continue;case"text":for(h=u.tokens?this.parseInline(u.tokens):u.text;n+1<k&&"text"===e[n+1].type;)u=e[++n],h+="\n"+(u.tokens?this.parseInline(u.tokens):u.text);v+=t?this.renderer.paragraph(h):h;continue;default:{const e='Token with "'+u.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return v}parseInline(e,t){t=t||this.renderer;let n,i,s,o="";const r=e.length;for(n=0;n<r;n++)if(i=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]&&(s=this.options.extensions.renderers[i.type].call({parser:this},i),!1!==s||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)))o+=s||"";else switch(i.type){case"escape":case"text":o+=t.text(i.text);break;case"html":o+=t.html(i.text);break;case"link":o+=t.link(i.href,i.title,this.parseInline(i.tokens,t));break;case"image":o+=t.image(i.href,i.title,i.text);break;case"strong":o+=t.strong(this.parseInline(i.tokens,t));break;case"em":o+=t.em(this.parseInline(i.tokens,t));break;case"codespan":o+=t.codespan(i.text);break;case"br":o+=t.br();break;case"del":o+=t.del(this.parseInline(i.tokens,t));break;default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return o}}function Pv(e,t,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(n=t,t=null),gv(t=dv({},Pv.defaults,t||{})),n){const i=t.highlight;let s;try{s=Cv.lex(e,t)}catch(bC){return n(bC)}const o=function(e){let o;if(!e)try{t.walkTokens&&Pv.walkTokens(s,t.walkTokens),o=Ev.parse(s,t)}catch(bC){e=bC}return t.highlight=i,e?n(e):n(null,o)};if(!i||i.length<3)return o();if(delete t.highlight,!s.length)return o();let r=0;return Pv.walkTokens(s,function(e){"code"===e.type&&(r++,setTimeout(()=>{i(e.text,e.lang,function(t,n){if(t)return o(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),r--,0===r&&o()})}
13,0))}),void(0===r&&o())}try{const n=Cv.lex(e,t);return t.walkTokens&&Pv.walkTokens(n,t.walkTokens),Ev.parse(n,t)}catch(bC){if(bC.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+Xy(bC.message+"",!0)+"</pre>";throw bC}}Pv.options=Pv.setOptions=function(e){var t;return dv(Pv.defaults,e),t=Pv.defaults,qy=t,Pv},Pv.getDefaults=Uy,Pv.defaults=qy,Pv.use=function(...e){const t=dv({},...e),n=Pv.defaults.extensions||{renderers:{},childTokens:{}};let i;e.forEach(e=>{if(e.extensions&&(i=!0,e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const t=n.renderers?n.renderers[e.name]:null;n.renderers[e.name]=t?function(...n){let i=e.renderer.apply(this,n);return!1===i&&(i=t.apply(this,n)),i}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");n[e.level]?n[e.level].unshift(e.tokenizer):n[e.level]=[e.tokenizer],e.start&&("block"===e.level?n.startBlock?n.startBlock.push(e.start):n.startBlock=[e.start]:"inline"===e.level&&(n.startInline?n.startInline.push(e.start):n.startInline=[e.start]))}e.childTokens&&(n.childTokens[e.name]=e.childTokens)})),e.renderer){const n=Pv.defaults.renderer||new xv;for(const t in e.renderer){const i=n[t];n[t]=(...s)=>{let o=e.renderer[t].apply(n,s);return!1===o&&(o=i.apply(n,s)),o}}t.renderer=n}if(e.tokenizer){const n=Pv.defaults.tokenizer||new bv;for(const t in e.tokenizer){const i=n[t];n[t]=(...s)=>{let o=e.tokenizer[t].apply(n,s);return!1===o&&(o=i.apply(n,s)),o}}t.tokenizer=n}if(e.walkTokens){const n=Pv.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens.call(this,t),n&&n.call(this,t)}}i&&(t.extensions=n),Pv.setOptions(t)})},Pv.walkTokens=function(e,t){for(const n of e)switch(t.call(Pv,n),n.type){case"table":for(const e of n.header)Pv.walkTokens(e.tokens,t);for(const e of n.rows)for(const n of e)Pv.walkTokens(n.tokens,t);break;case"list":Pv.walkTokens(n.items,t);break;default:Pv.defaults.extensions&&Pv.defaults.extensions.childTokens&&Pv.defaults.extensions.childTokens[n.type]?Pv.defaults.extensions.childTokens[n.type].forEach(function(e){Pv.walkTokens(n[e],t)}):n.tokens&&Pv.walkTokens(n.tokens,t)}},Pv.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");gv(t=dv({},Pv.defaults,t||{}));try{const n=Cv.lexInline(e,t);return t.walkTokens&&Pv.walkTokens(n,t.walkTokens),Ev.parseInline(n,t)}catch(bC){if(bC.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+Xy(bC.message+"",!0)+"</pre>";throw bC}},Pv.Parser=Ev,Pv.parser=Ev.parse,Pv.Renderer=xv,Pv.TextRenderer=Av,Pv.Lexer=Cv,Pv.lexer=Cv.lex,Pv.Tokenizer=bv,Pv.Slugger=Tv,Pv.parse=Pv,Pv.options,Pv.setOptions,Pv.use,Pv.walkTokens,Pv.parseInline,Ev.parse,Cv.lex;var Sv,Rv="undefined"!=typeof window?window:{};!function(){var e=Rv.DOMParser,t=!1;try{(new e).parseFromString("","text/html")&&(t=!0)}catch(bC){}return t}()?(Sv=function(){},function(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(bC){Rv.ActiveXObject&&(e=!0)}return e}()?Sv.prototype.parseFromString=function(e){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(e),t.close(),t}:Sv.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),t}):Rv.DOMParser;const Ov={"(":")","[":"]","{":"}"};class Iv extends Nu{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,n=t.document.selection,i="string"==typeof e.mention?{id:e.mention}:e.mention,s=i.id,o=e.range||n.getFirstRange();if(!t.canEditAt(o))return;const r=e.text||s,a=Vv({_text:r,id:s},i);if(1!=e.marker.length)throw new bs("mentioncommand-incorrect-marker",this);if(s.charAt(0)!=e.marker)throw new bs("mentioncommand-incorrect-id",this);t.change(e=>{const i=cr(n.getAttributes()),s=new Map(i.entries());s.set("mention",a);const l=t.insertContent(e.createText(r,s),o),c=l.start.nodeBefore,h=l.end.nodeAfter,u=h&&h.is("$text")&&h.data.startsWith(" ");let d=!1;if(c&&h&&c.is("$text")&&h.is("$text")){const e=c.data.slice(-1),t=e in Ov,n=t&&h.data.startsWith(Ov[e]);d=t&&n}d||u||t.insertContent(e.createText(" ",i),o.start.getShiftedBy(r.length))})}}class Mv extends Bu{static get pluginName(){return"MentionEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:e=>Bv(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:Nv}),e.conversion.for("downcast").add(Dv),n.registerPostFixer(e=>function(e,t,n){const i=t.differ.getChanges();let s=!1;for(const o of i){if("attribute"==o.type)continue;const t=o.position;if("$text"==o.name){const n=t.textNode&&t.textNode.nextSibling;s=Lv(t.textNode,e)||s,s=Lv(n,e)||s,s=Lv(t.nodeBefore,e)||s,s=Lv(t.nodeAfter,e)||s}if("$text"!=o.name&&"insert"==o.type){const n=t.nodeAfter;for(const t of e.createRangeIn(n).getItems())s=Lv(t,e)||s}if("insert"==o.type&&n.isInline(o.name)){const n=t.nodeAfter&&t.nodeAfter.nextSibling;s=Lv(t.nodeBefore,e)||s,s=Lv(n,e)||s}}return s}(e,n,t.schema)),n.registerPostFixer(e=>function(e,t){const n=t.differ.getChanges();let i=!1;for(const s of n)if("attribute"===s.type&&"mention"!=s.attributeKey){const t=s.range.start.nodeBefore,n=s.range.end.nodeAfter;for(const o of[t,n])Fv(o)&&o.getAttribute(s.attributeKey)!=s.attributeNewValue&&(e.setAttribute(s.attributeKey,s.attributeNewValue,o),i=!0)}return i}
13(e,n)),n.registerPostFixer(e=>function(e,t){const n=t.selection,i=n.focus;if(n.isCollapsed&&n.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(i))return e.removeSelectionAttribute("mention"),!0;return!1}(e,n)),e.commands.add("mention",new Iv(e))}}function Vv(e,t){return Object.assign({uid:gs()},e,t||{})}function Bv(e,t){const n=e.getAttribute("data-mention"),i=e.getChild(0);if(!i)return;return Vv({id:n,_text:i.data},t)}function Dv(e){e.on("attribute:mention",(e,t,n)=>{const i=t.attributeNewValue;if(!t.item.is("$textProxy")||!i)return;const s=t.range.start;(s.textNode||s.nodeAfter).data!=i._text&&n.consumable.consume(t.item,e.name)},{priority:"highest"})}function Nv(e,{writer:t}){if(!e)return;const n={class:"mention","data-mention":e.id},i={id:e.uid,priority:20};return t.createAttributeElement("span",n,i)}function Fv(e){if(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))return!1;return e.data!=e.getAttribute("mention")._text}function Lv(e,t){return!!Fv(e)&&(t.removeAttribute("mention",e),!0)}class $v extends Mm{selected;position;constructor(e){super(e),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 n=this.items.get(t);this.selected!==n&&(this.selected&&this.selected.removeHighlight(),n.highlight(),this.selected=n,this._isItemVisibleInScrolledArea(n)||(this.element.scrollTop=n.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new go(this.element).contains(new go(e.element))}}class zv extends Vf{domElement;constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",(e,t,n)=>{n?(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 jv extends Rm{item;marker;highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const Hv=[Wo.arrowup,Wo.arrowdown,Wo.esc],Wv=[Wo.enter,Wo.tab];class Uv extends Bu{_mentionsView;_mentionsConfigurations;_balloon;_items=new nr;_lastRequested;_requestFeedDebounced;static get pluginName(){return"MentionUI"}static get isOfficialPlugin(){return!0}static get requires(){return[Qg]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=Ni(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||Wv,n=Hv.concat(t);this._balloon=e.plugins.get(Qg),e.editing.view.document.on("keydown",(e,i)=>{var s;s=i.keyCode,n.includes(s)&&this._isUIVisible&&(i.preventDefault(),e.stop(),i.keyCode==Wo.arrowdown&&this._mentionsView.selectNext(),i.keyCode==Wo.arrowup&&this._mentionsView.selectPrevious(),t.includes(i.keyCode)&&this._mentionsView.executeSelected(),i.keyCode==Wo.esc&&this._hideUIAndRemoveMarker())},{priority:"highest"}),Bf({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const i=e.config.get("mention.feeds");for(const s of i){const{feed:e,marker:t,dropdownLimit:n}=s;if(!Zv(t))throw new bs("mentionconfig-incorrect-marker",null,{marker:t});const i={marker:t,feedCallback:"function"==typeof e?e.bind(this.editor):Jv(e),itemRenderer:s.itemRenderer,dropdownLimit:n};this._mentionsConfigurations.set(t,i)}this._setupTextWatcher(i),this.listenTo(e,"change:isReadOnly",()=>{this._hideUIAndRemoveMarker()}),this.on("requestFeed:response",(e,t)=>this._handleFeedResponse(t)),this.on("requestFeed:error",()=>this._hideUIAndRemoveMarker())}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}
13_createMentionView(){const e=this.editor.locale,t=new $v(e);return t.items.bindTo(this._items).using(n=>{const{item:i,marker:s}=n,{dropdownLimit:o}=this._mentionsConfigurations.get(s),r=o||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=r)return null;const a=new jv(e),l=this._renderItem(i,s);return l.delegate("execute").to(a),a.children.add(l),a.item=i,a.marker=s,a.on("execute",()=>{t.fire("execute",{item:i,marker:s})}),a}),t.on("execute",(e,t)=>{const n=this.editor,i=n.model,s=t.item,o=t.marker,r=n.model.markers.get("mention"),a=i.createPositionAt(i.document.selection.focus),l=i.createPositionAt(r.getStart()),c=i.createRange(l,a);this._hideUIAndRemoveMarker(),n.execute("mention",{mention:s,text:s.text,marker:o,range:c}),n.editing.view.focus()}),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:n}=this._mentionsConfigurations.get(e),i=n(t);i instanceof Promise?i.then(n=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:n,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:n,marker:e,feedText:t})}).catch(t=>{this.fire("requestFeed:error",{error:t}),_s("mention-feed-callback-error",{marker:e})}):this.fire("requestFeed:response",{feed:i,marker:e,feedText:t})}_setupTextWatcher(e){const t=this.editor,n=e.map(e=>({...e,pattern:Gv(e.marker,e.minimumCharacters||0)})),i=new Sp(t.model,function(e){const t=t=>{const n=Kv(e,t);if(!n)return!1;let i=0;0!==n.position&&(i=n.position-1);const s=t.substring(i);return n.pattern.test(s)};return t}(n));i.on("matched",(e,i)=>{const s=Kv(n,i.text),o=t.model.document.selection.focus,r=t.model.createPositionAt(o.parent,s.position);if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),n=e.nodeBefore;return t||n&&n.is("$text")&&n.hasAttribute("mention")}(o)||function(e){const t=e.nodeAfter;return t&&t.is("$text")&&t.hasAttribute("mention")}(r))return void this._hideUIAndRemoveMarker();const a=function(e,t){let n=0;0!==e.position&&(n=e.position-1);const i=Gv(e.marker,0),s=t.substring(n);return s.match(i)[2]}(s,i.text),l=s.marker.length+a.length,c=o.getShiftedBy(-l),h=o.getShiftedBy(-a.length),u=t.model.createRange(c,h);if(Qv(t)){const e=t.model.markers.get("mention");t.model.change(t=>{t.updateMarker(e,{range:u})})}else t.model.change(e=>{e.addMarker("mention",{range:u,usingOperation:!1,affectsData:!1})});this._requestFeedDebounced(s.marker,a)}),i.on("unmatched",()=>{this._hideUIAndRemoveMarker()});const s=t.commands.get("mention");return i.bind("isEnabled").to(s),i}_handleFeedResponse(e){const{feed:t,marker:n}=e;if(!Qv(this.editor))return;this._items.clear();for(const s of t){const e="object"!=typeof s?{id:s,text:s}:s;this._items.add({item:e,marker:n})}const i=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(i):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}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),Qv(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0}_renderItem(e,t){const n=this.editor;let i,s=e.id;const o=this._getItemRenderer(t);if(o){const t=o(e);"string"!=typeof t?i=new zv(n.locale,t):s=t}if(!i){const e=new Lf(n.locale);e.label=s,e.withText=!0,i=e}return i}_getBalloonPanelPositionData(e,t){const n=this.editor,i=n.editing,s=i.view.domConverter,o=i.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=n.model.document.selection.getFirstRange());const i=o.toViewRange(t);return go.getDomRangeRects(s.viewRangeToDom(i)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:qv(t,n.locale.uiLanguageDirection)}}}function qv(e,t){const n={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}
13}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(n,e)?[n[e]]:"rtl"!==t?[n.caret_se,n.caret_sw,n.caret_ne,n.caret_nw]:[n.caret_sw,n.caret_se,n.caret_nw,n.caret_ne]}function Kv(e,t){let n;for(const i of e){const e=t.lastIndexOf(i.marker);e>0&&!t.substring(e-1).match(i.pattern)||(!n||e>=n.position)&&(n={marker:i.marker,position:e,minimumCharacters:i.minimumCharacters,pattern:i.pattern})}return n}function Gv(e,t){const n=0==t?"*":`{${t},}`,i=ts.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";e=e.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&");return new RegExp(`(?:^|[ ${i}])([${e}])(.${n})$`,"u")}function Jv(e){return t=>e.filter(e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase()))}function Zv(e){return e&&1==e.length}function Qv(e){return e.model.markers.has("mention")}class Yv extends Bu{toMentionAttribute(e,t){return Bv(e,t)}static get pluginName(){return"Mention"}static get isOfficialPlugin(){return!0}static get requires(){return[Mv,Uv]}}function Xv(e,t,n,i,s=1){null!=t&&null!=s&&t>s?i.setAttribute(e,t,n):i.removeAttribute(e,n)}function ek(e,t,n={}){const i=e.createElement("tableCell",n);return e.insertElement("paragraph",i),e.insert(i,t),i}function tk(e,t){const n=t.parent.parent,i=parseInt(n.getAttribute("headingColumns")||"0"),{column:s}=e.getCellLocation(t);return!!i&&s<i}function nk(){return e=>{e.on("element:table",(e,t,n)=>{const i=t.viewItem;if(!n.consumable.test(i,{name:!0}))return;const{rows:s,headingRows:o,headingColumns:r}=function(e){let t,n=0;const i=[],s=[];let o;for(const r of Array.from(e.getChildren())){if("tbody"!==r.name&&"thead"!==r.name&&"tfoot"!==r.name)continue;"thead"!==r.name||o||(o=r);const e=Array.from(r.getChildren()).filter(e=>e.is("element","tr"));for(const a of e)if(o&&r===o||"tbody"===r.name&&Array.from(a.getChildren()).length&&Array.from(a.getChildren()).every(e=>e.is("element","th")))n++,i.push(a);else{s.push(a);const e=sk(a);(!t||e<t)&&(t=e)}}return{headingRows:n,headingColumns:t||0,rows:[...i,...s]}}(i),a={};r&&(a.headingColumns=r),o&&(a.headingRows=o);const l=n.writer.createElement("table",a);if(n.safeInsert(l,t.modelCursor)){if(n.consumable.consume(i,{name:!0}),s.forEach(e=>n.convertItem(e,n.writer.createPositionAt(l,"end"))),n.convertChildren(i,n.writer.createPositionAt(l,"end")),l.isEmpty){const e=n.writer.createElement("tableRow");n.writer.insert(e,n.writer.createPositionAt(l,"end")),ek(n.writer,n.writer.createPositionAt(e,"end"))}n.updateConversionResult(l,t)}})}}function ik(e){return t=>{t.on(`element:${e}`,(e,t,{writer:n})=>{if(!t.modelRange)return;const i=t.modelRange.start.nodeAfter,s=n.createPositionAt(i,0);if(t.viewItem.isEmpty)return void n.insertElement("paragraph",s);const o=Array.from(i.getChildren());if(o.every(e=>e.is("element","$marker"))){const e=n.createElement("paragraph");n.insert(e,n.createPositionAt(i,0));for(const t of o)n.move(n.createRangeOn(t),n.createPositionAt(e,"end"))}},{priority:"low"})}}function sk(e){let t=0,n=0;const i=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;n<i.length&&"th"===i[n].name;){const e=i[n];t+=parseInt(e.getAttribute("colspan")||"1"),n++}return t}class ok{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{const n=e.getChild(this._cellIndex);if(!n)return this._advanceToNextRow();const i=parseInt(n.getAttribute("colspan")||"1"),s=parseInt(n.getAttribute("rowspan")||"1");(i>1||s>1)&&this._recordSpans(n,s,i),this._shouldSkipSlot()||(t=this._formatOutValue(n)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}
13skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new rk(this,e,t,n)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,i=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||n||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){const i={cell:e,row:this._row,column:this._column};for(let s=this._row;s<this._row+t;s++)for(let e=this._column;e<this._column+n;e++)s==this._row&&e==this._column||this._markSpannedCell(s,e,i)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,n)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}}class rk{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,n,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function ak(e,t){return(n,{writer:i})=>{const s=n.getAttribute("headingRows")||0,o=i.createContainerElement("table",null,[]),r=i.createContainerElement("figure",{class:"table"},o);s>0&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("thead",null,i.createSlot(e=>e.is("element","tableRow")&&e.index<s))),s<e.getRows(n)&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("tbody",null,i.createSlot(e=>e.is("element","tableRow")&&e.index>=s)));for(const{positionOffset:e,filter:a}of t.additionalSlots)i.insert(i.createPositionAt(o,e),i.createSlot(a));return i.insert(i.createPositionAt(o,"after"),i.createSlot(e=>!e.is("element","tableRow")&&!t.additionalSlots.some(({filter:t})=>t(e)))),t.asWidget?function(e,t){return t.setCustomProperty("table",!0,e),vw(e,t,{hasSelectionHandle:!0})}(r,i):r}}function lk(e={}){return(t,{writer:n})=>{const i=t.parent,s=i.parent,o=s.getChildIndex(i),r=new ok(s,{row:o}),a=s.getAttribute("headingRows")||0,l=s.getAttribute("headingColumns")||0;let c=null;for(const h of r)if(h.cell==t){const t=h.row<a||h.column<l?"th":"td";c=e.asWidget?Aw(n.createEditableElement(t),n):n.createContainerElement(t);break}return c}}function ck(e={}){return(t,{writer:n})=>{if(!t.parent.is("element","tableCell"))return null;if(!hk(t))return null;if(e.asWidget)return n.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function hk(e){return 1==e.parent.childCount&&!!e.getAttributeKeys().next().done}class uk extends Nu{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=function(e,t){const n=e.getFirstPosition().parent,i=n===n.root?n:n.parent;return t.checkChild(i,"table")}(t,n)}execute(e={}){const t=this.editor,n=t.model,i=t.plugins.get("TableUtils"),s=t.config.get("table.defaultHeadings.rows"),o=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&s&&(e.headingRows=s),void 0===e.headingColumns&&o&&(e.headingColumns=o),n.change(t=>
13{const s=i.createTable(t,e);n.insertObject(s,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(s.getNodeByPath([0,0,0]),0))})}}class dk extends Nu{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i="above"===this.order,s=n.getSelectionAffectedTableCells(t),o=n.getRowIndexes(s),r=i?o.first:o.last,a=s[0].findAncestor("table");n.insertRows(a,{at:i?r:r+1,copyStructureFromAbove:!i})}}class fk extends Nu{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i="left"===this.order,s=n.getSelectionAffectedTableCells(t),o=n.getColumnIndexes(s),r=i?o.first:o.last,a=s[0].findAncestor("table");n.insertColumns(a,{columns:1,at:i?r:r+1})}}class mk extends Nu{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function gk(e,t,n){const{startRow:i,startColumn:s,endRow:o,endColumn:r}=t,a=n.createElement("table"),l=o-i+1;for(let h=0;h<l;h++)n.insertElement("tableRow",a,"end");const c=[...new ok(e,{startRow:i,endRow:o,startColumn:s,endColumn:r,includeAllSlots:!0})];for(const{row:h,column:u,cell:d,isAnchor:f,cellAnchorRow:m,cellAnchorColumn:g}of c){const e=h-i,t=a.getChild(e);if(f){const e=n.cloneElement(d);n.append(e,t),yk(e,h,u,o,r,n)}else(m<i||g<s)&&ek(n,n.createPositionAt(t,"end"))}return function(e,t,n,i,s){const o=parseInt(t.getAttribute("headingRows")||"0");if(o>0){Xv("headingRows",o-n,e,s,0)}const r=parseInt(t.getAttribute("headingColumns")||"0");if(r>0){Xv("headingColumns",r-i,e,s,0)}}(a,e,i,s,n),a}function pk(e,t,n=0){const i=[],s=new ok(e,{startRow:n,endRow:t-1});for(const o of s){const{row:e,cellHeight:n}=o;e<t&&t<=e+n-1&&i.push(o)}return i}function wk(e,t,n){const i=e.parent,s=i.parent,o=i.index,r=t-o,a={},l=parseInt(e.getAttribute("rowspan"))-r;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const h=o+r,u=[...new ok(s,{startRow:o,endRow:h,includeAllSlots:!0})];let d,f=null;for(const m of u){const{row:t,column:i,cell:s}=m;s===e&&void 0===d&&(d=i),void 0!==d&&d===i&&t===h&&(f=ek(n,m.getPositionBefore(),a))}return Xv("rowspan",r,e,n),f}function bk(e,t){const n=[],i=new ok(e);for(const s of i){const{column:e,cellWidth:i}=s;e<t&&t<=e+i-1&&n.push(s)}return n}function _k(e,t,n,i){const s=n-t,o={},r=parseInt(e.getAttribute("colspan"))-s;r>1&&(o.colspan=r);const a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(o.rowspan=a);const l=ek(i,i.createPositionAfter(e),o);return Xv("colspan",s,e,i),l}function yk(e,t,n,i,s,o){const r=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");if(n+r-1>s){Xv("colspan",s-n+1,e,o,1)}if(t+a-1>i){Xv("rowspan",i-t+1,e,o,1)}}function vk(e,t){const n=t.getColumns(e),i=new Array(n).fill(0);for(const{column:o}of new ok(e))i[o]++;const s=i.reduce((e,t,n)=>t?e:[...e,n],[]);if(s.length>0){const n=s[s.length-1];return t.removeColumns(e,{at:n}),!0}return!1}function kk(e,t){const n=[],i=t.getRows(e);for(let s=0;s<i;s++){e.getChild(s).isEmpty&&n.push(s)}if(n.length>0){const i=n[n.length-1];return t.removeRows(e,{at:i}),!0}return!1}function Ck(e,t){vk(e,t)||kk(e,t)}function xk(e,t){const n=Array.from(new ok(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(n.every(({cellHeight:e})=>1===e))return t.lastRow;const i=n[0].cellHeight-1;return t.lastRow+i}function Ak(e,t){const n=Array.from(new ok(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(n.every(({cellWidth:e})=>
131===e))return t.lastColumn;const i=n[0].cellWidth-1;return t.lastColumn+i}class Tk extends Nu{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,s=this.direction;e.change(e=>{const t="right"==s||"down"==s,o=t?n:i,r=t?i:n,a=r.parent;!function(e,t,n){Ek(e)||(Ek(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,"end")));n.remove(e)}(r,o,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(n.getAttribute(l)||"1"),h=parseInt(i.getAttribute(l)||"1");e.setAttribute(l,c+h,o),e.setSelection(e.createRangeIn(o));const u=this.editor.plugins.get("TableUtils");Ck(a.findAncestor("table"),u)})}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),n=t.getTableCellsContainingSelection(e.selection)[0];if(!n)return;const i=this.isHorizontal?function(e,t,n){const i=e.parent,s=i.parent,o="right"==t?e.nextSibling:e.previousSibling,r=(s.getAttribute("headingColumns")||0)>0;if(!o)return;const a="right"==t?e:o,l="right"==t?o:e,{column:c}=n.getCellLocation(a),{column:h}=n.getCellLocation(l),u=parseInt(a.getAttribute("colspan")||"1"),d=tk(n,a),f=tk(n,l);if(r&&d!=f)return;return c+u===h?o:void 0}(n,this.direction,t):function(e,t,n){const i=e.parent,s=i.parent,o=s.getChildIndex(i);if("down"==t&&o===n.getRows(s)-1||"up"==t&&0===o)return null;const r=parseInt(e.getAttribute("rowspan")||"1"),a=s.getAttribute("headingRows")||0,l="down"==t&&o+r===a,c="up"==t&&o===a;if(a&&(l||c))return null;const h=parseInt(e.getAttribute("rowspan")||"1"),u="down"==t?o+h:o,d=[...new ok(s,{endRow:u})],f=d.find(t=>t.cell===e),m=f.column,g=d.find(({row:e,cellHeight:n,column:i})=>i===m&&("down"==t?e===u:u===e+n));return g&&g.cell?g.cell:null}(n,this.direction,t);if(!i)return;const s=this.isHorizontal?"rowspan":"colspan",o=parseInt(n.getAttribute(s)||"1");return parseInt(i.getAttribute(s)||"1")===o?i:void 0}}function Ek(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class Pk extends Nu{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),s=e.getRows(i)-1,o=e.getRowIndexes(t),r=0===o.first&&o.last===s;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),s=n[0],o=s.findAncestor("table"),r=t.getCellLocation(s).column;e.change(e=>{const n=i.last-i.first+1;t.removeRows(o,{at:i.first,rows:n});const s=function(e,t,n,i){const s=e.getChild(Math.min(t,i-1));let o=s.getChild(0),r=0;for(const a of s.getChildren()){if(r>n)return o;o=a,r+=parseInt(a.getAttribute("colspan")||"1")}return o}(o,i.first,r,t.getRows(o));e.setSelection(e.createPositionAt(s,0))})}}class Sk extends Nu{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),s=e.getColumns(i),{first:o,last:r}=e.getColumnIndexes(t);this.isEnabled=r-o<s-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,n]=function(e,t){const n=t.getSelectionAffectedTableCells(e),i=n[0],s=n.pop(),o=[i,s];return i.isBefore(s)?o:o.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,s=[...new ok(i)],o={first:s.find(e=>e.cell===t).column,last:s.find(e=>e.cell===n).column},r=function(e,t,n,i){const s=parseInt(n.getAttribute("colspan")||"1");return s>1?n:t.previousSibling||n.nextSibling?n.nextSibling||t.previousSibling:i.first?e.reverse().find(({column:e})=>e<i.first).cell:e.reverse().find(({column:e})=>e>i.last).cell}(s,t,n,o);this.editor.model.change(t=>{const n=o.last-o.first+1;e.removeColumns(i,{at:o.first,columns:n}),t.setSelection(t.createPositionAt(r,0))})}}class Rk extends Nu{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),s=i[0].findAnce
13stor("table"),{first:o,last:r}=t.getRowIndexes(i),a=this.value?o:r+1,l=s.getAttribute("headingRows")||0;n.change(e=>{if(a){const t=pk(s,a,a>l?l:0);for(const{cell:n}of t)wk(n,a,e)}Xv("headingRows",a,s,e,0)})}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||"0");return!!n&&e.parent.index<n}}class Ok extends Nu{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every(e=>tk(t,e))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),s=i[0].findAncestor("table"),{first:o,last:r}=t.getColumnIndexes(i),a=this.value?o:r+1;n.change(e=>{if(a){const t=bk(s,a);for(const{cell:n,column:i}of t)_k(n,i,a,e)}Xv("headingColumns",a,s,e,0)})}}function Ik(e){const t=function(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find(e=>e.is("element","tableColumnGroup"))}(e);return t?Array.from(t.getChildren()):[]}class Mk extends Bu{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,n=t.parent,i=n.getChildIndex(t),s=new ok(n,{row:i});for(const{cell:o,row:r,column:a}of s)if(o===e)return{row:r,column:a}}createTable(e,t){const n=e.createElement("table"),i=t.rows||2,s=t.columns||2;return Vk(e,n,0,i,s),t.headingRows&&Xv("headingRows",Math.min(t.headingRows,i),n,e,0),t.headingColumns&&Xv("headingColumns",Math.min(t.headingColumns,s),n,e,0),n}insertRows(e,t={}){const n=this.editor.model,i=t.at||0,s=t.rows||1,o=void 0!==t.copyStructureFromAbove,r=t.copyStructureFromAbove?i-1:i,a=this.getRows(e),l=this.getColumns(e);if(i>a)throw new bs("tableutils-insertrows-insert-out-of-range",this,{options:t});n.change(t=>{const n=e.getAttribute("headingRows")||0;if(n>i&&Xv("headingRows",n+s,e,t,0),!o&&(0===i||i===a))return void Vk(t,e,i,s,l);const c=o?Math.max(i,r):i,h=new ok(e,{endRow:c}),u=new Array(l).fill(1);for(const{row:e,column:a,cellHeight:l,cellWidth:d,cell:f}of h){const n=e+l-1,c=e<=r&&r<=n;e<i&&i<=n?(t.setAttribute("rowspan",l+s,f),u[a]=-d):o&&c&&(u[a]=d)}for(let o=0;o<s;o++){const n=t.createElement("tableRow");t.insert(n,e,i);for(let e=0;e<u.length;e++){const i=u[e],s=t.createPositionAt(n,"end");i>
130&&ek(t,s,i>1?{colspan:i}:void 0),e+=Math.abs(i)-1}}})}insertColumns(e,t={}){const n=this.editor.model,i=t.at||0,s=t.columns||1;n.change(t=>{const n=e.getAttribute("headingColumns");i<n&&t.setAttribute("headingColumns",n+s,e);const o=this.getColumns(e);if(0===i||o===i){for(const n of e.getChildren())n.is("element","tableRow")&&Bk(s,t,t.createPositionAt(n,i?"end":0));return}const r=new ok(e,{column:i,includeAllSlots:!0});for(const e of r){const{row:n,cell:o,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:h}=e;if(a<i){t.setAttribute("colspan",c+s,o);const e=l+h-1;for(let t=n;t<=e;t++)r.skipRow(t)}else Bk(s,t,e.getPositionBefore())}})}removeRows(e,t){const n=this.editor.model,i=t.rows||1,s=this.getRows(e),o=t.at,r=o+i-1;if(r>s-1)throw new bs("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});n.change(t=>{const n={first:o,last:r},{cellsToMove:i,cellsToTrim:s}=function(e,{first:t,last:n}){const i=new Map,s=[];for(const{row:o,column:r,cellHeight:a,cell:l}of new ok(e,{endRow:n})){const e=o+a-1;if(o>=t&&o<=n&&e>n){const e=a-(n-o+1);i.set(r,{cell:l,rowspan:e})}if(o<t&&e>=t){let i;i=e>=n?n-t+1:e-t+1,s.push({cell:l,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:s}}(e,n);if(i.size){!function(e,t,n,i){const s=new ok(e,{includeAllSlots:!0,row:t}),o=[...s],r=e.getChild(t);let a;for(const{column:l,cell:c,isAnchor:h}of o)if(n.has(l)){const{cell:e,rowspan:t}=n.get(l),s=a?i.createPositionAfter(a):i.createPositionAt(r,0);i.move(i.createRangeOn(e),s),Xv("rowspan",t,e,i),a=e}else h&&(a=c)}(e,r+1,i,t)}for(let a=r;a>=o;a--)t.remove(e.getChild(a));for(const{rowspan:e,cell:o}of s)Xv("rowspan",e,o,t);!function(e,{first:t,last:n},i){const s=e.getAttribute("headingRows")||0;if(t<s){Xv("headingRows",n<s?s-(n-t+1):t,e,i,0)}}(e,n,t),vk(e,this)||kk(e,this)})}removeColumns(e,t){const n=this.editor.model,i=t.at,s=t.columns||1,o=t.at+s-1;n.change(t=>{!function(e,t,n){const i=e.getAttribute("headingColumns")||0;if(i&&t.first<i){const s=Math.min(i-1,t.last)-t.first+1;n.setAttribute("headingColumns",i-s,e)}}(e,{first:i,last:o},t);const n=Ik(e);for(let s=o;s>=i;s--){for(const{cell:n,column:i,cellWidth:o}of[...new ok(e)])i<=s&&o>1&&i+o>s?Xv("colspan",o-1,n,t):i===s&&t.remove(n);if(n[s]){const e=0===s?n[1]:n[s-1],i=parseFloat(n[s].getAttribute("columnWidth")),o=parseFloat(e.getAttribute("columnWidth"));t.remove(n[s]),t.setAttribute("columnWidth",i+o+"%",e)}}kk(e,this)||vk(e,this)})}splitCellVertically(e,t=2){const n=this.editor.model,i=e.parent.parent,s=parseInt(e.getAttribute("rowspan")||"1"),o=parseInt(e.getAttribute("colspan")||"1");n.change(n=>{if(o>1){const{newCellsSpan:i,updatedSpan:r}=Dk(o,t);Xv("colspan",r,e,n);const a={};i>1&&(a.colspan=i),s>1&&(a.rowspan=s);Bk(o>t?t-1:o-1,n,n.createPositionAfter(e),a)}if(o<t){const r=t-o,a=[...new ok(i)],{column:l}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:n,column:i})=>t!==e&&i===l||i<l&&i+n>l);for(const{cell:e,cellWidth:t}of c)n.setAttribute("colspan",t+r,e);const h={};s>1&&(h.rowspan=s),Bk(r,n,n.createPositionAfter(e),h);const u=i.getAttribute("headingColumns")||0;u>l&&Xv("headingColumns",u+r,i,n)}})}splitCellHorizontally(e,t=2){const n=this.editor.model,i=e.parent,s=i.parent,o=s.getChildIndex(i),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");n.change(n=>{if(r>1){const i=[...new ok(s,{startRow:o,endRow:o+r-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=Dk(r,t);Xv("rowspan",c,e,n);const{column:h}=i.find(({cell:t})=>t===e),u={};l>1&&(u.rowspan=l),a>1&&(u.colspan=a);let d=0;for(const e of i){const{column:t,row:i}=e,s=t===h;d>=l&&s&&(d=0),i>=o+c&&s&&(d||Bk(1,n,e.getPositionBefore(),u),d++)}}if(r<t){const i=t-r,l=[...new ok(s,{startRow:0,endRow:o})];for(const{cell:t,cellHeight:s,row:r}of l)if(t!==e&&r+s>o){const e=s+i;n.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),Vk(n,s,o+1,i,1,c);const h=s.getAttribute("headingRows")||0;h>o&&Xv("headingRows",h+i,s,n)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(e=>e.is("element","tableCell")).reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>
13t.is("element","tableRow")?e+1:e,0)}createTableWalker(e,t={}){return new ok(e,t)}getSelectedTableCells(e){const t=[];for(const n of this.sortRanges(e.getRanges())){const e=n.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){const t=[];for(const n of e.getRanges()){const e=n.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(e=>e.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),n=[...new ok(t)].filter(t=>e.includes(t.cell)).map(e=>e.column);return this._getFirstLastIndexesObject(n)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,n=new Set;let i=0;for(const o of e){const{row:e,column:s}=this.getCellLocation(o),r=parseInt(o.getAttribute("rowspan"))||1,a=parseInt(o.getAttribute("colspan"))||1;t.add(e),n.add(s),r>1&&t.add(e+r-1),a>1&&n.add(s+a-1),i+=r*a}const s=function(e,t){const n=Array.from(e.values()),i=Array.from(t.values()),s=Math.max(...n),o=Math.min(...n),r=Math.max(...i),a=Math.min(...i);return(s-o+1)*(r-a+1)}(t,n);return s==i}sortRanges(e){return Array.from(e).sort(Nk)}_getFirstLastIndexesObject(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}
13_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),n=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,i))return!1;const s=this.getColumnIndexes(e),o=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(s,o)}_areIndexesInSameSection({first:e,last:t},n){return e<n===t<n}}function Vk(e,t,n,i,s,o={}){for(let r=0;r<i;r++){const i=e.createElement("tableRow");e.insert(i,t,n),Bk(s,e,e.createPositionAt(i,"end"),o)}}function Bk(e,t,n,i={}){for(let s=0;s<e;s++)ek(t,n,i)}function Dk(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const n=Math.floor(e/t);return{newCellsSpan:n,updatedSpan:e-n*t+n}}function Nk(e,t){const n=e.start,i=t.start;return n.isBefore(i)?-1:1}class Fk extends Nu{refresh(){const e=this.editor.plugins.get(Mk),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(Mk);e.change(n=>{const i=t.getSelectedTableCells(e.document.selection),s=i.shift(),{mergeWidth:o,mergeHeight:r}=function(e,t,n){let i=0,s=0;for(const c of t){const{row:e,column:t}=n.getCellLocation(c);i=zk(c,t,i,"colspan"),s=zk(c,e,s,"rowspan")}const{row:o,column:r}=n.getCellLocation(e),a=i-r,l=s-o;return{mergeWidth:a,mergeHeight:l}}(s,i,t);Xv("colspan",o,s,n),Xv("rowspan",r,s,n);for(const e of i)Lk(e,s,n);Ck(s.findAncestor("table"),t),n.setSelection(s,"in")})}}function Lk(e,t,n){$k(e)||($k(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,"end"))),n.remove(e)}function $k(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function zk(e,t,n,i){const s=parseInt(e.getAttribute(i)||"1");return Math.max(n,t+s)}class jk extends Nu{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),s=n[0].findAncestor("table"),o=[];for(let r=i.first;r<=i.last;r++)for(const t of s.getChild(r).getChildren())o.push(e.createRangeOn(t));e.change(e=>{e.setSelection(o)})}}class Hk extends Nu{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n[0],s=n.pop(),o=i.findAncestor("table"),r=e.getCellLocation(i),a=e.getCellLocation(s),l=Math.min(r.column,a.column),c=Math.max(r.column,a.column),h=[];for(const u of new ok(o,{startColumn:l,endColumn:c}))h.push(t.createRangeOn(u.cell));t.change(e=>{e.setSelection(h)})}}function Wk(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.differ.getChanges();let i=!1;const s=new Set;for(const o of n){let t=null;"insert"==o.type&&"table"==o.name&&(t=o.position.nodeAfter),"insert"!=o.type&&"remove"!=o.type||"tableRow"!=o.name&&"tableCell"!=o.name||(t=o.position.findAncestor("table")),Kk(o)&&(t=o.range.start.findAncestor("table")),t&&!s.has(t)&&(i=Uk(t,e)||i,i=qk(t,e)||i,s.add(t))}return i}(t,e))}function Uk(e,t){let n=!1;const i=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),n=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),i=[];for(const{row:s,cell:o,cellHeight:r}of new ok(e)){if(r<2)continue;const e=s<t?t:n;if(s+r>e){const t=e-s;i.push({cell:o,rowspan:t})}}return i}(e);if(i.length){n=!0;for(const e of i)Xv("rowspan",e.rowspan,e.cell,t,1)}return n}function qk(e,t){let n=!1;const i=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:n}of new ok(e,{includeAllSlots:!0}))t[n]++;return t}(e),s=[];for(const[a,l]of i.entries())!l&&e.getChild(a).is("element","tableRow")&&s.push(a);if(s.length){n=!0;for(const n of s.reverse())t.remove(e.getChild(n)),i.splice(n,1)}
13const o=i.filter((t,n)=>e.getChild(n).is("element","tableRow")),r=o[0];if(!o.every(e=>e===r)){const i=o.reduce((e,t)=>t>e?t:e,0);for(const[s,r]of o.entries()){const o=i-r;if(o){for(let n=0;n<o;n++)ek(t,t.createPositionAt(e.getChild(s),"end"));n=!0}}}return n}function Kk(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function Gk(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.differ.getChanges();let i=!1;for(const s of n)"insert"==s.type&&"table"==s.name&&(i=Jk(s.position.nodeAfter,e)||i),"insert"==s.type&&"tableRow"==s.name&&(i=Zk(s.position.nodeAfter,e)||i),"insert"==s.type&&"tableCell"==s.name&&(i=Qk(s.position.nodeAfter,e)||i),"remove"!=s.type&&"insert"!=s.type||!Yk(s)||(i=Qk(s.position.parent,e)||i);return i}(t,e))}function Jk(e,t){let n=!1;for(const i of e.getChildren())i.is("element","tableRow")&&(n=Zk(i,t)||n);return n}function Zk(e,t){let n=!1;for(const i of e.getChildren())n=Qk(i,t)||n;return n}function Qk(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const n=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const i of n)t.wrap(t.createRangeOn(i),"paragraph");return!!n.length}function Yk(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function Xk(e,t){if(!e.is("element","paragraph"))return!1;const n=t.toViewElement(e);return!!n&&hk(e)!==n.is("element","span")}class eC extends Bu{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Mk]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,n=t.schema,i=e.conversion,s=e.plugins.get(Mk);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add(e=>{e.on("element:figure",(e,t,n)=>{if(!n.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const i=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!i||!n.consumable.test(i,{name:!0}))return;n.consumable.consume(t.viewItem,{name:!0,classes:"table"});const s=ir(n.convertItem(i,t.modelCursor).modelRange.getItems());s?(n.convertChildren(t.viewItem,n.writer.createPositionAt(s,"end")),n.updateConversionResult(s,t)):n.consumable.revert(t.viewItem,{name:!0,classes:"table"})})}),i.for("upcast").add(nk()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:ak(s,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:ak(s,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),i.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(ik("td")),i.for("upcast").add(ik("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:lk({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:lk()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:ck({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:ck(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:tC("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:tC("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new uk(e)),e.commands.add("insertTableRowAbove",new dk(e,{order:"above"})),e.commands.add("insertTableRowBelow",new dk(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new fk(e,{order:"left"})),e.commands.add("insertTableColumnRight",new fk(e,{order:"right"}
13)),e.commands.add("removeTableRow",new Pk(e)),e.commands.add("removeTableColumn",new Sk(e)),e.commands.add("splitTableCellVertically",new mk(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new mk(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Fk(e)),e.commands.add("mergeTableCellRight",new Tk(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Tk(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Tk(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Tk(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new Ok(e)),e.commands.add("setTableRowHeader",new Rk(e)),e.commands.add("selectTableRow",new jk(e)),e.commands.add("selectTableColumn",new Hk(e)),Wk(t),Gk(t),this.listenTo(t.document,"change:data",()=>{!function(e,t){const n=e.document.differ;for(const i of n.getChanges()){let e,n=!1;if("attribute"==i.type){const t=i.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=i.attributeKey&&"headingColumns"!=i.attributeKey)continue;e=t,n="headingRows"==i.attributeKey}else"tableRow"!=i.name&&"tableCell"!=i.name||(e=i.position.findAncestor("table"),n="tableRow"==i.name);if(!e)continue;const s=e.getAttribute("headingRows")||0,o=e.getAttribute("headingColumns")||0,r=new ok(e);for(const i of r){const e=i.row<s||i.column<o?"th":"td",r=t.mapper.toViewElement(i.cell);r&&r.is("element")&&r.name!=e&&t.reconvertItem(n?i.cell.parent:i.cell)}}}(t,e.editing),function(e,t){const n=e.document.differ,i=new Set;for(const s of n.getChanges()){const e="attribute"==s.type?s.range.start.parent:s.position.parent;e.is("element","tableCell")&&i.add(e)}for(const s of i.values()){const e=Array.from(s.getChildren()).filter(e=>Xk(e,t.mapper));for(const n of e)t.reconvertItem(n)}}(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function tC(e){return t=>{const n=parseInt(t.getAttribute(e));return Number.isNaN(n)||n<=0?null:n}}class nC extends Vf{items;keystrokes;focusTracker;constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new lr,this.focusTracker=new sr,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} Ã ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"[email protected]":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(e,t)=>{const{row:n,column:i}=t.target.dataset;this.items.get(10*(parseInt(n,10)-1)+(parseInt(i,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(e,t,n)=>{if(!n)return;const{row:i,column:s}=n.dataset;this.set({rows:parseInt(i),columns:parseInt(s)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Df({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((n,i)=>{const s=Math.floor(i/10)<e&&i%10<t;n.set("isOn",s)})}_createGridButton(e,t,n,i){const s=new Lf(e);return s.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),s.extendTemplate({attributes:{"data-row":t,"data-column":n}}),s}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const n=Math.floor(t/10),i=t%10,s=`${n+1} Ã ${i+1}`;e.push(this._createGridButton(this.locale,n+1,i+1,s))}return this.createCollection(e)}}class iC extends Bu{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=this.editor.t,n="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",n=>{const i=e.commands.get("insertTable"),s=Km(n);let o;return s.bind("isEnabled").to(i),s.buttonView.set({icon:_d,label:t("Insert table"),tooltip:!0}),s.on("change:isOpen",()=>{o||(o=new nC(n),s.panelView.children.add(o),o.delegate("execute").to(s),s.on("execute",()=>{e.execute("insertTable",{rows:o.rows,columns:o.columns}),e.editing.view.focus()}))}),s}),e.ui.componentFactory.add("menuBar:insertTable",n=>{const i=e.commands.get("insertTable"),s=new sp(n),o=new nC(n);return o.delegate("execute").to(s),s.on("change:isOpen",(e,t,n)=>{n||o.reset()}),o.on("execute",()=>{e.execute("insertTable",{rows:o.rows,columns:o.columns}),e.editing.view.focus()}),s.buttonView.set({label:t("Table"),icon:_d}),s.panelView.children.add(o),s.bind("isEnabled").to(i),s}),e.ui.componentFactory.add("tableColumn",e=>{const i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',i,e)}),e.ui.componentFactory.add("tableRow",e=>{const n=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',n,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',i,e)})}_prepareDropdown(e,t,n,i){const s=this.editor,o=Km(i),r=this._fillDropdownWithListOptions(o,n);return o.buttonView.set({label:e,icon:t,tooltip:!0}),o.bind("isEnabled").toMany(r,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(o,"execute",e=>{s.execute(e.source.commandName),e.source instanceof fm||s.editing.view.focus()}),o}_prepareMergeSplitButtonDropdown(e,t,n,i){const s=this.editor,o=Km(i,qm),r="mergeTableCells",a=s.commands.get(r),l=this._fillDropdownWithListOptions(o,n);return o.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),o.bind("isEnabled").toMany([a,...l],"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(o.buttonView,"execute",()=>{s.execute(r),s.editing.view.focus()}),this.listenTo(o,"execute",e=>{s.execute(e.source.commandName),s.editing.view.focus()}),o}_fillDropdownWithListOptions(e,t){const n=this.editor,i=[],s=new nr;for(const o of t)sC(o,n,i,s);return Zm(e,s),i}}function sC(e,t,n,i){if("button"===e.type||"switchbutton"===e.type){const i=e.model=new Jg(e.model),{commandName:s,bindIsOn:o}=e.model,r=t.commands.get(s);n.push(r),i.set({commandName:s}),i.bind("isEnabled").to(r),o&&i.bind("isOn").to(r,"value"),i.set({withText:!0})}i.add(e)}class oC extends Bu{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[Mk,Mk]}init(){const e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this.listenTo(n.document,"insertText",(e,t)=>this._handleInsertTextEvent(e,t),{priority:"high"}
13),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(Mk),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return 0==n.length?null:n}getSelectionAsFragment(){const e=this.editor.plugins.get(Mk),t=this.getSelectedTableCells();return t?this.editor.model.change(n=>{const i=n.createDocumentFragment(),{first:s,last:o}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),l=t[0].findAncestor("table");let c=a,h=o;if(e.isSelectionRectangular(t)){const e={firstColumn:s,lastColumn:o,firstRow:r,lastRow:a};c=xk(l,e),h=Ak(l,e)}const u=gk(l,{startRow:r,startColumn:s,endRow:c,endColumn:h},n);return n.insert(u,i,0),i}):null}setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(n.cells.map(t=>e.createRangeOn(t)),{backward:n.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=ir(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,n,i)=>{const s=i.writer;!function(e){for(const n of t)e.removeClass("ck-editor__editable_selected",n);t.clear()}(s);const o=this.getSelectedTableCells();if(!o)return;for(const a of o){const e=i.mapper.toViewElement(a);s.addClass("ck-editor__editable_selected",e),t.add(e)}const r=i.mapper.toViewElement(o[o.length-1]);s.setSelection(r,0)},{priority:"lowest"}))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(n=>{const i=n.createPositionAt(t[0],0),s=e.model.schema.getNearestSelectionRange(i);n.setSelection(s)})}})}_handleDeleteContent(e,t){const n=this.editor.plugins.get(Mk),i=t[0],s=t[1],o=this.editor.model,r=!s||"backward"==s.direction,a=n.getSelectedTableCells(i);a.length&&(e.stop(),o.change(e=>{const t=a[r?a.length-1:0];o.change(e=>{for(const t of a)o.deleteContent(e.createSelection(t,"in"))});const n=o.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(n):i.setTo(n)}))}_handleInsertTextEvent(e,t){const n=this.editor,i=this.getSelectedTableCells();if(!i)return;const s=n.editing.view,o=n.editing.mapper,r=i.map(e=>s.createRangeOn(o.toViewElement(e)));t.selection=s.createSelection(r)}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),i=n.getCellLocation(e),s=n.getCellLocation(t),o=Math.min(i.row,s.row),r=Math.max(i.row,s.row),a=Math.min(i.column,s.column),l=Math.max(i.column,s.column),c=new Array(r-o+1).fill(null).map(()=>[]),h={startRow:o,endRow:r,startColumn:a,endColumn:l};for(const{row:f,cell:m}of new ok(e.findAncestor("table"),h))c[f-o].push(m);const u=s.row<i.row,d=s.column<i.column;return u&&c.reverse(),d&&c.forEach(e=>e.reverse()),{cells:c.flat(),backward:u||d}}}class rC extends Bu{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Ww,Uw,oC,Mk]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(t,"cut",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e.model,"insertContent",(e,[t,n])=>this._onInsertContent(e,t,n),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const n=this.editor.editing.view,i=this.editor.plugins.get(oC),s=this.editor.plugins.get(Ww);i.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},()=>{const o=s._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>i.getSelectionAsFragment());n.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(o),method:e.name})}))}_onInsertContent(e,t,n){if(n&&!n.is("documentSelection"))return;const i=this.editor.model,s=this.editor.plugins.get(Mk),o=this.editor.plugins.get(Ww),r=this.getTableIfOnlyTableInContent(t,i);if(!r)return;
13const a=s.getSelectionAffectedTableCells(i.document.selection);a.length?(e.stop(),t.is("documentFragment")?o._pasteMarkersIntoTransformedElement(t.markers,e=>this._replaceSelectedCells(r,a,e)):this.editor.model.change(e=>{this._replaceSelectedCells(r,a,e)})):Ck(r,s)}_replaceSelectedCells(e,t,n){const i=this.editor.plugins.get(Mk),s={width:i.getColumns(e),height:i.getRows(e)},o=function(e,t,n,i){const s=e[0].findAncestor("table"),o=i.getColumnIndexes(e),r=i.getRowIndexes(e),a={firstColumn:o.first,lastColumn:o.last,firstRow:r.first,lastRow:r.last},l=1===e.length;l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,n,i){const s=i.getColumns(e),o=i.getRows(e);n>s&&i.insertColumns(e,{at:s,columns:n-s});t>o&&i.insertRows(e,{at:o,rows:t-o})}(s,a.lastRow+1,a.lastColumn+1,i));l||!i.isSelectionRectangular(e)?function(e,t,n){const{firstRow:i,lastRow:s,firstColumn:o,lastColumn:r}=t,a={first:i,last:s},l={first:o,last:r};lC(e,o,a,n),lC(e,r+1,a,n),aC(e,i,l,n),aC(e,s+1,l,n,i)}(s,a,n):(a.lastRow=xk(s,a),a.lastColumn=Ak(s,a));return a}(t,s,n,i),r=o.lastRow-o.firstRow+1,a=o.lastColumn-o.firstColumn+1;e=gk(e,{startRow:0,startColumn:0,endRow:Math.min(r,s.height)-1,endColumn:Math.min(a,s.width)-1},n);
13const l=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,s,l,o,n);if(this.editor.plugins.get("TableSelection").isEnabled){const e=i.sortRanges(c.map(e=>n.createRangeOn(e)));n.setSelection(e)}else n.setSelection(c[0],0);return l}_replaceSelectedCellsWithPasted(e,t,n,i,s){const{width:o,height:r}=t,a=function(e,t,n){const i=new Array(n).fill(null).map(()=>new Array(t).fill(null));for(const{column:s,row:o,cell:r}of new ok(e))i[o][s]=r;return i}(e,o,r),l=[...new ok(n,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];let h;for(const g of l){const{row:e,column:t}=g;t===i.firstColumn&&(h=g.getPositionBefore());const n=e-i.firstRow,l=t-i.firstColumn,u=a[n%r][l%o],d=u?s.cloneElement(u):null,f=this._replaceTableSlotCell(g,d,h,s);f&&(yk(f,e,t,i.lastRow,i.lastColumn,s),c.push(f),h=s.createPositionAfter(f))}const u=parseInt(n.getAttribute("headingRows")||"0"),d=parseInt(n.getAttribute("headingColumns")||"0"),f=i.firstRow<u&&u<=i.lastRow,m=i.firstColumn<d&&d<=i.lastColumn;if(f){const e=aC(n,u,{first:i.firstColumn,last:i.lastColumn},s,i.firstRow);c.push(...e)}if(m){const e=lC(n,d,{first:i.firstRow,last:i.lastRow},s);c.push(...e)}return c}_replaceTableSlotCell(e,t,n,i){const{cell:s,isAnchor:o}=e;return o&&i.remove(s),t?(i.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const n=t.createRangeIn(e);for(const i of n.getItems())if(i.is("element","table")){const e=t.createRange(n.start,t.createPositionBefore(i));if(t.hasContent(e,{ignoreWhitespaces:!0}))return null;const s=t.createRange(t.createPositionAfter(i),n.end);return t.hasContent(s,{ignoreWhitespaces:!0})?null:i}return null}}function aC(e,t,n,i,s=0){if(t<1)return;return pk(e,t,s).filter(({column:e,cellWidth:t})=>cC(e,t,n)).map(({cell:e})=>wk(e,t,i))}function lC(e,t,n,i){if(t<1)return;return bk(e,t).filter(({row:e,cellHeight:t})=>cC(e,t,n)).map(({cell:e,column:n})=>_k(e,n,t,i))}function cC(e,t,n){const i=e+t-1,{first:s,last:o}=n;return e>=s&&e<=o||e<s&&i>=s}class hC extends Bu{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[oC,Mk]}init(){const e=this.editor,t=e.editing.view.document,n=e.t;this.listenTo(t,"arrowKey",(...e)=>this._onArrowKey(...e),{context:"table"}),this.listenTo(t,"tab",(...e)=>this._handleTabOnSelectedTable(...e),{context:"figure"}),this.listenTo(t,"tab",(...e)=>this._handleTab(...e),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:n("Keystrokes that can be used in a table cell"),keystrokes:[{label:n("Move the selection to the next cell"),keystroke:"Tab"},{label:n("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:n("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:n("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const n=this.editor,i=n.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),n.model.change(e=>{e.setSelection(e.createRangeIn(i.getChild(0).getChild(0)))}))}_handleTab(e,t){const n=this.editor,i=this.editor.plugins.get(Mk),s=this.editor.plugins.get("TableSelection"),o=n.model.document.selection,r=!t.shiftKey;let a=i.getTableCellsContainingSelection(o)[0];if(a||(a=s.getFocusCell()),!a)return;t.preventDefault(),t.stopPropagation(),e.stop();const l=a.parent,c=l.parent,h=c.getChildIndex(l),u=l.getChildIndex(a),d=0===u;if(!r&&d&&0===h)return void n.model.change(e=>{e.setSelection(e.createRangeOn(c))});const f=u===l.childCount-1,m=h===i.getRows(c)-1;if(r&&m&&f&&(n.execute("insertTableRowBelow"),h===i.getRows(c)-1))return void n.model.change(e=>{e.setSelection(e.createRangeOn(c))});let g;if(r&&f){const e=c.getChild(h+1);g=e.getChild(0)}else if(!r&&d){const e=c.getChild(h-1);g=e.getChild(e.childCount-1)}else g=l.getChild(u+(r?1:-1));n.model.change(e=>{e.setSelection(e.createRangeIn(g))})}_onArrowKey(e,t){const n=this.editor,i=Jo(t.keyCode,n.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const n=this.editor.plugins.get(Mk),i=this.editor.plugins.get("TableSelection"),s=this.editor.model,o=s.document.selection,r=["right","down"].includes(e),a=n.get
13SelectedTableCells(o);if(a.length){let n;return n=t?i.getFocusCell():r?a[a.length-1]:a[0],this._navigateFromCellInDirection(n,e,t),!0}const l=o.focus.findAncestor("tableCell");if(!l)return!1;if(!o.isCollapsed)if(t){if(o.isBackward==r&&!o.containsEntireContent(l))return!1}else{const e=o.getSelectedElement();if(!e||!s.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(o,l,r)&&(this._navigateFromCellInDirection(l,e,t),!0)}_isSelectionAtCellEdge(e,t,n){const i=this.editor.model,s=this.editor.model.schema,o=n?e.getLastPosition():e.getFirstPosition();if(!s.getLimitElement(o).is("element","tableCell")){return i.createPositionAt(t,n?"end":0).isTouching(o)}const r=i.createSelection(o);return i.modifySelection(r,{direction:n?"forward":"backward"}),o.isEqual(r.focus)}_navigateFromCellInDirection(e,t,n=!1){const i=this.editor.model,s=e.findAncestor("table"),o=[...new ok(s,{includeAllSlots:!0})],{row:r,column:a}=o[o.length-1],l=o.find(({cell:t})=>t==e);let{row:c,column:h}=l;switch(t){case"left":h--;break;case"up":c--;break;case"right":h+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>r||h<0&&c<=0||h>a&&c>=r)return void i.change(e=>{e.setSelection(e.createRangeOn(s))});h<0?(h=n?0:a,c--):h>a&&(h=n?a:0,c++);const u=o.find(e=>e.row==c&&e.column==h).cell,d=["right","down"].includes(t),f=this.editor.plugins.get("TableSelection");if(n&&f.isEnabled){const t=f.getAnchorCell()||e;f.setCellSelection(t,u)}else{const e=i.createPositionAt(u,d?0:"end");i.change(t=>{t.setSelection(e)})}}}class uC extends Ka{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}}class dC extends Bu{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[oC,Mk]}init(){this.editor.editing.view.addObserver(uC),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(Mk);let n=!1;const i=e.plugins.get(oC);this.listenTo(e.editing.view.document,"mousedown",(s,o)=>{const r=e.model.document.selection;if(!this.isEnabled||!i.isEnabled)return;if(!o.domEvent.shiftKey)return;const a=i.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const l=this._getModelTableCellFromDomEvent(o);l&&fC(a,l)&&(n=!0,i.setCellSelection(a,l),o.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{n&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,i=!1,s=!1;const o=e.plugins.get(oC);this.listenTo(e.editing.view.document,"mousedown",(e,n)=>{this.isEnabled&&o.isEnabled&&(n.domEvent.shiftKey||n.domEvent.ctrlKey||n.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(n)))}),this.listenTo(e.editing.view.document,"mousemove",(e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(r);a&&fC(t,a)&&(n=a,i||n==t||(i=!0)),i&&(s=!0,o.setCellSelection(t,n),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1,s=!1,t=null,n=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{s&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function fC(e,t){return e.parent.parent==t.parent.parent}class mC extends Bu{static get requires(){return[eC,iC,oC,dC,hC,rC,Nw]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}const gC={uk:{dictionary:{"Words: %0":"Слова: %0","Characters: %0":"Символи: %0","Widget toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв вÑджеÑÑв","Insert paragraph before block":"ÐодаÑи Ð°Ð±Ð·Ð°Ñ Ð¿ÐµÑед блоком","Insert paragraph after block":"ÐодаÑи Ð°Ð±Ð·Ð°Ñ Ð¿ÑÑÐ»Ñ Ð±Ð»Ð¾ÐºÐ°","Press Enter to type after or press Shift + Enter to type before the widget":"ÐаÑиÑнÑÑÑ Enter, Ñоб дÑÑкÑваÑи пÑÑÐ»Ñ Ð°Ð±Ð¾ наÑиÑнÑÑÑ Shift + Enter, Ñоб дÑÑкÑваÑи пеÑед вÑджеÑом","Keystrokes that can be used when a widget is selected (for example: image, table, etc.)":"ÐаÑиÑÐºÐ°Ð½Ð½Ñ ÐºÐ»Ð°Ð²ÑÑ, ÑÐºÑ Ð¼Ð¾Ð¶Ð½Ð° викоÑиÑÑовÑваÑи, коли вибÑано вÑÐ´Ð¶ÐµÑ (напÑиклад: зобÑаженнÑ, ÑаблиÑÑ ÑоÑо)","Insert a new paragraph directly after a widget":"Ð
13ÑÑавиÑи новий Ð°Ð±Ð·Ð°Ñ Ð±ÐµÐ·Ð¿Ð¾ÑеÑеднÑо пÑÑÐ»Ñ Ð²ÑджеÑа","Insert a new paragraph directly before a widget":"ÐÑÑавиÑи новий Ð°Ð±Ð·Ð°Ñ Ð±ÐµÐ·Ð¿Ð¾ÑеÑеднÑо пеÑед вÑджеÑом","Move the caret to allow typing directly before a widget":"ÐеÑемÑÑÑÑÑÑ ÐºÑÑÑоÑ, Ñоб дозволиÑи Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ñ Ð±ÐµÐ·Ð¿Ð¾ÑеÑеднÑо пеÑед вÑджеÑом","Move the caret to allow typing directly after a widget":"ÐеÑемÑÑÑÑÑÑ ÐºÑÑÑоÑ, Ñоб дозволиÑи Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ñ Ð±ÐµÐ·Ð¿Ð¾ÑеÑеднÑо пÑÑÐ»Ñ Ð²ÑджеÑа","Move focus from an editable area back to the parent widget":"ÐеÑемÑÑÐµÐ½Ð½Ñ ÑокÑÑÑ Ð· облаÑÑÑ ÑедагÑÐ²Ð°Ð½Ð½Ñ Ð½Ð°Ð·Ð°Ð´ до баÑÑкÑвÑÑкого вÑджеÑа","Upload in progress":"ÐиконÑÑÑÑÑÑ Ð·Ð°Ð²Ð°Ð½ÑаженнÑ",Undo:"ÐÑдмÑна",Redo:"ÐовÑоÑ","Rich Text Editor":"РозÑиÑений ÑекÑÑовий ÑедакÑоÑ","Edit block":"РедагÑваÑи блок","Click to edit block":"ÐлаÑнÑÑÑ, Ñоб ÑедагÑваÑи блок","Drag to move":"ÐоÑÑгнÑÑÑ, Ñоб пеÑемÑÑÑиÑи",Next:"ÐаÑÑÑпний",Previous:"ÐопеÑеднÑй","Editor toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв ÑедакÑоÑа","Dropdown toolbar":"ÐипадаÑÑа Ð¿Ð°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв","Dropdown menu":"ÐипадаÑÑе менÑ",Black:"ЧоÑний","Dim grey":"Темно-ÑÑÑий",Grey:"СÑÑий","Light grey":"СвÑÑло-ÑÑÑий",White:"ÐÑлий",Red:"ЧеÑвоний",Orange:"ÐомаÑанÑевий",Yellow:"ÐовÑий","Light green":"СвÑÑло-зелений",Green:"Ðелений",Aquamarine:"ÐквамаÑиновий",Turquoise:"ÐÑÑÑзовий","Light blue":"СвÑÑло-ÑинÑй",Blue:"СинÑй",Purple:"ФÑолеÑовий","Editor block content toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв вмÑÑÑÑ Ð±Ð»Ð¾ÐºÑ ÑедакÑоÑа","Editor contextual toolbar":"ÐонÑекÑÑна Ð¿Ð°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв ÑедакÑоÑа",HEX:"ШÑÑÑнадÑÑÑковий","No results found":"ÐÑÑого не знайдено","No searchable items":"ÐÐµÐ¼Ð°Ñ ÑÑканиÑ
об'ÑкÑÑв","Editor dialog":"ÐÑалогове вÑкно ÑедакÑоÑа",Close:"ÐакÑиÑи","Help Contents. To close this dialog press ESC.":"ÐмÑÑÑ Ð´Ð¾Ð²Ñдки. Щоб закÑиÑи Ñе дÑалогове вÑкно, наÑиÑнÑÑÑ ESC.","Below, you can find a list of keyboard shortcuts that can be used in the editor.":"ÐижÑе ви можеÑе знайÑи ÑпиÑок комбÑнаÑÑй клавÑÑ, ÑÐºÑ Ð¼Ð¾Ð¶Ð½Ð° викоÑиÑÑовÑваÑи в ÑедакÑоÑÑ.","(may require <kbd>Fn</kbd>)":"(може вимагаÑи <kbd>Fn</kbd>)",Accessibility:"ÐоÑÑÑпнÑÑÑÑ","Accessibility help":"ÐовÑдка Ñодо доÑÑÑпноÑÑÑ","Press %0 for help.":"ÐаÑиÑнÑÑÑ %0 Ð´Ð»Ñ Ð´Ð¾Ð²Ñдки.","Move focus in and out of an active dialog window":"ÐеÑемÑÑÐµÐ½Ð½Ñ ÑокÑÑа в акÑÐ¸Ð²Ð½Ð¾Ð¼Ñ Ð´ÑÐ°Ð»Ð¾Ð³Ð¾Ð²Ð¾Ð¼Ñ Ð²ÑÐºÐ½Ñ Ñа з нÑого",MENU_BAR_MENU_FILE:"Файл",MENU_BAR_MENU_EDIT:"РедагÑваÑи",MENU_BAR_MENU_VIEW:"ÐÑедÑÑавленнÑ",MENU_BAR_MENU_INSERT:"ÐÑÑавиÑи",MENU_BAR_MENU_FORMAT:"ФоÑмаÑ",MENU_BAR_MENU_TOOLS:"ÐнÑÑÑÑменÑи",MENU_BAR_MENU_HELP:"Ðопомога",MENU_BAR_MENU_TEXT:"ТекÑÑ",MENU_BAR_MENU_FONT:"ШÑиÑÑ","Editor menu bar":"Ð Ñдок Ð¼ÐµÐ½Ñ ÑедагÑваннÑ",'Please enter a valid color (e.g. "ff0000").':'ÐÑÐ´Ñ Ð»Ð°Ñка, введÑÑÑ Ð´ÑйÑний колÑÑ (напÑ. "ff0000").',"Insert table":"ÐÑÑавиÑи ÑаблиÑÑ","Header column":"Ðаголовок ÑÑовпÑÑ","Insert column left":"ÐÑÑавиÑи ÑÑовпеÑÑ Ð·Ð»Ñва","Insert column right":"ÐÑÑавиÑи ÑÑовпеÑÑ ÑпÑава","Delete column":"ÐидалиÑи ÑÑовпеÑÑ","Select column":"ÐибеÑÑÑÑ ÑÑовпÑик",Column:"СÑовпеÑÑ","Header row":"Ðаголовок ÑÑдка","Insert row below":"ÐÑÑавиÑи ÑÑдок звеÑÑ
Ñ","Insert row above":"ÐÑÑавиÑи ÑÑдок знизÑ","Delete row":"ÐидалиÑи ÑÑдок","Select row":"ÐибеÑÑÑÑ ÑÑдок",Row:"Ð Ñдок","Merge cell up":"ÐоÑднаÑи Ð
13ºÐ¾Ð¼ÑÑки вгоÑÑ","Merge cell right":"ÐоÑднаÑи комÑÑки пÑавоÑÑÑ","Merge cell down":"ÐоÑднаÑи комÑÑки внизÑ","Merge cell left":"ÐоÑднаÑи комÑÑки лÑвоÑÑÑ","Split cell vertically":"РоздÑлиÑи комÑÑки веÑÑикалÑно","Split cell horizontally":"РоздÑлиÑи комÑÑки гоÑизонÑалÑно","Merge cells":"ÐоÑднаÑи комÑÑки","Table toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв ÑаблиÑÑ","Table properties":"ÐлаÑÑивоÑÑÑ ÑаблиÑÑ","Cell properties":"ÐлаÑÑивоÑÑÑ ÐºÐ¾Ð¼ÑÑок",Border:"Ðежа",Style:"СÑилÑ",Width:"ШиÑина",Height:"ÐиÑоÑа",Color:"ÐолÑÑ",Background:"Фон",Padding:"ÐаповненнÑ",Dimensions:"РозмÑÑи","Table cell text alignment":"ÐиÑÑвнÑÐ²Ð°Ð½Ð½Ñ ÑекÑÑÑ ÐºÐ¾Ð¼ÑÑки",Alignment:"ÐиÑÑвнÑваннÑ","Horizontal text alignment toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв виÑÑвнÑÐ²Ð°Ð½Ð½Ñ Ð³Ð¾ÑизонÑалÑного ÑекÑÑÑ","Vertical text alignment toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв веÑÑикалÑного виÑÑвнÑÐ²Ð°Ð½Ð½Ñ ÑекÑÑÑ","Table alignment toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв виÑÑвнÑÐ²Ð°Ð½Ð½Ñ ÑаблиÑÑ",None:"Ðе вказано",Solid:"СÑÑÑлÑний",Dotted:"ТоÑкова",Dashed:"ÐÑнкÑиÑна",Double:"ÐодвÑйна",Groove:"ÐолобÑаÑÑа",Ridge:"РебÑиÑÑа",Inset:"УгнÑÑа",Outset:"ÐипÑкла","Align cell text to the left":"ÐиÑÑвнÑÑи ÑекÑÑ Ð¿Ð¾ лÑÐ²Ð¾Ð¼Ñ ÐºÑаÑ","Align cell text to the center"
13:"ÐиÑÑвнÑÑи ÑекÑÑ Ð¿Ð¾ ÑенÑÑÑ","Align cell text to the right":"ÐиÑÑвнÑÑи ÑекÑÑ Ð¿Ð¾ пÑÐ°Ð²Ð¾Ð¼Ñ ÐºÑаÑ","Justify cell text":"ÐиÑÑвнÑÑи ÑекÑÑ Ð¿Ð¾ ÑиÑÐ¸Ð½Ñ ","Align cell text to the top":"ÐиÑÑвнÑÑи ÑекÑÑ ÐºÐ¾Ð¼ÑÑки по веÑÑ
Ñ ","Align cell text to the middle":"ÐиÑÑвнÑÑи ÑекÑÑ ÐºÐ¾Ð¼ÑÑки по ÑеÑединÑ","Align cell text to the bottom":"ÐиÑÑвнÑÑи ÑекÑÑ ÐºÐ¾Ð¼ÑÑки по низÑ","Align table to the left":"ÐиÑÑвнÑÑи ÑаблиÑÑ Ð¿Ð¾ лÑÐ²Ð¾Ð¼Ñ ÐºÑаÑ","Center table":"ÐÑдÑенÑÑÑваÑи ÑаблиÑÑ","Align table to the right":"ÐиÑÑвнÑÑи ÑаблиÑÑ Ð¿Ð¾ пÑÐ°Ð²Ð¾Ð¼Ñ ÐºÑÐ°Ñ ",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'ÐолÑÑ Ð½ÐµÐ´ÑйÑний. СпÑобÑйÑе "#FF0000" або "rgb(255,0,0)" або "red"','The value is invalid. Try "10px" or "2em" or simply "2".':'ÐнаÑÐµÐ½Ð½Ñ Ð½ÐµÐ´ÑйÑне. СпÑобÑйÑе "10px" або "2em" або пÑоÑÑо "2"',"Enter table caption":"ÐведÑÑÑ Ð¿ÑÐ´Ð¿Ð¸Ñ ÑаблиÑÑ","Keystrokes that can be used in a table cell":"ÐаÑиÑÐºÐ°Ð½Ð½Ñ ÐºÐ»Ð°Ð²ÑÑ, ÑÐºÑ Ð¼Ð¾Ð¶Ð½Ð° викоÑиÑÑовÑваÑи в комÑÑÑÑ ÑаблиÑÑ","Move the selection to the next cell":"Move the selection to the next cell","Move the selection to the previous cell":"ÐеÑемÑÑÑиÑи видÑÐ»ÐµÐ½Ð½Ñ Ð² попеÑÐµÐ´Ð½Ñ ÐºÐ»ÑÑинкÑ","Insert a new table row (when in the last cell of a table)":"ÐÑÑавиÑи новий ÑÑдок ÑаблиÑÑ (ÑкÑо в оÑÑаннÑй клÑÑинÑÑ ÑаблиÑÑ)","Navigate through the table":"ÐавÑгаÑÑÑ Ð¿Ð¾ ÑаблиÑÑ",Table:"ТаблиÑÑ",Styles:"СÑилÑ","Multiple styles":"ÐÑлÑка ÑÑилÑв","Block styles":"СÑÐ¸Ð»Ñ Ð±Ð»Ð¾ÐºÑ","Text styles":"СÑÐ¸Ð»Ñ ÑекÑÑÑ","Special characters":"СпеÑÑалÑÐ½Ñ Ñимволи",Category:"ÐаÑегоÑÑÑ",All:"УÑÑ",Arrows:"СÑÑÑлки",Currency:"ÐалÑÑа",Latin:"ÐаÑинÑÑкÑ",Mathematical:"ÐаÑемаÑиÑнÑ",Text:"ТекÑÑ","leftwards simple arrow":"пÑоÑÑа ÑÑÑÑлка влÑво","rightwards simple arrow":"пÑоÑÑа ÑÑÑÑлка впÑаво","upwards simple arrow":"пÑоÑÑа ÑÑÑÑлка вгоÑÑ","downwards simple arrow":"пÑоÑÑа ÑÑÑÑлка вниз","leftwards double arrow":"подвÑйна ÑÑÑÑлка влÑво","rightwards double arrow":"подвÑйна ÑÑÑÑлка впÑаво","upwards double arrow":"подвÑйна ÑÑÑÑлка вгоÑÑ","downwards double arrow":"подвÑйна ÑÑÑÑлка вниз","leftwards dashed arrow":"пÑнкÑиÑна ÑÑÑÑлка влÑво","rightwards dashed arrow":"пÑнкÑиÑна ÑÑÑÑлка впÑаво","upwards dashed arrow":"пÑнкÑиÑна ÑÑÑÑлка вгоÑÑ","downwards dashed arrow":"пÑнкÑиÑна ÑÑÑÑлка вниз","leftwards arrow to bar":"ÑÑÑÑлка влÑво до блокÑ","rightwards arrow to bar":"ÑÑÑÑлка впÑаво до блокÑ","upwards arrow to bar":"ÑÑÑÑлка вгоÑÑ Ð´Ð¾ блокÑ","downwards arrow to bar":"ÑÑÑÑлка вниз до блокÑ","up down arrow with base":"ÑÑÑÑлка вгоÑÑ-вниз Ñз оÑновоÑ","back with leftwards arrow above":"back Ð·Ñ ÑÑÑÑÐ»ÐºÐ¾Ñ Ð²Ð»Ñво звеÑÑ
Ñ","end with leftwards arrow above":"end Ð·Ñ ÑÑÑÑÐ»ÐºÐ¾Ñ Ð²Ð»Ñво звеÑÑ
Ñ","on with exclamation mark with left right arrow above":"on Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ Ð¾ÐºÐ»Ð¸ÐºÑ Ð·Ñ ÑÑÑÑÐ»ÐºÐ¾Ñ Ð²Ð»Ñво-впÑаво звеÑÑ
Ñ","soon with rightwards arrow above":"soon Ð·Ñ ÑÑÑÑÐ»ÐºÐ¾Ñ Ð²Ð¿Ñаво звеÑÑ
Ñ","top with upwards arrow above":"top Ð·Ñ ÑÑÑÑÐ»ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ Ð·Ð²ÐµÑÑ
Ñ","Dollar sign":"Символ долаÑа","Euro sign":"Символ ÑвÑо","Yen sign":"Символ Ñни","Pound sign":"Символ ÑÑнÑа","Cent sign":"Символ ÑенÑа","Euro-currency sign":"Символ ÑвÑовалÑÑи","Colon sign":"Символ двокÑапки","Cruzeiro sign":"Символ кÑÑзейÑо","French franc sign":"Символ ÑÑанÑÑзÑкого ÑÑанка","Lira sign":"Символ лÑÑи","Currency sign":"Символ валÑÑи","Bitcoin sign":"Символ бÑÑкоÑна","Mill sign":"Символ мÑлÑйона","Naira sign":"Символ найÑи","Peseta sign":"Символ пеÑеÑи","Rupee sign":"Символ ÑÑпÑÑ","Won sign":"Символ вони","New sheqel sign":"Символ нового ÑекелÑ","Dong sign":"Символ донга","Kip sign":"Символ кÑпа","Tugrik sign":"Символ ÑÑгÑика","Drachma sign":"Символ дÑаÑ
ми","German penny sign":"Символ нÑмеÑÑкого пеннÑ","Peso sign":"Символ пеÑо","Guarani sign":"Символ гÑаÑанÑ","Austral sign":"Символ аÑÑÑÑала","Hryvnia sign":"Символ гÑивнÑ","Cedi sign":"Символ ÑедÑ","Livre tournois sign":"Символ ÑÑÑÑÑкого лÑвÑÑ","Spesmilo sign":"Символ ÑпеÑмÑло","Tenge sign":"Символ Ñенге","Indian rupee sign":"Символ ÑндÑйÑÑÐºÐ¾Ñ ÑÑпÑÑ","Turkish lira sign":"Символ ÑÑÑеÑÑÐºÐ¾Ñ Ð»ÑÑи","Nordic mark sign":"Символ ноÑдиÑÐ½Ð¾Ñ Ð¼Ð°Ñки","Manat sign":"Символ манаÑа","Ruble sign":"Символ ÑÑблÑ","Latin capital letter a with macron":"ÐаÑинÑÑка велика лÑÑеÑа а Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin small letter a with macron":"ÐаÑинÑÑка мала лÑÑеÑа а Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin capital letter a with breve":"ÐаÑинÑÑка велика лÑÑеÑа а з бÑевÑÑом","Latin small letter a with breve":"ÐаÑинÑÑка мала лÑÑеÑа а з бÑевÑÑом","Latin capital letter a with ogonek":"ÐаÑинÑÑка велика лÑÑеÑа а з Ñ
воÑÑиком","Latin small letter a with ogonek":"ÐаÑинÑÑка мала лÑÑеÑа а з Ñ
воÑÑиком","Latin capital letter c with acute":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· гоÑÑÑим наголоÑом","Latin small letter c with acute":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· гоÑÑÑим наголоÑом","Latin capital letter c with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· даÑком","Latin small letter c with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· даÑком","Latin capital letter c with dot above":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· кÑÐ°Ð¿ÐºÐ¾Ñ Ð·Ð³Ð¾Ñи","Latin small letter c with dot above":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· кÑÐ°Ð¿ÐºÐ¾Ñ Ð·Ð³Ð¾Ñи","Latin capital letter c with caron":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· пÑаÑкоÑ","Latin small letter c with caron":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· пÑаÑкоÑ","Latin capital letter d with caron":"ÐаÑинÑÑка велика лÑÑеÑа d з пÑаÑкоÑ","Latin small letter d with caron":"ÐаÑинÑÑка мала лÑÑеÑа d з пÑаÑкоÑ","Latin capital letter d with stroke":"ÐаÑинÑÑка велика лÑÑеÑа d з ÑиÑкоÑ","Latin small letter d with stroke":"ÐаÑинÑÑка мала лÑÑеÑа d з ÑиÑкоÑ","Latin capital letter e with macron":"ÐаÑинÑÑка велика лÑÑеÑа е Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin small letter e with macron":"ÐаÑинÑÑка мала лÑÑеÑа е Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin capital letter e with breve":"ÐаÑинÑÑка велика лÑÑеÑа е з бÑевÑÑом","Latin small letter e with breve":"ÐаÑинÑÑка мала лÑÑеÑа е з бÑевÑÑом","Latin capital letter e with dot above":"ÐаÑинÑÑка велика лÑÑеÑа е з кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin small letter e with dot above":"ÐаÑинÑÑка мала лÑÑеÑа е з кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin capital letter e with ogonek":"ÐаÑинÑÑка велика лÑÑеÑа е з Ñ
воÑÑиком","Latin small letter e with ogonek":"ÐаÑинÑÑка мала лÑÑеÑа е з Ñ
воÑÑиком","Latin capital letter e with caron":"ÐаÑинÑÑка велика лÑÑеÑа е з пÑаÑкоÑ","Latin small letter e with caron":"ÐаÑинÑÑка мала лÑÑеÑа е з пÑаÑкоÑ","Latin capital letter g with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа g з даÑком","Latin small letter g with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа g з даÑком","Latin capital letter g with breve":"ÐаÑинÑÑка велика лÑÑеÑа g з бÑевÑÑом","Latin small letter g with breve":"ÐаÑинÑÑка мала лÑÑеÑа g з бÑевÑÑом","Latin capital letter g with dot above":"ÐаÑинÑÑка велика лÑÑеÑа g з кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin small letter g with dot above":"ÐаÑинÑÑка мала лÑÑеÑа g з кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin capital letter g with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа g з Ñедилем","Latin small letter g with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа g з Ñедилем","Latin capital letter h with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа h з даÑком","Latin small letter h with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа h з даÑком","Latin capital letter h with stroke":"ÐаÑинÑÑка велика лÑÑеÑа h з ÑиÑкоÑ","Latin small letter h with stroke":"ÐаÑинÑÑка мала лÑÑеÑа h з ÑиÑкоÑ","Latin capital letter i with tilde":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· ÑилÑдоÑ","Latin small letter i with tilde":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· ÑилÑдоÑ","Latin capital letter i with macron":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin small letter i with macron":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin capital letter i with breve":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· бÑевÑÑом","Latin small letter i with breve":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· бÑевÑÑом","Latin capital letter i with ogonek":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· пÑаÑкоÑ","Latin small letter i with ogonek":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð· пÑаÑкоÑ","Latin capital letter i with dot above":"ÐаÑинÑÑка велика лÑÑеÑа Ñ Ð· кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin small letter dotless i":"ÐаÑинÑÑка мала лÑÑеÑа Ñ Ð±ÐµÐ· кÑапки","Latin capital ligature ij":"ÐаÑинÑÑка велика лÑгаÑÑÑа ij","Latin small ligature ij":"ÐаÑинÑÑка мала лÑгаÑÑÑа ij","Latin capital letter j with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа j Ð
13· даÑком","Latin small letter j with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа j з даÑком","Latin capital letter k with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа k з Ñедилем","Latin small letter k with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа k з Ñедилем","Latin small letter kra":"ÐаÑинÑÑка мала лÑÑеÑа kra","Latin capital letter l with acute":"ÐаÑинÑÑка велика лÑÑеÑа l з гоÑÑÑим наголоÑом","Latin small letter l with acute":"ÐаÑинÑÑка мала лÑÑеÑа l з гоÑÑÑим наголоÑом","Latin capital letter l with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа l Ñз Ñедилем","Latin small letter l with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа l Ñз Ñедилем","Latin capital letter l with caron":"ÐаÑинÑÑка велика лÑÑеÑа l Ñз пÑаÑкоÑ","Latin small letter l with caron":"ÐаÑинÑÑка мала лÑÑеÑа l Ñз пÑаÑкоÑ","Latin capital letter l with middle dot":"ÐаÑинÑÑка велика лÑÑеÑа l з ÑеÑеднÑÐ¾Ñ ÐºÑапкоÑ","Latin small letter l with middle dot":"ÐаÑинÑÑка мала лÑÑеÑа l з ÑеÑеднÑÐ¾Ñ ÐºÑапкоÑ","Latin capital letter l with stroke":"ÐаÑинÑÑка велика лÑÑеÑа l з ÑиÑкоÑ","Latin small letter l with stroke":"ÐаÑинÑÑка мала лÑÑеÑа l з ÑиÑкоÑ","Latin capital letter n with acute":"ÐаÑинÑÑка велика лÑÑеÑа n з гоÑÑÑим наголоÑом","Latin small letter n with acute":"ÐаÑинÑÑка мала лÑÑеÑа n з гоÑÑÑим наголоÑом","Latin capital letter n with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа n Ñз Ñедилем","Latin small letter n with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа n Ñз Ñедилем","Latin capital letter n with caron":"ÐаÑинÑÑка велика лÑÑеÑа n Ñз пÑаÑкоÑ","Latin small letter n with caron":"ÐаÑинÑÑка мала лÑÑеÑа n Ñз пÑаÑкоÑ","Latin small letter n preceded by apostrophe":"ÐаÑинÑÑка мала лÑÑеÑа n з апоÑÑÑоÑом","Latin capital letter eng":"ÐаÑинÑÑÐºÑ Ð²ÐµÐ»Ð¸ÐºÑ Ð»ÑÑеÑи eng","Latin small letter eng":"ÐаÑинÑÑÐºÑ Ð¼Ð°Ð»Ñ Ð»ÑÑеÑи eng","Latin capital letter o with macron":"ÐаÑинÑÑка велика лÑÑеÑа о Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin small letter o with macron":"ÐаÑинÑÑка мала лÑÑеÑа о Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin capital letter o with breve":"ÐаÑинÑÑка велика лÑÑеÑа о з бÑевÑÑом","Latin small letter o with breve":"ÐаÑинÑÑка мала лÑÑеÑа о з бÑевÑÑом","Latin capital letter o with double acute":"ÐаÑинÑÑка велика лÑÑеÑа о з подвÑйним наголоÑом","Latin small letter o with double acute":"ÐаÑинÑÑка мала лÑÑеÑа о з подвÑйним наголоÑом","Latin capital ligature oe":"ÐаÑинÑÑка велика лÑгаÑÑÑа ое","Latin small ligature oe":"ÐаÑинÑÑка мала лÑгаÑÑÑа ое","Latin capital letter r with acute":"ÐаÑинÑÑка велика лÑÑеÑа r з гоÑÑÑим наголоÑом","Latin small letter r with acute":"ÐаÑинÑÑка мала лÑÑеÑа r з гоÑÑÑим наголоÑом","Latin capital letter r with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа r Ñз Ñедилем","Latin small letter r with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа r Ñз Ñедилем","Latin capital letter r with caron":"ÐаÑинÑÑка велика лÑÑеÑа r Ñз пÑаÑкоÑ","Latin small letter r with caron":"ÐаÑинÑÑка мала лÑÑеÑа r Ñз пÑаÑкоÑ","Latin capital letter s with acute":"ÐаÑинÑÑка велика лÑÑеÑа s Ñз гоÑÑÑим наголоÑом","Latin small letter s with acute":"ÐаÑинÑÑка мала лÑÑеÑа s Ñз гоÑÑÑим наголоÑом ","Latin capital letter s with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа s Ñз даÑком","Latin small letter s with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа s Ñз даÑком","Latin capital letter s with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа s Ñз Ñедилем","Latin small letter s with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа s Ñз Ñедилем","Latin capital letter s with caron":"ÐаÑинÑÑка велика лÑÑеÑа s Ñз пÑаÑкоÑ","Latin small letter s with caron":"ÐаÑинÑÑка мала лÑÑеÑа s Ñз пÑаÑкоÑ","Latin capital letter t with cedilla":"ÐаÑинÑÑка велика лÑÑеÑа t Ñз Ñедилем","Latin small letter t with cedilla":"ÐаÑинÑÑка мала лÑÑеÑа t Ñз Ñедилем","Latin capital letter t with caron":"ÐаÑинÑÑка велика лÑÑеÑа t Ñз пÑаÑкоÑ","Latin small letter t with caron":"ÐаÑинÑÑка мала лÑÑеÑа t Ñз пÑаÑкоÑ","Latin capital letter t with stroke":"ÐаÑинÑÑка велика лÑÑеÑа t Ñз ÑиÑкоÑ","Latin small letter t with stroke":"ÐаÑинÑÑка мала лÑÑеÑа t Ñз ÑиÑкоÑ","Latin capital letter u with tilde":"ÐаÑинÑÑка велика лÑÑеÑа u Ñз ÑилÑдоÑ","Latin small letter u with tilde":"ÐаÑинÑÑка мала лÑÑеÑа u Ñз ÑилÑдоÑ","Latin capital letter u with macron":"ÐаÑинÑÑка велика лÑÑеÑа u Ð·Ñ Ð
13·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin small letter u with macron":"ÐаÑинÑÑка мала лÑÑеÑа u Ð·Ñ Ð·Ð½Ð°ÐºÐ¾Ð¼ довгоÑи","Latin capital letter u with breve":"ÐаÑинÑÑка велика лÑÑеÑа u Ñз бÑевÑÑом","Latin small letter u with breve":"ÐаÑинÑÑка мала лÑÑеÑа u Ñз бÑевÑÑом","Latin capital letter u with ring above":"ÐаÑинÑÑка велика лÑÑеÑа u Ñз кÑлÑÑем вгоÑÑ","Latin small letter u with ring above":"ÐаÑинÑÑка мала лÑÑеÑа u Ñз кÑлÑÑем вгоÑÑ","Latin capital letter u with double acute":"ÐаÑинÑÑка велика лÑÑеÑа u Ñз подвÑйним наголоÑом","Latin small letter u with double acute":"ÐаÑинÑÑка мала лÑÑеÑа uÑз подвÑйним наголоÑом","Latin capital letter u with ogonek":"ÐаÑинÑÑка велика лÑÑеÑа u з Ñ
воÑÑиком","Latin small letter u with ogonek":"ÐаÑинÑÑка мала лÑÑеÑа u з Ñ
воÑÑиком","Latin capital letter w with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа w Ñз даÑком","Latin small letter w with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа w Ñз даÑком","Latin capital letter y with circumflex":"ÐаÑинÑÑка велика лÑÑеÑа y Ñз даÑком","Latin small letter y with circumflex":"ÐаÑинÑÑка мала лÑÑеÑа y Ñз даÑком","Latin capital letter y with diaeresis":"ÐаÑинÑÑка велика лÑÑеÑа y з ÑмлÑÑÑом","Latin capital letter z with acute":"ÐаÑинÑÑка велика лÑÑеÑа z з гоÑÑÑим наголоÑом","Latin small letter z with acute":"ÐаÑинÑÑка мала лÑÑеÑа z з гоÑÑÑим наголоÑом","Latin capital letter z with dot above":"ÐаÑинÑÑка велика лÑÑеÑа z з кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin small letter z with dot above":"ÐаÑинÑÑка мала лÑÑеÑа z з кÑÐ°Ð¿ÐºÐ¾Ñ Ð²Ð³Ð¾ÑÑ","Latin capital letter z with caron":"ÐаÑинÑÑка велика лÑÑеÑа z з пÑаÑкоÑ","Latin small letter z with caron":"ÐаÑинÑÑка мала лÑÑеÑа z з пÑаÑкоÑ","Latin small letter long s":"ÐаÑинÑÑка мала лÑÑеÑа довга s","Less-than sign":"Ðнак менÑе","Greater-than sign":"Ðнак бÑлÑÑе","Less-than or equal to":"ÐенÑе або доÑÑвнÑÑ","Greater-than or equal to":"ÐÑлÑÑе або доÑÑвнÑÑ","En dash":"ТиÑе","Em dash":"Ðовге ÑиÑе",Macron:"Ðнак довгоÑи",Overline:"РиÑка згоÑи","Degree sign":"Ðнак ÑÑÑпенÑ","Minus sign":"Ðнак мÑнÑÑ","Plus-minus sign":"Ðнак плÑÑ-мÑнÑÑ","Division sign":"Ðнак дÑленнÑ","Fraction slash":"РиÑка дÑобÑ","Multiplication sign":"Ðнак множеннÑ","Latin small letter f with hook":"ÐаÑинÑÑка мала лÑÑеÑа f з гаÑком",Integral:"ÐнÑегÑал","N-ary summation":"Сигма",Infinity:"ÐеÑкÑнÑеннÑÑÑÑ","Square root":"ÐвадÑаÑний коÑÑнÑ","Tilde operator":"ÐпеÑаÑÐ¾Ñ ÑилÑди","Approximately equal to":"ÐÑиблизно доÑÑвнÑÑ","Almost equal to":"Ðайже доÑÑвнÑÑ","Not equal to":"Ðе доÑÑвнÑÑ","Identical to":"ÐденÑиÑне до","Element of":"ÐлеменÑ","Not an element of":"Ðе елеменÑ","Contains as member":"ÐÑÑÑиÑÑ Ñк елеменÑ","N-ary product":"ÐÑ","Logical and":"ÐогÑÑний ÑполÑÑник and","Logical or":"ÐогÑÑний ÑполÑÑник or","Not sign":"Ðнак не",Intersection:"ÐеÑеÑин",Union:"ЮнÑон","Partial differential":"ЧаÑÑÐ¸Ð½Ð½Ñ Ð¿Ð¾Ñ
ÑднÑ","For all":"ÐÐ»Ñ Ð²ÑÑÑ
","There exists":"Там ÑÑнÑÑ","Empty set":"ÐоÑожнÑй набÑÑ",Nabla:"Ðабла","Asterisk operator":"ÐпеÑаÑÐ¾Ñ Ð·ÑÑоÑка","Proportional to":"ÐÑопоÑÑÑйно до",Angle:"ÐÑÑ","Vulgar fraction one quarter":"ÐвиÑайний дÑÑб одна ÑеÑвеÑÑа","Vulgar fraction one half":"ÐвиÑайний дÑÑб одна дÑÑга","Vulgar fraction three quarters":"ÐвиÑайний дÑÑб ÑÑи ÑеÑвеÑÑиÑ
","Single left-pointing angle quotation mark":"ÐдинаÑна лÑвоÑÑоÑÐ¾Ð½Ð½Ñ ÐºÑÑова лапка","Single right-pointing angle quotation mark":"ÐдинаÑна пÑавоÑÑоÑÐ¾Ð½Ð½Ñ ÐºÑÑова лапка","Left-pointing double angle quotation mark":"ÐодвÑÐ¹Ð½Ñ Ð»ÑвоÑÑоÑÐ¾Ð½Ð½Ñ ÐºÑÑÐ¾Ð²Ñ Ð»Ð°Ð¿ÐºÐ¸","Right-pointing double angle quotation mark":"ÐодвÑÐ¹Ð½Ñ Ð¿ÑавоÑÑоÑÐ¾Ð½Ð½Ñ ÐºÑÑÐ¾Ð²Ñ Ð»Ð°Ð¿ÐºÐ¸","Left single quotation mark":"ÐдинаÑна лÑва лапка","Right single quotation mark":"ÐдинаÑна пÑава лапка","Left double quotation mark":"ÐодвÑÐ¹Ð½Ñ Ð»ÑÐ²Ñ Ð»Ð°Ð¿ÐºÐ¸","Right double quotation mark":"ÐодвÑÐ¹Ð½Ñ Ð¿ÑÐ°Ð²Ñ Ð»Ð°Ð¿ÐºÐ¸","Single low-9 quotation mark":"ÐдинаÑна Ð½Ð¸Ð¶Ð½Ñ Ð»Ð°Ð¿ÐºÐ°","Double low-9 quotation mark":"ÐодвÑÐ¹Ð½Ñ Ð½Ð¸Ð¶Ð½Ñ Ð»Ð°Ð¿ÐºÐ¸","Inverted exclamation mark":"ÐеÑевеÑнÑÑий знак окликÑ","Inverted question mark":"ÐеÑевеÑнÑÑий знак пиÑаннÑ","Two dot leader":"ÐÑÐ´ÐµÑ Ñз двоÑ
кÑапок","Horizontal ellipsis":"ÐоÑизонÑалÑний елÑпÑ","Double dagger":"ÐодвÑйний Ñ
ÑеÑÑик","Per mille sign":"Ðнак пÑомÑле","Per ten thousand sign":"Ðнак на деÑÑÑÑ ÑиÑÑÑ","Double exclamation mark":"ÐодвÑйний знак окликÑ","Question exclamation mark":"Ðнак пиÑÐ°Ð½Ð½Ñ Ñ Ð·Ð½Ð°Ðº окликÑ","Exclamation question mark":"Ðнак Ð¾ÐºÐ»Ð¸ÐºÑ Ñ Ð·Ð½Ð°Ðº пиÑаннÑ","Double question mark":"ÐодвÑйний знак пиÑаннÑ","Copyright sign":"Ðнак авÑоÑÑÑкого пÑава","Registered sign":"Ðнак ÑеÑÑÑÑаÑÑÑ","Trade mark sign":"Ðнак ÑоÑÐ³Ð¾Ð²Ð¾Ñ Ð¼Ð°Ñки","Section sign":"Ðнак ÑоздÑлÑ","Paragraph sign":"Ðнак абзаÑÑ","Reversed paragraph sign":"ÐеÑевеÑнÑÑий знак абзаÑÑ",Source:"ÐжеÑело","Show source":"ÐоказаÑи джеÑело","Show blocks":"ÐоказаÑи блоки","Select all":"ÐибÑаÑи вÑе","Disable editing":"ÐимкнÑÑи ÑедагÑваннÑ","Enable editing":"УвÑ
13мкнÑÑи ÑедагÑваннÑ","Previous editable region":"ÐопеÑÐµÐ´Ð½Ñ Ð¾Ð±Ð»Ð°ÑÑÑ ÑедагÑваннÑ","Next editable region":"ÐаÑÑÑпна облаÑÑÑ ÑедагÑваннÑ","Navigate editable regions":"ÐавÑгаÑÑÑ Ð¿Ð¾ облаÑÑÑÑ
ÑедагÑваннÑ","Remove Format":"ÐидалиÑи ÑоÑмаÑÑваннÑ","Page break":"РозÑив cÑоÑÑнки","media widget":"медÑа вÑджеÑ","Media URL":"ÐедÑа URL","Paste the media URL in the input.":"ÐÑÑавÑе URL на медÑа в ÑнпÑÑ.","Tip: Paste the URL into the content to embed faster.":"ÐÑÑавÑе URL Ñ Ð²Ð¼ÑÑÑ Ð´Ð»Ñ Ñвидкого пеÑекладÑ.","The URL must not be empty.":"URL не повинен бÑÑи поÑожнÑм.","This media URL is not supported.":"Ðаний медÑа URL не пÑдÑÑимÑÑÑÑÑÑ.","Insert media":"ÐÑÑавиÑи медÑа",Media:"ÐедÑа","Media toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв медÑа","Open media in new tab":"ÐÑдкÑиÑи медÑа Ñ Ð½Ð¾Ð²Ñй вкладÑÑ","Numbered List":"ÐÑмеÑований ÑпиÑок","Bulleted List":"ÐаÑкеÑний ÑпиÑок","To-do List":"СпиÑок ÑпÑав","Bulleted list styles toolbar":"ÐÐ°Ð½ÐµÐ»Ñ Ð¼Ð°ÑкеÑниÑ
ÑпиÑкÑв","Numbered list styles toolbar":"ÐÐ°Ð½ÐµÐ»Ñ Ð½ÑмеÑованиÑ
ÑпиÑкÑв","Toggle the disc list style":"ÐеÑемкнÑÑи диÑковий ÑÑÐ¸Ð»Ñ ÑпиÑÐºÑ ","Toggle the circle list style":"ÐеÑемкнÑÑи кÑÑговий ÑÑÐ¸Ð»Ñ ÑпиÑкÑ","Toggle the square list style":"ÐеÑемкнÑÑи квадÑаÑний ÑÑÐ¸Ð»Ñ ÑпиÑкÑ","Toggle the decimal list style":"ÐеÑемкнÑÑи деÑÑÑковий ÑÑÐ¸Ð»Ñ ÑпиÑкÑ","Toggle the decimal with leading zero list style":"ÐеÑемкнÑÑи деÑÑÑковий ÑÑÐ¸Ð»Ñ ÑпиÑÐºÑ Ð· нÑлем на поÑаÑкÑ","Toggle the lowerâroman list style":"ÐеÑемкнÑÑи нижнÑо-ÑимÑÑкий ÑÑÐ¸Ð»Ñ ÑпиÑкÑ","Toggle the upperâroman list style":"ÐеÑемкнÑÑи веÑÑ
нÑо-ÑимÑÑкий ÑÑÐ¸Ð»Ñ ÑпиÑкÑ","Toggle the lowerâlatin list style":"ÐеÑемкнÑÑи нижнÑй лаÑинÑÑкий ÑÑÐ¸Ð»Ñ ÑпиÑкÑ","Toggle the upperâlatin list style":"ÐеÑемкнÑÑи веÑÑ
нÑй лаÑинÑÑкий ÑÑÐ¸Ð»Ñ ÑпиÑкÑ",Disc:"ÐÑÑг",Circle:"Ðоло",Square:"ÐвадÑаÑ",Decimal:"ЦиÑÑи","Decimal with leading zero":"ЦиÑÑи Ñз пÑовÑдним нÑлем","Lowerâroman":"ÐижнÑо-ÑимÑÑкий","Upper-roman":"ÐеÑÑ
нÑо-ÑимÑÑкий","Lower-latin":"ÐижнÑй лаÑинÑÑкий","Upper-latin":"ÐеÑÑ
нÑй лаÑинÑÑкий ","List properties":"СпиÑок влаÑÑивоÑÑей","Start at":"ÐоÑаÑок пÑи","Invalid start index value.":"ÐедÑйÑне поÑаÑкове знаÑÐµÐ½Ð½Ñ ÑндекÑÑ.","Start index must be greater than 0.":"ÐоÑаÑковий ÑÐ½Ð´ÐµÐºÑ Ð¼Ð°Ñ Ð±ÑÑи бÑлÑÑе 0.","Reversed order":"ÐвоÑоÑний поÑÑдок","Keystrokes that can be used in a list":"ÐаÑиÑÐºÐ°Ð½Ð½Ñ ÐºÐ»Ð°Ð²ÑÑ, ÑÐºÑ Ð¼Ð¾Ð¶Ð½Ð° викоÑиÑÑовÑваÑи в ÑпиÑкÑ","Increase list item indent":"ÐбÑлÑÑиÑи вÑдÑÑÑп елеменÑа ÑпиÑкÑ","Decrease list item indent":"ÐменÑиÑи вÑдÑÑÑп елеменÑа ÑпиÑкÑ","Entering a to-do list":"ÐÑ
одимо Ñ ÑпиÑок ÑпÑав","Leaving a to-do list":"ÐиÑ
одимо Ð·Ñ ÑпиÑÐºÑ ÑпÑав",Unlink:"ÐидалиÑи поÑиланнÑ",Link:"ÐоÑиланнÑ","Link URL":"URL поÑиланнÑ","Link URL must not be empty.":"URL-адÑеÑа поÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð½Ðµ може бÑÑи поÑожнÑоÑ.","Link image":"ÐоÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð·Ð¾Ð±ÑаженнÑ","Edit link":"РедагÑваÑи поÑиланнÑ","Open link in new tab":"ÐÑдкÑиÑи поÑÐ¸Ð»Ð°Ð½Ð½Ñ Ñ Ð½Ð¾Ð²Ñй вкладÑÑ","This link has no URL":"Це поÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð½Ðµ Ð¼Ð°Ñ URL","Open in a new tab":"ÐÑкÑиÑи Ñ Ð½Ð¾Ð²Ñй вкладÑÑ",Downloadable:"ÐаванÑажÑвалÑне","Create link":"СÑвоÑиÑи поÑиланнÑ","Move out of a link":"ÐийÑи з поÑиланнÑ",Language:"Ðова","Choose language":"ÐбÑаÑи мовÑ","Remove language":"ÐидалиÑи мовÑ","Increase indent":"ÐбÑлÑÑиÑи вÑдÑÑÑп","Decrease indent":"ÐменÑиÑи вÑдÑÑÑп","image widget":"Ð
13ÑÐ´Ð¶ÐµÑ Ð·Ð¾Ð±ÑаженнÑ","Wrap text":"ÐбеÑнÑÑи ÑекÑÑ","Break text":"РозÑÑваÑи ÑекÑÑÑ","In line":"Ð ÑекÑÑÑ","Side image":"Ðокове зобÑаженнÑ","Full size image":"Ðовний ÑозмÑÑ Ð·Ð¾Ð±ÑаженнÑ","Left aligned image":"ÐобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð»ÑвоÑÑÑ","Centered image":"ÐобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð¿Ð¾ ÑенÑÑÑ","Right aligned image":"ÐобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð¿ÑавоÑÑÑ","Change image text alternative":"ÐмÑниÑи ÑекÑÑÐ¾Ð²Ñ Ð°Ð»ÑÑеÑнаÑÐ¸Ð²Ñ Ð·Ð¾Ð±ÑаженнÑ","Text alternative":"ТекÑÑова алÑÑеÑнаÑива","Enter image caption":"ÐведÑÑÑ Ð¿ÑÐ´Ð¿Ð¸Ñ Ð·Ð¾Ð±ÑаженнÑ","Insert image":"ÐÑÑавиÑи зобÑаженнÑ","Replace image":"ÐамÑниÑи зобÑаженнÑ","Upload from computer":"ÐаванÑажиÑи з комп'ÑÑеÑа","Replace from computer":"ÐамÑниÑи з комп'ÑÑеÑа","Upload image from computer":"ÐаванÑажиÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð· комп'ÑÑеÑа","Image from computer":"ÐобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð· комп'ÑÑеÑа","From computer":"Ркомп'ÑÑеÑа","Replace image from computer":"ÐамÑниÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð· комп'ÑÑеÑа","Upload failed":"ÐаванÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð½Ðµ вдалоÑÑ","You have no image upload permissions.":"У Ð²Ð°Ñ Ð½ÐµÐ¼Ð°Ñ Ð¿Ñав на заванÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð¾Ð±ÑаженÑ.","Image toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв зобÑаженнÑ","Resize image":"РозÑÑгнÑÑи зобÑаженнÑ","Resize image to %0":"РозÑÑгнÑÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð´Ð¾ %0","Resize image to the original size":"РозÑÑгнÑÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð´Ð¾ оÑигÑналÑного ÑозмÑÑÑ","Resize image (in %0)":"ÐмÑниÑи ÑозмÑÑ Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð½Ñ (Ñ %0)",Original:"ÐÑигÑнал","Custom image size":"ÐлаÑний ÑозмÑÑ Ð·Ð¾Ð±ÑаженнÑ",Custom:"ÐлаÑний","Image resize list":"ÐеÑелÑк ÑозмÑÑÑв","Insert image via URL":"ÐÑÑавиÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ ÑеÑез поÑиланнÑ","Insert via URL":"ÐÑÑавиÑи за URL-адÑеÑоÑ","Image via URL":"ÐобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð° URL-адÑеÑоÑ","Via URL":"Ðа URL-адÑеÑоÑ","Update image URL":"ÐновиÑи поÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð½Ð° зобÑаженнÑ","Caption for the image":"ÐÑÐ´Ð¿Ð¸Ñ Ð´Ð¾ зобÑаженнÑ","Caption for image: %0":"ÐÑÐ´Ð¿Ð¸Ñ Ð´Ð¾ зобÑаженнÑ: %0","The value must not be empty.":"ÐнаÑÐµÐ½Ð½Ñ Ð½Ðµ може бÑÑи поÑожнÑм.","The value should be a plain number.":"ÐнаÑÐµÐ½Ð½Ñ Ð¼Ð°Ñ Ð²Ð¸ÑажаÑиÑÑ Ð¿ÑоÑÑим ÑиÑлом.","Uploading image":"ÐобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð°Ð²Ð°Ð½ÑажÑÑÑÑÑÑ","Image upload complete":"ÐаванÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð°Ð²ÐµÑÑено","Error during image upload":"ÐÑд ÑÐ°Ñ Ð·Ð°Ð²Ð°Ð½ÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð½Ñ ÑÑалаÑÑ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ°",Image:"ÐобÑаженнÑ","HTML object":"HTML об'ÑкÑ","Insert HTML":"ÐÑÑавиÑи HTML","HTML snippet":"ФÑÐ°Ð³Ð¼ÐµÐ½Ñ HTML","Paste raw HTML here...":"ÐÑÑавÑе ÑÑди необÑоблений HTML...","Edit source":"РедагÑваÑи джеÑело","Save changes":"ÐбеÑегÑи змÑни","No preview available":"ÐопеÑеднÑй пеÑеглÑд недоÑÑÑпний","Empty snippet content":"ÐоÑожнÑй вмÑÑÑ","Horizontal line":"ÐоÑизонÑалÑна лÑнÑÑ","Yellow marker":"ÐовÑий маÑкеÑ","Green marker":"Ðелений маÑкеÑ","Pink marker":"Рожевий маÑкеÑ","Blue marker":"СинÑй маÑкеÑ","Red pen":"ЧеÑвоний маÑкеÑ","Green pen":"Ðелений маÑкеÑ","Remove highlight":"ÐидалиÑи видÑленнÑ",Highlight:"ÐидÑленнÑ","Text highlight toolbar":"ÐÐ°Ð½ÐµÐ»Ñ Ð²Ð¸Ð´ÑÐ»ÐµÐ½Ð½Ñ ÑекÑÑÑ",Heading:"Ðаголовок","Choose heading":"ÐбеÑÑÑÑ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº","Heading 1":"Ðаголовок 1","Heading 2":"Ðаголовок 2","Heading 3":"Ðаголовок 3","Heading 4":"Ðаголовок 4","Heading 5":"Ðаголовок 5","Heading 6":"Ðаголовок 6","Type your title":"ÐведÑÑÑ Ð½Ð°Ð·Ð²Ñ","Type or paste your content here.":"ÐведÑÑÑ Ð°Ð±Ð¾ вÑÑавÑе ÑвÑй вмÑÑÑ ÑÑÑ.","Font Size":"РозмÑÑ ÑÑиÑÑÑ",Tiny:"ÐÑиÑ
ÑÑний",Small:"ÐаленÑкий",Big:"Ðеликий",Huge:"ÐелиÑезний","Font Family":"СÑмейÑÑво ÑÑиÑÑÑв",Default:"Ðа замовÑÑваннÑм","Font Color":"ÐолÑÑ ÑÑиÑÑÑ","Font Backgroun
13d Color":"ÐолÑÑ Ñла ÑÑиÑÑÑ","Document colors":"ÐолÑоÑи докÑменÑÑ","Find and replace":"ÐнайÑи Ñа замÑниÑи","Find in textâ¦":"ÐнайÑи в ÑекÑÑÑâ¦",Find:"ÐнайÑи","Previous result":"ÐопеÑеднÑй ÑезÑлÑÑаÑ","Next result":"ÐаÑÑÑпний ÑезÑлÑÑаÑ",Replace:"ÐамÑниÑи","Replace all":"ÐамÑниÑи вÑе","Match case":"ÐÑаÑ
ÑваÑи ÑегÑÑÑÑ","Whole words only":"ТÑлÑки ÑÑÐ»Ñ Ñлова","Replace withâ¦":"ÐамÑниÑиâ¦","Text to find must not be empty.":"ТекÑÑ Ð´Ð»Ñ Ð¿Ð¾ÑÑÐºÑ Ð½Ðµ повинен бÑÑи поÑожнÑм.","Tip: Find some text first in order to replace it.":"ÐоÑада: ÑпоÑаÑÐºÑ Ð·Ð½Ð°Ð¹Ð´ÑÑÑ ÑекÑÑ, Ñоб замÑниÑи його.","Advanced options":"РозÑиÑÐµÐ½Ñ Ð¾Ð¿ÑÑÑ","Find in the document":"ÐоÑÑк в докÑменÑÑ","Insert a soft break (a <code><br></code> element)":"ÐÑÑавиÑи мâÑкий ÑозÑив (ÐµÐ»ÐµÐ¼ÐµÐ½Ñ <code><br></code>)","Insert a hard break (a new paragraph)":"ÐÑÑавиÑи жоÑÑÑкий ÑозÑив (новий абзаÑ)",Cancel:"ÐÑдмÑна",Clear:"ÐÑиÑÑиÑи","Remove color":"ÐидалиÑи колÑÑ","Restore default":"ÐÑдновиÑи за замовÑÑваннÑм",Save:"ÐбеÑегÑи","Show more items":"ÐоказаÑи бÑлÑÑе","%0 of %1":"%0 Ñз %1","Cannot upload file:":"Ðеможливо заванÑажиÑи Ñайл:","Rich Text Editor. Editing area: %0":"РедакÑÐ¾Ñ Rich Text. ÐблаÑÑÑ ÑедагÑваннÑ: %0","Insert with file manager":"ÐÑÑавиÑи за Ð´Ð¾Ð¿Ð¾Ð¼Ð¾Ð³Ð¾Ñ Ñайлового менеджеÑа","Replace with file manager":"ÐамÑниÑи за Ð´Ð¾Ð¿Ð¾Ð¼Ð¾Ð³Ð¾Ñ Ñайлового менеджеÑа","Insert image with file manager":"ÐÑÑавиÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð° Ð´Ð¾Ð¿Ð¾Ð¼Ð¾Ð³Ð¾Ñ Ñайлового менеджеÑа","Replace image with file manager":"ÐамÑниÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ð° Ð´Ð¾Ð¿Ð¾Ð¼Ð¾Ð³Ð¾Ñ Ñайлового менеджеÑа",File:"Файл","With file manager":"ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ ÑайлÑв","Toggle caption off":"ÐимкнÑÑи пÑдпиÑ","Toggle caption on":"УвÑмкнÑÑи пÑдпиÑ","Content editing keystrokes":"ÐаÑиÑÐºÐ°Ð½Ð½Ñ ÐºÐ»Ð°Ð²ÑÑ Ð´Ð»Ñ ÑедагÑÐ²Ð°Ð½Ð½Ñ Ð²Ð¼ÑÑÑÑ","These keyboard shortcuts allow for quick access to content editing features.":"Ð¦Ñ ÐºÐ¾Ð¼Ð±ÑнаÑÑÑ ÐºÐ»Ð°Ð²ÑÑ Ð·Ð°Ð±ÐµÐ·Ð¿ÐµÑÑÑÑÑ Ñвидкий доÑÑÑп до ÑÑнкÑÑй ÑедагÑÐ²Ð°Ð½Ð½Ñ Ð²Ð¼ÑÑÑÑ.","User interface and content navigation keystrokes":"ÐнÑеÑÑÐµÐ¹Ñ ÐºÐ¾ÑиÑÑÑваÑа Ñа клавÑÑÑ Ð½Ð°Ð²ÑгаÑÑÑ Ð²Ð¼ÑÑÑом","Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.":"ÐикоÑиÑÑовÑйÑе Ð½Ð°Ð²ÐµÐ´ÐµÐ½Ñ Ð½Ð¸Ð¶Ñе комбÑнаÑÑÑ ÐºÐ»Ð°Ð²ÑÑ Ð´Ð»Ñ Ð±ÑлÑÑ ÐµÑекÑÐ¸Ð²Ð½Ð¾Ñ Ð½Ð°Ð²ÑгаÑÑÑ Ð² ÑнÑеÑÑейÑÑ ÐºÐ¾ÑиÑÑÑваÑа CKEditor 5.","Close contextual balloons, dropdowns, and dialogs":"ÐакÑиÑи конÑекÑÑÐ½Ñ Ð²Ð¸Ð½Ð¾Ñки, ÑÐ¿Ð°Ð´Ð½Ñ ÑпиÑки Ñа дÑÐ°Ð»Ð¾Ð³Ð¾Ð²Ñ Ð²Ñкна","Open the accessibility help dialog":"ÐÑдкÑийÑе дÑалогове вÑкно довÑдки Ð´Ð»Ñ Ð´Ð¾ÑÑÑпноÑÑÑ","Move focus between form fields (inputs, buttons, etc.)":"ÐеÑемÑÑÐµÐ½Ð½Ñ ÑокÑÑа мÑж полÑми ÑоÑми (введеннÑ, кнопки ÑоÑо)","Move focus to the menu bar, navigate between menu bars":"ÐеÑемÑÑÑÑÑÑ ÑокÑÑ Ð½Ð° ÑÑдок менÑ, пеÑемÑÑÑйÑеÑÑ Ð¼Ñж ÑÑдками менÑ","Move focus to the toolbar, navigate between toolbars":"ÐеÑемÑÑÐµÐ½Ð½Ñ ÑокÑÑа на Ð¿Ð°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв, навÑгаÑÑÑ Ð¼Ñж панелÑми ÑнÑÑÑÑменÑÑв","Navigate through the toolbar or menu bar":"ÐеÑемÑÑÑйÑеÑÑ Ð¿Ð°Ð½ÐµÐ»Ð»Ñ ÑнÑÑÑÑменÑÑв або ÑÑдком менÑ","Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.":"ÐкÑивÑйÑе кнопкÑ, на ÑкÑй знаÑ
одиÑÑÑÑ ÑокÑÑ. ÐкÑиваÑÑÑ ÐºÐ½Ð¾Ð¿Ð¾Ðº, ÑÐºÑ Ð²Ð·Ð°ÑмодÑÑÑÑ Ð· ÑедакÑоÑÑÑким Ð
13ºÐ¾Ð½ÑенÑом пеÑемÑÑÑÑ ÑокÑÑ Ð½Ð°Ð·Ð°Ð´ на конÑенÑ.",Accept:"ÐÑийнÑÑи",Paragraph:"ÐаÑагÑаÑ","Color picker":"ÐибÑÑ ÐºÐ¾Ð»ÑоÑÑ","Insert code block":"ÐÑÑавÑе блок кодÑ","Plain text":"ÐÑоÑÑий ÑекÑÑ","Leaving %0 code snippet":"ÐиÑ
Ñд з ÑÑагменÑÑ ÐºÐ¾Ð´Ñ %0","Entering %0 code snippet":"ÐÑ
Ñд Ñ ÑÑÐ°Ð³Ð¼ÐµÐ½Ñ ÐºÐ¾Ð´Ñ %0","Entering code snippet":"ÐÑ
Ñд Ñ ÑÑÐ°Ð³Ð¼ÐµÐ½Ñ ÐºÐ¾Ð´Ñ","Leaving code snippet":"ÐиÑ
Ñд з ÑÑагменÑÑ ÐºÐ¾Ð´Ñ","Code block":"Ðлок кодÑ","Copy selected content":"ÐопÑÑваÑи вибÑаний вмÑÑÑ","Paste content":"ÐÑÑавиÑи вмÑÑÑ","Paste content as plain text":"ÐÑÑавиÑи вмÑÑÑ Ñк пÑоÑÑий ÑекÑÑ","Insert image or file":"ÐÑÑавÑе зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð°Ð±Ð¾ Ñайл","Could not obtain resized image URL.":"Ðе вдалоÑÑ Ð¾ÑÑимаÑи URL змÑненого зобÑаженнÑ.","Selecting resized image failed":"Ðе вдалоÑÑ Ð²Ð¸Ð±ÑаÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð·Ñ Ð·Ð¼Ñненим ÑозмÑÑом","Could not insert image at the current position.":"Ðе можливо вÑÑавиÑи зобÑÐ°Ð¶ÐµÐ½Ð½Ñ Ð² поÑоÑÐ½Ñ Ð¿Ð¾Ð·Ð¸ÑÑÑ.","Inserting image failed":"Ðе вдалоÑÑ Ð²ÑÑавиÑи зобÑаженнÑ","Open file manager":"ÐÑдкÑиÑи Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑ ÑайлÑв","Cannot determine a category for the uploaded file.":"Ðе вдаÑÑÑÑÑ Ð²Ð¸Ð·Ð½Ð°ÑиÑи каÑегоÑÑÑ Ð´Ð»Ñ Ð·Ð°Ð²Ð°Ð½Ñаженого ÑайлÑ.","Cannot access default workspace.":"ÐÐµÐ¼Ð°Ñ Ð´Ð¾ÑÑÑÐ¿Ñ Ð´Ð¾ ÑобоÑого пÑоÑÑоÑÑ Ð·Ð° замовÑÑваннÑм.","You have no image editing permissions.":"У Ð²Ð°Ñ Ð½ÐµÐ¼Ð°Ñ Ð¿Ñав на ÑедагÑÐ²Ð°Ð½Ð½Ñ Ð·Ð¾Ð±ÑаженÑ.","Edit image":"РедагÑваÑи зобÑаженнÑ","Processing the edited image.":"ÐбÑобка вÑдÑедагованого зобÑаженнÑ.","Server failed to process the image.":"СеÑвеÑÑ Ð½Ðµ вдалоÑÑ Ð¾Ð±ÑобиÑи зобÑаженнÑ.","Failed to determine category of edited image.":"Ðе вдалоÑÑ Ð²Ð¸Ð·Ð½Ð°ÑиÑи каÑегоÑÑÑ Ð²ÑдÑедагованого зобÑаженнÑ.","Block quote":"ЦиÑаÑа",Bold:"ÐиÑний",Italic:"ÐÑÑÑив",Underline:"ÐÑдкÑеÑлений",Code:"Ðод",Strikethrough:"ÐакÑеÑлений",Subscript:"ÐижнÑй ÑндекÑ",Superscript:"ÐеÑÑ
нÑй ÑндекÑ","Italic text":"ÐÑÑÑив","Move out of an inline code style":"ÐийÑи Ð·Ñ ÑÑÐ¸Ð»Ñ Ð²Ð±Ñдованого кодÑ","Bold text":"ÐиÑний ÑÑиÑÑ","Underline text":"ÐÑдкÑеÑлений","Strikethrough text":"ÐакÑеÑлений","Saving changes":"ÐбеÑÐµÐ¶ÐµÐ½Ð½Ñ Ð·Ð¼Ñн","Revert autoformatting action":"СкаÑÑваÑи дÑÑ Ð°Ð²ÑоÑоÑмаÑÑваннÑ","Align left":"Ðо лÑÐ²Ð¾Ð¼Ñ ÐºÑаÑ","Align right":"Ðо пÑÐ°Ð²Ð¾Ð¼Ñ ÐºÑаÑ","Align center":"Ðо ÑенÑÑÑ",Justify:"Ðо ÑиÑинÑ","Text alignment":"ÐиÑÑвнÑÐ²Ð°Ð½Ð½Ñ ÑекÑÑÑ","Text alignment toolbar":"ÐÐ°Ð½ÐµÐ»Ñ ÑнÑÑÑÑменÑÑв виÑÑвнÑÐ²Ð°Ð½Ð½Ñ ÑекÑÑÑ"},getPluralForm:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2}},pC={key:0,class:"d-flex justify-end counter"},wC={__name:"BanzaWysiwygEditor",props:{modelValue:{type:String,default:""},name:{type:String,default:""},rules:{type:[String,Array],default:""},maxLength:{type:Number,default:0},inline:{type:Boolean,default:!1}},setup(e){const t=e,{value:s,errors:o}=m(()=>t.name||p(),g(()=>t.rules),{initialValue:t.modelValue??"",label:t.label,syncVModel:!0}),l=h(0),c=h(!1),u=h(t.inline?mb:cb),d=h({plugins:[Up,Rb,Zp,Y_,Hy,mC,fw,v_,Sb,Yv,g_,x_,u_],toolbar:["undo","redo","|","heading","|","bold","italic","|","fontSize","fontColor","fontBackgroun
13dColor","|","link","bulletedList","numberedList","|","outdent","indent","|","insertTable","blockQuote"],fontSize:{options:[8,10,12,"default",16,18,20,22,24,28,32]},translations:[gC],link:{decorators:{openInNewTab:{mode:"manual",label:"Open in a new tab",defaultValue:!0,attributes:{target:"_blank",rel:"noopener noreferrer"}}}}});return n(()=>s.value,(e,n)=>{if(t.maxLength>0&&c.value){const i=document.createElement("div");i.innerHTML=e;const o=i.textContent.trim().length;o>t.maxLength?s.value=n:l.value=o||0}}),i(()=>{c.value=!0}),(t,n)=>{const i=w("b-client-only");return r(),b("div",{class:A(["d-flex flex-column banza-ck-editor",e.maxLength>0&&l.value>=e.maxLength?"max-length":""])},[_(i,null,{default:y(()=>[c.value?(r(),a(v(D),{key:0,editor:u.value,config:d.value,modelValue:v(s),"onUpdate:modelValue":n[0]||(n[0]=e=>k(s)?s.value=e:null)},null,8,["editor","config","modelValue"])):C("",!0)]),_:1}),e.maxLength>0?(r(),b("div",pC,x(l.value)+" / "+x(e.maxLength),1)):C("",!0)],2)}}};export{wC as default};
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.